Appearance
adam_stepper_object
ADAM, the time integrator adapter: ADAM's
[runge_kutta]schemes on a SELAH stepper (SELAH M7, issue #132).
SELAH owns the time operators (the coefficients, the registers and the stage kernels); this object is the thin ADAM side of it:
- the input:
[runge_kutta] scheme, read asrk_objectreads it (no other key), and the mapping of ADAM's scheme names onto a SELAH scheme and storage form (stepper_map); - the field: ADAM's
q(nv, 1-ngc:ni+ngc, 1-ngc:nj+ngc, 1-ngc:nk+ngc, nb)(LAYOUT_V_FIRST, the CPU backends) orq_gpu(nb, 1-ngc:ni+ngc, 1-ngc:nj+ngc, 1-ngc:nk+ngc, nv)(LAYOUT_V_LAST, the FNL backends), the box of each call built from the active blocks (field%blocks_number, never stored: it changes at every regrid); - the immersed boundary:
ib%phiis SELAH's mask (a cell is active where the last component, the all-solids distance, is negative, as inrk_object); - the registers: allocated here through FUNDAL (device memory in a device build) and passed to SELAH (
registers=); on the host zeroed block by block the first time a block is active (issue #45: zeroing the whole fill-the-node pool at allocation would commit all of it), on the device zeroed at allocation (as the FNL stage buffers always were); reachable between steps as scratch (scratch(n), the D_flux diagnostic and the equilibrium residual, #132 rule 3).
The scheme mapping (#132): runge-kutta-1/2/3 are the two-register Shu-Osher forms of Euler, SSP-22 and SSP-33 (ADAM's low-storage coefficients are these, bitwise); runge-kutta-ssp-11/22/33/54 are the Butcher forms of Euler, SSP-22, SSP-33 and SSP-54 (bitwise ADAM's tableaux), every stage on its own register (stages_on_q off), as ADAM's stages are; runge-kutta-yoshida is SELAH's Yoshida-4 splitting (the PRISM integrator of phase 4: it needs the components of its two partitions).
The stage window. Between begin_stage(k) and end_stage(k) the state of stage k is q itself when state_is_q(k) (every stage of the two-register forms), else stage_state(); the caller fills its ghost cells and writes the residual into rhs_register(). The masked (solid) cells of every stage state hold q, as every stage buffer of rk_object did: SELAH's mask policy (masked_q=.true., szaghi/SELAH#5), written by its stage kernel in the same pass; the immersed-boundary extrapolation of the residual starts from them.
The same source serves the CPU backends (host build) and the FNL backends (OpenACC build, -DDEV_OAC): the arrays passed (q, phi, dq) are host arrays in the first, device arrays (FUNDAL pointers) in the second.
Source: src/lib/common/adam_stepper_object.F90
Dependencies
Re-exports
| Name | Kind | Module | Description |
|---|---|---|---|
LAYOUT_V_FIRST | selah | ||
LAYOUT_V_LAST | selah |
Contents
- stepper_object
- stepper_map
- begin_step
- begin_stage
- destroy
- end_stage
- finish_step
- initialize
- load_from_file
- set_rhs
- stepper_stored_fields
- stepper_butcher_stages
- description
- imag_axis_bound
- is_butcher
- is_splitting
- is_two_register
- rhs_register
- scratch
- ssp_coefficient
- stage_euler_fraction
- stage_state
- stage_time
- stage_weight
- stages
- state_is_q
- interior_box
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
RK_1 | character(len=13) | parameter | Parameter of time scheme, Runge-Kutta 1. |
RK_2 | character(len=13) | parameter | Parameter of time scheme, Runge-Kutta 2. |
RK_3 | character(len=13) | parameter | Parameter of time scheme, Runge-Kutta 3. |
RK_SSP_11 | character(len=18) | parameter | Parameter of time scheme, Runge-Kutta SSP 11 (forward Euler). |
RK_SSP_22 | character(len=18) | parameter | Parameter of time scheme, Runge-Kutta SSP 22. |
RK_SSP_33 | character(len=18) | parameter | Parameter of time scheme, Runge-Kutta SSP 33. |
RK_SSP_54 | character(len=18) | parameter | Parameter of time scheme, Runge-Kutta SSP 54. |
RK_YOSHIDA | character(len=19) | parameter | Parameter of time scheme, Runge-Kutta Yoshida, symplectic 4. |
INI_SECTION_NAME | character(len=11) | parameter | INI (config) file section name containing configs. |
Derived Types
stepper_object
ADAM's [runge_kutta] scheme on a SELAH stepper.
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
scheme | character(len=:) | allocatable | ADAM scheme name ([runge_kutta] scheme). |
selah_scheme | character(len=:) | allocatable | SELAH scheme. |
form | character(len=:) | allocatable | SELAH storage form. |
st | type(stepper) | SELAH stepper. | |
regs | real(kind=R8P) | pointer, contiguous | Registers (v, i, j, k, b, slot). |
nregs | integer(kind=I4P) | Registers number. | |
blocks_zeroed | integer(kind=I4P) | Block slots of regs zeroed so far (issue #45). | |
nv | integer(kind=I4P) | Number of variables. | |
ni | integer(kind=I4P) | Cells per block, per direction. | |
nj | integer(kind=I4P) | Cells per block, per direction. | |
nk | integer(kind=I4P) | Cells per block, per direction. | |
ngc | integer(kind=I4P) | Ghost cells. | |
nb | integer(kind=I4P) | Block slots of the pool. | |
layout | integer(kind=I4P) | Field layout: (v, i, j, k, b) or (b, i, j, k, v). |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
begin_step | pass(self) | Open a step. |
begin_stage | pass(self) | Open stage k: build its state. |
description | pass(self) | Return pretty-printed object description. |
destroy | pass(self) | Free the registers. |
end_stage | pass(self) | Close stage k. |
finish_step | pass(self) | Close the step. |
initialize | pass(self) | Initialize the stepper and its registers. |
imag_axis_bound | pass(self) | Stability bound on the imaginary axis (SELAH). |
is_butcher | pass(self) | The form is Butcher's (the stages on their own registers). |
is_splitting | pass(self) | The form is a splitting of two partitions. |
is_two_register | pass(self) | The form is the two-register (low-storage) Shu-Osher one. |
load_from_file | pass(self) | Load config from file. |
rhs_register | pass(self) | Residual register of the active stage. |
scratch | pass(self) | A register as scratch, between steps. |
set_rhs | pass(self) | Copy a residual into the residual register of the active stage. |
ssp_coefficient | pass(self) | SSP coefficient of the scheme (SELAH; 0 if not SSP). |
stage_euler_fraction | pass(self) | Forward-Euler step of stage k, a fraction of the step (SELAH). |
stage_state | pass(self) | State register of the active stage (null when it is q). |
stage_time | pass(self) | Fraction of the step at which stage k is evaluated. |
stage_weight | pass(self) | Effective Butcher weight of stage k. |
stages | pass(self) | Stages per step. |
state_is_q | pass(self) | The state of stage k is q itself. |
interior_box | pass(self) | Box of the interior cells of the active blocks. |
Subroutines
stepper_map
Map an ADAM [runge_kutta] scheme name onto a SELAH scheme and storage form; an unknown name gives empty strings.
Attributes: pure
fortran
subroutine stepper_map(scheme, selah_scheme, form)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
scheme | character(len=*) | in | ADAM scheme name. | |
selah_scheme | character(len=:) | out | allocatable | SELAH scheme. |
form | character(len=:) | out | allocatable | SELAH storage form. |
Call graph
begin_step
Open a step: zero the block slots active for the first time, then let SELAH keep what its form needs of q.
fortran
subroutine begin_step(self, field, q, phi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | inout | Stepper. | |
field | type(field_object) | in | Field (sibling realm component, threaded in). | |
q | real(kind=R8P) | in | State. | |
phi | real(kind=R8P) | in | optional | IB distance. |
Call graph
begin_stage
Open stage k: SELAH builds its state (its masked cells q, the mask policy).
fortran
subroutine begin_stage(self, k, field, dt, q, phi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | inout | Stepper. | |
k | integer(kind=I4P) | in | Stage. | |
field | type(field_object) | in | Field (sibling realm component, threaded in). | |
dt | real(kind=R8P) | in | Time step. | |
q | real(kind=R8P) | in | State. | |
phi | real(kind=R8P) | in | optional | IB distance. |
Call graph
destroy
Free the stepper and its registers.
fortran
subroutine destroy(self)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | inout | Stepper. |
Call graph
end_stage
Close stage k, its residual written into rhs_register(): the two-register forms advance q here.
fortran
subroutine end_stage(self, k, field, dt, q, phi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | inout | Stepper. | |
k | integer(kind=I4P) | in | Stage. | |
field | type(field_object) | in | Field (sibling realm component, threaded in). | |
dt | real(kind=R8P) | in | Time step. | |
q | real(kind=R8P) | inout | State. | |
phi | real(kind=R8P) | in | optional | IB distance. |
Call graph
finish_step
Close the step: the Butcher form advances q now and gives the step residual dq = sum_k b_k R_k (0 in the masked cells, #128 D4); the two-register forms already advanced q and leave dq as the caller wrote it.
fortran
subroutine finish_step(self, field, dt, q, dq, phi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | inout | Stepper. | |
field | type(field_object) | in | Field (sibling realm component, threaded in). | |
dt | real(kind=R8P) | in | Time step. | |
q | real(kind=R8P) | inout | State. | |
dq | real(kind=R8P) | inout | optional | Step residual. |
phi | real(kind=R8P) | in | optional | IB distance. |
Call graph
initialize
Initialize the stepper of [runge_kutta] scheme (or of scheme) and its registers, the field's pool shape.
fortran
subroutine initialize(self, field, grid, file_parameters, scheme, partitions, layout)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | inout | Stepper. | |
field | type(field_object) | in | Field (sibling realm component, threaded in). | |
grid | type(grid_object) | in | Grid (sibling realm component, threaded in). | |
file_parameters | type(file_ini) | in | optional | Simulation parameters ini file handler. |
scheme | character(len=*) | in | optional | Runge-Kutta scheme. |
partitions | integer(kind=I4P) | in | optional | Splitting: the variables of its two partitions. |
layout | integer(kind=I4P) | in | optional | Field layout (default LAYOUT_V_FIRST). |
Call graph
load_from_file
Load config from file: [runge_kutta] scheme, the only key (as rk_object reads it).
fortran
subroutine load_from_file(self, file_parameters)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | inout | Stepper. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. |
Call graph
set_rhs
Copy the residual dq into the residual register of the active stage, the interior cells of the active blocks (SELAH's copy kernel: on the device in a device build). For a caller that evaluates the residual into its own array (the residual log reads it, a correction acts on it) before the stage update reads the register.
fortran
subroutine set_rhs(self, field, dq)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. | |
field | type(field_object) | in | Field (sibling realm component, threaded in). | |
dq | real(kind=R8P) | in | Residual. |
Call graph
Functions
stepper_stored_fields
Return the block-sized fields (of nv variables) the stepper of a scheme allocates: SELAH's registers_needed, the residual register included. It lets an app size its memory budget before the stepper exists; an unknown scheme returns -1.
Attributes: pure
Returns: integer(kind=I4P)
fortran
function stepper_stored_fields(scheme) result(fields)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
scheme | character(len=*) | in | ADAM scheme name. |
Call graph
stepper_butcher_stages
Return the stages of a scheme of the Butcher form (the SSP schemes), from SELAH's tableau; -1 for any other scheme. It lets an app size what follows the field's stages (PRISM's particle stages) before the stepper exists.
Attributes: pure
Returns: integer(kind=I4P)
fortran
function stepper_butcher_stages(scheme) result(stages)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
scheme | character(len=*) | in | ADAM scheme name. |
Call graph
description
Return a pretty-formatted object description.
Attributes: pure
Returns: character(len=:)
fortran
function description(self) result(desc)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
imag_axis_bound
Return the end of the scheme's stability region on the imaginary axis, |R(iy)| <= 1 for |y| <= beta (SELAH, from its stability polynomial; 0 when R(iy) leaves the unit disc at once, as for Euler and SSP-22).
Attributes: pure
Returns: real(kind=R8P)
fortran
function imag_axis_bound(self) result(beta)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
is_butcher
Return true if the form is Butcher's: every stage on its own state register, the step closed by finish_step.
Attributes: elemental
Returns: logical
fortran
function is_butcher(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
is_splitting
Return true if the form is a splitting of two partitions (each stage a flow of one partition).
Attributes: elemental
Returns: logical
fortran
function is_splitting(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
is_two_register
Return true if the form is the two-register Shu-Osher one (every stage on q, low storage).
Attributes: elemental
Returns: logical
fortran
function is_two_register(self) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
rhs_register
Return the residual register of the active stage, with the field's bounds (null outside a stage window).
Returns: real(kind=R8P)
fortran
function rhs_register(self) result(r)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
scratch
Return register n as scratch, between steps (SELAH's registers are scratch after finish_step): every form has at least two registers (#132 rule 3, #128 D1). Writing them leaves the next step unchanged: each step rebuilds what it reads of them.
Returns: real(kind=R8P)
fortran
function scratch(self, n) result(r)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. | |
n | integer(kind=I4P) | in | Register. |
Call graph
ssp_coefficient
Return the SSP coefficient C of the scheme (SELAH, from its Shu-Osher form): every stage a convex combination of forward-Euler steps when C > 0; 0 for a scheme that is not SSP and for a splitting.
Attributes: pure
Returns: real(kind=R8P)
fortran
function ssp_coefficient(self) result(c)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
stage_euler_fraction
Return the forward-Euler step the residual of stage k enters, as a fraction of the step (SELAH, f_k = max_i beta_ik / alpha_ik of the Shu-Osher form): a limiter that makes the state of stage k plus f_k dt times its residual admissible keeps every later stage and the step admissible; 0 when the scheme has no such decomposition.
Attributes: pure
Returns: real(kind=R8P)
fortran
function stage_euler_fraction(self, k) result(f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. | |
k | integer(kind=I4P) | in | Stage. |
Call graph
stage_state
Return the state register of the active stage, with the field's bounds; null when the stage's state is q itself.
Returns: real(kind=R8P)
fortran
function stage_state(self) result(u)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
stage_time
Return the fraction of the step at which the residual of stage k is evaluated (the abscissa c_k).
Attributes: pure
Returns: real(kind=R8P)
fortran
function stage_time(self, k) result(c)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. | |
k | integer(kind=I4P) | in | Stage. |
Call graph
stage_weight
Return the effective Butcher weight b_k of stage k: the weight of its fluxes in the step (the flux register's).
Attributes: pure
Returns: real(kind=R8P)
fortran
function stage_weight(self, k) result(w)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. | |
k | integer(kind=I4P) | in | Stage. |
Call graph
stages
Return the stages per step.
Attributes: pure
Returns: integer(kind=I4P)
fortran
function stages(self) result(n)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. |
Call graph
state_is_q
Return true if the state of stage k is q itself (every stage of the two-register forms).
Attributes: pure
Returns: logical
fortran
function state_is_q(self, k) result(yes)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. | |
k | integer(kind=I4P) | in | Stage. |
Call graph
interior_box
Return the box of the interior cells of the active blocks (field%blocks_number, at the time of the call).
Attributes: pure
Returns: type(box)
fortran
function interior_box(self, field) result(bx)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(stepper_object) | in | Stepper. | |
field | type(field_object) | in | Field. |
Call graph