FLINT 0.9.9
Fortran Library for numerical INTegration of differential equations
Loading...
Searching...
No Matches
stepsize Module Reference

StepSize Module. More...

Functions/Subroutines

subroutine stepsz0hairer (h, p, n, x0, y0, f0, sc, hsign, hmax, fcalls, pdiffeqsys, params)
 Subroutine for computing the starting step size using Hairer's algorithm.
 
real(wp) function stepszhairer (h, islaststeprejected, q, e, stepszparams)
 Pure function for computing the new step size using Hairer's algorithm.
 

Variables

real(wp), parameter sf = 0.9_WP
 Safety factor.
 
real(wp), parameter sfmin = 0.333_WP
 Minimum safety factor, so we dont decrease the step size too fast.
 
real(wp), parameter sfmax = 6.0_WP
 Maximum safety factor, so we dont increase the step size too fast

 
real(wp), parameter hbyhoptold = 1.0e-4_WP
 Lund stabilization PI control term (see Hairer's code)
 

Detailed Description

StepSize Module.

This module provides procedures for step size computation.

Author
Bharat Mahajan
Date
Created: 01/28/2019
Module containing all the algorithms for step size computations

Function/Subroutine Documentation

◆ stepsz0hairer()

subroutine stepsize::stepsz0hairer ( real(wp), intent(out) h,
integer, intent(in) p,
integer, intent(in) n,
real(wp), intent(in) x0,
real(wp), dimension(n), intent(in) y0,
real(wp), dimension(n), intent(in) f0,
real(wp), dimension(n), intent(in) sc,
real(wp), intent(in) hsign,
real(wp), intent(in) hmax,
integer, intent(out) fcalls,
class(diffeqsys), intent(inout), pointer pdiffeqsys,
real(wp), dimension(:), intent(in), optional params )

Subroutine for computing the starting step size using Hairer's algorithm.

For details on the algorithm, see Hairer's book "Solving ODE I" or his code dop853.f at http://www.unige.ch/~hairer/prog/nonstiff/dop853.f.

Parameters
[out]hComputed step size
[in]pOrder of the method, which is used to advance the integration. For example, for Dormand-Prince 8(7) ERK method, p=8.
[in]ndimension of the DiffEq system
[in]x0Initial value of the independent variable
[in]y0Initial condition
[in]f0DiffEq Function evaluated at Y0
[in]scError Scale factor
[in]hsignMust be either +1.0 or -1.0 depending on the forward or backward integration, respectively
[in]hmaxMaximum allowed step size
[out]fcallsNumber of Calls that this routine makes to DiffEq function "F"
[in,out]pdiffeqsysDiffEq system
[in]paramsReal parameter array to be passed to DEFunc
Remarks
The equation to solve for the new guess for the starting step size is

\[ h_1^{p+1} max(d1, d2) = 0.01 \]

In Hairer's dop853 code, he actually uses $p$ instead of $p+1$ as the power of $h_1$ for reasons unknown. He uses $p=8$ for his dop853.

Definition at line 53 of file StepSz.f90.

◆ stepszhairer()

real(wp) function stepsize::stepszhairer ( real(wp), intent(in) h,
logical, intent(in) islaststeprejected,
integer, intent(in) q,
real(wp), intent(in) e,
real(wp), dimension(6), intent(inout) stepszparams )

Pure function for computing the new step size using Hairer's algorithm.

For details on the algorithm, see Hairer's book "Solving ODE I" or his code dop853.f at http://www.unige.ch/~hairer/prog/nonstiff/dop853.f.

Parameters
[in]hcurrent step size
[in]islaststeprejectedIf true then the step size is decreased else increased.
[in]qq = min(p,phat) but Hairer uses q=8 in DOP853.
[in]eError norm
[in,out]stepszparamsContains safety factor and Lund stabilization related parameters
Remarks
Optimal step computed using the equations:

\[  err = C h^{(q+1)}  \]

\[ 1 = C h_{opt}^{q+1} \]

New step chosen such that

\[ SF_{min} <= SF\, h_{new}/h_{old} <= SF_{max}  \]

New step chosen such that

\[ SF_{min} <= SF\, h_{new}/h_{old} <= SF_{max}  \]

Definition at line 124 of file StepSz.f90.

References hbyhoptold, sf, sfmax, sfmin, and stepszhairer().

Referenced by stepszhairer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ hbyhoptold

real(wp), parameter stepsize::hbyhoptold = 1.0e-4_WP

Lund stabilization PI control term (see Hairer's code)

Definition at line 44 of file StepSz.f90.

Referenced by stepszhairer().

◆ sf

real(wp), parameter stepsize::sf = 0.9_WP

Safety factor.

Definition at line 35 of file StepSz.f90.

Referenced by stepszhairer().

◆ sfmax

real(wp), parameter stepsize::sfmax = 6.0_WP

Maximum safety factor, so we dont increase the step size too fast

Definition at line 41 of file StepSz.f90.

Referenced by stepszhairer().

◆ sfmin

real(wp), parameter stepsize::sfmin = 0.333_WP

Minimum safety factor, so we dont decrease the step size too fast.

Definition at line 38 of file StepSz.f90.

Referenced by stepszhairer().