34 std::string ICConsistency,
35 bool ICConsistencyCheck,
36 const Teuchos::RCP<StepperForwardEulerAppAction<Scalar> >& stepperFEAppAction)
38 this->setStepperName(
"Forward Euler");
39 this->setStepperType(
"Forward Euler");
40 this->setUseFSAL( useFSAL);
41 this->setICConsistency( ICConsistency);
42 this->setICConsistencyCheck( ICConsistencyCheck);
44 this->setAppAction(stepperFEAppAction);
45 if (appModel != Teuchos::null) {
46 this->setModel(appModel);
85 const Teuchos::RCP<SolutionHistory<Scalar> >& solutionHistory)
87 this->checkInitialized();
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);
102 stepperFEAppAction_->execute(solutionHistory, thisStepper,
105 RCP<SolutionState<Scalar> > currentState=solutionHistory->getCurrentState();
106 RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
107 if (currentState->getXDot() != Teuchos::null)
108 this->setStepperXDot(currentState->getXDot());
109 RCP<Thyra::VectorBase<Scalar> > xDot = this->getStepperXDot();
110 const Scalar dt = workingState->getTimeStep();
112 if (!(this->getUseFSAL()) || workingState->getNConsecutiveFailures() != 0) {
114 stepperFEAppAction_->execute(solutionHistory, thisStepper,
117 auto p = Teuchos::rcp(
new ExplicitODEParameters<Scalar>(dt));
120 this->evaluateExplicitODE(xDot, currentState->getX(),
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)
135 this->setStepperXDot(workingState->getXDot());
136 xDot = this->getStepperXDot();
138 if (this->getUseFSAL()) {
140 stepperFEAppAction_->execute(solutionHistory, thisStepper,
143 auto p = Teuchos::rcp(
new ExplicitODEParameters<Scalar>(dt));
146 this->evaluateExplicitODE(xDot, workingState->getX(),
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);
160 stepperFEAppAction_->execute(solutionHistory, thisStepper,
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_ = "
196 << stepperFEAppAction_ << std::endl
197 <<
"----------------------------" << std::endl;