9#ifndef Tempus_StepperForwardEuler_impl_hpp
10#define Tempus_StepperForwardEuler_impl_hpp
12#include "Thyra_VectorStdOps.hpp"
34 std::string ICConsistency,
35 bool ICConsistencyCheck,
45 if (appModel != Teuchos::null) {
55 if (appAction == Teuchos::null) {
72 RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
75 if (initialState->getXDot() == Teuchos::null)
91 TEMPUS_FUNC_TIME_MONITOR(
"Tempus::StepperForwardEuler::takeStep()");
93 TEUCHOS_TEST_FOR_EXCEPTION(solutionHistory->getNumStates() < 2,
95 "Error - StepperForwardEuler<Scalar>::takeStep(...)\n"
96 "Need at least two SolutionStates for Forward Euler.\n"
97 " Number of States = " << solutionHistory->getNumStates() <<
"\n"
98 "Try setting in \"Solution History\" \"Storage Type\" = \"Undo\"\n"
99 " or \"Storage Type\" = \"Static\" and \"Storage Limit\" = \"2\"\n");
101 RCP<StepperForwardEuler<Scalar> > thisStepper = Teuchos::rcpFromRef(*
this);
105 RCP<SolutionState<Scalar> > currentState=solutionHistory->getCurrentState();
106 RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
107 if (currentState->getXDot() != Teuchos::null)
110 const Scalar dt = workingState->getTimeStep();
112 if (!(this->
getUseFSAL()) || workingState->getNConsecutiveFailures() != 0) {
121 currentState->getTime(), p);
125 currentState->setIsSynced(
true);
130 Thyra::V_VpStV(Teuchos::outArg(*(workingState->getX())),
131 *(currentState->getX()),dt,*(xDot));
134 if (workingState->getXDot() != Teuchos::null)
147 workingState->getTime(), p);
151 workingState->setIsSynced(
true);
153 assign(xDot.ptr(), Teuchos::ScalarTraits<Scalar>::zero());
154 workingState->setIsSynced(
false);
158 workingState->setOrder(this->
getOrder());
159 workingState->computeNorms(currentState);
173template<
class Scalar>
177 Teuchos::RCP<Tempus::StepperState<Scalar> > stepperState =
183template<
class Scalar>
185 Teuchos::FancyOStream &out,
186 const Teuchos::EVerbosityLevel verbLevel)
const
188 auto l_out = Teuchos::fancyOStream( out.getOStream() );
189 Teuchos::OSTab ostab(*l_out, 2, this->
description());
190 l_out->setOutputToRootOnly(0);
195 *l_out <<
" stepperFEAppAction_ = "
197 <<
"----------------------------" << std::endl;
201template<
class Scalar>
204 out.setOutputToRootOnly(0);
212 out <<
"The Forward Euler AppAction is not set!\n";
220template<
class Scalar>
221Teuchos::RCP<StepperForwardEuler<Scalar> >
224 Teuchos::RCP<Teuchos::ParameterList> pl)
227 stepper->setStepperExplicitValues(pl);
229 if (model != Teuchos::null) {
230 stepper->setModel(model);
231 stepper->initialize();
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
virtual void evaluateExplicitODE(Teuchos::RCP< Thyra::VectorBase< Scalar > > xDot, Teuchos::RCP< const Thyra::VectorBase< Scalar > > x, const Scalar time, const Teuchos::RCP< ExplicitODEParameters< Scalar > > &p)
Evaluate xDot = f(x,t).
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions, make them consistent, and set needed memory.
virtual void setModel(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &appModel)
Set model.
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Application Action for StepperForwardEuler.
@ BEFORE_EXPLICIT_EVAL
Before the explicit evaluation.
@ END_STEP
At the end of the step.
@ BEGIN_STEP
At the beginning of the step.
Default modifier for StepperForwardEuler.
Forward Euler time stepper.
virtual void setInitialConditions(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Set the initial conditions, make them consistent, and set needed memory.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual Scalar getOrder() const
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
virtual void setUseFSAL(bool a)
virtual Teuchos::RCP< Tempus::StepperState< Scalar > > getDefaultStepperState()
Get a default (initial) StepperState.
Teuchos::RCP< StepperForwardEulerAppAction< Scalar > > stepperFEAppAction_
StepperForwardEuler()
Default constructor.
virtual void takeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory)
Take the specified timestep, dt, and return true if successful.
virtual void setAppAction(Teuchos::RCP< StepperForwardEulerAppAction< Scalar > > appAction)
StepperState is a simple class to hold state information about the stepper.
void setICConsistencyCheck(bool c)
virtual void setStepperXDot(Teuchos::RCP< Thyra::VectorBase< Scalar > > xDot)
Set xDot for Stepper storage.
virtual Teuchos::RCP< Thyra::VectorBase< Scalar > > getStepperXDot()
Get Stepper xDot.
void setStepperName(std::string s)
Set the stepper name.
virtual std::string description() const
virtual void initialize()
Initialize after construction and changing input parameters.
std::string getStepperType() const
Get the stepper type. The stepper type is used as an identifier for the stepper, and can only be set ...
virtual bool isValidSetup(Teuchos::FancyOStream &out) const
virtual void checkInitialized()
Check initialization, and error out on failure.
void setStepperType(std::string s)
Set the stepper type.
void setICConsistency(std::string s)
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Teuchos::RCP< StepperForwardEuler< Scalar > > createStepperForwardEuler(const Teuchos::RCP< const Thyra::ModelEvaluator< Scalar > > &model, Teuchos::RCP< Teuchos::ParameterList > pl)
Nonmember constructor - ModelEvaluator and ParameterList.