Tempus  Version of the Day
Time Integration
Tempus_TimeStepControl_impl.hpp
Go to the documentation of this file.
1 // @HEADER
2 // ****************************************************************************
3 // Tempus: Copyright (2017) Sandia Corporation
4 //
5 // Distributed under BSD 3-clause license (See accompanying file Copyright.txt)
6 // ****************************************************************************
7 // @HEADER
8 
9 #ifndef Tempus_TimeStepControl_impl_hpp
10 #define Tempus_TimeStepControl_impl_hpp
11 
12 // Teuchos
13 #include "Teuchos_ScalarTraits.hpp"
14 #include "Teuchos_StandardParameterEntryValidators.hpp"
15 #include "Teuchos_VerboseObjectParameterListHelpers.hpp"
16 #include "Teuchos_TimeMonitor.hpp"
17 
18 //Step control strategy
23 
24 //Thyra
25 #include "Thyra_VectorStdOps.hpp"
26 
27 namespace Tempus {
28 
29 template<class Scalar>
31  Teuchos::RCP<Teuchos::ParameterList> pList)
32  : outputAdjustedDt_(false), dtAfterOutput_(0.0)
33 {
34  this->initialize(pList);
35 }
36 
37 template<class Scalar>
39  : tscPL_ (tsc_.tscPL_ ),
40  outputIndices_ (tsc_.outputIndices_ ),
41  outputTimes_ (tsc_.outputTimes_ ),
42  outputAdjustedDt_ (tsc_.outputAdjustedDt_ ),
43  dtAfterOutput_ (tsc_.dtAfterOutput_ ),
44  stepControlStrategy_(tsc_.stepControlStrategy_ )
45 {}
46 
47 
48 template<class Scalar>
50  const Teuchos::RCP<SolutionHistory<Scalar> > & solutionHistory,
51  Status & integratorStatus)
52 {
53  using Teuchos::RCP;
54 
55  TEMPUS_FUNC_TIME_MONITOR("Tempus::TimeStepControl::getNextTimeStep()");
56  {
57  RCP<Teuchos::FancyOStream> out = this->getOStream();
58  Teuchos::OSTab ostab(out,1,"getNextTimeStep");
59  bool printChanges = solutionHistory->getVerbLevel() !=
60  Teuchos::as<int>(Teuchos::VERB_NONE);
61 
62  auto changeDT = [] (Scalar dt_old, Scalar dt_new, std::string reason) {
63  std::stringstream message;
64  message <<
65  " (dt = "<<std::scientific<<std::setw(9)<<std::setprecision(3)<<dt_old
66  << ", new = "<<std::scientific<<std::setw(9)<<std::setprecision(3)<<dt_new
67  << ") " << reason << std::endl;
68  return message.str();
69  };
70 
71  RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
72  RCP<SolutionStateMetaData<Scalar> > metaData = workingState->getMetaData();
73  const Scalar lastTime = solutionHistory->getCurrentState()->getTime();
74  const int iStep = metaData->getIStep();
75  int order = metaData->getOrder();
76  Scalar dt = metaData->getDt();
77  bool output = metaData->getOutput();
78 
79  RCP<StepperState<Scalar> > stepperState = workingState->getStepperState();
80 
81  output = false;
82 
83  if (getStepType() == "Variable") {
84  // If last time step was adjusted for output, reinstate previous dt.
85  if (outputAdjustedDt_ == true) {
86  if (printChanges) *out << changeDT(dt, dtAfterOutput_,
87  "Reset dt after output.");
88  dt = dtAfterOutput_;
89  outputAdjustedDt_ = false;
90  dtAfterOutput_ = 0.0;
91  }
92 
93  if (dt <= 0.0) {
94  if (printChanges) *out << changeDT(dt, getInitTimeStep(),
95  "Reset dt to initial dt.");
96  dt = getInitTimeStep();
97  }
98 
99  if (dt < getMinTimeStep()) {
100  if (printChanges) *out << changeDT(dt, getMinTimeStep(),
101  "Reset dt to minimum dt.");
102  dt = getMinTimeStep();
103  }
104  }
105 
106  // update dt in metaData for the step control strategy to be informed
107  metaData->setDt(dt);
108 
109  // call the step control strategy (to update order/dt if needed)
110  stepControlStrategy_->getNextTimeStep(*this, solutionHistory,
111  integratorStatus);
112 
113  // get the order and dt (probably have changed by stepControlStrategy_)
114  order = metaData->getOrder();
115  dt = metaData->getDt();
116 
117  if (getStepType() == "Variable") {
118  if (dt < getMinTimeStep()) { // decreased below minimum dt
119  if (printChanges) *out << changeDT(dt, getMinTimeStep(),
120  "dt is too small. Resetting to minimum dt.");
121  dt = getMinTimeStep();
122  }
123  if (dt > getMaxTimeStep()) { // increased above maximum dt
124  if (printChanges) *out << changeDT(dt, getMaxTimeStep(),
125  "dt is too large. Resetting to maximum dt.");
126  dt = getMaxTimeStep();
127  }
128  }
129 
130 
131  // Check if we need to output this step index
132  std::vector<int>::const_iterator it =
133  std::find(outputIndices_.begin(), outputIndices_.end(), iStep);
134  if (it != outputIndices_.end()) output = true;
135 
136  // Adjust time step to hit output times (if Variable timestep).
137  Scalar reltol = 1.0e-6;
138  for (size_t i=0; i < outputTimes_.size(); ++i) {
139  const Scalar oTime = outputTimes_[i];
140  if (lastTime < oTime && oTime <= lastTime+dt+getMinTimeStep()) {
141  if (std::abs((lastTime+dt-oTime)/(lastTime+dt)) < reltol) {
142  output = true;
143  if (getStepType() == "Variable") {
144  if (printChanges) *out << changeDT(dt, oTime - lastTime,
145  "Adjusting dt for numerical roundoff to hit the next output time.");
146  // Next output time IS VERY near next time (<reltol away from it),
147  // e.g., adjust for numerical roundoff.
148  outputAdjustedDt_ = true;
149  dtAfterOutput_ = dt;
150  dt = oTime - lastTime;
151  }
152  } else if (lastTime*(1.0+reltol) < oTime &&
153  oTime < (lastTime+dt-getMinTimeStep())*(1.0+reltol)) {
154  output = true;
155  if (getStepType() == "Variable") {
156  if (printChanges) *out << changeDT(dt, oTime - lastTime,
157  "Adjusting dt to hit the next output time.");
158  // Next output time is not near next time
159  // (>getMinTimeStep() away from it).
160  // Take time step to hit output time.
161  outputAdjustedDt_ = true;
162  dtAfterOutput_ = dt;
163  dt = oTime - lastTime;
164  }
165  } else {
166  if (getStepType() == "Variable") {
167  if (printChanges) *out << changeDT(dt, (oTime - lastTime)/2.0,
168  "The next output time is within the minimum dt of the next time. "
169  "Adjusting dt to take two steps.");
170  // Next output time IS near next time
171  // (<getMinTimeStep() away from it).
172  // Take two time steps to get to next output time.
173  dt = (oTime - lastTime)/2.0;
174  }
175  }
176  break;
177  }
178  }
179 
180  // Adjust time step to hit final time or correct for small
181  // numerical differences.
182  if ((lastTime + dt > getFinalTime() ) ||
183  (std::abs((lastTime+dt-getFinalTime())/(lastTime+dt)) < reltol)) {
184  if (printChanges) *out << changeDT(dt, getFinalTime() - lastTime,
185  "Adjusting dt to hit the final time.");
186  dt = getFinalTime() - lastTime;
187  }
188 
189  // Time step always needs to keep time within range.
190  TEUCHOS_TEST_FOR_EXCEPTION(
191  (lastTime + dt < getInitTime()), std::out_of_range,
192  "Error - Time step does not move time INTO time range.\n"
193  " [timeMin, timeMax] = [" << getInitTime() << ", "
194  << getFinalTime() << "]\n"
195  " T + dt = " << lastTime <<" + "<< dt <<" = " << lastTime + dt <<"\n");
196 
197  TEUCHOS_TEST_FOR_EXCEPTION(
198  (lastTime + dt > getFinalTime()), std::out_of_range,
199  "Error - Time step move time OUT OF time range.\n"
200  " [timeMin, timeMax] = [" << getInitTime() << ", "
201  << getFinalTime() << "]\n"
202  " T + dt = " << lastTime <<" + "<< dt <<" = " << lastTime + dt <<"\n");
203 
204  metaData->setOrder(order);
205  metaData->setDt(dt);
206  metaData->setTime(lastTime + dt);
207  metaData->setOutput(output);
208  }
209  return;
210 }
211 
212 
213 /// Test if time is within range: include timeMin and exclude timeMax.
214 template<class Scalar>
215 bool TimeStepControl<Scalar>::timeInRange(const Scalar time) const{
216  const Scalar relTol = 1.0e-14;
217  bool tir = (getInitTime()*(1.0-relTol) <= time and
218  time < getFinalTime()*(1.0-relTol));
219  return tir;
220 }
221 
222 
223 template<class Scalar>
224 bool TimeStepControl<Scalar>::indexInRange(const int iStep) const{
225  bool iir = (getInitIndex() <= iStep and iStep < getFinalIndex());
226  return iir;
227 }
228 
229 
230 template<class Scalar>
232 {
233  if (numTimeSteps >= 0) {
234  tscPL_->set<int> ("Number of Time Steps", numTimeSteps);
235  const int initIndex = getInitIndex();
236  tscPL_->set<int> ("Final Time Index", initIndex + numTimeSteps);
237  const double initTime = tscPL_->get<double>("Initial Time");
238  const double finalTime = tscPL_->get<double>("Final Time");
239  double initTimeStep = (finalTime - initTime)/numTimeSteps;
240  if (numTimeSteps == 0) initTimeStep = Scalar(0.0);
241  tscPL_->set<double> ("Initial Time Step", initTimeStep);
242  tscPL_->set<double> ("Minimum Time Step", initTimeStep);
243  tscPL_->set<double> ("Maximum Time Step", initTimeStep);
244  tscPL_->set<std::string>("Integrator Step Type", "Constant");
245 
246  Teuchos::RCP<Teuchos::FancyOStream> out = this->getOStream();
247  Teuchos::OSTab ostab(out,1,"setNumTimeSteps");
248  *out << "Warning - Found 'Number of Time Steps' = " << getNumTimeSteps()
249  << " Set the following parameters: \n"
250  << " 'Final Time Index' = " << getFinalIndex() << "\n"
251  << " 'Initial Time Step' = " << getInitTimeStep() << "\n"
252  << " 'Integrator Step Type' = " << getStepType() << std::endl;
253  }
254 }
255 
256 
257 template<class Scalar>
259 {
260  std::string name = "Tempus::TimeStepControl";
261  return(name);
262 }
263 
264 
265 template<class Scalar>
267  Teuchos::FancyOStream &out,
268  const Teuchos::EVerbosityLevel verbLevel) const
269 {
270  if (verbLevel == Teuchos::VERB_EXTREME) {
271  out << description() << "::describe:" << std::endl
272  << "pList = " << tscPL_ << std::endl;
273  }
274 }
275 
276 
277 template <class Scalar>
279  Teuchos::RCP<Teuchos::ParameterList> const& pList)
280 {
281  if (pList == Teuchos::null) {
282  // Create default parameters if null, otherwise keep current parameters.
283  if (tscPL_ == Teuchos::null) {
284  tscPL_ = Teuchos::parameterList("TimeStepControl");
285  *tscPL_ = *(this->getValidParameters());
286  }
287  } else {
288  tscPL_ = pList;
289  }
290  tscPL_->validateParametersAndSetDefaults(*this->getValidParameters(), 0);
291 
292  // Override parameters
293  if (getStepType() == "Constant") {
294  const double initTimeStep = tscPL_->get<double>("Initial Time Step");
295  tscPL_->set<double> ("Minimum Time Step", initTimeStep);
296  tscPL_->set<double> ("Maximum Time Step", initTimeStep);
297  }
298  setNumTimeSteps(getNumTimeSteps());
299 
300  // set the time step control strategy
301  setTimeStepControlStrategy();
302 
303  TEUCHOS_TEST_FOR_EXCEPTION(
304  (getInitTime() > getFinalTime() ), std::logic_error,
305  "Error - Inconsistent time range.\n"
306  " (timeMin = "<<getInitTime()<<") > (timeMax = "<<getFinalTime()<<")\n");
307 
308  TEUCHOS_TEST_FOR_EXCEPTION(
309  (getMinTimeStep() < Teuchos::ScalarTraits<Scalar>::zero() ),
310  std::logic_error,
311  "Error - Negative minimum time step. dtMin = "<<getMinTimeStep()<<")\n");
312  TEUCHOS_TEST_FOR_EXCEPTION(
313  (getMaxTimeStep() < Teuchos::ScalarTraits<Scalar>::zero() ),
314  std::logic_error,
315  "Error - Negative maximum time step. dtMax = "<<getMaxTimeStep()<<")\n");
316  TEUCHOS_TEST_FOR_EXCEPTION(
317  (getMinTimeStep() > getMaxTimeStep() ), std::logic_error,
318  "Error - Inconsistent time step range.\n"
319  " (dtMin = "<<getMinTimeStep()<<") > (dtMax = "<<getMaxTimeStep()<<")\n");
320  TEUCHOS_TEST_FOR_EXCEPTION(
321  (getInitTimeStep() < Teuchos::ScalarTraits<Scalar>::zero() ),
322  std::logic_error,
323  "Error - Negative initial time step. dtInit = "<<getInitTimeStep()<<")\n");
324  TEUCHOS_TEST_FOR_EXCEPTION(
325  (getInitTimeStep() < getMinTimeStep() ||
326  getInitTimeStep() > getMaxTimeStep() ),
327  std::out_of_range,
328  "Error - Initial time step is out of range.\n"
329  << " [dtMin, dtMax] = [" << getMinTimeStep() << ", "
330  << getMaxTimeStep() << "]\n"
331  << " dtInit = " << getInitTimeStep() << "\n");
332 
333  TEUCHOS_TEST_FOR_EXCEPTION(
334  (getInitIndex() > getFinalIndex() ), std::logic_error,
335  "Error - Inconsistent time index range.\n"
336  " (iStepMin = "<<getInitIndex()<<") > (iStepMax = "
337  <<getFinalIndex()<<")\n");
338 
339  TEUCHOS_TEST_FOR_EXCEPTION(
340  (getMaxAbsError() < Teuchos::ScalarTraits<Scalar>::zero() ),
341  std::logic_error,
342  "Error - Negative maximum time step. errorMaxAbs = "
343  <<getMaxAbsError()<<")\n");
344  TEUCHOS_TEST_FOR_EXCEPTION(
345  (getMaxRelError() < Teuchos::ScalarTraits<Scalar>::zero() ),
346  std::logic_error,
347  "Error - Negative maximum time step. errorMaxRel = "
348  <<getMaxRelError()<<")\n");
349 
350  TEUCHOS_TEST_FOR_EXCEPTION(
351  (getMinOrder() < Teuchos::ScalarTraits<Scalar>::zero() ),
352  std::logic_error,
353  "Error - Negative minimum order. orderMin = "<<getMinOrder()<<")\n");
354  TEUCHOS_TEST_FOR_EXCEPTION(
355  (getMaxOrder() < Teuchos::ScalarTraits<Scalar>::zero() ), std::logic_error,
356  "Error - Negative maximum order. orderMax = "<<getMaxOrder()<<")\n");
357  TEUCHOS_TEST_FOR_EXCEPTION(
358  (getMinOrder() > getMaxOrder() ), std::logic_error,
359  "Error - Inconsistent order range.\n"
360  " (orderMin = "<<getMinOrder()<<") > (orderMax = "
361  <<getMaxOrder()<<")\n");
362  TEUCHOS_TEST_FOR_EXCEPTION(
363  (getInitOrder() < getMinOrder() || getInitOrder() > getMaxOrder()),
364  std::out_of_range,
365  "Error - Initial order is out of range.\n"
366  << " [orderMin, orderMax] = [" << getMinOrder() << ", "
367  << getMaxOrder() << "]\n"
368  << " order = " << getInitOrder() << "\n");
369 
370  TEUCHOS_TEST_FOR_EXCEPTION(
371  (getStepType() != "Constant" and getStepType() != "Variable"),
372  std::out_of_range,
373  "Error - 'Integrator Step Type' does not equal none of these:\n"
374  << " 'Constant' - Integrator will take constant time step sizes.\n"
375  << " 'Variable' - Integrator will allow changes to the time step size.\n"
376  << " stepType = " << getStepType() << "\n");
377 
378 
379  // Parse output times
380  {
381  outputTimes_.clear();
382  std::string str = tscPL_->get<std::string>("Output Time List");
383  std::string delimiters(",");
384  // Skip delimiters at the beginning
385  std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
386  // Find the first delimiter
387  std::string::size_type pos = str.find_first_of(delimiters, lastPos);
388  while ((pos != std::string::npos) || (lastPos != std::string::npos)) {
389  // Found a token, add it to the vector
390  std::string token = str.substr(lastPos,pos-lastPos);
391  outputTimes_.push_back(Scalar(std::stod(token)));
392  if(pos==std::string::npos) break;
393 
394  lastPos = str.find_first_not_of(delimiters, pos); // Skip delimiters
395  pos = str.find_first_of(delimiters, lastPos); // Find next delimiter
396  }
397 
398  Scalar outputTimeInterval = tscPL_->get<double>("Output Time Interval");
399  Scalar output_t = getInitTime();
400  while (output_t <= getFinalTime()) {
401  outputTimes_.push_back(output_t);
402  output_t += outputTimeInterval;
403  }
404 
405  // order output times
406  std::sort(outputTimes_.begin(),outputTimes_.end());
407  }
408 
409  // Parse output indices
410  {
411  outputIndices_.clear();
412  std::string str = tscPL_->get<std::string>("Output Index List");
413  std::string delimiters(",");
414  std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
415  std::string::size_type pos = str.find_first_of(delimiters, lastPos);
416  while ((pos != std::string::npos) || (lastPos != std::string::npos)) {
417  std::string token = str.substr(lastPos,pos-lastPos);
418  outputIndices_.push_back(int(std::stoi(token)));
419  if(pos==std::string::npos) break;
420 
421  lastPos = str.find_first_not_of(delimiters, pos);
422  pos = str.find_first_of(delimiters, lastPos);
423  }
424 
425  Scalar outputIndexInterval = tscPL_->get<int>("Output Index Interval");
426  Scalar output_i = getInitIndex();
427  while (output_i <= getFinalIndex()) {
428  outputIndices_.push_back(output_i);
429  output_i += outputIndexInterval;
430  }
431 
432  // order output indices
433  std::sort(outputIndices_.begin(),outputIndices_.end());
434  }
435 
436  return;
437 }
438 
439 template<class Scalar>
441  Teuchos::RCP<TimeStepControlStrategy<Scalar> > tscs)
442 {
443  using Teuchos::RCP;
444  using Teuchos::ParameterList;
445 
446  if (stepControlStrategy_ == Teuchos::null){
447  stepControlStrategy_ =
448  Teuchos::rcp(new TimeStepControlStrategyComposite<Scalar>());
449  }
450 
451  if (tscs == Teuchos::null) {
452  // Create stepControlStrategy_ if null, otherwise keep current parameters.
453 
454  if (getStepType() == "Constant"){
455  stepControlStrategy_->addStrategy(
456  Teuchos::rcp(new TimeStepControlStrategyConstant<Scalar>()));
457  } else if (getStepType() == "Variable") {
458  // add TSCS from "Time Step Control Strategy List"
459 
460  RCP<ParameterList> tscsPL =
461  Teuchos::sublist(tscPL_,"Time Step Control Strategy",true);
462  // Construct from TSCS sublist
463  std::vector<std::string> tscsLists;
464 
465  // string tokenizer
466  tscsLists.clear();
467  std::string str = tscsPL->get<std::string>("Time Step Control Strategy List");
468  std::string delimiters(",");
469  // Skip delimiters at the beginning
470  std::string::size_type lastPos = str.find_first_not_of(delimiters, 0);
471  // Find the first delimiter
472  std::string::size_type pos = str.find_first_of(delimiters, lastPos);
473  while ((pos != std::string::npos) || (lastPos != std::string::npos)) {
474  // Found a token, add it to the vector
475  std::string token = str.substr(lastPos,pos-lastPos);
476  tscsLists.push_back(token);
477  if(pos==std::string::npos) break;
478 
479  lastPos = str.find_first_not_of(delimiters, pos); // Skip delimiters
480  pos = str.find_first_of(delimiters, lastPos); // Find next delimiter
481  }
482 
483  // For each sublist name tokenized, add the TSCS
484  for( auto el: tscsLists){
485 
486  RCP<Teuchos::ParameterList> pl =
487  Teuchos::rcp(new ParameterList(tscsPL->sublist(el)));
488 
489  RCP<TimeStepControlStrategy<Scalar>> ts;
490 
491  // construct appropriate TSCS
492  if(pl->get<std::string>("Name") == "Integral Controller")
493  ts = Teuchos::rcp(new TimeStepControlStrategyIntegralController<Scalar>(pl));
494  else if(pl->get<std::string>("Name") == "Basic VS")
495  ts = Teuchos::rcp(new TimeStepControlStrategyBasicVS<Scalar>(pl));
496 
497  stepControlStrategy_->addStrategy(ts);
498  }
499  }
500 
501  } else {
502  // just add the new tscs to the vector of strategies
503  stepControlStrategy_->addStrategy(tscs);
504  }
505 
506 }
507 
508 
509 template<class Scalar>
510 Teuchos::RCP<const Teuchos::ParameterList>
512 {
513  Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
514 
515  const double stdMax = std::numeric_limits<double>::max();
516  pl->set<double>("Initial Time" , 0.0 , "Initial time");
517  pl->set<double>("Final Time" , stdMax , "Final time");
518  pl->set<int> ("Initial Time Index" , 0 , "Initial time index");
519  pl->set<int> ("Final Time Index" , 1000000, "Final time index");
520  pl->set<double>("Minimum Time Step" , 0.0 , "Minimum time step size");
521  pl->set<double>("Initial Time Step" , 1.0 , "Initial time step size");
522  pl->set<double>("Maximum Time Step" , stdMax , "Maximum time step size");
523  pl->set<int> ("Minimum Order", 0,
524  "Minimum time-integration order. If set to zero (default), the\n"
525  "Stepper minimum order is used.");
526  pl->set<int> ("Initial Order", 0,
527  "Initial time-integration order. If set to zero (default), the\n"
528  "Stepper minimum order is used.");
529  pl->set<int> ("Maximum Order", 0,
530  "Maximum time-integration order. If set to zero (default), the\n"
531  "Stepper maximum order is used.");
532  pl->set<double>("Maximum Absolute Error", 1.0e-08, "Maximum absolute error");
533  pl->set<double>("Maximum Relative Error", 1.0e-08, "Maximum relative error");
534 
535  pl->set<std::string>("Integrator Step Type", "Variable",
536  "'Integrator Step Type' indicates whether the Integrator will allow "
537  "the time step to be modified.\n"
538  " 'Constant' - Integrator will take constant time step sizes.\n"
539  " 'Variable' - Integrator will allow changes to the time step size.\n");
540 
541  pl->set<std::string>("Output Time List", "",
542  "Comma deliminated list of output times");
543  pl->set<std::string>("Output Index List","",
544  "Comma deliminated list of output indices");
545  pl->set<double>("Output Time Interval", stdMax, "Output time interval");
546  pl->set<int> ("Output Index Interval", 1000000, "Output index interval");
547 
548  pl->set<int> ("Maximum Number of Stepper Failures", 10,
549  "Maximum number of Stepper failures");
550  pl->set<int> ("Maximum Number of Consecutive Stepper Failures", 5,
551  "Maximum number of consecutive Stepper failures");
552  pl->set<int> ("Number of Time Steps", -1,
553  "The number of constant time steps. The actual step size gets computed\n"
554  "on the fly given the size of the time domain. Overides and resets\n"
555  " 'Final Time Index' = 'Initial Time Index' + 'Number of Time Steps'\n"
556  " 'Initial Time Step' = "
557  "('Final Time' - 'Initial Time')/'Number of Time Steps'\n"
558  " 'Integrator Step Type' = 'Constant'\n");
559 
560  Teuchos::RCP<Teuchos::ParameterList> tscsPL = Teuchos::parameterList("Time Step Control Strategy");
561  tscsPL->set<std::string>("Time Step Control Strategy List","");
562  pl->set("Time Step Control Strategy", *tscsPL);
563  return pl;
564 }
565 
566 
567 template <class Scalar>
568 Teuchos::RCP<Teuchos::ParameterList>
570 {
571  return(tscPL_);
572 }
573 
574 
575 template <class Scalar>
576 Teuchos::RCP<Teuchos::ParameterList>
578 {
579  Teuchos::RCP<Teuchos::ParameterList> temp_plist = tscPL_;
580  tscPL_ = Teuchos::null;
581  return(temp_plist);
582 }
583 
584 
585 } // namespace Tempus
586 #endif // Tempus_TimeStepControl_impl_hpp
Tempus_TimeStepControlStrategyComposite.hpp
Tempus::TimeStepControl::unsetParameterList
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
Definition: Tempus_TimeStepControl_impl.hpp:577
Tempus::solutionHistory
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Nonmember constructor.
Definition: Tempus_SolutionHistory_impl.hpp:504
Tempus::TimeStepControl::setTimeStepControlStrategy
virtual void setTimeStepControlStrategy(Teuchos::RCP< TimeStepControlStrategy< Scalar > > tscs=Teuchos::null)
Set the TimeStepControlStrategy.
Definition: Tempus_TimeStepControl_impl.hpp:440
Tempus::TimeStepControlStrategyConstant
StepControlStrategy class for TimeStepControl.
Definition: Tempus_TimeStepControlStrategyConstant.hpp:26
Tempus::TimeStepControl::timeInRange
virtual bool timeInRange(const Scalar time) const
Check if time is within minimum and maximum time.
Definition: Tempus_TimeStepControl_impl.hpp:215
Tempus_TimeStepControlStrategyBasicVS.hpp
Tempus::TimeStepControl::initialize
virtual void initialize(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Definition: Tempus_TimeStepControl_decl.hpp:59
Tempus
Definition: Tempus_AdjointAuxSensitivityModelEvaluator_decl.hpp:20
Tempus::TimeStepControl::getValidParameters
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
Definition: Tempus_TimeStepControl_impl.hpp:511
Tempus::TimeStepControl::setNumTimeSteps
virtual void setNumTimeSteps(int numTimeSteps)
Definition: Tempus_TimeStepControl_impl.hpp:231
Tempus::TimeStepControl::getNextTimeStep
virtual void getNextTimeStep(const Teuchos::RCP< SolutionHistory< Scalar > > &solutionHistory, Status &integratorStatus)
Determine the time step size.
Definition: Tempus_TimeStepControl_impl.hpp:49
Tempus_TimeStepControlStrategyIntegralController.hpp
Tempus::TimeStepControl::indexInRange
virtual bool indexInRange(const int iStep) const
Check if time step index is within minimum and maximum index.
Definition: Tempus_TimeStepControl_impl.hpp:224
Tempus::TimeStepControl::TimeStepControl
TimeStepControl(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Constructor.
Definition: Tempus_TimeStepControl_impl.hpp:30
Tempus::TimeStepControl
TimeStepControl manages the time step size. There several mechanicisms that effect the time step size...
Definition: Tempus_Integrator.hpp:26
Tempus::SolutionHistory
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
Definition: Tempus_Integrator.hpp:25
Tempus_TimeStepControlStrategyConstant.hpp
Tempus::TimeStepControlStrategy
StepControlStrategy class for TimeStepControl.
Definition: Tempus_TimeStepControlStrategy.hpp:26
Tempus::TimeStepControlStrategyComposite
StepControlStrategy class for TimeStepControl.
Definition: Tempus_TimeStepControlStrategyComposite.hpp:24
Tempus::TimeStepControl::getNonconstParameterList
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Definition: Tempus_TimeStepControl_impl.hpp:569
Tempus::TimeStepControl::describe
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Definition: Tempus_TimeStepControl_impl.hpp:266
Tempus::TimeStepControlStrategyIntegralController
StepControlStrategy class for TimeStepControl.
Definition: Tempus_TimeStepControlStrategyIntegralController.hpp:54
Tempus::TimeStepControl::description
std::string description() const
Definition: Tempus_TimeStepControl_impl.hpp:258
Tempus::Status
Status
Status for the Integrator, the Stepper and the SolutionState.
Definition: Tempus_Types.hpp:16
Tempus::TimeStepControlStrategyBasicVS
StepControlStrategy class for TimeStepControl.
Definition: Tempus_TimeStepControlStrategyBasicVS.hpp:105
Tempus::TimeStepControl::setParameterList
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pl)
Definition: Tempus_TimeStepControl_impl.hpp:278