Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_IntegratorPseudoTransientAdjointSensitivity_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_IntegratorPseudoTransientAdjointSensitivity_decl_hpp
11 #define Tempus_IntegratorPseudoTransientAdjointSensitivity_decl_hpp
12 
13 #include "Tempus_config.hpp"
14 #include "Tempus_IntegratorBasic.hpp"
15 #include "Tempus_AdjointSensitivityModelEvaluator.hpp"
16 
17 #include "Tempus_StepperStaggeredForwardSensitivity.hpp" // For SensitivityStepMode
18 
19 namespace Tempus {
20 
58 template <class Scalar>
60  : virtual public Tempus::Integrator<Scalar>,
61  virtual public Teuchos::ParameterListAcceptor {
62  public:
96  adjoint_residual_model,
97  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_solve_model);
98 
104  adjoint_residual_model,
105  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_solve_model,
106  std::string stepperType);
107 
113  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_model);
114 
119  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_model,
120  std::string stepperType);
121 
131 
140  std::string stepperType);
141 
143 
146 
149 
151 
152 
154  virtual bool advanceTime();
156  virtual bool advanceTime(const Scalar timeFinal) override;
158  virtual Scalar getTime() const override;
160  virtual int getIndex() const override;
162  virtual Status getStatus() const override;
164  virtual void setStatus(const Status st) override;
166  virtual Teuchos::RCP<Stepper<Scalar> > getStepper() const override;
171  const override;
176  override;
179  const override;
181  override;
187  virtual void setObserver(
188  Teuchos::RCP<IntegratorObserver<Scalar> > obs = Teuchos::null);
191  {
192  return state_integrator_->getIntegratorTimer();
193  }
195  {
196  return state_integrator_->getStepperTimer();
197  }
198 
200 
202  virtual void initializeSolutionHistory(
203  Scalar t0, Teuchos::RCP<const Thyra::VectorBase<Scalar> > x0,
204  Teuchos::RCP<const Thyra::VectorBase<Scalar> > xdot0 = Teuchos::null,
205  Teuchos::RCP<const Thyra::VectorBase<Scalar> > xdotdot0 = Teuchos::null,
206  Teuchos::RCP<const Thyra::MultiVectorBase<Scalar> > y0 = Teuchos::null,
207  Teuchos::RCP<const Thyra::MultiVectorBase<Scalar> > ydot0 = Teuchos::null,
209  Teuchos::null);
210 
217 
224  const;
225 
230 
232 
233  void setParameterList(
234  const Teuchos::RCP<Teuchos::ParameterList>& pl) override;
237 
239  const override;
241 
243 
244  std::string description() const override;
246  const Teuchos::EVerbosityLevel verbLevel) const override;
248 
251 
255 
259 
260  protected:
262 
263  // Create sensitivity model evaluator from application model
268  adjoint_residual_model,
269  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_solve_model,
270  const Teuchos::RCP<Teuchos::ParameterList>& inputPL);
271 
272  void buildSolutionHistory();
273 
286 };
287 
289 template <class Scalar>
294 
296 template <class Scalar>
300  std::string stepperType);
301 
303 template <class Scalar>
308  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_model);
309 
311 template <class Scalar>
315  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_model,
316  std::string stepperType);
317 
319 template <class Scalar>
324  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_residual_model,
325  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_solve_model);
326 
328 template <class Scalar>
332  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_residual_model,
333  const Teuchos::RCP<Thyra::ModelEvaluator<Scalar> >& adjoint_solve_model,
334  std::string stepperType);
335 
337 template <class Scalar>
340 
341 } // namespace Tempus
342 
343 #endif // Tempus_IntegratorPseudoTransientAdjointSensitivity_decl_hpp
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl) override
virtual Teuchos::RCP< Teuchos::Time > getIntegratorTimer() const override
Returns the IntegratorTimer_ for this Integrator.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override
virtual Teuchos::RCP< IntegratorObserver< Scalar > > getObserver()
Get the Observer.
virtual Teuchos::RCP< const Thyra::MultiVectorBase< Scalar > > getY() const
Get the current adjoint solution, y.
virtual Teuchos::RCP< const Thyra::VectorBase< Scalar > > getXDot() const
Get the current time derivative of the solution, xdot.
Teuchos::RCP< Tempus::IntegratorPseudoTransientAdjointSensitivity< Scalar > > integratorPseudoTransientAdjointSensitivity(Teuchos::RCP< Teuchos::ParameterList > pList, const Teuchos::RCP< Thyra::ModelEvaluator< Scalar > > &model)
Nonmember constructor.
void setDoAdjointIntegration(const bool f)
Set/get whether to do the adjoint integration.
virtual void setObserver(Teuchos::RCP< IntegratorObserver< Scalar > > obs=Teuchos::null)
Set the Observer.
virtual Teuchos::RCP< SolutionHistory< Scalar > > getNonConstSolutionHistory() override
Get the SolutionHistory.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
virtual Teuchos::RCP< const Thyra::MultiVectorBase< Scalar > > getDgDp() const
Return adjoint sensitivity stored in gradient format.
virtual Teuchos::RCP< const Thyra::MultiVectorBase< Scalar > > getYDot() const
Get the current time derivative of the adjoint solution, ydot.
Time integrator suitable for pseudotransient adjoint sensitivity analysis.
SensitivityStepMode getStepMode() const
What mode the current time integration step is in.
virtual Teuchos::RCP< const Thyra::VectorBase< Scalar > > getG() const
Return response function g.
void setDoForwardIntegration(const bool f)
Set/get whether to do the forward integration.
virtual Teuchos::RCP< TimeStepControl< Scalar > > getNonConstTimeStepControl() override
Status
Status for the Integrator, the Stepper and the SolutionState.
IntegratorObserver class for time integrators.
virtual Teuchos::RCP< const Thyra::VectorBase< Scalar > > getXDotDot() const
Get the current second time derivative of the solution, xdotdot.
virtual void initializeSolutionHistory(Scalar t0, Teuchos::RCP< const Thyra::VectorBase< Scalar > > x0, Teuchos::RCP< const Thyra::VectorBase< Scalar > > xdot0=Teuchos::null, Teuchos::RCP< const Thyra::VectorBase< Scalar > > xdotdot0=Teuchos::null, Teuchos::RCP< const Thyra::MultiVectorBase< Scalar > > y0=Teuchos::null, Teuchos::RCP< const Thyra::MultiVectorBase< Scalar > > ydot0=Teuchos::null, Teuchos::RCP< const Thyra::MultiVectorBase< Scalar > > ydotdot0=Teuchos::null)
Set the initial state from Thyra::VectorBase(s)
virtual Teuchos::RCP< const Thyra::MultiVectorBase< Scalar > > getYDotDot() const
Get the current second time derivative of the adjoint solution, ydotdot.
Thyra Base interface for time integrators. Time integrators are designed to advance the solution from...
virtual Teuchos::RCP< Stepper< Scalar > > getStepper() const override
Get the Stepper.
virtual Teuchos::RCP< const SolutionHistory< Scalar > > getSolutionHistory() const override
Get the SolutionHistory.
virtual Teuchos::RCP< const TimeStepControl< Scalar > > getTimeStepControl() const override
Get the TimeStepControl.
virtual bool advanceTime()
Advance the solution to timeMax, and return true if successful.
Teuchos::RCP< AdjointSensitivityModelEvaluator< Scalar > > createSensitivityModel(const Teuchos::RCP< Thyra::ModelEvaluator< Scalar > > &model, const Teuchos::RCP< Thyra::ModelEvaluator< Scalar > > &adjoint_residual_model, const Teuchos::RCP< Thyra::ModelEvaluator< Scalar > > &adjoint_solve_model, const Teuchos::RCP< Teuchos::ParameterList > &inputPL)
virtual Teuchos::RCP< const Thyra::VectorBase< Scalar > > getX() const
Get the current solution, x.