9 #ifndef Tempus_TimeStepControl_impl_hpp 10 #define Tempus_TimeStepControl_impl_hpp 12 #include "Teuchos_TimeMonitor.hpp" 22 template<
class Scalar>
24 : isInitialized_ (false),
29 maxTimeStep_ (1.0e+99),
31 finalIndex_ (1000000),
32 maxAbsError_ (1.0e-08),
33 maxRelError_ (1.0e-08),
35 maxConsecFailures_ (5),
37 printDtChanges_ (true),
38 outputExactly_ (true),
41 outputIndexInterval_(1000000),
42 outputTimeInterval_ (1.0e+99),
43 outputAdjustedDt_(false),
51 template<
class Scalar>
63 int maxConsecFailures,
67 std::vector<int> outputIndices,
68 std::vector<Scalar> outputTimes,
69 int outputIndexInterval,
70 Scalar outputTimeInterval,
72 : isInitialized_ (false ),
73 initTime_ (initTime ),
74 finalTime_ (finalTime ),
75 minTimeStep_ (minTimeStep ),
76 initTimeStep_ (initTimeStep ),
77 maxTimeStep_ (maxTimeStep ),
78 initIndex_ (initIndex ),
79 finalIndex_ (finalIndex ),
80 maxAbsError_ (maxAbsError ),
81 maxRelError_ (maxRelError ),
82 maxFailures_ (maxFailures ),
83 maxConsecFailures_ (maxConsecFailures ),
84 numTimeSteps_ (numTimeSteps ),
85 printDtChanges_ (printDtChanges ),
86 outputExactly_ (outputExactly ),
87 outputIndices_ (outputIndices ),
88 outputTimes_ (outputTimes ),
89 outputIndexInterval_(outputIndexInterval),
90 outputTimeInterval_ (outputTimeInterval ),
91 outputAdjustedDt_ (false ),
92 dtAfterOutput_ (0.0 ),
93 stepControlStrategy_(stepControlStrategy)
100 template<
class Scalar>
103 TEUCHOS_TEST_FOR_EXCEPTION(
104 (getInitTime() > getFinalTime() ), std::logic_error,
105 "Error - Inconsistent time range.\n" 106 " (timeMin = "<<getInitTime()<<
") > (timeMax = "<<getFinalTime()<<
")\n");
108 TEUCHOS_TEST_FOR_EXCEPTION(
109 (getMinTimeStep() < Teuchos::ScalarTraits<Scalar>::zero() ),
111 "Error - Negative minimum time step. dtMin = "<<getMinTimeStep()<<
")\n");
112 TEUCHOS_TEST_FOR_EXCEPTION(
113 (getMaxTimeStep() < Teuchos::ScalarTraits<Scalar>::zero() ),
115 "Error - Negative maximum time step. dtMax = "<<getMaxTimeStep()<<
")\n");
116 TEUCHOS_TEST_FOR_EXCEPTION(
117 (getMinTimeStep() > getMaxTimeStep() ), std::logic_error,
118 "Error - Inconsistent time step range.\n" 119 " (dtMin = "<<getMinTimeStep()<<
") > (dtMax = "<<getMaxTimeStep()<<
")\n");
120 TEUCHOS_TEST_FOR_EXCEPTION(
121 (getInitTimeStep() < Teuchos::ScalarTraits<Scalar>::zero() ),
123 "Error - Negative initial time step. dtInit = "<<getInitTimeStep()<<
")\n");
124 TEUCHOS_TEST_FOR_EXCEPTION(
125 (getInitTimeStep() < getMinTimeStep() ||
126 getInitTimeStep() > getMaxTimeStep() ),
128 "Error - Initial time step is out of range.\n" 129 <<
" [dtMin, dtMax] = [" << getMinTimeStep() <<
", " 130 << getMaxTimeStep() <<
"]\n" 131 <<
" dtInit = " << getInitTimeStep() <<
"\n");
133 TEUCHOS_TEST_FOR_EXCEPTION(
134 (getInitIndex() > getFinalIndex() ), std::logic_error,
135 "Error - Inconsistent time index range.\n" 136 " (iStepMin = "<<getInitIndex()<<
") > (iStepMax = " 137 <<getFinalIndex()<<
")\n");
139 TEUCHOS_TEST_FOR_EXCEPTION(
140 (getMaxAbsError() < Teuchos::ScalarTraits<Scalar>::zero() ),
142 "Error - Negative maximum time step. errorMaxAbs = " 143 <<getMaxAbsError()<<
")\n");
144 TEUCHOS_TEST_FOR_EXCEPTION(
145 (getMaxRelError() < Teuchos::ScalarTraits<Scalar>::zero() ),
147 "Error - Negative maximum time step. errorMaxRel = " 148 <<getMaxRelError()<<
")\n");
150 TEUCHOS_TEST_FOR_EXCEPTION(
151 (getStepType() !=
"Constant" && getStepType() !=
"Variable"),
153 "Error - 'Step Type' does not equal one of these:\n" 154 <<
" 'Constant' - Integrator will take constant time step sizes.\n" 155 <<
" 'Variable' - Integrator will allow changes to the time step size.\n" 156 <<
" stepType = " << getStepType() <<
"\n");
158 TEUCHOS_TEST_FOR_EXCEPTION(
159 (stepControlStrategy_ == Teuchos::null), std::logic_error,
160 "Error - Strategy is unset!\n");
162 stepControlStrategy_->initialize();
164 isInitialized_ =
true;
168 template<
class Scalar>
170 printDtChanges(
int istep, Scalar dt_old, Scalar dt_new, std::string reason)
const 172 if (!getPrintDtChanges())
return;
174 Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
175 out->setOutputToRootOnly(0);
176 Teuchos::OSTab ostab(out,0,
"printDtChanges");
178 std::stringstream message;
179 message << std::scientific
180 <<std::setw(6)<<std::setprecision(3)<<istep
181 <<
" * (dt = "<<std::setw(9)<<std::setprecision(3)<<dt_old
182 <<
", new = "<<std::setw(9)<<std::setprecision(3)<<dt_new
183 <<
") " << reason << std::endl;
184 *out << message.str();
188 template<
class Scalar>
191 if ( !isInitialized_ ) {
192 this->describe( *(this->getOStream()), Teuchos::VERB_MEDIUM);
193 TEUCHOS_TEST_FOR_EXCEPTION( !isInitialized_, std::logic_error,
194 "Error - " << this->description() <<
" is not initialized!");
199 template<
class Scalar>
202 Status & integratorStatus)
208 TEMPUS_FUNC_TIME_MONITOR(
"Tempus::TimeStepControl::setNextTimeStep()");
210 RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
211 const Scalar lastTime = solutionHistory->getCurrentState()->getTime();
212 const int iStep = workingState->getIndex();
213 Scalar dt = workingState->getTimeStep();
214 Scalar time = workingState->getTime();
217 RCP<StepperState<Scalar> > stepperState = workingState->getStepperState();
220 if (getStepType() ==
"Variable") {
221 if (outputAdjustedDt_ ==
true) {
222 printDtChanges(iStep, dt, dtAfterOutput_,
"Reset dt after output.");
224 time = lastTime + dt;
225 outputAdjustedDt_ =
false;
226 dtAfterOutput_ = 0.0;
230 printDtChanges(iStep, dt, getInitTimeStep(),
"Reset dt to initial dt.");
231 dt = getInitTimeStep();
232 time = lastTime + dt;
235 if (dt < getMinTimeStep()) {
236 printDtChanges(iStep, dt, getMinTimeStep(),
"Reset dt to minimum dt.");
237 dt = getMinTimeStep();
238 time = lastTime + dt;
243 workingState->setTimeStep(dt);
244 workingState->setTime(time);
247 stepControlStrategy_->setNextTimeStep(*
this, solutionHistory,
251 dt = workingState->getTimeStep();
252 time = workingState->getTime();
254 if (getStepType() ==
"Variable") {
255 if (dt < getMinTimeStep()) {
256 printDtChanges(iStep, dt, getMinTimeStep(),
257 "dt is too small. Resetting to minimum dt.");
258 dt = getMinTimeStep();
259 time = lastTime + dt;
261 if (dt > getMaxTimeStep()) {
262 printDtChanges(iStep, dt, getMaxTimeStep(),
263 "dt is too large. Resetting to maximum dt.");
264 dt = getMaxTimeStep();
265 time = lastTime + dt;
271 std::vector<int>::const_iterator it =
272 std::find(getOutputIndices().begin(), getOutputIndices().end(), iStep);
273 if (it != getOutputIndices().end()) output =
true;
275 const int iInterval = getOutputIndexInterval();
276 if ( (iStep - getInitIndex()) % iInterval == 0) output =
true;
280 Scalar reltol = 1.0e-6;
281 Scalar endTime = lastTime+dt+getMinTimeStep();
284 if (getStepType() ==
"Constant") endTime = lastTime+dt;
285 bool checkOutput =
false;
286 Scalar oTime = getInitTime();
287 for (
size_t i=0; i < outputTimes_.size(); ++i) {
288 oTime = outputTimes_[i];
289 if (lastTime < oTime && oTime <= endTime) {
294 const Scalar tInterval = getOutputTimeInterval();
295 Scalar oTime2 = ceil((lastTime-getInitTime())/tInterval)*tInterval
297 if (lastTime < oTime2 && oTime2 <= endTime) {
298 if (checkOutput ==
true) {
299 if (oTime2 < oTime) oTime = oTime2;
306 if (checkOutput ==
true) {
307 const bool outputExactly = getOutputExactly();
308 if (getStepType() ==
"Variable" && outputExactly ==
true) {
310 if ( time > oTime ) {
312 printDtChanges(iStep, dt, oTime - lastTime,
313 "Adjusting dt to hit the next output time.");
317 outputAdjustedDt_ =
true;
319 dt = oTime - lastTime;
320 time = lastTime + dt;
321 }
else if (std::fabs((time-oTime)/(time)) < reltol) {
323 printDtChanges(iStep, dt, oTime - lastTime,
324 "Adjusting dt for numerical roundoff to hit the next output time.");
327 outputAdjustedDt_ =
true;
329 dt = oTime - lastTime;
330 time = lastTime + dt;
331 }
else if (std::fabs((time + getMinTimeStep() - oTime)/oTime) < reltol ) {
332 printDtChanges(iStep, dt, (oTime - lastTime)/2.0,
333 "The next output time is within the minimum dt of the next time. " 334 "Adjusting dt to take two steps.");
338 dt = (oTime - lastTime)/2.0;
339 time = lastTime + dt;
351 if (getStepType() ==
"Variable") {
352 if ((lastTime + dt > getFinalTime() ) ||
353 (std::fabs((lastTime+dt-getFinalTime())/(lastTime+dt)) < reltol)) {
354 printDtChanges(iStep, dt, getFinalTime() - lastTime,
355 "Adjusting dt to hit final time.");
356 dt = getFinalTime() - lastTime;
357 time = lastTime + dt;
362 TEUCHOS_TEST_FOR_EXCEPTION( dt <= Scalar(0.0), std::out_of_range,
363 "Error - Time step is not positive. dt = " << dt <<
"\n");
366 TEUCHOS_TEST_FOR_EXCEPTION(
367 (lastTime + dt < getInitTime()), std::out_of_range,
368 "Error - Time step does not move time INTO time range.\n" 369 " [timeMin, timeMax] = [" << getInitTime() <<
", " 370 << getFinalTime() <<
"]\n" 371 " T + dt = " << lastTime <<
" + "<< dt <<
" = " << lastTime + dt <<
"\n");
373 if (getStepType() ==
"Variable") {
374 TEUCHOS_TEST_FOR_EXCEPTION(
375 (lastTime + dt > getFinalTime()), std::out_of_range,
376 "Error - Time step move time OUT OF time range.\n" 377 " [timeMin, timeMax] = [" << getInitTime() <<
", " 378 << getFinalTime() <<
"]\n" 379 " T + dt = " << lastTime <<
" + "<< dt <<
" = " << lastTime + dt <<
"\n");
382 workingState->setTimeStep(dt);
383 workingState->setTime(time);
384 workingState->setOutput(output);
391 template<
class Scalar>
395 const int relTol = 14;
397 (getInitTime() == 0) ? 0 : 1 + (
int)std::floor(std::log10(std::fabs(getInitTime()) ) );
398 const Scalar absTolInit = std::pow(10, i-relTol);
400 (getFinalTime() == 0) ? 0 : 1 + (
int)std::floor(std::log10(std::fabs(getFinalTime()) ) );
401 const Scalar absTolFinal = std::pow(10, j-relTol);
403 const bool test1 = getInitTime() - absTolInit <= time;
404 const bool test2 = time < getFinalTime() - absTolFinal;
406 return (test1 && test2);
411 template<
class Scalar>
413 bool iir = (getInitIndex() <= iStep && iStep < getFinalIndex());
418 template<
class Scalar>
421 TEUCHOS_TEST_FOR_EXCEPTION( getStepType() !=
"Constant", std::out_of_range,
422 "Error - Can only use setNumTimeSteps() when 'Step Type' == 'Constant'.\n");
424 if (numTimeSteps >= 0) {
425 numTimeSteps_ = numTimeSteps;
426 setFinalIndex(getInitIndex() + numTimeSteps_);
428 if (numTimeSteps_ == 0)
429 initTimeStep = Scalar(0.0);
431 initTimeStep = (getFinalTime() - getInitTime())/numTimeSteps_;
432 setInitTimeStep(initTimeStep);
433 setMinTimeStep (initTimeStep);
434 setMaxTimeStep (initTimeStep);
436 Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
437 out->setOutputToRootOnly(0);
438 Teuchos::OSTab ostab(out,1,
"setNumTimeSteps");
439 *out <<
"Warning - setNumTimeSteps() Setting 'Number of Time Steps' = " << getNumTimeSteps()
440 <<
" Set the following parameters: \n" 441 <<
" 'Final Time Index' = " << getFinalIndex() <<
"\n" 442 <<
" 'Initial Time Step' = " << getInitTimeStep() <<
"\n" 443 <<
" 'Step Type' = " << getStepType() << std::endl;
445 isInitialized_ =
false;
450 template<
class Scalar>
453 std::string name =
"Tempus::TimeStepControl";
458 template<
class Scalar>
460 Teuchos::FancyOStream &out,
461 const Teuchos::EVerbosityLevel verbLevel)
const 463 auto l_out = Teuchos::fancyOStream( out.getOStream() );
464 Teuchos::OSTab ostab(*l_out, 2, this->description());
465 l_out->setOutputToRootOnly(0);
467 *l_out <<
"\n--- " << this->description() <<
" ---" <<std::endl;
469 if (Teuchos::as<int>(verbLevel) >= Teuchos::as<int>(Teuchos::VERB_MEDIUM)) {
470 std::vector<int> idx = getOutputIndices();
471 std::ostringstream listIdx;
473 for(std::size_t i = 0; i < idx.size()-1; ++i) listIdx << idx[i] <<
", ";
474 listIdx << idx[idx.size()-1];
477 std::vector<Scalar> times = getOutputTimes();
478 std::ostringstream listTimes;
479 if (!times.empty()) {
480 for(std::size_t i = 0; i < times.size()-1; ++i)
481 listTimes << times[i] <<
", ";
482 listTimes << times[times.size()-1];
485 *l_out <<
" stepType = " << getStepType() << std::endl
486 <<
" initTime = " << getInitTime() << std::endl
487 <<
" finalTime = " << getFinalTime() << std::endl
488 <<
" minTimeStep = " << getMinTimeStep() << std::endl
489 <<
" initTimeStep = " << getInitTimeStep() << std::endl
490 <<
" maxTimeStep = " << getMaxTimeStep() << std::endl
491 <<
" initIndex = " << getInitIndex() << std::endl
492 <<
" finalIndex = " << getFinalIndex() << std::endl
493 <<
" maxAbsError = " << getMaxAbsError() << std::endl
494 <<
" maxRelError = " << getMaxRelError() << std::endl
495 <<
" maxFailures = " << getMaxFailures() << std::endl
496 <<
" maxConsecFailures = " << getMaxConsecFailures() << std::endl
497 <<
" numTimeSteps = " << getNumTimeSteps() << std::endl
498 <<
" printDtChanges = " << getPrintDtChanges() << std::endl
499 <<
" outputExactly = " << getOutputExactly() << std::endl
500 <<
" outputIndices = " << listIdx.str() << std::endl
501 <<
" outputTimes = " << listTimes.str() << std::endl
502 <<
" outputIndexInterval= " << getOutputIndexInterval() << std::endl
503 <<
" outputTimeInterval = " << getOutputTimeInterval() << std::endl
504 <<
" outputAdjustedDt = " << outputAdjustedDt_ << std::endl
505 <<
" dtAfterOutput = " << dtAfterOutput_ <<std::endl;
506 stepControlStrategy_->describe(*l_out, verbLevel);
508 *l_out << std::string(this->description().length()+8,
'-') <<std::endl;
513 template<
class Scalar>
519 if ( tscs != Teuchos::null ) {
520 stepControlStrategy_ = tscs;
522 stepControlStrategy_ =
525 isInitialized_ =
false;
529 template<
class Scalar>
530 Teuchos::RCP<const Teuchos::ParameterList>
533 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList(
"Time Step Control");
535 pl->set<
double>(
"Initial Time" , getInitTime() ,
"Initial time");
536 pl->set<
double>(
"Final Time" , getFinalTime() ,
"Final time");
537 pl->set<
double>(
"Minimum Time Step" , getMinTimeStep() ,
"Minimum time step size");
538 pl->set<
double>(
"Initial Time Step" , getInitTimeStep(),
"Initial time step size");
539 pl->set<
double>(
"Maximum Time Step" , getMaxTimeStep() ,
"Maximum time step size");
540 pl->set<
int> (
"Initial Time Index" , getInitIndex() ,
"Initial time index");
541 pl->set<
int> (
"Final Time Index" , getFinalIndex() ,
"Final time index");
542 pl->set<
int> (
"Number of Time Steps", getNumTimeSteps(),
543 "The number of constant time steps. The actual step size gets computed\n" 544 "on the fly given the size of the time domain. Overides and resets\n" 545 " 'Final Time Index' = 'Initial Time Index' + 'Number of Time Steps'\n" 546 " 'Initial Time Step' = " 547 "('Final Time' - 'Initial Time')/'Number of Time Steps'\n");
548 pl->set<
double>(
"Maximum Absolute Error", getMaxAbsError() ,
"Maximum absolute error");
549 pl->set<
double>(
"Maximum Relative Error", getMaxRelError() ,
"Maximum relative error");
551 pl->set<
bool> (
"Print Time Step Changes", getPrintDtChanges(),
552 "Print timestep size when it changes");
554 pl->set<
bool>(
"Output Exactly On Output Times", getOutputExactly(),
555 "This determines if the timestep size will be adjusted to exactly land\n" 556 "on the output times for 'Variable' timestepping (default=true).\n" 557 "When set to 'false' or for 'Constant' time stepping, the timestep\n" 558 "following the output time will be flagged for output.\n");
560 pl->set<
int> (
"Output Index Interval", getOutputIndexInterval(),
"Output index interval");
561 pl->set<
double>(
"Output Time Interval", getOutputTimeInterval(),
"Output time interval");
564 std::vector<int> idx = getOutputIndices();
565 std::ostringstream list;
567 for(std::size_t i = 0; i < idx.size()-1; ++i) list << idx[i] <<
", ";
568 list << idx[idx.size()-1];
570 pl->set<std::string>(
"Output Index List", list.str(),
571 "Comma deliminated list of output indices");
574 std::vector<Scalar> times = getOutputTimes();
575 std::ostringstream list;
576 if (!times.empty()) {
577 for(std::size_t i = 0; i < times.size()-1; ++i) list << times[i] <<
", ";
578 list << times[times.size()-1];
580 pl->set<std::string>(
"Output Time List", list.str(),
581 "Comma deliminated list of output times");
584 pl->set<
int> (
"Maximum Number of Stepper Failures", getMaxFailures(),
585 "Maximum number of Stepper failures");
586 pl->set<
int> (
"Maximum Number of Consecutive Stepper Failures", getMaxConsecFailures(),
587 "Maximum number of consecutive Stepper failures");
589 pl->set(
"Time Step Control Strategy", *stepControlStrategy_->getValidParameters());
597 template <
class Scalar>
599 Teuchos::RCP<Teuchos::ParameterList>
const& pList,
bool runInitialize)
602 using Teuchos::ParameterList;
605 if (pList == Teuchos::null)
return tsc;
607 pList->validateParametersAndSetDefaults(*tsc->getValidParameters(), 0);
609 tsc->setInitTime( pList->get<
double>(
"Initial Time"));
610 tsc->setFinalTime( pList->get<
double>(
"Final Time"));
611 tsc->setMinTimeStep( pList->get<
double>(
"Minimum Time Step"));
612 tsc->setInitTimeStep( pList->get<
double>(
"Initial Time Step"));
613 tsc->setMaxTimeStep( pList->get<
double>(
"Maximum Time Step"));
614 tsc->setInitIndex( pList->get<
int> (
"Initial Time Index"));
615 tsc->setFinalIndex( pList->get<
int> (
"Final Time Index"));
616 tsc->setMaxAbsError( pList->get<
double>(
"Maximum Absolute Error"));
617 tsc->setMaxRelError( pList->get<
double>(
"Maximum Relative Error"));
618 tsc->setMaxFailures( pList->get<
int> (
"Maximum Number of Stepper Failures"));
619 tsc->setMaxConsecFailures(pList->get<
int> (
"Maximum Number of Consecutive Stepper Failures"));
620 tsc->setPrintDtChanges( pList->get<
bool> (
"Print Time Step Changes"));
621 tsc->setNumTimeSteps( pList->get<
int> (
"Number of Time Steps"));
623 tsc->setOutputExactly( pList->get<
bool> (
"Output Exactly On Output Times"));
627 std::vector<int> outputIndices;
628 outputIndices.clear();
629 std::string str = pList->get<std::string>(
"Output Index List");
630 std::string delimiters(
",");
631 std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
632 std::string::size_type pos = str.find_first_of(delimiters, lastPos);
633 while ((pos != std::string::npos) || (lastPos != std::string::npos)) {
634 std::string token = str.substr(lastPos,pos-lastPos);
635 outputIndices.push_back(
int(std::stoi(token)));
636 if(pos==std::string::npos)
break;
638 lastPos = str.find_first_not_of(delimiters, pos);
639 pos = str.find_first_of(delimiters, lastPos);
643 std::sort(outputIndices.begin(),outputIndices.end());
644 tsc->setOutputIndices(outputIndices);
647 tsc->setOutputIndexInterval(pList->get<
int>(
"Output Index Interval"));
651 std::vector<Scalar> outputTimes;
653 std::string str = pList->get<std::string>(
"Output Time List");
654 std::string delimiters(
",");
656 std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
658 std::string::size_type pos = str.find_first_of(delimiters, lastPos);
659 while ((pos != std::string::npos) || (lastPos != std::string::npos)) {
661 std::string token = str.substr(lastPos,pos-lastPos);
662 outputTimes.push_back(Scalar(std::stod(token)));
663 if(pos==std::string::npos)
break;
665 lastPos = str.find_first_not_of(delimiters, pos);
666 pos = str.find_first_of(delimiters, lastPos);
670 std::sort(outputTimes.begin(),outputTimes.end());
671 outputTimes.erase(std::unique(outputTimes.begin(),
674 tsc->setOutputTimes(outputTimes);
677 tsc->setOutputTimeInterval(pList->get<
double>(
"Output Time Interval"));
680 if ( !pList->isParameter(
"Time Step Control Strategy") ) {
682 tsc->setTimeStepControlStrategy();
686 RCP<ParameterList> tscsPL =
687 Teuchos::sublist(pList,
"Time Step Control Strategy",
true);
689 auto strategyType = tscsPL->get<std::string>(
"Strategy Type");
690 if (strategyType ==
"Constant") {
691 tsc->setTimeStepControlStrategy(
692 createTimeStepControlStrategyConstant<Scalar>(tscsPL));
693 }
else if (strategyType ==
"Basic VS") {
694 tsc->setTimeStepControlStrategy(
695 createTimeStepControlStrategyBasicVS<Scalar>(tscsPL));
696 }
else if (strategyType ==
"Integral Controller") {
697 tsc->setTimeStepControlStrategy(
698 createTimeStepControlStrategyIntegralController<Scalar>(tscsPL));
699 }
else if (strategyType ==
"Composite") {
700 tsc->setTimeStepControlStrategy(
701 createTimeStepControlStrategyComposite<Scalar>(tscsPL));
703 RCP<Teuchos::FancyOStream> out =
704 Teuchos::fancyOStream(Teuchos::rcpFromRef(std::cout));
705 out->setOutputToRootOnly(0);
706 Teuchos::OSTab ostab(out,1,
"createTimeStepControl()");
707 *out <<
"Warning -- Did not find a Tempus strategy to create!\n" 708 <<
"'Strategy Type' = '" << strategyType <<
"'\n" 709 <<
"Should call setTimeStepControlStrategy() with this\n" 710 <<
"(app-specific?) strategy, and initialize().\n" << std::endl;
714 if (runInitialize) tsc->initialize();
720 #endif // Tempus_TimeStepControl_impl_hpp virtual void checkInitialized()
Teuchos::RCP< TimeStepControl< Scalar > > createTimeStepControl(Teuchos::RCP< Teuchos::ParameterList > const &pList, bool runInitialize=true)
Nonmember constructor from ParameterList.
virtual bool timeInRange(const Scalar time) const
Check if time is within minimum and maximum time.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
virtual void initialize() const
virtual void setNumTimeSteps(int numTimeSteps)
virtual Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Return ParameterList with current values.
virtual void setTimeStepControlStrategy(Teuchos::RCP< TimeStepControlStrategy< Scalar > > tscs=Teuchos::null)
Status
Status for the Integrator, the Stepper and the SolutionState.
std::string description() const
virtual void printDtChanges(int istep, Scalar dt_old, Scalar dt_new, std::string reason) const
TimeStepControl manages the time step size. There several mechanisms that effect the time step size a...
TimeStepControl()
Default Constructor.
virtual int getNumTimeSteps() const
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
StepControlStrategy class for TimeStepControl.
virtual void setNextTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory, Status &integratorStatus)
Determine the time step size.
TimeStepControlStrategy class for TimeStepControl.
virtual bool indexInRange(const int iStep) const
Check if time step index is within minimum and maximum index.