35 const Teuchos::RCP<Thyra::NonlinearSolverBase<Scalar> >& solver,
36 bool useFSAL, std::string ICConsistency,
bool ICConsistencyCheck,
37 bool zeroInitialGuess,
41 this->setStepperName(
"Trapezoidal Method");
42 this->setStepperType(
"Trapezoidal Method");
43 this->setUseFSAL(useFSAL);
44 this->setICConsistency(ICConsistency);
45 this->setICConsistencyCheck(ICConsistencyCheck);
46 this->setZeroInitialGuess(zeroInitialGuess);
48 this->setAppAction(stepperTrapAppAction);
49 this->setSolver(solver);
51 if (appModel != Teuchos::null) {
52 this->setModel(appModel);
78 RCP<SolutionState<Scalar> > initialState = solutionHistory->getCurrentState();
81 if (initialState->getXDot() == Teuchos::null)
82 this->setStepperXDot(initialState->getX()->clone_v());
84 this->setStepperXDot(initialState->getXDot());
88 TEUCHOS_TEST_FOR_EXCEPTION(
89 !(this->getUseFSAL()), std::logic_error,
90 "Error - The First-Same-As-Last (FSAL) principle is required\n"
91 " for the Trapezoidal Stepper (i.e., useFSAL=true)!\n");
105 this->checkInitialized();
109 TEMPUS_FUNC_TIME_MONITOR(
"Tempus::StepperTrapezoidal::takeStep()");
111 TEUCHOS_TEST_FOR_EXCEPTION(
112 solutionHistory->getNumStates() < 2, std::logic_error,
113 "Error - StepperTrapezoidal<Scalar>::takeStep(...)\n"
114 <<
"Need at least two SolutionStates for Trapezoidal.\n"
115 <<
" Number of States = " << solutionHistory->getNumStates()
116 <<
"\nTry setting in \"Solution History\" \"Storage Type\" = "
118 <<
" or \"Storage Type\" = \"Static\" and \"Storage Limit\" = "
120 RCP<StepperTrapezoidal<Scalar> > thisStepper = Teuchos::rcpFromRef(*
this);
121 stepperTrapAppAction_->execute(
122 solutionHistory, thisStepper,
125 RCP<SolutionState<Scalar> > workingState =
126 solutionHistory->getWorkingState();
127 RCP<SolutionState<Scalar> > currentState =
128 solutionHistory->getCurrentState();
130 RCP<const Thyra::VectorBase<Scalar> > xOld = currentState->getX();
131 RCP<const Thyra::VectorBase<Scalar> > xDotOld = currentState->getXDot();
132 RCP<Thyra::VectorBase<Scalar> > x = workingState->getX();
133 if (workingState->getXDot() != Teuchos::null)
134 this->setStepperXDot(workingState->getXDot());
135 RCP<Thyra::VectorBase<Scalar> > xDot = this->getStepperXDot();
137 const Scalar time = workingState->getTime();
138 const Scalar dt = workingState->getTimeStep();
139 const Scalar alpha = getAlpha(dt);
140 const Scalar beta = getBeta(dt);
143 Teuchos::RCP<TimeDerivative<Scalar> > timeDer = Teuchos::rcp(
146 auto p = Teuchos::rcp(
148 stepperTrapAppAction_->execute(
149 solutionHistory, thisStepper,
152 const Thyra::SolveStatus<Scalar> sStatus =
153 this->solveImplicitODE(x, xDot, time, p);
154 stepperTrapAppAction_->execute(
155 solutionHistory, thisStepper,
158 if (workingState->getXDot() != Teuchos::null) timeDer->compute(x, xDot);
160 workingState->setSolutionStatus(sStatus);
161 workingState->setOrder(this->getOrder());
162 workingState->computeNorms(currentState);
163 stepperTrapAppAction_->execute(
164 solutionHistory, thisStepper,
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...