  Direct methods for the simulation of optimal control problems apply a
specific discretization to the dynamics of the problem, and the discrete
adjoint method is suitable to calculate corresponding conditions to approximate
an optimal solution. While the benefits of structure preserving or geometric
methods have been known for decades, their exploration in the context of
optimal control problems is a relatively recent field of research. In this
work, the discrete adjoint method is derived for variational integrators
yielding structure preserving approximations of the dynamics firstly in the ODE
case and secondly for the case in which the dynamics is subject to holonomic
constraints. The convergence rates are illustrated by numerical examples.
Thirdly, the discrete adjoint method is applied to geometrically exact beam
dynamics, represented by a holonomically constrained PDE.
