Skip to content

adam_flume_fnl_kernels ​

ADAM, FLUME FNL device kernels.

Model-independent kernels; the per-model ones (face fluxes, auxiliary variables, signal speed) live in adam_flume_fnl_<model>_kernels (issue #41, section 4).

Module-level kernels (issue #35, D-11/D-12): private work arrays have constant bounds, no array section is ever an actual argument inside a loop body, host scalars are firstprivate, device arrays are DEVICEVAR/DEVICEPTR, and every offload !$acc directive is immediately followed by its !$omp twin. Device arrays are transposed, (b, i, j, k, v): the block index is stride-1, so it is the innermost loop of every collapse(4) nest.

Source: src/app/flume/fnl/adam_flume_fnl_kernels.F90

Dependencies

Contents ​

Subroutines ​

apply_reflux_face_dev ​

Add the Berger-Colella correction scale delta(:, c) of one register face to the coarse skin cells of block b.

fortran
subroutine apply_reflux_face_dev(axis, sgn, b, ni, nj, nk, ngc, nv, nface_cells, scale, delta_gpu, q_gpu)

Arguments

NameTypeIntentAttributesDescription
axisinteger(kind=I4P)inFace normal axis (1..3) and side (+-1).
sgninteger(kind=I4P)inFace normal axis (1..3) and side (+-1).
binteger(kind=I4P)inCoarse block.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
nvinteger(kind=I4P)inVariables number.
nface_cellsinteger(kind=I4P)inSkin cells number.
scalereal(kind=R8P)inCorrection scale, sgn dt / dx_coarse.
delta_gpureal(kind=R8P)inFlux mismatch F_coarse - F_fine_sum (nv, cells).
q_gpureal(kind=R8P)inoutConservative variables.

Call graph

compute_flux_difference_dev ​

Compute the residuals from the face fluxes, dq = -sum_d (F_{d,i+1/2} - F_{d,i-1/2}) / dx_d.

A null direction weighs zero, and the residual of the variable it freezes, freeze(d) (0: none), is zero: the normal momentum for Euler (CHASE semantics, issue #35, section 3.4), none for MHD (issue #41, M2-P3).

fortran
subroutine compute_flux_difference_dev(nv, ni, nj, nk, ngc, blocks_number, is_null, freeze, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
nvinteger(kind=I4P)inConservative variables number.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
blocks_numberinteger(kind=I4P)inActual blocks number.
is_nulllogicalinNull directions.
freezeinteger(kind=I4P)inVariable frozen by each null direction (0: none).
dxyz_gpureal(kind=R8P)inBlocks space steps [nb, 3].
flx_f_gpureal(kind=R8P)inX-face fluxes.
fly_f_gpureal(kind=R8P)inY-face fluxes.
flz_f_gpureal(kind=R8P)inZ-face fluxes.
dq_gpureal(kind=R8P)inoutResiduals.

Call graph

compute_flux_difference_ib_dev ​

Compute the residuals from the face fluxes with immersed solids: the spacing of a fluid cell is cut by the solid surface (ib_cut_spacing, CHASE semantics, issue #35 D-9); device twin of the CPU flux difference with phi.

fortran
subroutine compute_flux_difference_ib_dev(nv, ni, nj, nk, ngc, blocks_number, is_null, freeze, dxyz_gpu, flx_f_gpu, fly_f_gpu, flz_f_gpu, phi_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
nvinteger(kind=I4P)inConservative variables number.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
blocks_numberinteger(kind=I4P)inActual blocks number.
is_nulllogicalinNull directions.
freezeinteger(kind=I4P)inVariable frozen by each null direction (0: none).
dxyz_gpureal(kind=R8P)inBlocks space steps [nb, 3].
flx_f_gpureal(kind=R8P)inX-face fluxes.
fly_f_gpureal(kind=R8P)inY-face fluxes.
flz_f_gpureal(kind=R8P)inZ-face fluxes.
phi_gpureal(kind=R8P)inDistance function [nb, i, j, k, solids+1].
dq_gpureal(kind=R8P)inoutResiduals.

Call graph

compute_rk_ssp_residual_dev ​

Compute the residual of a strong stability preserving step, dq = sum_s beta_s dq_s, from the stored stages.

Device twin of the residual that the host rk_object%update_q returns: the residuals history of the two backends then reports the same quantity (the effective step residual, not the last stage one).

fortran
subroutine compute_rk_ssp_residual_dev(ni, nj, nk, ngc, nv, blocks_number, nrk, beta_gpu, q_rk_gpu, dq_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
nvinteger(kind=I4P)inVariables number.
blocks_numberinteger(kind=I4P)inActual blocks number.
nrkinteger(kind=I4P)inRunge-Kutta stages number.
beta_gpureal(kind=R8P)inRunge-Kutta beta coefficients.
q_rk_gpureal(kind=R8P)inStored stage residuals.
dq_gpureal(kind=R8P)inoutStep residual.

Call graph

fill_seam_copy_dev ​

Copy a peer realm's interior cells into this realm's seam ghost cells, following the seam map rows.

fortran
subroutine fill_seam_copy_dev(row_start, row_count, nv, ngc, rows_gpu, src_gpu, dst_gpu)

Arguments

NameTypeIntentAttributesDescription
row_startinteger(kind=I4P)inSeam map slice of the peer.
row_countinteger(kind=I4P)inSeam map slice of the peer.
nvinteger(kind=I4P)inVariables number.
ngcinteger(kind=I4P)inGhost cells number.
rows_gpuinteger(kind=I4P)inSeam map rows.
src_gpureal(kind=R8P)inPeer active buffer.
dst_gpureal(kind=R8P)inoutOwn active buffer.

Call graph

pack_seam_skin_dev ​

Pack the face fluxes of face fec of block b into the skin skin_gpu(v, c), c running over the two tangential axes, inner fastest (the flux register order, accumulate_seam_skin).

fortran
subroutine pack_seam_skin_dev(fec, b, ni, nj, nk, nv, flx_f_gpu, fly_f_gpu, flz_f_gpu, skin_gpu)

Arguments

NameTypeIntentAttributesDescription
fecinteger(kind=I4P)inFace (1..6: -x, +x, -y, +y, -z, +z).
binteger(kind=I4P)inBlock.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
nvinteger(kind=I4P)inVariables number.
flx_f_gpureal(kind=R8P)inX-face fluxes.
fly_f_gpureal(kind=R8P)inY-face fluxes.
flz_f_gpureal(kind=R8P)inZ-face fluxes.
skin_gpureal(kind=R8P)inoutFace skin (nv, inner_n*outer_n).

Call graph

set_boundary_conditions_dev ​

Set boundary conditions on one crown: face ghosts by kind, edge and corner ghosts by extrapolation.

Crowns are processed in order by the caller, so every source cell is interior or in a lower (already filled) crown: the rows of one launch are independent.

fortran
subroutine set_boundary_conditions_dev(ni, nj, nk, ngc, nv, crown, local_map_bc_crown_gpu, q_inflow_gpu, wall_sign_gpu, q_gpu)

Arguments

NameTypeIntentAttributesDescription
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
nvinteger(kind=I4P)inConservative variables number.
crowninteger(kind=I4P)inCrown counter.
local_map_bc_crown_gpuinteger(kind=I8P)inBoundary crown map (row, field, crown).
q_inflow_gpureal(kind=R8P)inConservative inflow state of each face [nv, 6].
wall_sign_gpureal(kind=R8P)inWall mirror sign per variable and direction [nv, 3].
q_gpureal(kind=R8P)inoutConservative variables.

Call graph