TC_PI< NEWT > Class Template Reference#

DiFfRG: TC_PI< NEWT > Class Template Reference
DiFfRG
Discretization Framework for functional Renormalization Group flows

Proportional-integral step-size control from the solver's error measure. More...

#include <pi.hh>

Inheritance diagram for TC_PI< NEWT >:

Public Types

using Base = TC_Default<NEWT>
 

Public Member Functions

 TC_PI (NEWT &newton_, unsigned int alg_order_, double t_, double max_t_, double dt_, double min_dt_, double max_dt_)
 
- Public Member Functions inherited from TC_Default< NEWT >
 TC_Default (NEWT &newton_, unsigned int alg_order_, double t_, double max_t_, double dt_, double min_dt_, double max_dt_)
 
double get_dt () const
 The step to take next.
 
double get_t () const
 The current time.
 
unsigned int get_stuck () const
 How many steps in a row did not advance the time.
 
bool finished () const
 Whether max_t has been reached.
 
template<typename F >
void advance (F &f)
 Attempt one step and plan the next.
 

Protected Member Functions

void get_q ()
 Update q from the current error.
 
virtual void step_success () override
 Advance the time and suggest the next step from the current and previous error.
 
virtual void step_fail (const std::exception &) override
 On a fail, decrease the timestep by at least a factor of 2 relative to the failed step.
 
- Protected Member Functions inherited from TC_Default< NEWT >

Protected Attributes

double beta1
 
double beta2
 
double qsteady_min
 
double qsteady_max
 
double qmin
 
double qmax
 
double qoldinit
 
double qold
 
double q11
 
double q
 
double gamma
 
double t
 
NEWT & newton
 
double cur_dt
 
double sug_dt
 
unsigned int alg_order
 
- Protected Attributes inherited from TC_Default< NEWT >
NEWT & newton
 
unsigned int alg_order
 
double t
 
double max_t
 
double sug_dt
 
double min_dt
 
double max_dt
 
double cur_dt
 
double last_t
 
unsigned int stuck
 
bool fin
 

Detailed Description

template<typename NEWT>
class DiFfRG::TC_PI< NEWT >

Proportional-integral step-size control from the solver's error measure.

With the error \(E_n\) = newton.get_error() of the accepted step and the one before, \(E_{n-1}\), the next step is \(\Delta t_{n+1} = \Delta t_n / q\) with

\[ q = \frac{1}{0.9}\, \frac{E_n^{\beta_1}}{E_{n-1}^{\beta_2}}\,, \qquad \beta_1 = \frac{0.7}{p}\,, \quad \beta_2 = \frac{0.4}{p}\,, \]

where \(p\) is the order of the method, \(q\) is clipped to [0.1, 5] and set to 1 within [0.99, 1.2]. \(E_{n-1}\) is floored at \(10^{-4}\). A failed step is retried with at most half the step size. The coefficients are close to the PI defaults of OrdinaryDiffEq.jl. For ImplicitEuler and TRBDF2 \(E\) is the weighted norm of their local error estimate; a step that throws (e.g. rejected with \(E > 1\)) is retried with a smaller step.

Template Parameters
NEWTthe solver; must provide set_ignore_nonconv(bool) and get_error().

Member Typedef Documentation

◆ Base

template<typename NEWT >
using Base = TC_Default<NEWT>

Constructor & Destructor Documentation

◆ TC_PI()

template<typename NEWT >
TC_PI ( NEWT & newton_,
unsigned int alg_order_,
double t_,
double max_t_,
double dt_,
double min_dt_,
double max_dt_ )
inline

Member Function Documentation

◆ get_q()

template<typename NEWT >
void get_q ( )
inlineprotected

Update q from the current error.

◆ step_fail()

template<typename NEWT >
virtual void step_fail ( const std::exception & )
inlineoverrideprotectedvirtual

On a fail, decrease the timestep by at least a factor of 2 relative to the failed step.

The error estimate alone cannot guarantee that: a failure need not come with EEst > 1, and the failed step may have been clipped below sug_dt (to hit max_t), so scaling sug_dt could retry the same step.

Reimplemented from TC_Default< NEWT >.

◆ step_success()

template<typename NEWT >
virtual void step_success ( )
inlineoverrideprotectedvirtual

Advance the time and suggest the next step from the current and previous error.

Reimplemented from TC_Default< NEWT >.

Member Data Documentation

◆ alg_order

template<typename NEWT >
unsigned int alg_order
protected

◆ beta1

template<typename NEWT >
double beta1
protected

◆ beta2

template<typename NEWT >
double beta2
protected

◆ cur_dt

template<typename NEWT >
double cur_dt
protected

◆ gamma

template<typename NEWT >
double gamma
protected

◆ newton

template<typename NEWT >
NEWT& newton
protected

◆ q

template<typename NEWT >
double q
protected

◆ q11

template<typename NEWT >
double q11
protected

◆ qmax

template<typename NEWT >
double qmax
protected

◆ qmin

template<typename NEWT >
double qmin
protected

◆ qold

template<typename NEWT >
double qold
protected

◆ qoldinit

template<typename NEWT >
double qoldinit
protected

◆ qsteady_max

template<typename NEWT >
double qsteady_max
protected

◆ qsteady_min

template<typename NEWT >
double qsteady_min
protected

◆ sug_dt

template<typename NEWT >
double sug_dt
protected

◆ t

template<typename NEWT >
double t
protected

The documentation for this class was generated from the following file:
  • /home/runner/work/DiFfRG/DiFfRG/DiFfRG/include/DiFfRG/timestepping/timestep_control/pi.hh