135 const TimeStepControl<Scalar> & tsc,
136 Teuchos::RCP<SolutionHistory<Scalar> > solutionHistory,
143 RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
144 const Scalar errorAbs = workingState->getErrorAbs();
145 const Scalar errorRel = workingState->getErrorRel();
146 const int iStep = workingState->getIndex();
147 Scalar dt = workingState->getTimeStep();
151 Scalar eta = solutionHistory->getCurrentState()->getDxNormL2Rel();
156 tsc.printDtChanges(iStep, dt, dt*sigma,
157 "Stepper failure - Decreasing dt.");
162 tsc.printDtChanges(iStep, dt, dt*rho,
164 + std::to_string(eta) +
" < " + std::to_string(
getMinEta())
165 +
"). Increasing dt.");
169 tsc.printDtChanges(iStep, dt, dt*sigma,
171 + std::to_string(eta) +
" > " + std::to_string(
getMaxEta())
172 +
"). Decreasing dt.");
175 else if (errorAbs > tsc.getMaxAbsError()) {
176 tsc.printDtChanges(iStep, dt, dt*sigma,
177 "Absolute error is too large ("
178 + std::to_string(errorAbs)+
" > "+std::to_string(tsc.getMaxAbsError())
179 +
"). Decreasing dt.");
182 else if (errorRel > tsc.getMaxRelError()) {
183 tsc.printDtChanges(iStep, dt, dt*sigma,
184 "Relative error is too large ("
185 + std::to_string(errorRel)+
" > "+std::to_string(tsc.getMaxRelError())
186 +
"). Decreasing dt.");
191 if (dt < tsc.getMinTimeStep()) {
192 tsc.printDtChanges(iStep, dt, tsc.getMinTimeStep(),
193 "dt is too small. Resetting to minimum dt.");
194 dt = tsc.getMinTimeStep();
196 if (dt > tsc.getMaxTimeStep()) {
197 tsc.printDtChanges(iStep, dt, tsc.getMaxTimeStep(),
198 "dt is too large. Resetting to maximum dt.");
199 dt = tsc.getMaxTimeStep();
202 workingState->setTimeStep(dt);
203 workingState->setTime(solutionHistory->getCurrentState()->getTime() + dt);
204 workingState->setComputeNorms(
true);
213 const Teuchos::EVerbosityLevel verbLevel)
const override
215 auto l_out = Teuchos::fancyOStream( out.getOStream() );
216 Teuchos::OSTab ostab(*l_out, 2, this->
description());
217 l_out->setOutputToRootOnly(0);
219 *l_out <<
"\n--- " << this->
description() <<
" ---" << std::endl;
221 if (Teuchos::as<int>(verbLevel) >= Teuchos::as<int>(Teuchos::VERB_MEDIUM)) {
223 <<
" Step Type = " << this->
getStepType() << std::endl
224 <<
" Amplification Factor = " <<
getAmplFactor() << std::endl
226 <<
" Minimum Value Monitoring Function = " <<
getMinEta() << std::endl
227 <<
" Maximum Value Monitoring Function = " <<
getMaxEta() << std::endl;
228 *l_out << std::string(this->
description().length()+8,
'-') <<std::endl;
250 TEUCHOS_TEST_FOR_EXCEPTION(
getAmplFactor() <= 1.0, std::out_of_range,
251 "Error - Invalid value of Amplification Factor = " <<
getAmplFactor()
252 <<
"! \n" <<
"Amplification Factor must be > 1.0.\n");
254 TEUCHOS_TEST_FOR_EXCEPTION(
getReductFactor() >= 1.0, std::out_of_range,
256 <<
"! \n" <<
"Reduction Factor must be < 1.0.\n");
259 "Error - Invalid values of 'Minimum Value Monitoring Function' = "
260 <<
getMinEta() <<
"\n and 'Maximum Value Monitoring Function' = "
261 <<
getMaxEta() <<
"! \n Mininum Value cannot be > Maximum Value! \n");