Appearance
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
- apply_reflux_face_dev
- compute_flux_difference_dev
- compute_flux_difference_ib_dev
- compute_rk_ssp_residual_dev
- fill_seam_copy_dev
- pack_seam_skin_dev
- set_boundary_conditions_dev
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
axis | integer(kind=I4P) | in | Face normal axis (1..3) and side (+-1). | |
sgn | integer(kind=I4P) | in | Face normal axis (1..3) and side (+-1). | |
b | integer(kind=I4P) | in | Coarse block. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
nv | integer(kind=I4P) | in | Variables number. | |
nface_cells | integer(kind=I4P) | in | Skin cells number. | |
scale | real(kind=R8P) | in | Correction scale, sgn dt / dx_coarse. | |
delta_gpu | real(kind=R8P) | in | Flux mismatch F_coarse - F_fine_sum (nv, cells). | |
q_gpu | real(kind=R8P) | inout | Conservative 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
nv | integer(kind=I4P) | in | Conservative variables number. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
is_null | logical | in | Null directions. | |
freeze | integer(kind=I4P) | in | Variable frozen by each null direction (0: none). | |
dxyz_gpu | real(kind=R8P) | in | Blocks space steps [nb, 3]. | |
flx_f_gpu | real(kind=R8P) | in | X-face fluxes. | |
fly_f_gpu | real(kind=R8P) | in | Y-face fluxes. | |
flz_f_gpu | real(kind=R8P) | in | Z-face fluxes. | |
dq_gpu | real(kind=R8P) | inout | Residuals. |
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
nv | integer(kind=I4P) | in | Conservative variables number. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
is_null | logical | in | Null directions. | |
freeze | integer(kind=I4P) | in | Variable frozen by each null direction (0: none). | |
dxyz_gpu | real(kind=R8P) | in | Blocks space steps [nb, 3]. | |
flx_f_gpu | real(kind=R8P) | in | X-face fluxes. | |
fly_f_gpu | real(kind=R8P) | in | Y-face fluxes. | |
flz_f_gpu | real(kind=R8P) | in | Z-face fluxes. | |
phi_gpu | real(kind=R8P) | in | Distance function [nb, i, j, k, solids+1]. | |
dq_gpu | real(kind=R8P) | inout | Residuals. |
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
nv | integer(kind=I4P) | in | Variables number. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
nrk | integer(kind=I4P) | in | Runge-Kutta stages number. | |
beta_gpu | real(kind=R8P) | in | Runge-Kutta beta coefficients. | |
q_rk_gpu | real(kind=R8P) | in | Stored stage residuals. | |
dq_gpu | real(kind=R8P) | inout | Step 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
row_start | integer(kind=I4P) | in | Seam map slice of the peer. | |
row_count | integer(kind=I4P) | in | Seam map slice of the peer. | |
nv | integer(kind=I4P) | in | Variables number. | |
ngc | integer(kind=I4P) | in | Ghost cells number. | |
rows_gpu | integer(kind=I4P) | in | Seam map rows. | |
src_gpu | real(kind=R8P) | in | Peer active buffer. | |
dst_gpu | real(kind=R8P) | inout | Own 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
fec | integer(kind=I4P) | in | Face (1..6: -x, +x, -y, +y, -z, +z). | |
b | integer(kind=I4P) | in | Block. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
nv | integer(kind=I4P) | in | Variables number. | |
flx_f_gpu | real(kind=R8P) | in | X-face fluxes. | |
fly_f_gpu | real(kind=R8P) | in | Y-face fluxes. | |
flz_f_gpu | real(kind=R8P) | in | Z-face fluxes. | |
skin_gpu | real(kind=R8P) | inout | Face 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
nv | integer(kind=I4P) | in | Conservative variables number. | |
crown | integer(kind=I4P) | in | Crown counter. | |
local_map_bc_crown_gpu | integer(kind=I8P) | in | Boundary crown map (row, field, crown). | |
q_inflow_gpu | real(kind=R8P) | in | Conservative inflow state of each face [nv, 6]. | |
wall_sign_gpu | real(kind=R8P) | in | Wall mirror sign per variable and direction [nv, 3]. | |
q_gpu | real(kind=R8P) | inout | Conservative variables. |
Call graph