Constructor for a stepsize_class.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| class(stepsize_class), | intent(out) | :: | me |
(all options not specified are set to their defaults) |
||
| real(kind=wp), | intent(in), | optional | :: | hmin |
minimum allowed step size (>0) |
|
| real(kind=wp), | intent(in), | optional | :: | hmax |
maximum allowed step size (>0) |
|
| real(kind=wp), | intent(in), | optional | :: | hfactor_reject |
minimum allowed factor for decreasing step size after rejected step (>0) |
|
| real(kind=wp), | intent(in), | optional | :: | hfactor_accept |
maximum allowed factor for decreasing step size after accepted step (>0) |
|
| procedure(norm_func), | optional | :: | norm |
the user-specified function |
||
| integer, | intent(in), | optional | :: | accept_mode |
method to determine if step is accepted [1,2] |
|
| logical, | intent(in), | optional | :: | relative_err |
if true, use the error per unit step:
. Otherwise (the default),
use the error per step: .
Note that, for the error per unit step,
the scaled error is proportional to one less power of |
|
| real(kind=wp), | intent(in), | optional | :: | safety_factor |
for |
|
| integer, | intent(in), | optional | :: | p_exponent_offset |
the exponent of the step size factor is
|
|
| integer, | intent(in), | optional | :: | max_attempts |
max step size change attempts after rejected step |
|
| logical, | intent(in), | optional | :: | fixed_step_mode |
if true, then the method runs in
fixed step mode with not error estimation.
All the other inputs are ignored. Note that
this requires a |
|
| integer, | intent(in), | optional | :: | rtol_scaling |
the state used to scale the relative tolerance:
|
|
| integer, | intent(in), | optional | :: | error_combination |
for methods with two error estimates ( |
|
| real(kind=wp), | intent(in), | optional | :: | pi_beta |
the parameter for the PI (Lund) stabilized
step size control ( |
|
| real(kind=wp), | intent(in), | optional | :: | pi_beta_mult |
the error exponent is reduced by |
|
| logical, | intent(in), | optional | :: | no_increase_after_reject |
if true, the step size is not increased for the step after a rejected step (default is false). |
subroutine stepsize_class_constructor(me,hmin,hmax,hfactor_reject,& hfactor_accept,norm,accept_mode,relative_err,& safety_factor,p_exponent_offset,max_attempts,& fixed_step_mode,rtol_scaling,error_combination,& pi_beta,pi_beta_mult,no_increase_after_reject) implicit none class(stepsize_class),intent(out) :: me !! (all options not specified are set to their defaults) real(wp),intent(in),optional :: hmin !! minimum allowed step size (>0) real(wp),intent(in),optional :: hmax !! maximum allowed step size (>0) real(wp),intent(in),optional :: hfactor_reject !! minimum allowed factor for !! decreasing step size after !! rejected step (>0) real(wp),intent(in),optional :: hfactor_accept !! maximum allowed factor for !! decreasing step size after !! accepted step (>0) procedure(norm_func),optional :: norm !! the user-specified \( ||x|| \) !! function integer,intent(in),optional :: accept_mode !! method to determine if step !! is accepted [1,2] integer,intent(in),optional :: max_attempts !! max step size change attempts !! after rejected step logical,intent(in),optional :: relative_err !! if true, use the error per unit step: !! \( ||err|| \le |h| tol \). Otherwise (the default), !! use the error per step: \( ||err|| \le tol \). !! Note that, for the error per unit step, !! the scaled error is proportional to one less power of `h`, !! so `p_exponent_offset` should be one less than !! for the error per step (e.g., `-1` rather than `0` !! for a `p(p-1)` pair). real(wp),intent(in),optional :: safety_factor !! for `hfactor` equation (>0) integer,intent(in),optional :: p_exponent_offset !! the exponent of the step size factor is !! `1/(p + p_exponent_offset)` (`-1`, `0`, or `1`). !! See [[stepsize_class]] for details. logical,intent(in),optional :: fixed_step_mode !! if true, then the method runs in !! fixed step mode with not error estimation. !! All the other inputs are ignored. Note that !! this requires a `dt /= 0` input for the integrator. integer,intent(in),optional :: rtol_scaling !! the state used to scale the relative tolerance: !! `1`: `|x(t+h)|` (the default), !! `2`: `max(|x(t)|,|x(t+h)|)` (as in `DOPRI5` and `DOP853`). integer,intent(in),optional :: error_combination !! for methods with two error estimates (`rkdp85`): !! `1`: combined for each component (the default), !! `2`: combined using their scaled norms (as in `DOP853`). real(wp),intent(in),optional :: pi_beta !! the \( \beta \) parameter for the PI (Lund) stabilized !! step size control (`0` to disable, which is the default). !! Values up to `0.04` are recommended for `DOPRI5`. real(wp),intent(in),optional :: pi_beta_mult !! the error exponent is reduced by `pi_beta_mult*pi_beta` !! (`0.75` is the default, and is used in `DOPRI5`, !! `0.2` is used in `DOP853`). logical,intent(in),optional :: no_increase_after_reject !! if true, the step size is not increased for the step !! after a rejected step (default is false). if (present(hmin)) me%hmin = abs(hmin) if (present(hmax)) me%hmax = abs(hmax) if (present(hfactor_reject)) me%hfactor_reject = abs(hfactor_reject) if (present(hfactor_accept)) me%hfactor_accept = abs(hfactor_accept) if (present(norm)) me%norm => norm if (present(accept_mode)) me%accept_mode = accept_mode if (present(max_attempts)) me%max_attempts = max_attempts !if (present(compute_h_factor)) me%compute_h_factor => compute_h_factor if (present(relative_err )) me%relative_err = relative_err if (present(safety_factor )) me%safety_factor = abs(safety_factor ) if (present(p_exponent_offset)) me%p_exponent_offset = p_exponent_offset if (present(fixed_step_mode)) me%fixed_step_mode = fixed_step_mode if (present(rtol_scaling)) me%rtol_scaling = rtol_scaling if (present(error_combination)) me%error_combination = error_combination if (present(pi_beta)) me%pi_beta = abs(pi_beta) if (present(pi_beta_mult)) me%pi_beta_mult = abs(pi_beta_mult) if (present(no_increase_after_reject)) me%no_increase_after_reject = no_increase_after_reject call me%reset() end subroutine stepsize_class_constructor