Skip to content

selah_box ​

SELAH, L1: the box, the part of a block-structured field a kernel updates.

A field is a rank-5 array: components, three cell indices with ghost cells, and blocks, in one of two layouts:

  • LAYOUT_V_FIRST: (v, i, j, k, b), the components contiguous (ADAM's CPU fields);
  • LAYOUT_V_LAST: (b, i, j, k, v), the blocks contiguous (ADAM's FNL device fields).

A box holds the lower bounds of the allocation (lb, ghosts included) and the range the kernels loop over (lo:hi): the interior cells of the active blocks 1..blocks_number of a pool that may hold more, and all components or a range of them (a partition of a splitting scheme). The kernels never write outside the box: not the ghost cells, not the pool slots past blocks_number. A box is passed at every call, never stored, because the active blocks change at every regrid.

Fields of rank 1 to 4. A field of lower rank is a rank-5 field with singleton dimensions: the kernels and the stepper keep one rank-5 implementation. Dimension d of a rank-k field is dimension d of the rank-5 view when the field's first dimension holds its components, d + 1 when the field is scalar (box_dim):

FieldAs rank 5 (v, i, j, k, b)
(i), scalar(1, i, 1, 1, 1)
(v, i)(v, i, 1, 1, 1)
(v, i, j)(v, i, j, 1, 1)
(v, i, j, k)(v, i, j, k, 1)
(i, j), (i, j, k), (i, j, k, b), scalar(1, i, j, 1, 1), (1, i, j, k, 1), (1, i, j, k, b)

The rank-k constructors (box_interior(lb, ub, ngc, components), box_range(lb, lo, hi, components)) take the components flag explicitly: the mapping is never guessed. Fields of rank below 5 have the layout LAYOUT_V_FIRST.

Source: src/lib/selah_box.F90

Contents ​

Variables ​

NameTypeAttributesDescription
LAYOUT_V_FIRSTinteger(kind=I4P)parameterLayout (v, i, j, k, b).
LAYOUT_V_LASTinteger(kind=I4P)parameterLayout (b, i, j, k, v).

Derived Types ​

box ​

The part of a rank-5 field a kernel updates.

Components

NameTypeAttributesDescription
layoutinteger(kind=I4P)Layout, LAYOUT_V_FIRST or LAYOUT_V_LAST.
lbinteger(kind=I4P)Lower bounds of the allocation, ghosts included.
lointeger(kind=I4P)First index of the loop range, per dimension.
hiinteger(kind=I4P)Last index of the loop range, per dimension.
rankinteger(kind=I4P)Rank of the field (1 to 5), viewed as rank 5.
componentslogicalThe field's first dimension holds its components (always, for rank 5).

Interfaces ​

box_interior ​

The interior cells of a field: of the active blocks of a rank-5 field, or of a field of rank 1 to 4.

Module procedures: box_interior_blocks, box_interior_rank

Functions ​

box_range ​

The loop range lo:hi of a field of rank k = size(lb) whose lower bounds are lb, as a box.

Attributes: pure

Returns: type(box)

fortran
function box_range(lb, lo, hi, components) result(bx)

Arguments

NameTypeIntentAttributesDescription
lbinteger(kind=I4P)inLower bounds of the field, ghosts included (size k, 1 to 5).
lointeger(kind=I4P)inFirst index of the loop range (size k).
hiinteger(kind=I4P)inLast index of the loop range (size k).
componentslogicalinThe field's first dimension holds its components.

Call graph

box_dim ​

The dimension of the rank-5 view that holds dimension d of the field: d, or d + 1 for a scalar field.

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function box_dim(bx, d) result(m)

Arguments

NameTypeIntentAttributesDescription
bxtype(box)inBox.
dinteger(kind=I4P)inDimension of the field (1 to its rank).

Call graph

component_dim ​

The dimension of the components: 1 (V_FIRST) or 5 (V_LAST).

Attributes: pure

Returns: integer(kind=I4P)

fortran
function component_dim(bx) result(d)

Arguments

NameTypeIntentAttributesDescription
bxtype(box)inBox.

Call graph

box_components ​

The same box restricted to the components v1..v2 (the variables of one partition).

Attributes: pure

Returns: type(box)

fortran
function box_components(bx, v1, v2) result(sub)

Arguments

NameTypeIntentAttributesDescription
bxtype(box)inBox.
v1integer(kind=I4P)inComponent range.
v2integer(kind=I4P)inComponent range.

Call graph

GPL-3.0-or-later, BSD-2-Clause, BSD-3-Clause or MIT, at your choice