Optimality conditions for finite element simulation of adaptive bone remodeling