Tempus  Version of the Day
Time Integration
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Tempus_StepperImplicit_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_StepperImplicit_decl_hpp
10 #define Tempus_StepperImplicit_decl_hpp
11 
12 // Tempus
13 #include "Tempus_config.hpp"
14 #include "Tempus_Stepper.hpp"
15 #include "Tempus_WrapperModelEvaluatorBasic.hpp"
16 
17 
18 namespace Tempus {
19 
20 
21 template<class Scalar>
23 {
24  public:
27  : timeDer_(Teuchos::null), timeStepSize_(Scalar(0.0)),
28  alpha_(Scalar(0.0)), beta_(Scalar(0.0)), evaluationType_(SOLVE_FOR_X),
29  stageNumber_(0)
30  {}
33  Scalar timeStepSize, Scalar alpha, Scalar beta,
34  EVALUATION_TYPE evaluationType = SOLVE_FOR_X,
35  int stageNumber = 0)
36  : timeDer_(timeDer), timeStepSize_(timeStepSize),
37  alpha_(alpha), beta_(beta), evaluationType_(evaluationType),
38  stageNumber_(stageNumber)
39  {}
40 
42  Scalar timeStepSize_;
43  Scalar alpha_;
44  Scalar beta_;
47 };
48 
227 template<class Scalar>
228 class StepperImplicit : virtual public Tempus::Stepper<Scalar>
229 {
230 public:
231 
233 
234  virtual void setModel(
235  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel);
236 
238  {
240  if (wrapperModel_ != Teuchos::null) model = wrapperModel_->getAppModel();
241  return model;
242  }
243 
246 
247  virtual void setDefaultSolver();
248 
250  virtual void setSolver(
252 
254  { return solver_; }
255 
257  virtual void setInitialConditions (
258  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory);
259 
261  virtual Scalar getAlpha(const Scalar dt) const = 0;
262 
264  virtual Scalar getBeta (const Scalar dt) const = 0;
265 
269 
274  const Scalar time,
276 
278  void evaluateImplicitODE(
282  const Scalar time,
284 
286  virtual void setInitialGuess(
287  Teuchos::RCP<const Thyra::VectorBase<Scalar> > initialGuess)
288  {
289  initialGuess_ = initialGuess;
290  this->isInitialized_ = false;
291  }
292 
294  virtual void setZeroInitialGuess(bool zIG) {
295  zeroInitialGuess_ = zIG;
296  this->isInitialized_ = false;
297  }
298 
299  virtual bool getZeroInitialGuess() const { return zeroInitialGuess_; }
300 
301  virtual Scalar getInitTimeStep(
302  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */) const
303  {return Scalar(1.0e+99);}
305 
307 
308  virtual void describe(Teuchos::FancyOStream & out,
309  const Teuchos::EVerbosityLevel verbLevel) const;
311 
312  virtual bool isValidSetup(Teuchos::FancyOStream & out) const;
313 
315 
317 
320 
323 
325  void setSolverName(std::string i) { solverName_ = i; }
327  std::string getSolverName() const { return solverName_; }
328 
329 protected:
330 
335  std::string solverName_;
336 
337 };
338 
339 } // namespace Tempus
340 #endif // Tempus_StepperImplicit_decl_hpp
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions and make them consistent.
ImplicitODEParameters(Teuchos::RCP< TimeDerivative< Scalar > > timeDer, Scalar timeStepSize, Scalar alpha, Scalar beta, EVALUATION_TYPE evaluationType=SOLVE_FOR_X, int stageNumber=0)
Constructor.
const Thyra::SolveStatus< Scalar > solveImplicitODE(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &x)
Solve problem using x in-place. (Needs to be deprecated!)
EVALUATION_TYPE
EVALUATION_TYPE indicates the evaluation to apply to the implicit ODE.
Teuchos::RCP< const Thyra::VectorBase< Scalar > > initialGuess_
Teuchos::RCP< WrapperModelEvaluator< Scalar > > wrapperModel_
void setStepperImplicitValues(Teuchos::RCP< Teuchos::ParameterList > pl)
Set StepperImplicit member data from the ParameterList.
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
virtual Teuchos::RCP< const WrapperModelEvaluator< Scalar > > getWrapperModel()
virtual Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > getSolver() const
Get solver.
bool isInitialized_
True if stepper&#39;s member data is initialized.
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
virtual Scalar getBeta(const Scalar dt) const =0
Return beta = d(x)/dx.
Teuchos::RCP< TimeDerivative< Scalar > > timeDer_
Thyra Base interface for time steppers.
void evaluateImplicitODE(Teuchos::RCP< Thyra::VectorBase< Scalar > > &f, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &xDot, const Scalar time, const Teuchos::RCP< ImplicitODEParameters< Scalar > > &p)
Evaluate implicit ODE residual, f(x, xDot, t, p).
virtual void setSolver(Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver)
Set solver.
Thyra Base interface for implicit time steppers.
virtual Scalar getInitTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &) const
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
void setSolverName(std::string i)
Set the Solver Name.
void setStepperSolverValues(Teuchos::RCP< Teuchos::ParameterList > pl)
Set solver from ParameterList.
virtual void setZeroInitialGuess(bool zIG)
Set parameter so that the initial guess is set to zero (=True) or use last timestep (=False)...
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel()
Teuchos::RCP< Teuchos::ParameterList > getValidParametersBasicImplicit() const
This interface defines the time derivative connection between an implicit Stepper and WrapperModelEva...
std::string getSolverName() const
Get the Solver Name.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual void setInitialGuess(Teuchos::RCP< const Thyra::VectorBase< Scalar > > initialGuess)
Pass initial guess to Newton solver (only relevant for implicit solvers)
virtual Scalar getAlpha(const Scalar dt) const =0
Return alpha = d(xDot)/dx.
Solve for x and determine xDot from x.
Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver_
virtual bool getZeroInitialGuess() const