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_SolutionStateMetaData.hpp"
16 #include "Tempus_SolutionHistory.hpp"
53 template<
class Scalar>
79 Teuchos::RCP<SolutionState<Scalar> > workingState=
solutionHistory->getWorkingState();
80 Teuchos::RCP<SolutionStateMetaData<Scalar> > metaData = workingState->getMetaData();
81 const Scalar errorRel = metaData->getErrorRel();
85 int order = metaData->getOrder() - 1;
86 Scalar dt = metaData->getDt();
90 Teuchos::RCP<Teuchos::FancyOStream> out = tsc.getOStream();
91 Teuchos::OSTab ostab(out,1,
"getNextTimeStep");
109 Scalar k1 = Teuchos::as<Scalar>(-
k1_ / order);
110 Scalar k2 = Teuchos::as<Scalar>(
k2_ / order);
111 Scalar k3 = Teuchos::as<Scalar>(-
k3_ / order);
113 k1 = std::pow(
errN_, k1);
124 beta = std::max(
facMin_, beta);
125 beta = std::min(
facMax_, beta);
133 dt = std::min(dt, metaData->getDt());
139 facMax_ =
tscsPL_->get<Scalar>(
"Safety Factor After Step Rejection");
150 const Teuchos::RCP<Teuchos::ParameterList> & pList)
override
153 if (pList == Teuchos::null) {
155 if (
tscsPL_ == Teuchos::null) {
156 tscsPL_ = Teuchos::parameterList(
"TimeStepControlStrategyIntegralController");
175 TEUCHOS_TEST_FOR_EXCEPTION(safetyFactor_ <= 0.0, std::out_of_range,
176 "Error - Invalid value of Safety Factory= " << safetyFactor_ <<
"! \n"
177 <<
"Safety Factor must be > 0.0.\n");
179 TEUCHOS_TEST_FOR_EXCEPTION(facMax_ <= 0.0, std::out_of_range,
180 "Error - Invalid value of Maximum Safety Factory= " << facMax_ <<
"! \n"
181 <<
"Maximum Safety Factor must be > 0.0.\n");
183 TEUCHOS_TEST_FOR_EXCEPTION(facMax_<= 0.0, std::out_of_range,
184 "Error - Invalid value of Minimum Safety Factory= " << facMin_ <<
"! \n"
185 <<
"Minimum Safety Factor must be > 0.0.\n");
187 TEUCHOS_TEST_FOR_EXCEPTION(((controller_ !=
"I") and
188 (controller_ !=
"PI") and
189 (controller_ !=
"PID")), std::invalid_argument,
190 "Error - Invalid choice of Controller Type = " << controller_ <<
"! \n"
191 <<
"Valid Choice are ['I', 'PI', 'PID'].\n");
197 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
199 pl->set<std::string>(
"Name",
"Integral Controller",
"Integral Controller");
200 pl->set<std::string>(
"Controller Type",
"PID",
201 "Proportional-Integral-Derivative");
202 pl->set<Scalar>(
"KI" , 0.58,
"Integral gain");
203 pl->set<Scalar>(
"KP" , 0.21,
"Proportional gain");
204 pl->set<Scalar>(
"KD" , 0.10,
"Derivative gain");
205 pl->set<Scalar>(
"Safety Factor" , 0.90,
"Safety Factor");
206 pl->set<Scalar>(
"Maximum Safety Factor" , 5.0,
"Maximum Safety Factor");
207 pl->set<Scalar>(
"Minimum Safety Factor" , 0.5,
"Minimum Safety Factor");
208 pl->set<Scalar>(
"Safety Factor After Step Rejection" , 0.9,
209 "Safety Factor Following Step Rejection");
218 Teuchos::RCP<Teuchos::ParameterList> temp_plist =
tscsPL_;
241 #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
Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Nonmember constructor.
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.