9 #ifndef Tempus_TimeStepControlStrategy_IntegralController_hpp
10 #define Tempus_TimeStepControlStrategy_IntegralController_hpp
12 #include "Tempus_TimeStepControl.hpp"
14 #include "Tempus_SolutionState.hpp"
15 #include "Tempus_SolutionHistory.hpp"
52 template<
class Scalar>
78 Teuchos::RCP<SolutionState<Scalar> > workingState=solutionHistory->getWorkingState();
79 const Scalar errorRel = workingState->getErrorRel();
83 int order = workingState->getOrder() - 1;
84 Scalar dt = workingState->getTimeStep();
87 Teuchos::RCP<Teuchos::FancyOStream> out = tsc.getOStream();
88 Teuchos::OSTab ostab(out,1,
"getNextTimeStep");
106 Scalar k1 = Teuchos::as<Scalar>(-
k1_ / order);
107 Scalar k2 = Teuchos::as<Scalar>(
k2_ / order);
108 Scalar k3 = Teuchos::as<Scalar>(-
k3_ / order);
110 k1 = std::pow(
errN_, k1);
121 beta = std::max(
facMin_, beta);
122 beta = std::min(
facMax_, beta);
130 dt = std::min(dt, workingState->getTimeStep());
136 facMax_ =
tscsPL_->get<Scalar>(
"Safety Factor After Step Rejection");
141 workingState->setTimeStep(dt);
147 const Teuchos::RCP<Teuchos::ParameterList> & pList)
override
150 if (pList == Teuchos::null) {
152 if (
tscsPL_ == Teuchos::null) {
153 tscsPL_ = Teuchos::parameterList(
"TimeStepControlStrategyIntegralController");
172 TEUCHOS_TEST_FOR_EXCEPTION(safetyFactor_ <= 0.0, std::out_of_range,
173 "Error - Invalid value of Safety Factory= " << safetyFactor_ <<
"! \n"
174 <<
"Safety Factor must be > 0.0.\n");
176 TEUCHOS_TEST_FOR_EXCEPTION(facMax_ <= 0.0, std::out_of_range,
177 "Error - Invalid value of Maximum Safety Factory= " << facMax_ <<
"! \n"
178 <<
"Maximum Safety Factor must be > 0.0.\n");
180 TEUCHOS_TEST_FOR_EXCEPTION(facMax_<= 0.0, std::out_of_range,
181 "Error - Invalid value of Minimum Safety Factory= " << facMin_ <<
"! \n"
182 <<
"Minimum Safety Factor must be > 0.0.\n");
184 TEUCHOS_TEST_FOR_EXCEPTION(((controller_ !=
"I") and
185 (controller_ !=
"PI") and
186 (controller_ !=
"PID")), std::invalid_argument,
187 "Error - Invalid choice of Controller Type = " << controller_ <<
"! \n"
188 <<
"Valid Choice are ['I', 'PI', 'PID'].\n");
194 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
196 pl->set<std::string>(
"Name",
"Integral Controller",
"Integral Controller");
197 pl->set<std::string>(
"Controller Type",
"PID",
198 "Proportional-Integral-Derivative");
199 pl->set<Scalar>(
"KI" , 0.58,
"Integral gain");
200 pl->set<Scalar>(
"KP" , 0.21,
"Proportional gain");
201 pl->set<Scalar>(
"KD" , 0.10,
"Derivative gain");
202 pl->set<Scalar>(
"Safety Factor" , 0.90,
"Safety Factor");
203 pl->set<Scalar>(
"Maximum Safety Factor" , 5.0,
"Maximum Safety Factor");
204 pl->set<Scalar>(
"Minimum Safety Factor" , 0.5,
"Minimum Safety Factor");
205 pl->set<Scalar>(
"Safety Factor After Step Rejection" , 0.9,
206 "Safety Factor Following Step Rejection");
215 Teuchos::RCP<Teuchos::ParameterList> temp_plist =
tscsPL_;
238 #endif // Tempus_TimeStepControlStrategy_IntegralController_hpp
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const override
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList() override
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList() override
Status
Status for the Integrator, the Stepper and the SolutionState.
Teuchos::RCP< Teuchos::ParameterList > tscsPL_
TimeStepControl manages the time step size. There several mechanicisms that effect the time step size...
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pList) override
SolutionHistory is basically a container of SolutionStates. SolutionHistory maintains a collection of...
TimeStepControlStrategyIntegralController(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Constructor.
virtual ~TimeStepControlStrategyIntegralController()
Destructor.
StepControlStrategy class for TimeStepControl.
bool firstSuccessfulStep_
StepControlStrategy class for TimeStepControl.
virtual void getNextTimeStep(const TimeStepControl< Scalar > tsc, Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory, Status &) override
Determine the time step size.