Automated Derivation of the Adjoint of High-Level Transient Finite Element Programs