Tempus Version of the Day
Time Integration
Loading...
Searching...
No Matches
Tempus_AdjointAuxSensitivityModelEvaluator_decl.hpp
Go to the documentation of this file.
1//@HEADER
2// *****************************************************************************
3// Tempus: Time Integration and Sensitivity Analysis Package
4//
5// Copyright 2017 NTESS and the Tempus contributors.
6// SPDX-License-Identifier: BSD-3-Clause
7// *****************************************************************************
8//@HEADER
9
10#ifndef Tempus_AdjointAuxSensitivityModelEvaluator_decl_hpp
11#define Tempus_AdjointAuxSensitivityModelEvaluator_decl_hpp
12
13#include "Thyra_StateFuncModelEvaluatorBase.hpp"
14#include "Thyra_DefaultProductVectorSpace.hpp"
15#include "Thyra_DefaultProductVector.hpp"
16#include "Thyra_DefaultMultiVectorProductVectorSpace.hpp"
17#include "Thyra_DefaultMultiVectorProductVector.hpp"
18
19#include "Tempus_config.hpp"
20#include "Tempus_SolutionHistory.hpp"
22
23namespace Tempus {
24
70template <typename Scalar>
72 : public Thyra::StateFuncModelEvaluatorBase<Scalar> {
73 public:
76
78
109 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& model,
110 const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& adjoint_model,
111 const Scalar& t_init, const Scalar& t_final,
112 const Teuchos::RCP<const Teuchos::ParameterList>& pList = Teuchos::null);
113
115 Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getModel() const
116 {
117 return model_;
118 }
119
121 Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > getAdjointModel() const
122 {
123 return adjoint_model_;
124 }
125
127 void setFinalTime(const Scalar t_final);
128
131 const Teuchos::RCP<const Tempus::SolutionHistory<Scalar> >& sh);
132
135
136 Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_p_space(int p) const;
137
138 Teuchos::RCP<const Teuchos::Array<std::string> > get_p_names(int p) const;
139
140 Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_x_space() const;
141
142 Teuchos::RCP<const Thyra::VectorSpaceBase<Scalar> > get_f_space() const;
143
144 Teuchos::RCP<Thyra::LinearOpBase<Scalar> > create_W_op() const;
145
146 Teuchos::RCP<const Thyra::LinearOpWithSolveFactoryBase<Scalar> >
147 get_W_factory() const;
148
149 Thyra::ModelEvaluatorBase::InArgs<Scalar> createInArgs() const;
150
151 Thyra::ModelEvaluatorBase::InArgs<Scalar> getNominalValues() const;
152
154
155 static Teuchos::RCP<const Teuchos::ParameterList> getValidParameters();
156
157 private:
158 typedef Thyra::DefaultProductVectorSpace<Scalar> DPVS;
159 typedef Thyra::DefaultProductVector<Scalar> DPV;
160 typedef Thyra::DefaultMultiVectorProductVectorSpace<Scalar> DMVPVS;
161 typedef Thyra::DefaultMultiVectorProductVector<Scalar> DMVPV;
162
163 Thyra::ModelEvaluatorBase::OutArgs<Scalar> createOutArgsImpl() const;
164
165 void evalModelImpl(
166 const Thyra::ModelEvaluatorBase::InArgs<Scalar>& inArgs,
167 const Thyra::ModelEvaluatorBase::OutArgs<Scalar>& outArgs) const;
168
170 Thyra::ModelEvaluatorBase::InArgs<Scalar> responseInArgs(
171 const Thyra::ModelEvaluatorBase::InArgs<Scalar>& me_inArgs) const;
172
173 Thyra::ModelEvaluatorBase::InArgs<Scalar> prototypeInArgs_;
174 Thyra::ModelEvaluatorBase::OutArgs<Scalar> prototypeOutArgs_;
175
176 Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > model_;
177 Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > adjoint_model_;
178
179 Teuchos::RCP<const DMVPVS> adjoint_space_;
180 Teuchos::RCP<const DMVPVS> residual_space_;
181 Teuchos::RCP<const DMVPVS> response_space_;
182 Teuchos::RCP<const DPVS> x_prod_space_;
183 Teuchos::RCP<const DPVS> f_prod_space_;
184 Teuchos::RCP<const Tempus::SolutionHistory<Scalar> > sh_;
185 Scalar t_init_;
186 Scalar t_final_;
195
197 mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdx_;
198 mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdxdot_;
199 mutable Teuchos::RCP<Thyra::LinearOpBase<Scalar> > my_dfdp_op_;
200 mutable Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > my_dfdp_mv_;
201 mutable Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > my_dgdx_mv_;
202 mutable Teuchos::RCP<Thyra::MultiVectorBase<Scalar> > my_dgdp_mv_;
203 mutable bool dgdx_dot_checked_;
204 mutable Teuchos::RCP<Tempus::SolutionState<Scalar> > forward_state_;
205 mutable Scalar t_interp_;
206};
207
208} // namespace Tempus
209
210#endif
Thyra::ModelEvaluatorBase::InArgs< Scalar > responseInArgs(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &me_inArgs) const
InArgs for evaluating the response derivatives at the forward state.
void evalModelImpl(const Thyra::ModelEvaluatorBase::InArgs< Scalar > &inArgs, const Thyra::ModelEvaluatorBase::OutArgs< Scalar > &outArgs) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_p_space(int p) const
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > adjoint_model_
Teuchos::RCP< Thyra::LinearOpBase< Scalar > > create_W_op() const
Thyra::DefaultMultiVectorProductVectorSpace< Scalar > DMVPVS
static Teuchos::RCP< const Teuchos::ParameterList > getValidParameters()
void setFinalTime(const Scalar t_final)
Set the final time from the forward evaluation.
Thyra::ModelEvaluatorBase::InArgs< Scalar > createInArgs() const
Thyra::ModelEvaluatorBase::InArgs< Scalar > getNominalValues() const
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getAdjointModel() const
Get the underlying adjoint model.
Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > sh_
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
Get the underlying model 'f'.
Thyra::ModelEvaluatorBase::OutArgs< Scalar > createOutArgsImpl() const
void setForwardSolutionHistory(const Teuchos::RCP< const Tempus::SolutionHistory< Scalar > > &sh)
Set solution history from forward evaluation.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_f_space() const
Teuchos::RCP< const Thyra::LinearOpWithSolveFactoryBase< Scalar > > get_W_factory() const
Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > model_
Teuchos::RCP< const Teuchos::Array< std::string > > get_p_names(int p) const
AdjointAuxSensitivityModelEvaluator(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &adjoint_model, const Scalar &t_init, const Scalar &t_final, const Teuchos::RCP< const Teuchos::ParameterList > &pList=Teuchos::null)
Constructor.
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
AdjointResponseType
Type of response for transient adjoint sensitivities.