  This paper discusses the computation of derivatives for optimization problems
governed by linear hyperbolic systems of partial differential equations (PDEs)
that are discretized by the discontinuous Galerkin (dG) method. An efficient
and accurate computation of these derivatives is important, for instance, in
inverse problems and optimal control problems. This computation is usually
based on an adjoint PDE system, and the question addressed in this paper is how
the discretization of this adjoint system should relate to the dG
discretization of the hyperbolic state equation. Adjoint-based derivatives can
either be computed before or after discretization; these two options are often
referred to as the optimize-then-discretize and discretize-then-optimize
approaches. We discuss the relation between these two options for dG
discretizations in space and Runge-Kutta time integration. Discretely exact
discretizations for several hyperbolic optimization problems are derived,
including the advection equation, Maxwell's equations and the coupled
elastic-acoustic wave equation. We find that the discrete adjoint equation
inherits a natural dG discretization from the discretization of the state
equation and that the expressions for the discretely exact gradient often have
to take into account contributions from element faces. For the coupled
elastic-acoustic wave equation, the correctness and accuracy of our derivative
expressions are illustrated by comparisons with finite difference gradients.
The results show that a straightforward discretization of the continuous
gradient differs from the discretely exact gradient, and thus is not consistent
with the discretized objective. This inconsistency may cause difficulties in
the convergence of gradient based algorithms for solving optimization problems.
