Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_StepperOperatorSplit_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_StepperOperatorSplit_decl_hpp
11 #define Tempus_StepperOperatorSplit_decl_hpp
12 
13 #include "Tempus_config.hpp"
14 #include "Tempus_Stepper.hpp"
16 
17 namespace Tempus {
18 
62 template <class Scalar>
63 class StepperOperatorSplit : virtual public Tempus::Stepper<Scalar> {
64  public:
71 
74  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar>>> appModels,
75  std::vector<Teuchos::RCP<Stepper<Scalar>>> subStepperList, bool useFSAL,
76  std::string ICConsistency, bool ICConsistencyCheck, int order,
77  int orderMin, int orderMax,
79  stepperOSAppAction);
80 
82 
83  virtual void setModel(
84  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar>>& appModel);
85 
87 
88  virtual void setSolver(
90 
92  {
93  return Teuchos::null;
94  }
95 
96  virtual void setAppAction(
98 
100  const
101  {
102  return stepperOSAppAction_;
103  }
104 
106  {
107  tempState_ = state;
108  }
109 
111  virtual void initialize();
112 
114  virtual void setInitialConditions(
115  const Teuchos::RCP<SolutionHistory<Scalar>>& solutionHistory);
116 
118  virtual void takeStep(
119  const Teuchos::RCP<SolutionHistory<Scalar>>& solutionHistory);
120 
122  virtual void setInitialGuess(
123  Teuchos::RCP<const Thyra::VectorBase<Scalar>> /* initial_guess */)
124  {
125  }
126 
129  virtual Scalar getOrder() const { return order_; }
130  virtual Scalar getOrderMin() const { return orderMin_; }
131  virtual Scalar getOrderMax() const { return orderMax_; }
132 
133  virtual Scalar getInitTimeStep(
134  const Teuchos::RCP<SolutionHistory<Scalar>>& /* solutionHistory */) const
135  {
136  return Scalar(1.0e+99);
137  }
138  virtual void setOrder(Scalar o) { order_ = o; }
139  virtual void setOrderMin(Scalar o) { orderMin_ = o; }
140  virtual void setOrderMax(Scalar o) { orderMax_ = o; }
141 
142  virtual bool isExplicit() const
143  {
144  bool isExplicit = false;
145  typename std::vector<Teuchos::RCP<Stepper<Scalar>>>::const_iterator
146  subStepperIter = subStepperList_.begin();
147  for (; subStepperIter < subStepperList_.end(); subStepperIter++) {
148  if ((*subStepperIter)->isExplicit()) isExplicit = true;
149  }
150  return isExplicit;
151  }
152  virtual bool isImplicit() const
153  {
154  bool isImplicit = false;
155  typename std::vector<Teuchos::RCP<Stepper<Scalar>>>::const_iterator
156  subStepperIter = subStepperList_.begin();
157  for (; subStepperIter < subStepperList_.end(); subStepperIter++) {
158  if ((*subStepperIter)->isImplicit()) isImplicit = true;
159  }
160  return isImplicit;
161  }
162  virtual bool isExplicitImplicit() const
163  {
164  return isExplicit() && isImplicit();
165  }
166  virtual bool isOneStepMethod() const
167  {
168  bool isOneStepMethod = true;
169  typename std::vector<Teuchos::RCP<Stepper<Scalar>>>::const_iterator
170  subStepperIter = subStepperList_.begin();
171  for (; subStepperIter < subStepperList_.end(); subStepperIter++) {
172  if (!(*subStepperIter)->isOneStepMethod()) isOneStepMethod = false;
173  }
174  return isOneStepMethod;
175  }
176  virtual bool isMultiStepMethod() const { return !isOneStepMethod(); }
177  virtual void setUseFSAL(bool a)
178  {
179  this->useFSAL_ = a;
180  this->isInitialized_ = false;
181  }
182  virtual OrderODE getOrderODE() const { return FIRST_ORDER_ODE; }
184 
186 
187  void createSubSteppers(
188  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar>>> appModels,
190 
192 
193  virtual void describe(Teuchos::FancyOStream& out,
194  const Teuchos::EVerbosityLevel verbLevel) const;
196 
197  virtual bool isValidSetup(Teuchos::FancyOStream& out) const;
198 
199  virtual std::vector<Teuchos::RCP<Stepper<Scalar>>> getStepperList() const
200  {
201  return subStepperList_;
202  }
203  virtual void setStepperList(std::vector<Teuchos::RCP<Stepper<Scalar>>> sl)
204  {
205  subStepperList_ = sl;
206  }
207 
213  virtual void addStepper(Teuchos::RCP<Stepper<Scalar>> stepper,
214  bool useFSAL = false);
215 
216  virtual void setSubStepperList(
217  std::vector<Teuchos::RCP<Stepper<Scalar>>> subStepperList);
218 
219  virtual void clearSubStepperList() { subStepperList_.clear(); }
220 
221  virtual void setModels(
222  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar>>> appModels);
223 
224  protected:
225  Scalar order_;
226  Scalar orderMin_;
227  Scalar orderMax_;
228 
229  std::vector<Teuchos::RCP<Stepper<Scalar>>> subStepperList_;
233 };
234 
236 // ------------------------------------------------------------------------
237 template <class Scalar>
239  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar>>> appModels,
241 
242 } // namespace Tempus
243 
244 #endif // Tempus_StepperOperatorSplit_decl_hpp
virtual void setAppAction(Teuchos::RCP< StepperOperatorSplitAppAction< Scalar >> appAction)
virtual Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > getSolver() const
Get solver.
virtual Teuchos::RCP< StepperOperatorSplitAppAction< Scalar > > getAppAction() const
virtual void setInitialGuess(Teuchos::RCP< const Thyra::VectorBase< Scalar >>)
Pass initial guess to Newton solver.
std::vector< Teuchos::RCP< Stepper< Scalar > > > subStepperList_
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual void setSubStepperList(std::vector< Teuchos::RCP< Stepper< Scalar >>> subStepperList)
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
bool isInitialized_
True if stepper&#39;s member data is initialized.
virtual void setStepperList(std::vector< Teuchos::RCP< Stepper< Scalar >>> sl)
OperatorSplit stepper loops through the Stepper list.
Thyra Base interface for time steppers.
virtual void setModels(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar >>> appModels)
Teuchos::RCP< SolutionState< Scalar > > tempState_
virtual void setTempState(Teuchos::RCP< Tempus::SolutionState< Scalar >> state)
bool useFSAL_
Use First-Same-As-Last (FSAL) principle.
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar >> &solutionHistory)
Set the initial conditions and make them consistent.
virtual Scalar getInitTimeStep(const Teuchos::RCP< SolutionHistory< Scalar >> &) const
Teuchos::RCP< StepperOperatorSplitAppAction< Scalar > > stepperOSAppAction_
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
void createSubSteppers(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar >>> appModels, Teuchos::RCP< Teuchos::ParameterList > pl)
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Teuchos::RCP< SolutionHistory< Scalar > > OpSpSolnHistory_
Stepper integrates first-order ODEs.
Teuchos::RCP< StepperOperatorSplit< Scalar > > createStepperOperatorSplit(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar >>> appModels, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar >> &solutionHistory)
Take the specified timestep, dt, and return true if successful.
StepperOperatorSplitAppAction class for StepperOperatorSplit.
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
virtual void setSolver(Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar >> solver)
virtual void initialize()
Initialize during construction and after changing input parameters.
Solution state for integrators and steppers.
virtual void addStepper(Teuchos::RCP< Stepper< Scalar >> stepper, bool useFSAL=false)
Add Stepper to subStepper list. In most cases, subSteppers cannot use xDotOld (thus the default)...
virtual std::vector< Teuchos::RCP< Stepper< Scalar > > > getStepperList() const
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar >> &appModel)