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: 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_StepperImplicit_decl_hpp
11 #define Tempus_StepperImplicit_decl_hpp
12 
13 // Tempus
14 #include "Tempus_config.hpp"
15 #include "Tempus_Stepper.hpp"
16 #include "Tempus_WrapperModelEvaluatorBasic.hpp"
17 
18 namespace Tempus {
19 
196 template <class Scalar>
197 class StepperImplicit : virtual public Tempus::Stepper<Scalar> {
198  public:
200 
201  virtual void setModel(
203  const Teuchos::RCP<const Thyra::ModelEvaluator<Scalar> >& appModel)
204  override;
205 
207  const override
208  {
210  if (wrapperModel_ != Teuchos::null) model = wrapperModel_->getAppModel();
211  return model;
212  }
213 
215  {
216  return wrapperModel_;
217  }
218 
219  virtual void setDefaultSolver();
220 
222  virtual void setSolver(
224 
226  const override
227  {
228  return solver_;
229  }
230 
232  virtual void setInitialConditions(
233  const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory) override;
234 
236  virtual Scalar getAlpha(const Scalar dt) const = 0;
237 
239  virtual Scalar getBeta(const Scalar dt) const = 0;
240 
244  const Teuchos::RCP<Thyra::VectorBase<Scalar> >& xDot, const Scalar time,
246  const Teuchos::RCP<Thyra::VectorBase<Scalar> >& y = Teuchos::null,
247  const int index = -1 /* index and y are for IMEX_RK_Partition */);
248 
250  void evaluateImplicitODE(
253  const Teuchos::RCP<Thyra::VectorBase<Scalar> >& xDot, const Scalar time,
255 
257  virtual void setInitialGuess(
258  Teuchos::RCP<const Thyra::VectorBase<Scalar> > initialGuess) override
259  {
260  initialGuess_ = initialGuess;
261  this->isInitialized_ = false;
262  }
263 
266  virtual void setZeroInitialGuess(bool zIG)
267  {
268  zeroInitialGuess_ = zIG;
269  this->isInitialized_ = false;
270  }
271 
272  virtual bool getZeroInitialGuess() const { return zeroInitialGuess_; }
273 
274  virtual Scalar getInitTimeStep(
275  const Teuchos::RCP<SolutionHistory<Scalar> >& /* solutionHistory */)
276  const override
277  {
278  return Scalar(1.0e+99);
279  }
281 
283 
284  virtual void describe(
286  const Teuchos::EVerbosityLevel verbLevel) const override;
288 
289  virtual bool isValidSetup(Teuchos::FancyOStream& out) const override;
290 
292  const override;
293 
295 
298 
301 
303  void setSolverName(std::string i) { solverName_ = i; }
305  std::string getSolverName() const { return solverName_; }
306 
307  protected:
312  std::string solverName_;
313 };
314 
315 } // namespace Tempus
316 #endif // Tempus_StepperImplicit_decl_hpp
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
virtual void setSolver(Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver) override
Set solver.
virtual Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > getSolver() const override
Get solver.
virtual bool isValidSetup(Teuchos::FancyOStream &out) const override
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 Scalar getInitTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &) const override
virtual void setInitialGuess(Teuchos::RCP< const Thyra::VectorBase< Scalar > > initialGuess) override
Pass initial guess to Newton solver (only relevant for implicit solvers)
virtual Teuchos::RCP< const WrapperModelEvaluator< Scalar > > getWrapperModel()
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const override
bool isInitialized_
True if stepper&#39;s member data is initialized.
virtual Scalar getBeta(const Scalar dt) const =0
Return beta = d(x)/dx.
const Thyra::SolveStatus< Scalar > solveImplicitODE(const Teuchos::RCP< Thyra::VectorBase< Scalar > > &x, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &xDot, const Scalar time, const Teuchos::RCP< ImplicitODEParameters< Scalar > > &p, const Teuchos::RCP< Thyra::VectorBase< Scalar > > &y=Teuchos::null, const int index=-1)
Solve implicit ODE, f(x, xDot, t, p) = 0.
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel) override
Set the model.
Thyra Base interface for time steppers.
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory) override
Set the initial conditions and make them consistent.
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).
Thyra Base interface for implicit time steppers.
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)
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
virtual Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > getModel() const override
Teuchos::RCP< Teuchos::ParameterList > getValidParametersBasicImplicit() const
std::string getSolverName() const
Get the Solver Name.
virtual Scalar getAlpha(const Scalar dt) const =0
Return alpha = d(xDot)/dx.
Teuchos::RCP< Thyra::NonlinearSolverBase< Scalar > > solver_
virtual bool getZeroInitialGuess() const