FOODIE integrator: provide an explicit class of leapfrog multi-step schemes, 2nd order accurate.
Considering the following ODE system:
$$ U_t = R(t,U) $$
where \(U_t = \frac{dU}{dt}\), U is the vector of state variables being a function of the time-like independent variable t, R is the (vectorial) residual function, the leapfrog class scheme implemented (see [3]) is:
$$ U^{n+2} = U^{n} + 2\Delta t \cdot R(t^{n+1}, U^{n+1}) $$
Optionally, the Robert-Asselin-Williams (RAW) filter (see [3]) is applied to the computed integration steps: $$ \Delta = \frac{\nu}{2}(U^{n} - 2 U^{n+1} + U^{n+2}) $$ $$ U^{n+1} = U^{n+1} + \Delta * \alpha $$ $$ U^{n+2} = U^{n+2} + \Delta * (\alpha-1) $$ Note that for \(\alpha=1\) the filter reverts back to the standard Robert-Asselin scheme. The filter coefficients should be taken as \(\nu \in (0,1]\) and \(\alpha \in (0.5,1]\). The default values are
The value of \(\Delta t\) must be provided, it not being computed by the integrator.
The schemes are explicit. The filter coefficients \(\nu,\,\alpha \) define the actual scheme.
[1] The integration of a low order spectral form of the primitive meteorological equations, Robert, A. J., J. Meteor. Soc. Japan,vol. 44, pages 237–245, 1966.
[2] Frequency filter for time integrations, Asselin, R., Monthly Weather Review, vol. 100, pages 487–490, 1972.
[3] The RAW filter: An improvement to the Robert–Asselin filter in semi-implicit integrations, Williams, P.D., Monthly Weather Review, vol. 139(6), pages 1996–2007, June 2011.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
character(len=99), | private, | parameter | :: | class_name_ | = | 'leapfrog' | Name of the class of schemes. |
logical, | private, | parameter | :: | has_fast_mode_ | = | .true. | Flag to check if integrator provides fast mode integrate. |
character(len=99), | private, | parameter | :: | supported_schemes_(1:2) | = | [trim(class_name_)//' ', trim(class_name_)//'_raw'] | List of supported schemes. |
FOODIE integrator: provide an explicit class of leapfrog multi-step schemes, 2nd order accurate.
Type | Visibility | Attributes | Name | Initial | |||
---|---|---|---|---|---|---|---|
real(kind=R_P), | public, | allocatable | :: | Dt(:) | Previous time steps. |
||
real(kind=R_P), | private | :: | alpha | Robert-Asselin-Williams filter coefficient. |
|||
logical, | public | :: | autoupdate | Perform cyclic autoupdate of previous time steps buffers. |
|||
class(integrand_object), | public, | allocatable | :: | buffer | Buffer used for fast integration. |
||
character(len=:), | public, | allocatable | :: | description_ | Informative description of the integrator. |
||
integer(kind=I_P), | public | :: | error | = | 0 | Error status code. |
|
character(len=:), | public, | allocatable | :: | error_message | Error message, hopefully meaningful. |
||
class(integrand_object), | private, | allocatable | :: | filter | Filter field displacement. |
||
logical, | private | :: | is_filtered | Flag to check if the integration if RAW filtered. |
|||
integer(kind=I_P), | public | :: | iterations | Implicit iterations. |
|||
real(kind=R_P), | private | :: | nu | Robert-Asselin filter coefficient. |
|||
class(integrand_object), | public, | allocatable | :: | previous(:) | Previous steps. |
||
integer(kind=I_P), | public | :: | registers | Number of registers used for steps. |
|||
integer(kind=I_P), | public | :: | steps | Number of time steps. |
|||
real(kind=R_P), | public, | allocatable | :: | t(:) | Previous times. |
procedure, public, pass(self) :: allocate_integrand_members | Allocate integrand members. |
procedure, public, pass(lhs) :: assign_abstract | Assign ony members of abstract integrator_object type. |
procedure, public, pass(lhs) :: assign_multistep | Assign members of integrator_multistep_object and parents. |
generic, public :: assignment(=) => integr_assign_integr | Overload |
procedure, public, pass(self) :: check_error | Check for error occurrencies. |
procedure, public, pass(self) :: class_name | Return the class name of schemes. |
procedure, public, pass(self) :: description | Return informative integrator description. |
procedure, public, pass(self) :: destroy | Destroy the integrator. |
procedure, public, pass(self) :: destroy_abstract | Destroy only members of abstract integrator_object type. |
procedure, public, pass(self) :: destroy_multistep | Destroy the integrator. |
procedure, public, pass(self) :: has_fast_mode | Return .true. if the integrator class has fast mode integrate. |
procedure, public, pass(self) :: initialize | Initialize (create) the integrator. |
procedure, public, pass(lhs) :: integr_assign_integr | Operator |
procedure, public, pass(self) :: integrate | Integrate integrand field. |
procedure, public, pass(self) :: integrate_fast | Integrate integrand field, fast mode. |
procedure, public, pass(self) :: is_multistage | Return .true. for multistage integrator. |
procedure, public, pass(self) :: is_multistep | Return .true. for multistep integrator. |
procedure, public, pass(self) :: is_supported | Return .true. if the integrator class support the given scheme. |
procedure, public, pass(self) :: stages_number | Return number of stages used. |
procedure, public, pass(self) :: steps_number | Return number of steps used. |
procedure, public, pass(self) :: supported_schemes | Return the list of supported schemes. |
procedure, public, pass(self) :: trigger_error | Trigger an error. |
procedure, public, nopass :: update_previous | Cyclic update previous time steps. |
Return the class name of schemes.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(in) | :: | self | Integrator. |
Class name.
Return .true. if the integrator class has fast mode integrate.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(in) | :: | self | Integrator. |
Inquire result.
Return .true. if the integrator class support the given scheme.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(in) | :: | self | Integrator. |
||
character(len=*), | intent(in) | :: | scheme | Selected scheme. |
Inquire result.
Return the list of supported schemes.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(in) | :: | self | Integrator. |
Queried scheme.
Allocate members of interpolator being of integrand_object class.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(inout) | :: | self | Integrator. |
||
class(integrand_object), | intent(in) | :: | U | Integrand. |
Destroy the integrator.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(inout) | :: | self | Integrator. |
Create the actual leapfrog integrator: initialize the filter coefficient.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(inout) | :: | self | Integrator. |
||
character(len=*), | intent(in) | :: | scheme | Selected scheme. |
||
real(kind=R_P), | intent(in), | optional | :: | nu | Williams-Robert-Asselin filter coefficient. |
|
real(kind=R_P), | intent(in), | optional | :: | alpha | Robert-Asselin filter coefficient. |
|
logical, | intent(in), | optional | :: | autoupdate | Enable cyclic autoupdate of previous time steps. |
|
class(integrand_object), | intent(in), | optional | :: | U | Integrand molding prototype. |
|
logical, | intent(in), | optional | :: | stop_on_fail | Stop execution if initialization fail. |
Operator =
.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(inout) | :: | lhs | Left hand side. |
||
class(integrator_object), | intent(in) | :: | rhs | Right hand side. |
Integrate field with leapfrog class scheme.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(inout) | :: | self | Integrator. |
||
class(integrand_object), | intent(inout) | :: | U | Field to be integrated. |
||
real(kind=R_P), | intent(in) | :: | Dt | Time step. |
||
real(kind=R_P), | intent(in) | :: | t | Time. |
Integrate field with leapfrog class scheme, fast mode.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(integrator_leapfrog), | intent(inout) | :: | self | Integrator. |
||
class(integrand_object), | intent(inout) | :: | U | Field to be integrated. |
||
real(kind=R_P), | intent(in) | :: | Dt | Time step. |
||
real(kind=R_P), | intent(in) | :: | t | Time. |