Appearance
adam_flume_cpu_euler_kernels
ADAM, FLUME CPU kernels of the Euler model.
The model-agnostic loop bodies (adam_flume_cpu_{face,aux}_kernels_agnostic.INC) instantiated on the Euler physics: the local arrays are sized by the Euler constants NV_K = NV_EULER, NV_AUX_K = NV_AUX (issue #41, section 4), plus the Euler signal-speed loop.
Source: src/app/flume/cpu/adam_flume_cpu_euler_kernels.F90
Dependencies
Contents
- compute_face_fluxes
- add_gravity_edge_correction
- compute_q_aux
- count_nonfinite
- compute_positivity_factors
- compute_seam_positivity_factors
- compute_backbone_fluxes
- positivity_cell_factor
- blend_positivity_fluxes
- blend_inadmissible_ghosts
- compute_lambda_max
- compute_lambda_max_dissipative
- face_split_fluxes
- backbone_face_flux
- cell_sources
- internal_energy
Subroutines
compute_face_fluxes
Compute the WENO 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: gather the stencil m = 1-S ... S into constant-bound locals, project and split it, reconstruct every field (the local v is the packed stencil of the WENO primitive), back-project.
fortran
subroutine compute_face_fluxes(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, gamma, ch, is_characteristic, weno, q, q_aux, fl)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. | |
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 conservative) variables. | |
weno | type(weno_object) | in | WENO coefficients. | |
q | real(kind=R8P) | in | Conservative variables. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
fl | real(kind=R8P) | inout | Face fluxes of direction d. |
Call graph
add_gravity_edge_correction
Add the faces beyond the block to the gravity energy correction of direction d (issue #73, M7-G2a): cell 1 takes -g_d F^rho / 24 of face -1 (between cells -1 and 0), cell n_d that of face n_d + 1 (between cells n_d + 1 and n_d + 2), the two terms of g_d (-F_{i-3/2} + F_{i-1/2} + F_{i+1/2} - F_{i+3/2}) / 24 whose faces the block does not hold. Each face is computed as compute_face_fluxes does (the same body, its mass component kept), from the ghosts: its stencil reaches S + 1 ghost cells, which the initialisation requires with gravity.
fortran
subroutine add_gravity_edge_correction(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, gamma, ch, is_characteristic, weno, ir, gd, q, q_aux, gc)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. | |
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 conservative) variables. | |
weno | type(weno_object) | in | WENO coefficients. | |
ir | integer(kind=I4P) | in | Index of the density (mass) variable. | |
gd | real(kind=R8P) | in | Gravity along d. | |
q | real(kind=R8P) | in | Conservative variables. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
gc | real(kind=R8P) | inout | Gravity energy correction [1, ...]. |
Call graph
compute_q_aux
Compute the auxiliary variables on every cell, ghost cells included.
fortran
subroutine compute_q_aux(ni, nj, nk, ngc, blocks_number, gamma, R, q, q_aux)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. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
gamma | real(kind=R8P) | in | Specific heats ratio. | |
R | real(kind=R8P) | in | Gas constant. | |
q | real(kind=R8P) | in | Conservative variables. | |
q_aux | real(kind=R8P) | inout | Auxiliary variables. |
Call graph
count_nonfinite
Count the non-finite (NaN or infinite) conservative values of the interior cells (issue #45): the exponent field has all its bits set. Tested on the bit pattern, so that no floating point mode can fold the test away.
fortran
subroutine count_nonfinite(ni, nj, nk, ngc, blocks_number, q, n)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. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
q | real(kind=R8P) | in | Conservative variables. | |
n | integer(kind=I8P) | out | Non-finite values number. |
Call graph
compute_positivity_factors
Compute the cell factor Lambda of every interior cell into lam(1,:,:,:,:) (the other components untouched) and count the cells whose backbone is not admissible (Lambda = 0 there: the floors, if enabled, take over) and those with a non-finite high-order face flux (Lambda = 0 too: a NaN or infinite flux carries no information, and every comparison with it is false, so the corner factors would keep it; tested on the bit pattern as count_nonfinite).
fortran
subroutine compute_positivity_factors(ni, nj, nk, ngc, blocks_number, gamma, ch, damping, hs, dt, g, has_phi, phi, dxyz, is_null, q, q_aux, flx, fly, flz, gc, lam, bad, nonfinite)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. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed (EGLM only). | |
damping | real(kind=R8P) | in | GLM damping rate (EGLM only). | |
hs | integer(kind=I4P) | in | Half stencil of the high-order sources. | |
dt | real(kind=R8P) | in | Forward-Euler step of the stage. | |
g | real(kind=R8P) | in | Gravity (issue #73), zero without it. | |
has_phi | logical | in | The cell potential is applied (issue #81). | |
phi | real(kind=R8P) | in | Gravitational potential (read with has_phi). | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q | real(kind=R8P) | in | Conservative variables (ghosts updated). | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
flx | real(kind=R8P) | in | X-face high-order fluxes. | |
fly | real(kind=R8P) | in | Y-face high-order fluxes. | |
flz | real(kind=R8P) | in | Z-face high-order fluxes. | |
gc | real(kind=R8P) | in | Gravity energy correction (zero without it). | |
lam | real(kind=R8P) | inout | Cell factors (component 1). | |
bad | integer(kind=I4P) | out | Cells with an inadmissible backbone. | |
nonfinite | integer(kind=I4P) | out | Cells with a non-finite high-order face flux. |
Call graph
compute_seam_positivity_factors
Recompute the factor of the cells beside a 2:1 seam with the seam faces' backbone and high-order fluxes overridden (issue #50, D1: per-stage seam flux synchronisation). Cell n is cell(1:4,n) = (i, j, k, b); its face fec (1..6: -x, +x, -y, +y, -z, +z) takes olo(:,fec,n) and ohi(:,fec,n) where omask(fec,n), the backbone flux of q and the high-order flux of flx/fly/flz elsewhere, exactly as compute_positivity_factors. dbad and dnonfinite return the change of the two counts against the factors without the overrides, which compute_positivity_factors has already counted.
fortran
subroutine compute_seam_positivity_factors(ngc, gamma, ch, damping, hs, dt, g, has_phi, phi, dxyz, is_null, q, q_aux, flx, fly, flz, gc, ncells, cell, omask, olo, ohi, lam, dbad, dnonfinite)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ngc | integer(kind=I4P) | in | Ghost cells number. | |
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed (EGLM only). | |
damping | real(kind=R8P) | in | GLM damping rate (EGLM only). | |
hs | integer(kind=I4P) | in | Half stencil of the high-order sources. | |
dt | real(kind=R8P) | in | Forward-Euler step of the stage. | |
g | real(kind=R8P) | in | Gravity (issue #73), zero without it. | |
has_phi | logical | in | The cell potential is applied (issue #81). | |
phi | real(kind=R8P) | in | Gravitational potential (read with has_phi). | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q | real(kind=R8P) | in | Conservative variables (ghosts updated). | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
flx | real(kind=R8P) | in | X-face high-order fluxes. | |
fly | real(kind=R8P) | in | Y-face high-order fluxes. | |
flz | real(kind=R8P) | in | Z-face high-order fluxes. | |
gc | real(kind=R8P) | in | Gravity energy correction (zero without it). | |
ncells | integer(kind=I4P) | in | Seam cells. | |
cell | integer(kind=I4P) | in | Seam cells (i, j, k, b) [4, ncells]. | |
omask | logical | in | Overridden faces [6, ncells]. | |
olo | real(kind=R8P) | in | Override backbone fluxes [nv, 6, ncells]. | |
ohi | real(kind=R8P) | in | Override high-order fluxes [nv, 6, ncells]. | |
lam | real(kind=R8P) | inout | Cell factors (component 1). | |
dbad | integer(kind=I4P) | out | Change of the inadmissible backbones count. | |
dnonfinite | integer(kind=I4P) | out | Change of the non-finite cells count. |
Call graph
compute_backbone_fluxes
Compute the backbone flux of n face state pairs of direction d (issue #50: the fine faces of a 2:1 seam take the coarse donor cell as their outer state).
fortran
subroutine compute_backbone_fluxes(n, d, gamma, ch, qL, qR, flo)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
n | integer(kind=I4P) | in | Faces number. | |
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed (EGLM only). | |
qL | real(kind=R8P) | in | Left states [nv, n]. | |
qR | real(kind=R8P) | in | Right states [nv, n]. | |
flo | real(kind=R8P) | out | Backbone fluxes [nv, n]. |
Call graph
positivity_cell_factor
The factor of one cell from its backbone update qb, the antidiffusive differences dlt(:,1:nf) of its active faces and the source difference dsrc: status 1 (and lc = 0) if the backbone is not admissible, 2 (and lc = 0) if a face difference is not finite (a NaN passes every comparison of the corners), else 0 with lc the largest factor of the corner box.
Attributes: pure
fortran
subroutine positivity_cell_factor(nf, qb, dlt, dsrc, lc, status)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
nf | integer(kind=I4P) | in | Active faces. | |
qb | real(kind=R8P) | in | Backbone update. | |
dlt | real(kind=R8P) | in | Antidiffusive differences. | |
dsrc | real(kind=R8P) | in | Source difference. | |
lc | real(kind=R8P) | out | Cell factor. | |
status | integer(kind=I4P) | out | 0 admissible, 1 inadmissible backbone, 2 non-finite. |
Call graph
blend_positivity_fluxes
Blend the face fluxes of direction d with the backbone: F <- F^LLF + theta (F - F^LLF), theta the smaller factor of the two cells (ghost factors from the exchange; a ghost never written keeps 1, so a physical-boundary face takes the interior cell's factor). Faces with theta = 1 are left untouched (bitwise), and counted otherwise; a face with theta = 0 takes the backbone flux itself (0 * NaN would keep a non-finite high-order flux).
fortran
subroutine blend_positivity_fluxes(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, gamma, ch, q, lam, fl, limited)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. | |
gamma | real(kind=R8P) | in | Specific heats ratio. | |
ch | real(kind=R8P) | in | GLM cleaning speed (EGLM only). | |
q | real(kind=R8P) | in | Conservative variables. | |
lam | real(kind=R8P) | in | Cell factors (component 1). | |
fl | real(kind=R8P) | inout | Face fluxes of direction d. | |
limited | integer(kind=I4P) | out | Faces with theta < 1. |
Call graph
blend_inadmissible_ghosts
Blend every inadmissible face ghost of q toward the adjacent interior cell and count the ghosts blended.
fortran
subroutine blend_inadmissible_ghosts(ni, nj, nk, ngc, blocks_number, is_null, q, blended)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. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
is_null | logical | in | Null directions. | |
q | real(kind=R8P) | inout | Conservative variables (ghosts updated). | |
blended | integer(kind=I4P) | out | Ghosts blended. |
Call graph
compute_lambda_max
Compute max(sum_d (|u_d| + a) / dx_d) over the interior cells (null directions excluded).
fortran
subroutine compute_lambda_max(ni, nj, nk, ngc, blocks_number, gamma, R, dxyz, is_null, q, lambda_max)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. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
gamma | real(kind=R8P) | in | Specific heats ratio. | |
R | real(kind=R8P) | in | Gas constant. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q | real(kind=R8P) | in | Conservative variables. | |
lambda_max | real(kind=R8P) | out | Maximum of sum_d (|u_d| + a) / dx_d. |
Call graph
compute_lambda_max_dissipative
Compute max(sum_d (|u_d| + a) / dx_d + 2 nu sum_d 1 / dx_d^2) over the interior cells (issue #65, D-M4-3), nu the largest diffusivity of the cell, with the maxima of the two parts and the minimum cell Reynolds number sum_d (|u_d| + a) / dx_d / (nu sum_d 1 / dx_d^2), (|u| + a) dx / nu on a uniform 1D grid.
fortran
subroutine compute_lambda_max_dissipative(ni, nj, nk, ngc, blocks_number, gamma, R, cp, mu0, k0, eta, t_wall, tref, omega_mu, omega_k, dxyz, is_null, q, lambda_max, lambda_hyp, lambda_dif, re_cell_min)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. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
gamma | real(kind=R8P) | in | Specific heats ratio, gas constant, cp. | |
R | real(kind=R8P) | in | Specific heats ratio, gas constant, cp. | |
cp | real(kind=R8P) | in | Specific heats ratio, gas constant, cp. | |
mu0 | real(kind=R8P) | in | Dissipative coefficients. | |
k0 | real(kind=R8P) | in | Dissipative coefficients. | |
eta | real(kind=R8P) | in | Dissipative coefficients. | |
t_wall | real(kind=R8P) | in | Hottest isothermal wall temperature, 0 if none. | |
tref | real(kind=R8P) | in | Temperature laws. | |
omega_mu | real(kind=R8P) | in | Temperature laws. | |
omega_k | real(kind=R8P) | in | Temperature laws. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q | real(kind=R8P) | in | Conservative variables. | |
lambda_max | real(kind=R8P) | out | Maximum of the sum. | |
lambda_hyp | real(kind=R8P) | out | Maximum of the hyperbolic part. | |
lambda_dif | real(kind=R8P) | out | Maximum of the diffusive part. | |
re_cell_min | real(kind=R8P) | out | Minimum cell Reynolds number. |
Call graph
face_split_fluxes
Split adapter of the shared face kernel (issue #41, M2-P3): the Euler split, ch unused.
Attributes: pure
fortran
subroutine face_split_fluxes(gamma, ch, d, S, is_characteristic, qs, qas, fsplit, 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 conservative) variables. | |
qs | real(kind=R8P) | in | Stencil conservative variables. | |
qas | real(kind=R8P) | in | Stencil auxiliary variables. | |
fsplit | real(kind=R8P) | out | Split 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
backbone_face_flux
Backbone adapter of the positivity limiter: the Rusanov flux, ch unused.
Attributes: pure
fortran
subroutine backbone_face_flux(gamma, ch, d, qL, qR, 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. | |
qL | real(kind=R8P) | in | Left state. | |
qR | real(kind=R8P) | in | Right state. | |
f | real(kind=R8P) | out | Flux. |
Call graph
cell_sources
Sources adapter of the positivity limiter: none (Euler).
Attributes: pure
fortran
subroutine cell_sources(ngc, hs, damping, dxyz, is_null, q, q_aux, i, j, k, b, s_lo, s_hi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ngc | integer(kind=I4P) | in | Ghost cells number. | |
hs | integer(kind=I4P) | in | Half stencil of the high-order sources. | |
damping | real(kind=R8P) | in | GLM damping rate. | |
dxyz | real(kind=R8P) | in | Block space steps. | |
is_null | logical | in | Null directions. | |
q | real(kind=R8P) | in | Conservative variables. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
i | integer(kind=I4P) | in | Cell indexes. | |
j | integer(kind=I4P) | in | Cell indexes. | |
k | integer(kind=I4P) | in | Cell indexes. | |
b | integer(kind=I4P) | in | Cell indexes. | |
s_lo | real(kind=R8P) | out | Backbone sources. | |
s_hi | real(kind=R8P) | out | High-order sources. |
Call graph
Functions
internal_energy
Internal-energy adapter of the positivity limiter: E minus the kinetic energy, per unit volume.
Attributes: pure
Returns: real(kind=R8P)
fortran
function internal_energy(q) result(e)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
q | real(kind=R8P) | in | Conservative variables. |
Call graph