Appearance
adam_flume_fnl_mhd_eglm_llf_kernels
ADAM, FLUME FNL device kernels of the MHD-EGLM model with the LLF Riemann solver (scheme
weno-riemann).
The model- and solver-agnostic face loop (adam_flume_fnl_riemann_face_kernels_agnostic.INC, issue #47) instantiated on the MHD-EGLM model and the LLF solver of adam_flume_mhd_riemann_library: the local arrays are sized by NV_K = NV_MHD_EGLM, NV_AUX_K = NV_AUX_MHD, and the four adapters call the MHD libraries.
Source: src/app/flume/fnl/adam_flume_fnl_mhd_eglm_llf_kernels.F90
Dependencies
Contents
- compute_riemann_face_fluxes_dev
- add_gravity_edge_correction_dev
- face_interpolation_fields
- face_states
- riemann_flux
- cell_flux
Subroutines
compute_riemann_face_fluxes_dev
Compute the weno-riemann face fluxes of direction d: face (i,j,k) lies between cells (i,j,k) and (i+di,j+dj,k+dk), so the face array starts at index 0 along d.
Per face (device twin of the CPU compute_riemann_face_fluxes): gather the stencil m = min(1-S,-1) ... max(S,2) into constant-bound privates, WENO-interpolate its fields to the two face states (weno_a_gpu, weno_p_gpu are the INTERPOLATION tables), take the Riemann flux F and add the correction F^ = F + s (cc(1) F + cc(2) (f_0 + f_1) + cc(3) (f_-1 + f_2) - F), s = 1 where every WENO weights ratio is >= tau, else 0; fallbacks counts the faces whose Riemann solver fell back (HLLD to HLL).
fortran
subroutine compute_riemann_face_fluxes_dev(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, S, gamma, ch, is_characteristic, weno_a_gpu, weno_p_gpu, weno_d_gpu, weno_zeps, weno_sigma, cc, tau, q_gpu, q_aux_gpu, fl_gpu, fallbacks)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
di | integer(kind=I4P) | in | Unit step along d. | |
dj | integer(kind=I4P) | in | Unit step along d. | |
dk | integer(kind=I4P) | in | Unit step along d. | |
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. | |
S | integer(kind=I4P) | in | WENO stencil half-width. | |
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed (models with GLM only). | |
is_characteristic | logical | in | Characteristic (or primitive) variables. | |
weno_a_gpu | real(kind=R8P) | in | WENO interpolation optimal weights. | |
weno_p_gpu | real(kind=R8P) | in | WENO interpolation polynomials coefficients. | |
weno_d_gpu | real(kind=R8P) | in | WENO smoothness indicators coefficients. | |
weno_zeps | real(kind=R8P) | in | WENO parameter avoiding division by zero. | |
weno_sigma | real(kind=R8P) | in | WENO descaler switch (0 Jiang-Shu, 1 SI). | |
cc | real(kind=R8P) | in | Correction coefficients. | |
tau | real(kind=R8P) | in | Sensor threshold. | |
q_gpu | real(kind=R8P) | in | Conservative variables. | |
q_aux_gpu | real(kind=R8P) | in | Auxiliary variables. | |
fl_gpu | real(kind=R8P) | inout | Face fluxes of direction d. | |
fallbacks | integer(kind=I4P) | out | Faces whose Riemann solver fell back. |
Call graph
add_gravity_edge_correction_dev
Add the faces beyond the block to the gravity energy correction of direction d (issue #73, M7-G2a; device twin of the CPU add_gravity_edge_correction of weno-riemann): each face computed as compute_riemann_face_fluxes_dev does (the same body, its mass component kept).
fortran
subroutine add_gravity_edge_correction_dev(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, S, gamma, ch, is_characteristic, weno_a_gpu, weno_p_gpu, weno_d_gpu, weno_zeps, weno_sigma, cc, tau, ir, gd, q_gpu, q_aux_gpu, gc_gpu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
di | integer(kind=I4P) | in | Unit step along d. | |
dj | integer(kind=I4P) | in | Unit step along d. | |
dk | integer(kind=I4P) | in | Unit step along d. | |
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. | |
S | integer(kind=I4P) | in | WENO stencil half-width. | |
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed (models with GLM only). | |
is_characteristic | logical | in | Characteristic (or primitive) variables. | |
weno_a_gpu | real(kind=R8P) | in | WENO interpolation optimal weights. | |
weno_p_gpu | real(kind=R8P) | in | WENO interpolation polynomials coefficients. | |
weno_d_gpu | real(kind=R8P) | in | WENO smoothness indicators coefficients. | |
weno_zeps | real(kind=R8P) | in | WENO parameter avoiding division by zero. | |
weno_sigma | real(kind=R8P) | in | WENO descaler switch (0 Jiang-Shu, 1 SI). | |
cc | real(kind=R8P) | in | Correction coefficients. | |
tau | real(kind=R8P) | in | Sensor threshold. | |
ir | integer(kind=I4P) | in | Index of the density (mass) variable. | |
gd | real(kind=R8P) | in | Gravity along d. | |
q_gpu | real(kind=R8P) | in | Conservative variables. | |
q_aux_gpu | real(kind=R8P) | in | Auxiliary variables. | |
gc_gpu | real(kind=R8P) | inout | Gravity energy correction [..., 1]. |
Call graph
face_interpolation_fields
Interpolation-fields adapter of the shared face kernel: the MHD fields, the EGLM eigenvectors, ch unused.
Attributes: pure
fortran
subroutine face_interpolation_fields(gamma, ch, d, S, is_characteristic, qs, qas, fint, er, mu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed. | |
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
S | integer(kind=I4P) | in | WENO stencil half-width, S <= S_MAX. | |
is_characteristic | logical | in | Characteristic (or primitive) variables. | |
qs | real(kind=R8P) | in | Stencil conservative variables. | |
qas | real(kind=R8P) | in | Stencil auxiliary variables. | |
fint | real(kind=R8P) | out | Fields in the WENO upwind layout. | |
er | real(kind=R8P) | out | Right eigenvectors. | |
mu | real(kind=R8P) | out | Magnitude of each field (WENO descaler). |
Call graph
face_states
Face-states adapter of the shared face kernel: the MHD states, ch unused.
Attributes: pure
fortran
subroutine face_states(gamma, ch, is_characteristic, er, vr, q0, q1, qL, qR)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed. | |
is_characteristic | logical | in | Characteristic (or primitive) variables. | |
er | real(kind=R8P) | in | Right eigenvectors. | |
vr | real(kind=R8P) | in | Interpolated fields. | |
q0 | real(kind=R8P) | in | Conservative variables of cell 0. | |
q1 | real(kind=R8P) | in | Conservative variables of cell 1. | |
qL | real(kind=R8P) | out | Left state. | |
qR | real(kind=R8P) | out | Right state. |
Call graph
riemann_flux
Riemann-solver adapter of the shared face kernel: MHD LLF, ch the GLM cleaning speed, never a fallback.
Attributes: pure
fortran
subroutine riemann_flux(gamma, ch, d, qL, qR, f, fallback)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed. | |
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
qL | real(kind=R8P) | in | Left state. | |
qR | real(kind=R8P) | in | Right state. | |
f | real(kind=R8P) | out | Flux. | |
fallback | logical | out | Fallback flag (always false). |
Call graph
cell_flux
Cell-flux adapter of the shared face kernel: the MHD physical flux, gamma unused.
Attributes: pure
fortran
subroutine cell_flux(gamma, ch, d, q, qa, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed. | |
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
q | real(kind=R8P) | in | Conservative variables. | |
qa | real(kind=R8P) | in | Auxiliary variables. | |
f | real(kind=R8P) | out | Physical flux. |
Call graph