Rythmos - Transient Integration for Differential Equations
Version of the Day
|
Concrete testing class for basic adjoint calculation. More...
#include <Rythmos_BasicDiscreteAdjointStepperTester_decl.hpp>
Inherits VerboseObject< BasicDiscreteAdjointStepperTester< Scalar > >, and ParameterListAcceptorDefaultBase.
Related Functions | |
(Note that these are not member functions.) | |
template<class Scalar > | |
RCP < BasicDiscreteAdjointStepperTester < Scalar > > | basicDiscreteAdjointStepperTester () |
Nonmember constructor. More... | |
template<class Scalar > | |
RCP < BasicDiscreteAdjointStepperTester < Scalar > > | basicDiscreteAdjointStepperTester (const RCP< ParameterList > ¶mList) |
Nonmember constructor. More... | |
Overridden from ParameterListAcceptor (simple forwarding functions) | |
void | setParameterList (RCP< ParameterList > const ¶mList) |
RCP< const ParameterList > | getValidParameters () const |
Testing functions | |
bool | testAdjointStepper (Thyra::ModelEvaluator< Scalar > &adjointModel, const Ptr< IntegratorBase< Scalar > > &forwardIntegrator) |
Test the the AdjointStepper object for a given forward simulation. More... | |
Public friend functions | |
RCP < BasicDiscreteAdjointStepperTester < Scalar > > | basicDiscreteAdjointStepperTester () |
Concrete testing class for basic adjoint calculation.
This testing class performs the most basic test of an adjoint computation for a nonlinear model that you can possibly check. The basic response problem is:
f(x_dot_, x_, t) = 0, for t <: [t_0, t_f] x(t_0) = x_init + B*p x_dot(t_0) = x_dot_int d_hat(p) = h(x(t_f,p)) = 0.5 * x^T * x
This formulation assumes that the mass matrix d(f)/d(x_dot) is full rank which will be needed to compute the adjoint initial condition..
The intial condition vectors x_init and x_dot_init are taken from the orginal forward problem's intial condition as is t_0. The time t_f is taken from an initalized integrator.
The multi-vector B can be chosen by the user or can be computed automatically internally. If B is not choses by the user, it will be computed automatically as a single column with random numbers.
The forward sensitivity equations (with S = d(x)/d(p)) that are solved with the reduced response sensitivity are then:
d(f)/d(x_dot) * S_dot + d(f)/d(x) * S = 0, for t <: [t_0, t_f] S(t_0) = B S_dot(t_0) = 0 d(d_hat)/d(p)^T = S^T * x, at t = t_f
The adjoint equations that are solved for the reduced sensitivity are then:
d(f)/d(x_dot)^T * lambda_dot - d(f)/d(x)^T * lambda = 0, for t <: [t_0, t_f] d(f)/d(x_dot)^T * lambda = x, at t = t_f d(d_hat)/d(p)^T = B^T * d(f)/d(x_dot)^T * lambda, at t = t_0
Note that if d(f)/d(x_dot) is full rank, then the adjoint initial condition at t_f reduces to:
lambda(t_f) = d(f)/d(x_dot)^{-T} * x(t_f)
which is the form of the initial condition used in this test (nice and simple).
NOTE: However, if this is a general DAE where d(f)/d(x_dot) is rank deficient, then the adjoint initial value calcuation at t_f gets more complicated and this testing class can not handle those cases.
Definition at line 42 of file Rythmos_BasicDiscreteAdjointStepperTester_decl.hpp.
void Rythmos::BasicDiscreteAdjointStepperTester< Scalar >::setParameterList | ( | RCP< ParameterList > const & | paramList | ) |
Definition at line 69 of file Rythmos_BasicDiscreteAdjointStepperTester_def.hpp.
RCP< const ParameterList > Rythmos::BasicDiscreteAdjointStepperTester< Scalar >::getValidParameters | ( | ) | const |
Definition at line 82 of file Rythmos_BasicDiscreteAdjointStepperTester_def.hpp.
bool Rythmos::BasicDiscreteAdjointStepperTester< Scalar >::testAdjointStepper | ( | Thyra::ModelEvaluator< Scalar > & | adjointModel, |
const Ptr< IntegratorBase< Scalar > > & | forwardIntegrator | ||
) |
Test the the AdjointStepper object for a given forward simulation.
adjointModel | [in] The basic adjoint model ready to be used to integrate the adjoint. On output, this stepper will have been used to integate the adjoint. |
forwardIntegrator | [in/out] The basic forward integrator ready to integrate the forward problem. This integrator algorithm will be cloned to integrate the forward sensitivities and the adjoint. This integator should be set up to take fixed time steps. There is no need for adaptive time steps for a test like this. On output, this integrator will have been run to the output time. |
NOTE: This function is declared non-const since it can technically change the parameter list as the fuctions are performed.
Definition at line 96 of file Rythmos_BasicDiscreteAdjointStepperTester_def.hpp.
|
related |
Nonmember constructor.
|
related |
Nonmember constructor.