Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Tempus::AdjointSensitivityModelEvaluator< Scalar > Class Template Reference

ModelEvaluator for forming adjoint sensitivity equations. More...

#include <Tempus_AdjointSensitivityModelEvaluator_decl.hpp>

Inheritance diagram for Tempus::AdjointSensitivityModelEvaluator< Scalar >:

Public Types

typedef Thyra::VectorBase< Scalar > Vector
 
typedef Thyra::MultiVectorBase
< Scalar > 
MultiVector
 

Public Member Functions

 AdjointSensitivityModelEvaluator (const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const Scalar &t_final, const bool is_pseudotransient, const Teuchos::RCP< const Teuchos::ParameterList > &pList=Teuchos::null)
 Constructor. More...
 
Teuchos::RCP< const
Thyra::ModelEvaluator< Scalar > > 
getModel () const
 Get the underlying model 'f'. More...
 
void setForwardSolutionHistory (const Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > &sh)
 Set solution history from forward evaluation. More...
 
Public functions overridden from ModelEvaulator.
Teuchos::RCP< const
Thyra::VectorSpaceBase< Scalar > > 
get_p_space (int p) const
 
Teuchos::RCP< const
Teuchos::Array< std::string > > 
get_p_names (int p) const
 
Teuchos::RCP< const
Thyra::VectorSpaceBase< Scalar > > 
get_x_space () const
 
Teuchos::RCP< const
Thyra::VectorSpaceBase< Scalar > > 
get_f_space () const
 
Teuchos::RCP< const
Thyra::VectorSpaceBase< Scalar > > 
get_g_space (int j) const
 
Teuchos::RCP
< Thyra::LinearOpBase< Scalar > > 
create_W_op () const
 
Teuchos::RCP< const
Thyra::LinearOpWithSolveFactoryBase
< Scalar > > 
get_W_factory () const
 
Thyra::ModelEvaluatorBase::InArgs
< Scalar > 
createInArgs () const
 
Thyra::ModelEvaluatorBase::InArgs
< Scalar > 
getNominalValues () const
 

Static Public Member Functions

static Teuchos::RCP< const
Teuchos::ParameterList > 
getValidParameters ()
 

Private Types

typedef
Thyra::DefaultMultiVectorProductVectorSpace
< Scalar > 
DMVPVS
 
typedef
Thyra::DefaultMultiVectorProductVector
< Scalar > 
DMVPV
 

Private Member Functions

Thyra::ModelEvaluatorBase::OutArgs
< Scalar > 
createOutArgsImpl () const
 
void evalModelImpl (const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
 

Private Attributes

Thyra::ModelEvaluatorBase::InArgs
< Scalar > 
prototypeInArgs_
 
Thyra::ModelEvaluatorBase::OutArgs
< Scalar > 
prototypeOutArgs_
 
Teuchos::RCP< const
Thyra::ModelEvaluator< Scalar > > 
model_
 
Teuchos::RCP< const DMVPVSadjoint_space_
 
Teuchos::RCP< const DMVPVSresidual_space_
 
Teuchos::RCP< const DMVPVSresponse_space_
 
Teuchos::RCP< const
Tempus::SolutionHistory
< Scalar > > 
sh_
 
Scalar t_final_
 
bool is_pseudotransient_
 
bool mass_matrix_is_constant_
 
bool mass_matrix_is_identity_
 
int p_index_
 
int g_index_
 
int num_adjoint_
 
bool mass_matrix_is_computed_
 
Teuchos::RCP
< Thyra::VectorBase< Scalar > > 
my_x_dot_
 
Teuchos::RCP
< Thyra::LinearOpBase< Scalar > > 
my_dfdx_
 
Teuchos::RCP
< Thyra::LinearOpBase< Scalar > > 
my_dfdxdot_
 
Teuchos::RCP
< Thyra::LinearOpBase< Scalar > > 
my_dfdp_op_
 
Teuchos::RCP
< Thyra::MultiVectorBase
< Scalar > > 
my_dfdp_mv_
 
Teuchos::RCP
< Thyra::MultiVectorBase
< Scalar > > 
my_dgdx_mv_
 
Teuchos::RCP
< Tempus::SolutionState
< Scalar > > 
forward_state_
 
Scalar t_interp_
 

Detailed Description

template<typename Scalar>
class Tempus::AdjointSensitivityModelEvaluator< Scalar >

ModelEvaluator for forming adjoint sensitivity equations.

This class wraps a given ModelEvalutor encapsulating f(x_dot,x,p) and creates a new "residual" for the adjoint sensitivity equations: F(y) = d/dt( df/dx_dot^T*y ) - df/dx^T*y + dg/dx^T = 0 where y is the adjoint variable. Nominally y is a multi-vector belonging to the vector space of the residual f with number of columns equal to the dimension of g. To satisfy the model evaluator interface, y is converted to a product vector formed by its columns. This is the form of the adjoint equations suitable for computing pseudotransientsensitivities of a response function g(x(T),p) or adjoint sensitivities for a time-integrated response function int_0^T g(x(t),p).

To compute adjoint sensitivities, the equations f(x_dot,x,p) = 0 are integrated forward in time to some final time T, with the adjoint equations above integrated backward in time starting at T. Since the tempus integrator can only integrate forward in time, we define tau = T - t and transform the adjoint equations to: F(y) = d/dtau( df/dx_dot^T*y ) + df/dx^T*y - dg/dx^T = 0. The initial conditions for y are y(T) = 0. The sensitivity of g(T) is then int_0^T(dg/dp(T) - df/dp^T*y)dt + dx/dp(0)^T*df/dx_dot(0)^T*y(0) for transient adjoint sensitivites and is dg/dp(T) - df/dp^T*y for pseudotransient.

This model evaluator supports both implicit and explict forms of the governing equations. However it assumes df/dx_dot is constant with respect to x_dot, x, and t so that the adjoint equations become F(y) = df/dxdot^T*y_dot + df/dx^T*y - dg/dx^T = 0. Moving beyond this assumption will require modifications to the steppers in how they generate time-derivative terms.

Definition at line 53 of file Tempus_AdjointSensitivityModelEvaluator_decl.hpp.

Member Typedef Documentation

template<typename Scalar >
typedef Thyra::DefaultMultiVectorProductVector<Scalar> Tempus::AdjointSensitivityModelEvaluator< Scalar >::DMVPV
private
template<typename Scalar >
typedef Thyra::DefaultMultiVectorProductVectorSpace<Scalar> Tempus::AdjointSensitivityModelEvaluator< Scalar >::DMVPVS
private
template<typename Scalar >
typedef Thyra::MultiVectorBase<Scalar> Tempus::AdjointSensitivityModelEvaluator< Scalar >::MultiVector
template<typename Scalar >
typedef Thyra::VectorBase<Scalar> Tempus::AdjointSensitivityModelEvaluator< Scalar >::Vector

Constructor & Destructor Documentation

template<typename Scalar >
Tempus::AdjointSensitivityModelEvaluator< Scalar >::AdjointSensitivityModelEvaluator ( const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &  model,
const Scalar &  t_final,
const bool  is_pseudotransient,
const Teuchos::RCP< const Teuchos::ParameterList > &  pList = Teuchos::null 
)

Constructor.

t_final is the final integration time used to implement the time transformation described above. num_adjoint is the number of adjoint variables defining the number of columns in y, which is determined by the number of elements in the vector space for the response g. The optionally supplied parameter list supports the following options:

  • "Sensitivity Parameter Index", (default: 0) The model evaluator parameter index for which sensitivities will be computed.
  • "Response Function Index", (default: 0) The model evaluator response index for which sensitivities will be computed.
  • "Mass Matrix Is Constant" (default: true) Whether the mass matrix df/dx_dot is a constant matrix. As describe above, this is currently required to be true.
  • "Mass Matrix Is Identity" (default: false) Whether the mass matrix is the identity matrix, in which some computations can be skipped.

Definition at line 26 of file Tempus_AdjointSensitivityModelEvaluator_impl.hpp.

Member Function Documentation

template<typename Scalar >
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > Tempus::AdjointSensitivityModelEvaluator< Scalar >::create_W_op ( ) const
template<typename Scalar >
Thyra::ModelEvaluatorBase::InArgs< Scalar > Tempus::AdjointSensitivityModelEvaluator< Scalar >::createInArgs ( ) const
template<typename Scalar >
Thyra::ModelEvaluatorBase::OutArgs< Scalar > Tempus::AdjointSensitivityModelEvaluator< Scalar >::createOutArgsImpl ( ) const
private
template<typename Scalar >
void Tempus::AdjointSensitivityModelEvaluator< Scalar >::evalModelImpl ( const Thyra::ModelEvaluatorBase::InArgs< Scalar > &  inArgs,
const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &  outArgs 
) const
private
template<typename Scalar >
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > Tempus::AdjointSensitivityModelEvaluator< Scalar >::get_f_space ( ) const
template<typename Scalar >
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > Tempus::AdjointSensitivityModelEvaluator< Scalar >::get_g_space ( int  j) const
template<typename Scalar >
Teuchos::RCP< const Teuchos::Array< std::string > > Tempus::AdjointSensitivityModelEvaluator< Scalar >::get_p_names ( int  p) const
template<typename Scalar >
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > Tempus::AdjointSensitivityModelEvaluator< Scalar >::get_p_space ( int  p) const
template<typename Scalar >
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > Tempus::AdjointSensitivityModelEvaluator< Scalar >::get_W_factory ( ) const
template<typename Scalar >
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > Tempus::AdjointSensitivityModelEvaluator< Scalar >::get_x_space ( ) const
template<typename Scalar >
Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::getModel ( ) const
inline

Get the underlying model 'f'.

Definition at line 85 of file Tempus_AdjointSensitivityModelEvaluator_decl.hpp.

template<typename Scalar >
Thyra::ModelEvaluatorBase::InArgs< Scalar > Tempus::AdjointSensitivityModelEvaluator< Scalar >::getNominalValues ( ) const
template<class Scalar >
Teuchos::RCP< const Teuchos::ParameterList > Tempus::AdjointSensitivityModelEvaluator< Scalar >::getValidParameters ( )
static
template<typename Scalar >
void Tempus::AdjointSensitivityModelEvaluator< Scalar >::setForwardSolutionHistory ( const Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > &  sh)

Set solution history from forward evaluation.

Definition at line 108 of file Tempus_AdjointSensitivityModelEvaluator_impl.hpp.

Member Data Documentation

template<typename Scalar >
Teuchos::RCP<const DMVPVS> Tempus::AdjointSensitivityModelEvaluator< Scalar >::adjoint_space_
private
template<typename Scalar >
Teuchos::RCP<Tempus::SolutionState<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::forward_state_
mutableprivate
template<typename Scalar >
int Tempus::AdjointSensitivityModelEvaluator< Scalar >::g_index_
private
template<typename Scalar >
bool Tempus::AdjointSensitivityModelEvaluator< Scalar >::is_pseudotransient_
private
template<typename Scalar >
bool Tempus::AdjointSensitivityModelEvaluator< Scalar >::mass_matrix_is_computed_
mutableprivate
template<typename Scalar >
bool Tempus::AdjointSensitivityModelEvaluator< Scalar >::mass_matrix_is_constant_
private
template<typename Scalar >
bool Tempus::AdjointSensitivityModelEvaluator< Scalar >::mass_matrix_is_identity_
private
template<typename Scalar >
Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::model_
private
template<typename Scalar >
Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::my_dfdp_mv_
mutableprivate
template<typename Scalar >
Teuchos::RCP<Thyra::LinearOpBase<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::my_dfdp_op_
mutableprivate
template<typename Scalar >
Teuchos::RCP<Thyra::LinearOpBase<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::my_dfdx_
mutableprivate
template<typename Scalar >
Teuchos::RCP<Thyra::LinearOpBase<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::my_dfdxdot_
mutableprivate
template<typename Scalar >
Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::my_dgdx_mv_
mutableprivate
template<typename Scalar >
Teuchos::RCP<Thyra::VectorBase<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::my_x_dot_
mutableprivate
template<typename Scalar >
int Tempus::AdjointSensitivityModelEvaluator< Scalar >::num_adjoint_
private
template<typename Scalar >
int Tempus::AdjointSensitivityModelEvaluator< Scalar >::p_index_
private
template<typename Scalar >
Thyra::ModelEvaluatorBase::InArgs<Scalar> Tempus::AdjointSensitivityModelEvaluator< Scalar >::prototypeInArgs_
private
template<typename Scalar >
Thyra::ModelEvaluatorBase::OutArgs<Scalar> Tempus::AdjointSensitivityModelEvaluator< Scalar >::prototypeOutArgs_
private
template<typename Scalar >
Teuchos::RCP<const DMVPVS> Tempus::AdjointSensitivityModelEvaluator< Scalar >::residual_space_
private
template<typename Scalar >
Teuchos::RCP<const DMVPVS> Tempus::AdjointSensitivityModelEvaluator< Scalar >::response_space_
private
template<typename Scalar >
Teuchos::RCP<const Tempus::SolutionHistory<Scalar> > Tempus::AdjointSensitivityModelEvaluator< Scalar >::sh_
private
template<typename Scalar >
Scalar Tempus::AdjointSensitivityModelEvaluator< Scalar >::t_final_
private
template<typename Scalar >
Scalar Tempus::AdjointSensitivityModelEvaluator< Scalar >::t_interp_
mutableprivate

The documentation for this class was generated from the following files: