Dune::Copasi
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Dune::Copasi::SimpleAdaptiveStepper< State, TimeQuantity, DurationQuantity > Class Template Reference

Adapt an stepper into a simple adaptive time stepper. More...

#include <stepper.hh>

Inheritance diagram for Dune::Copasi::SimpleAdaptiveStepper< State, TimeQuantity, DurationQuantity >:
Inheritance graph
[legend]
Collaboration diagram for Dune::Copasi::SimpleAdaptiveStepper< State, TimeQuantity, DurationQuantity >:
Collaboration graph
[legend]

Public Member Functions

 SimpleAdaptiveStepper (std::function< TimeQuantity &(State &)> time_mut, std::function< const TimeQuantity &(const State &)> time_const, double decrease_factor=0.5, double increase_factor=1.5, std::optional< DurationQuantity > min_step={}, std::optional< DurationQuantity > max_step={})
 Construct a new simple adaptive stepper.
 
template<std::same_as< void > = void>
requires requires(const State& cstate, State& mstate) { { cstate.time } -> std::convertible_to<const TimeQuantity&>; { mstate.time } -> std::convertible_to<TimeQuantity&>; }
 SimpleAdaptiveStepper (double decrease_factor=0.5, double increase_factor=1.5, std::optional< DurationQuantity > min_step={}, std::optional< DurationQuantity > max_step={})
 Construct a new simple adaptive stepper.
 
PDELab::ErrorCondition do_step (PDELab::OneStep< State > &one_step, const State &in, State &out, DurationQuantity &dt) const override
 Perform one simple adaptive time step of the system.
 
- Public Member Functions inherited from Dune::Copasi::TimeStepper< State, TimeQuantity, DurationQuantity >
 TimeStepper (std::function< TimeQuantity &(State &)> time_mut, std::function< const TimeQuantity &(const State &)> time_const)
 Construct a new time stepper.
 
template<std::same_as< void > = void>
requires requires(const State& cstate, State& mstate) { { cstate.time } -> std::convertible_to<const TimeQuantity&>; { mstate.time } -> std::convertible_to<TimeQuantity&>; }
 TimeStepper ()
 Construct a new time stepper.
 
 TimeStepper (const TimeStepper &)=delete
 
 TimeStepper (TimeStepper &&)=delete
 
TimeStepperoperator= (const TimeStepper &)=delete
 
TimeStepperoperator= (TimeStepper &&)=delete
 
virtual ~TimeStepper ()=default
 Time stepper destructor.
 
PDELab::ErrorCondition evolve (PDELab::OneStep< State > &one_step, const State &in, State &out, DurationQuantity &dt, TimeQuantity end_time, std::function< void(const State &)> callable=[](const State &) {}, bool snap_to_end_time=true) const
 Evolve the system until end_time
 
PDELab::ErrorCondition snap_to_time (PDELab::OneStep< State > &one_step, const State &in, State &out, DurationQuantity &dt, TimeQuantity snap_time, std::function< void(const State &)> callable=[](const State &) {}) const
 Snap the output to a specific time.
 

Detailed Description

template<class State, class TimeQuantity, class DurationQuantity>
class Dune::Copasi::SimpleAdaptiveStepper< State, TimeQuantity, DurationQuantity >

Adapt an stepper into a simple adaptive time stepper.

When a time step is not successful, the delta time will be decreased until step is successful or the minimum time step is reached. When step is successful, delta time is increased up to a maximum value

Template Parameters
TimeQuantityType representing time quantities
DurationQuantityType representing duration quantities
StateType representing states

Constructor & Destructor Documentation

◆ SimpleAdaptiveStepper() [1/2]

template<class State , class TimeQuantity , class DurationQuantity >
Dune::Copasi::SimpleAdaptiveStepper< State, TimeQuantity, DurationQuantity >::SimpleAdaptiveStepper ( std::function< TimeQuantity &(State &)> time_mut,
std::function< const TimeQuantity &(const State &)> time_const,
double decrease_factor = 0.5,
double increase_factor = 1.5,
std::optional< DurationQuantity > min_step = {},
std::optional< DurationQuantity > max_step = {} )
inline

Construct a new simple adaptive stepper.

Parameters
time_mutFunctor that obtains a mutable time quantity from a given state
time_constFunctor that obtains a constant time quantity from a given constant state
decrease_factorFactor to decrease time step on failure
increase_factorFactor to increase time step on success
min_stepMinimum step size
max_stepMaximum step size

◆ SimpleAdaptiveStepper() [2/2]

template<class State , class TimeQuantity , class DurationQuantity >
template<std::same_as< void > = void>
requires requires(const State& cstate, State& mstate) { { cstate.time } -> std::convertible_to<const TimeQuantity&>; { mstate.time } -> std::convertible_to<TimeQuantity&>; }
Dune::Copasi::SimpleAdaptiveStepper< State, TimeQuantity, DurationQuantity >::SimpleAdaptiveStepper ( double decrease_factor = 0.5,
double increase_factor = 1.5,
std::optional< DurationQuantity > min_step = {},
std::optional< DurationQuantity > max_step = {} )
inlineexplicit

Construct a new simple adaptive stepper.

Parameters
decrease_factorFactor to decrease time step on failure
increase_factorFactor to increase time step on success
min_stepMinimum step size
max_stepMaximum step size

Member Function Documentation

◆ do_step()

template<class State , class TimeQuantity , class DurationQuantity >
PDELab::ErrorCondition Dune::Copasi::SimpleAdaptiveStepper< State, TimeQuantity, DurationQuantity >::do_step ( PDELab::OneStep< State > & one_step,
const State & in,
State & out,
DurationQuantity & dt ) const
inlineoverridevirtual

Perform one simple adaptive time step of the system.

When a time step is not successful, the delta time will be decreased until step is successful or the minimum time step is reached. When step is successful, delta time is increased up to a maximum value

Parameters
one_stepSystem that contain suitable operators to advance in time
inInput state to advance time from
outOutput state where result will be placed
dtMutable delta time to perform step
Returns
error condition describing the reason of (not) convergence of the timestep

Reimplemented from Dune::Copasi::TimeStepper< State, TimeQuantity, DurationQuantity >.


The documentation for this class was generated from the following file: