Tempus  Version of the Day
Time Integration
Tempus_AdjointAuxSensitivityModelEvaluator_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_AdjointAuxSensitivityModelEvaluator_decl_hpp
10 #define Tempus_AdjointAuxSensitivityModelEvaluator_decl_hpp
11 
12 #include "Thyra_StateFuncModelEvaluatorBase.hpp"
13 #include "Thyra_DefaultProductVectorSpace.hpp"
14 #include "Thyra_DefaultProductVector.hpp"
15 #include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
16 #include "Thyra_DefaultMultiVectorProductVector.hpp"
17 
18 #include "Tempus_config.hpp"
19 #include "Tempus_SolutionHistory.hpp"
20 
21 namespace Tempus {
22 
56 template <typename Scalar>
58  public Thyra::StateFuncModelEvaluatorBase<Scalar> {
59 public:
62 
64 
83  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & model,
84  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > & adjoint_model,
85  const Scalar& t_final,
86  const Teuchos::RCP<const Teuchos::ParameterList>& pList = Teuchos::null);
87 
89  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const
90  { return model_; }
91 
93  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getAdjointModel() const
94  { return adjoint_model_; }
95 
98  const Teuchos::RCP<const Tempus::SolutionHistory<Scalar> >& sh);
99 
102 
103  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_p_space(int p) const;
104 
105  Teuchos::RCP<const Teuchos::Array<std::string> > get_p_names(int p) const;
106 
107  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
108 
109  Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_f_space() 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::DefaultProductVectorSpace<Scalar> DPVS;
127  typedef Thyra::DefaultProductVector<Scalar> DPV;
128  typedef Thyra::DefaultMultiVectorProductVectorSpace<Scalar> DMVPVS;
129  typedef Thyra::DefaultMultiVectorProductVector<Scalar> DMVPV;
130 
131  Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
132 
133  void evalModelImpl(
134  const Thyra::ModelEvaluatorBase::InArgs<Scalar> &inArgs,
135  const Thyra::ModelEvaluatorBase::OutArgs<Scalar> &outArgs) const;
136 
137 
138  Thyra::ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
139  Thyra::ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
140 
141  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > model_;
142  Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > adjoint_model_;
143 
144  Teuchos::RCP<const DMVPVS> adjoint_space_;
145  Teuchos::RCP<const DMVPVS> residual_space_;
146  Teuchos::RCP<const DMVPVS> response_space_;
147  Teuchos::RCP<const DPVS> x_prod_space_;
148  Teuchos::RCP<const DPVS> f_prod_space_;
149  Teuchos::RCP<const Tempus::SolutionHistory<Scalar> > sh_;
150  Scalar t_final_;
153  int p_index_;
154  int g_index_;
156 
158  mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdx_;
159  mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdxdot_;
160  mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdp_op_;
161  mutable Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > my_dfdp_mv_;
162  mutable Teuchos::RCP<Tempus::SolutionState<Scalar> > forward_state_;
163  mutable Scalar t_interp_;
164 };
165 
166 } // namespace Tempus
167 
168 #endif
Thyra::DefaultMultiVectorProductVectorSpace< Scalar > DMVPVS
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > adjoint_model_
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
static Teuchos::RCP< const Teuchos::ParameterList > getValidParameters()
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
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getAdjointModel() const
Get the underlying adjoint model.
void setForwardSolutionHistory(const Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > &sh)
Set solution history from forward evaluation.
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int p) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
AdjointAuxSensitivityModelEvaluator(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &adjoint_model, const Scalar &t_final, const Teuchos::RCP< const Teuchos::ParameterList > &pList=Teuchos::null)
Constructor.
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > model_
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > sh_