Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_StepperStaggeredForwardSensitivity_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_StepperStaggeredForwardSensitivity_decl_hpp
11 #define Tempus_StepperStaggeredForwardSensitivity_decl_hpp
12 
13 #include "Tempus_config.hpp"
14 #include "Tempus_Stepper.hpp"
16 
17 namespace Tempus {
18 
21  Combined,
22  Adjoint };
23 
35 template <class Scalar>
37  : virtual public Tempus::Stepper<Scalar>,
38  virtual public Teuchos::ParameterListAcceptor {
39  public:
46 
48 
80  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
82  sens_residual_model,
84  sens_solve_model,
85  const Teuchos::RCP<Teuchos::ParameterList>& pList = Teuchos::null,
86  const Teuchos::RCP<Teuchos::ParameterList>& sens_pList = Teuchos::null);
87 
89 
90  virtual void setModel(
91  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel)
92  {
93  setModel(appModel, appModel, appModel);
94  }
95  virtual void setModel(
96  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel,
98  sens_residual_model,
100  sens_solve_model);
102 
103  virtual void setSolver(
104  Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> > solver = Teuchos::null);
106  {
107  return stateStepper_->getSolver();
108  }
109 
111  virtual void setInitialConditions(
112  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */)
113  {
114  }
115 
117  virtual void takeStep(
118  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
119 
122  virtual Scalar getOrder() const { return stateStepper_->getOrder(); }
123  virtual Scalar getOrderMin() const { return stateStepper_->getOrderMin(); }
124  virtual Scalar getOrderMax() const { return stateStepper_->getOrderMax(); }
125  virtual Scalar getInitTimeStep(
126  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */) const
127  {
128  return Scalar(1.0e+99);
129  }
130 
131  virtual bool isExplicit() const
132  {
133  return stateStepper_->isExplicit() || sensitivityStepper_->isExplicit();
134  }
135  virtual bool isImplicit() const
136  {
137  return stateStepper_->isImplicit() || sensitivityStepper_->isImplicit();
138  }
139  virtual bool isExplicitImplicit() const
140  {
141  return isExplicit() && isImplicit();
142  }
143 
144  virtual bool isOneStepMethod() const
145  {
146  return stateStepper_->isOneStepMethod() &&
147  sensitivityStepper_->isOneStepMethod();
148  }
149  virtual bool isMultiStepMethod() const { return !isOneStepMethod(); }
150 
151  virtual OrderODE getOrderODE() const { return FIRST_ORDER_ODE; }
152 
153  virtual void setUseFSAL(bool a) { stepperPL_->set<bool>("Use FSAL", a); }
154  virtual bool getUseFSAL() const
155  {
156  return stepperPL_->get<bool>("Use FSAL", false);
157  }
158 
159  virtual void setICConsistency(std::string s)
160  {
161  stepperPL_->set<std::string>("Initial Condition Consistency", s);
162  }
163  virtual std::string getICConsistency() const
164  {
165  return stepperPL_->get<std::string>("Initial Condition Consistency",
166  "None");
167  }
168 
169  virtual void setICConsistencyCheck(bool c)
170  {
171  stepperPL_->set<bool>("Initial Condition Consistency Check", c);
172  }
173  virtual bool getICConsistencyCheck() const
174  {
175  return stepperPL_->get<bool>("Initial Condition Consistency Check", false);
176  }
178 
180  virtual void setInitialGuess(
181  Teuchos::RCP<const Thyra::VectorBase<Scalar> > /* initial_guess */)
182  {
183  }
184 
186 
193 
195 
196  virtual std::string description() const
197  {
198  return "StepperStaggeredForwardSensitivity";
199  }
200  virtual void describe(Teuchos::FancyOStream& out,
201  const Teuchos::EVerbosityLevel verbLevel) const;
203 
204  virtual bool isValidSetup(Teuchos::FancyOStream& out) const;
205 
207 
209  {
210  return stepperPL_;
211  }
212 
215 
216  private:
219 
220  protected:
232 };
233 
234 } // namespace Tempus
235 
236 #endif // Tempus_StepperStaggeredForwardSensitivity_decl_hpp
virtual Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > getSolver() const
Get solver.
virtual Scalar getInitTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &) const
T & get(const std::string &name, T def_value)
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &)
Set the initial conditions and make them consistent.
A stepper implementing staggered forward sensitivity analysis.
ParameterList & set(std::string const &name, T &&value, std::string const &docString="", RCP< const ParameterEntryValidator > const &validator=null)
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
Teuchos::RCP< const Thyra::VectorSpaceBase< Scalar > > get_x_space() const
Teuchos::RCP< SensitivityModelEvaluatorBase< Scalar > > combined_fsa_model_
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
Thyra Base interface for time steppers.
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
Teuchos::RCP< Teuchos::ParameterList > getDefaultParameters() const
Teuchos::RCP< SensitivityModelEvaluatorBase< Scalar > > fsa_model_
virtual Teuchos::RCP< const Teuchos::ParameterList > getParameterList() const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Stepper integrates first-order ODEs.
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
SensitivityStepMode getStepMode() const
What mode the current time integration step is in.
void setParams(const Teuchos::RCP< Teuchos::ParameterList > &pl, const Teuchos::RCP< Teuchos::ParameterList > &spl)
virtual void setInitialGuess(Teuchos::RCP< const Thyra::VectorBase< Scalar > >)
Pass initial guess to Newton solver.
virtual void setSolver(Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver=Teuchos::null)
Set solver.
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl)
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const