2.0.0b10
catchment modelling framework
Loading...
Searching...
No Matches
RKFIntegrator Class Reference

Integrates a vector of cmf::math::StateVariable with the Runge-Kutta-Fehlberg (RKF54) method. More...

+ Inheritance diagram for RKFIntegrator:
+ Collaboration diagram for RKFIntegrator:

Detailed Description

Integrates a vector of cmf::math::StateVariable with the Runge-Kutta-Fehlberg (RKF54) method.

Public Member Functions

 RKFIntegrator (const cmf::math::state_list &states, real epsilon=1e-9, cmf::math::Time dt_min=cmf::math::timespan(1000))
 Constructs a new RKFIntegrator from a pointer to a vector of state variables.
 
 RKFIntegrator (real epsilon=1e-9, cmf::math::Time dt_min=cmf::math::timespan(1000))
 Constructs a new RKFIntegrator.
 
virtual Integratorcopy () const
 Polymorphic copy constructor.
 
int integrate (cmf::math::Time MaxTime, cmf::math::Time TimeStep)
 Integrates the vector of state variables.
 
void reset () override
 Resets any saved history (for multistep methods)
 
std::string to_string () const override
 Desrcibes the iterator.
 
Integrate
void integrate_until (cmf::math::Time t_max, cmf::math::Time dt=Time(), bool reset=false)
 Integrates the vector of state variables until t_max.
 

Protected Member Functions

void AdjustTimestep (Time &TimeStep, Time MaxTime)
 Protected function to adjust the step width for stability reasons.
 

Protected Attributes

Accuracy parameters
const real Epsilon =1e-9
 Tolerable error.
 

model time

cmf::math::Time get_t () const
 Returns the current model time.
 
void set_t (cmf::math::Time val)
 Sets the current model time.
 
cmf::math::Time get_dt () const
 Returns the last time step.
 
cmf::math::Time m_t
 Actual time of the solver.
 
cmf::math::Time m_dt
 last time step of the solver
 

Constructor & Destructor Documentation

◆ RKFIntegrator() [1/2]

RKFIntegrator ( const cmf::math::state_list & states,
real epsilon = 1e-9,
cmf::math::Time dt_min = cmf::math::timespan(1000) )

Constructs a new RKFIntegrator from a pointer to a vector of state variables.

Note
The RKF Integrator becomes the owner of states
Parameters
statesStatevariables of the system
epsilonrelative error tolerance per time step (default=1e-9)
dt_minminimum time step (default=1s)

◆ RKFIntegrator() [2/2]

RKFIntegrator ( real epsilon = 1e-9,
cmf::math::Time dt_min = cmf::math::timespan(1000) )

Constructs a new RKFIntegrator.

Parameters
epsilonrelative error tolerance per time step (default=1e-9)
dt_minminimum time step (default=1s)

Member Function Documentation

◆ integrate()

int integrate ( cmf::math::Time MaxTime,
cmf::math::Time TimeStep )
virtual

Integrates the vector of state variables.

Parameters
MaxTimeTo stop the model (if running in a model framework) at time steps of value exchange e.g. full hours, the next value exchange time can be given
TimeStepTakes the proposed timestep, and changes it into the effictivly used timestep according to the local stiffness of the problem and MaxTime

Implements Integrator.

◆ integrate_until()

void integrate_until ( cmf::math::Time t_max,
cmf::math::Time dt = Time(),
bool reset = false )
inherited

Integrates the vector of state variables until t_max.

Parameters
t_maxTime, the solver should run to
dtTime step (may be omitted)
resetIf true, solver is reseted before integration starts