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: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_StepperOperatorSplit_decl_hpp
10 #define Tempus_StepperOperatorSplit_decl_hpp
11 
12 #include "Tempus_config.hpp"
13 #include "Tempus_Stepper.hpp"
15 
16 namespace Tempus {
17 
64 template<class Scalar>
65 class StepperOperatorSplit : virtual public Tempus::Stepper<Scalar>
66 {
67 public:
68 
75 
78  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > appModels,
79  std::vector<Teuchos::RCP<Stepper<Scalar> > > subStepperList,
80  bool useFSAL,
81  std::string ICConsistency,
82  bool ICConsistencyCheck,
83  int order,
84  int orderMin,
85  int orderMax,
86  const Teuchos::RCP<StepperOperatorSplitAppAction<Scalar> >& stepperOSAppAction);
87 
89 
90  virtual void setModel(
91  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel);
92 
94  getModel();
95 
96  virtual void setSolver(
98 
100  { return Teuchos::null; }
101 
103 
105  { return stepperOSAppAction_; }
106 
108  { tempState_ = state; }
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 
127  virtual Scalar getOrder() const {return order_;}
128  virtual Scalar getOrderMin() const {return orderMin_;}
129  virtual Scalar getOrderMax() const {return orderMax_;}
130 
131  virtual Scalar getInitTimeStep(
132  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */) const
133  {return Scalar(1.0e+99);}
134  virtual void setOrder (Scalar o) { order_ = o;}
135  virtual void setOrderMin(Scalar o) { orderMin_ = o;}
136  virtual void setOrderMax(Scalar o) { orderMax_ = o;}
137 
138  virtual bool isExplicit() const
139  {
140  bool isExplicit = false;
141  typename std::vector<Teuchos::RCP<Stepper<Scalar> > >::const_iterator
142  subStepperIter = subStepperList_.begin();
143  for (; subStepperIter < subStepperList_.end(); subStepperIter++) {
144  if ( (*subStepperIter)->isExplicit() ) isExplicit = true;
145  }
146  return isExplicit;
147  }
148  virtual bool isImplicit() const
149  {
150  bool isImplicit = false;
151  typename std::vector<Teuchos::RCP<Stepper<Scalar> > >::const_iterator
152  subStepperIter = subStepperList_.begin();
153  for (; subStepperIter < subStepperList_.end(); subStepperIter++) {
154  if ( (*subStepperIter)->isImplicit() ) isImplicit = true;
155  }
156  return isImplicit;
157  }
158  virtual bool isExplicitImplicit() const
159  {return isExplicit() && isImplicit();}
160  virtual bool isOneStepMethod() const
161  {
162  bool isOneStepMethod = true;
163  typename std::vector<Teuchos::RCP<Stepper<Scalar> > >::const_iterator
164  subStepperIter = subStepperList_.begin();
165  for (; subStepperIter < subStepperList_.end(); subStepperIter++) {
166  if ( !(*subStepperIter)->isOneStepMethod() ) isOneStepMethod = false;
167  }
168  return isOneStepMethod;
169  }
170  virtual bool isMultiStepMethod() const {return !isOneStepMethod();}
171  virtual void setUseFSAL(bool a) { this->useFSAL_ = a; this->isInitialized_ = false; }
172  virtual OrderODE getOrderODE() const {return FIRST_ORDER_ODE;}
174 
176 
177  void createSubSteppers(
178  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > appModels,
180 
182 
183  virtual void describe(Teuchos::FancyOStream & out,
184  const Teuchos::EVerbosityLevel verbLevel) const;
186 
187  virtual bool isValidSetup(Teuchos::FancyOStream & out) const;
188 
189  virtual std::vector<Teuchos::RCP<Stepper<Scalar> > > getStepperList() const
190  { return subStepperList_; }
191  virtual void setStepperList(std::vector<Teuchos::RCP<Stepper<Scalar> > > sl)
192  { subStepperList_ = sl; }
193 
199  virtual void addStepper(Teuchos::RCP<Stepper<Scalar> > stepper,
200  bool useFSAL = false);
201 
202  virtual void setSubStepperList(
203  std::vector<Teuchos::RCP<Stepper<Scalar> > > subStepperList);
204 
205  virtual void clearSubStepperList() { subStepperList_.clear(); }
206 
207  virtual void setModels(
208  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > appModels);
209 
210 protected:
211 
212  Scalar order_;
213  Scalar orderMin_;
214  Scalar orderMax_;
215 
216  std::vector<Teuchos::RCP<Stepper<Scalar> > > subStepperList_;
220 
221 };
222 
223 
225 // ------------------------------------------------------------------------
226 template<class Scalar>
229  std::vector<Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> > > appModels,
231 
232 
233 } // namespace Tempus
234 
235 #endif // Tempus_StepperOperatorSplit_decl_hpp
virtual Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > getSolver() const
Get solver.
virtual void setInitialGuess(Teuchos::RCP< const Thyra::VectorBase< Scalar > >)
Pass initial guess to Newton solver.
virtual Teuchos::RCP< StepperOperatorSplitAppAction< Scalar > > getAppAction() const
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 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 Scalar getInitTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &) const
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel()
std::vector< Teuchos::RCP< Stepper< Scalar > > > subStepperList_
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
virtual void setSolver(Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver)
Set solver.
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
virtual void setModels(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > appModels)
bool isInitialized_
True if stepper&#39;s member data is initialized.
OperatorSplit stepper loops through the Stepper list.
Thyra Base interface for time steppers.
Teuchos::RCP< SolutionState< Scalar > > tempState_
virtual void setAppAction(Teuchos::RCP< StepperOperatorSplitAppAction< Scalar > > appAction)
virtual void setTempState(Teuchos::RCP< Tempus::SolutionState< Scalar >> state)
void createSubSteppers(std::vector< Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > > appModels, Teuchos::RCP< Teuchos::ParameterList > pl)
bool useFSAL_
Use First-Same-As-Last (FSAL) principle.
Teuchos::RCP< StepperOperatorSplitAppAction< Scalar > > stepperOSAppAction_
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
virtual void setStepperList(std::vector< Teuchos::RCP< Stepper< Scalar > > > sl)
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions and make them consistent.
Teuchos::RCP< SolutionHistory< Scalar > > OpSpSolnHistory_
Stepper integrates first-order ODEs.
StepperOperatorSplitAppAction class for StepperOperatorSplit.
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
virtual void initialize()
Initialize during construction and after changing input parameters.
Solution state for integrators and steppers. SolutionState contains the metadata for solutions and th...
virtual std::vector< Teuchos::RCP< Stepper< Scalar > > > getStepperList() const
virtual void setSubStepperList(std::vector< Teuchos::RCP< Stepper< Scalar > > > subStepperList)