Tempus  Version of the Day
Time Integration
Tempus_AdjointSensitivityModelEvaluator_decl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_AdjointSensitivityModelEvaluator_decl_hpp
10 #define Tempus_AdjointSensitivityModelEvaluator_decl_hpp
11 
12 #include "Thyra_StateFuncModelEvaluatorBase.hpp"
13 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
14 #include "Thyra_DefaultMultiVectorProductVector.hpp"
15 
16 #include "Tempus_config.hpp"
17 #include "Tempus_SolutionHistory.hpp"
18 
19 namespace Tempus {
20 
53 template <typename Scalar>
55  public Thyra::StateFuncModelEvaluatorBase<Scalar> {
56 public:
59 
61 
80  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & model,
81  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & adjoint_model,
82  const Scalar& t_final,
83  const bool is_pseudotransient,
84  const Teuchos::RCP<const Teuchos::ParameterList>& pList = Teuchos::null);
85 
87  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const
88  { return model_; }
89 
91  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getAdjointModel() const
92  { return adjoint_model_; }
93 
96  const Teuchos::RCP<const Tempus::SolutionHistory<Scalar> >& sh);
97 
100 
101  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_p_space(int p) const;
102 
103  Teuchos::RCP<const Teuchos::Array<std::string> > get_p_names(int p) const;
104 
105  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
106 
107  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_f_space() const;
108 
109  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_g_space(int j) const;
110 
111  Teuchos::RCP<Thyra::LinearOpBase<Scalar> > create_W_op() const;
112 
113  Teuchos::RCP<const Thyra::LinearOpWithSolveFactoryBase<Scalar> >
114  get_W_factory() const;
115 
116  Thyra::ModelEvaluatorBase::InArgs<Scalar> createInArgs() const;
117 
118  Thyra::ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const;
119 
121 
122  static Teuchos::RCP<const Teuchos::ParameterList> getValidParameters();
123 
124 private:
125 
126  typedef Thyra::DefaultMultiVectorProductVectorSpace<Scalar> DMVPVS;
127  typedef Thyra::DefaultMultiVectorProductVector<Scalar> DMVPV;
128 
129  Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
130 
131  void evalModelImpl(
132  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
133  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
134 
135 
136  Thyra::ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
137  Thyra::ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
138 
139  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > model_;
140  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > adjoint_model_;
141 
142  Teuchos::RCP<const DMVPVS> adjoint_space_;
143  Teuchos::RCP<const DMVPVS> residual_space_;
144  Teuchos::RCP<const DMVPVS> response_space_;
145  Teuchos::RCP<const Tempus::SolutionHistory<Scalar> > sh_;
146  Scalar t_final_;
150  int p_index_;
151  int g_index_;
153 
155  mutable Teuchos::RCP<Thyra::VectorBase<Scalar> > my_x_dot_;
156  mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdx_;
157  mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdxdot_;
158  mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdp_op_;
159  mutable Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > my_dfdp_mv_;
160  mutable Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > my_dgdx_mv_;
161  mutable Teuchos::RCP<Tempus::SolutionState<Scalar> > forward_state_;
162  mutable Scalar t_interp_;
163 };
164 
165 } // namespace Tempus
166 
167 #endif
static Teuchos::RCP< const Teuchos::ParameterList > getValidParameters()
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int p) const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
AdjointSensitivityModelEvaluator(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &adjoint_model, const Scalar &t_final, const bool is_pseudotransient, const Teuchos::RCP< const Teuchos::ParameterList > &pList=Teuchos::null)
Constructor.
Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > sh_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_g_space(int j) const
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Thyra::ModelEvaluatorBase::OutArgs< Scalar > prototypeOutArgs_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > my_dfdp_mv_
Thyra::DefaultMultiVectorProductVector< Scalar > DMVPV
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > model_
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
void setForwardSolutionHistory(const Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > &sh)
Set solution history from forward evaluation.
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
Get the underlying model &#39;f&#39;.
ModelEvaluator for forming adjoint sensitivity equations.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int p) const
Thyra::DefaultMultiVectorProductVectorSpace< Scalar > DMVPVS
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getAdjointModel() const
Get the underlying adjoint model.
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > adjoint_model_
Teuchos::RCP< Tempus::SolutionState< Scalar > > forward_state_
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
Teuchos::RCP< Thyra::MultiVectorBase< Scalar > > my_dgdx_mv_