9 #ifndef Tempus_TimeStepControlStrategy_PID_hpp
10 #define Tempus_TimeStepControlStrategy_PID_hpp
12 #include "Tempus_TimeStepControl.hpp"
14 #include "Tempus_SolutionState.hpp"
15 #include "Tempus_SolutionStateMetaData.hpp"
16 #include "Tempus_SolutionHistory.hpp"
25 template<
class Scalar>
42 Status & integratorStatus)
override
51 Teuchos::RCP<SolutionState<Scalar> > workingState=
solutionHistory->getWorkingState();
52 Teuchos::RCP<SolutionStateMetaData<Scalar> > metaData = workingState->getMetaData();
53 const Scalar errorAbs = metaData->getErrorAbs();
54 volatile const int iStep = metaData->getIStep();
55 volatile const Scalar errorRel = metaData->getErrorRel();
56 int order = metaData->getOrder();
57 Scalar dt = metaData->getDt();
59 Teuchos::as<int>(Teuchos::VERB_NONE);
61 Teuchos::RCP<Teuchos::FancyOStream> out = tsc.getOStream();
62 Teuchos::OSTab ostab(out,1,
"getNextTimeStep");
80 Scalar k1 = Teuchos::as<Scalar>(-
k1_ / order);
81 Scalar k2 = Teuchos::as<Scalar>(
k2_ / order);
82 Scalar k3 = Teuchos::as<Scalar>(-
k3_ / order);
84 k1 = std::pow(
errN_, k1);
97 dt = std::min(dt, metaData->getDt());
115 if (pList == Teuchos::null) {
117 if (
tscsPL_ == Teuchos::null) {
118 tscsPL_ = Teuchos::parameterList(
"TimeStepControlStrategyPID");
136 TEUCHOS_TEST_FOR_EXCEPTION(safetyFactor_ <= 0.0, std::out_of_range,
137 "Error - Invalid value of Safety Factory= " << safetyFactor_ <<
"! \n"
138 <<
"Safety Factor must be > 0.0.\n");
140 TEUCHOS_TEST_FOR_EXCEPTION(facMax_ <= 0.0, std::out_of_range,
141 "Error - Invalid value of Maximum Safety Factory= " << facMax_ <<
"! \n"
142 <<
"Maximum Safety Factor must be > 0.0.\n");
144 TEUCHOS_TEST_FOR_EXCEPTION(facMax_<= 0.0, std::out_of_range,
145 "Error - Invalid value of Minimum Safety Factory= " << facMin_ <<
"! \n"
146 <<
"Minimum Safety Factor must be > 0.0.\n");
151 Teuchos::RCP<Teuchos::ParameterList> pl = Teuchos::parameterList();
153 pl->set<std::string>(
"Name",
"PID");
154 pl->set<Scalar>(
"K1" , 0.58,
"");
155 pl->set<Scalar>(
"K2" , 0.21,
"");
156 pl->set<Scalar>(
"K3" , 0.10,
"");
157 pl->set<Scalar>(
"Safety Factor" , 0.90,
"Safety Factor");
158 pl->set<Scalar>(
"Maximum Safety Factor" , 5.0,
"Maximum Safety Factor");
159 pl->set<Scalar>(
"Minimum Safety Factor" , 0.5,
"Minimum Safety Factor");
168 Teuchos::RCP<Teuchos::ParameterList> temp_plist =
tscsPL_;
190 #endif // Tempus_TimeStepControlStrategy_PID_hpp
virtual void getNextTimeStep(const TimeStepControl< Scalar > tsc, Teuchos::RCP< SolutionHistory< Scalar > > solutionHistory, Status &integratorStatus) override
Determine the time step size.
bool firstSuccessfulStep_
Teuchos::RCP< const Teuchos::ParameterList > getValidParameters() const
TimeStepControlStrategyPID(Teuchos::RCP< Teuchos::ParameterList > pList=Teuchos::null)
Constructor.
StepControlStrategy class for TimeStepControl.
Teuchos::RCP< Teuchos::ParameterList > getNonconstParameterList()
Status
Status for the Integrator, the Stepper and the SolutionState.
void setParameterList(const Teuchos::RCP< Teuchos::ParameterList > &pList)
TimeStepControl manages the time step size. There several mechanicisms that effect the time step size...
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...
Teuchos::RCP< Teuchos::ParameterList > unsetParameterList()
virtual ~TimeStepControlStrategyPID()
Destructor.
Teuchos::RCP< Teuchos::ParameterList > tscsPL_
StepControlStrategy class for TimeStepControl.