Skip to content

adam_flume_euler_library ​

ADAM, FLUME pointwise Euler physics shared by the CPU and FNL backends.

Every routine is pure, takes explicit-size dummies and is tagged !$acc routine seq + !$omp declare target, so CPU loops and FNL device kernels call the SAME source: CPU/FNL agreement is then a property of the loops only. Calorically perfect ideal gas: p = (gamma-1) (rE - rho |u|^2 / 2), T = p / (rho R), a = sqrt(gamma p / rho).

Eigensystem in direction d (issue #35, section 3.3): normal n = e_d, tangents taken cyclically, t1 = e_{mod(d,3)+1}, t2 = e_{mod(d+1,3)+1}; with b2 = (gamma-1)/a^2, b1 = b2 |u|^2 / 2, u_n = u.n:

 r1 = (1, u - a n, H - a u_n)        l1 = (b1 + u_n/a, -b2 u - n/a, b2) / 2
 r2 = (1, u, |u|^2 / 2)              l2 = (1 - b1, b2 u, -b2)
 r3 = (0, t1, u.t1)                  l3 = (-u.t1, t1, 0)
 r4 = (0, t2, u.t2)                  l4 = (-u.t2, t2, 0)
 r5 = (1, u + a n, H + a u_n)        l5 = (b1 - u_n/a, -b2 u + n/a, b2) / 2

eigenvalues (u_n - a, u_n, u_n, u_n, u_n + a). Storage, stated once: el(k,:) is the row l_k, er(:,k) is the column r_k; projection w_k = sum_v el(k,v) q_v, back-projection q_v = sum_k er(v,k) w_k.

The WENO reconstruction primitive differs between host (adam_weno_object) and device (adam_fnl_weno_kernels), so the per-face flux is split in two physics halves around it (issue #35, section 7.1): compute_face_split_fluxes projects and splits the stencil, the backend reconstructs each field, compute_face_flux_back_projection returns to conservative variables.

Source: src/app/flume/common/adam_flume_euler_library.F90

Dependencies

Contents ​

Subroutines ​

compute_eigenvalues ​

Compute the eigenvalues of the flux Jacobian in direction d: (u_n - a, u_n, u_n, u_n, u_n + a).

Attributes: pure

fortran
subroutine compute_eigenvalues(d, qa, lambda)

Arguments

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
qareal(kind=R8P)inAuxiliary variables.
lambdareal(kind=R8P)outEigenvalues.

Call graph

compute_eigenvectors ​

Compute the left (rows) and right (columns) eigenvectors of the flux Jacobian in direction d at state qa.

Attributes: pure

fortran
subroutine compute_eigenvectors(gamma, d, qa, el, er)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
qareal(kind=R8P)inAuxiliary variables (e.g. a Roe average).
elreal(kind=R8P)outLeft eigenvectors, el(k,:) = l_k.
erreal(kind=R8P)outRight eigenvectors, er(:,k) = r_k.

Call graph

compute_face_flux_back_projection ​

Return the face flux in conservative variables from the reconstructed split fields, F = R (f+ + f-).

Attributes: pure

fortran
subroutine compute_face_flux_back_projection(is_characteristic, er, vr, flux)

Arguments

NameTypeIntentAttributesDescription
is_characteristiclogicalinReconstruction variables: characteristic or conservative.
erreal(kind=R8P)inRight eigenvectors, er(:,k) = r_k (unused if conservative).
vrreal(kind=R8P)inReconstructed split fields at the face.
fluxreal(kind=R8P)outFace flux.

Call graph

compute_face_interpolation_fields ​

Return the fields of the stencil of face i+1/2 to be WENO-interpolated to the face (scheme weno-riemann).

The stencil holds cells m = 1-S ... S relative to cell i (cell i+1 is m = 1). Characteristic variant: the conservative states projected on the left eigenvectors of the Roe average of cells 0 and 1, w = L q; primitive variant: (rho, u, v, w, p). Stored in the layout of the WENO upwind primitive: fint(2,m,k) = field k of cell m for m = 1-S ... S-1 (interpolated toward the left state), fint(1,m,k) = field k of cell m+1 (toward the right state). er returns the right eigenvectors for compute_face_states. mu returns the magnitude of each field, the stencil mean of the absolute projection sum_v |l_kv| qm_v (qm the reference magnitudes of compute_state_magnitudes; |w_k| for the primitive fields), floored at tiny: the descaler of the scale-invariant WENO weights (issue #49). It scales exactly like the field and, unlike the field, does not vanish where the projection on the local state does.

Attributes: pure

fortran
subroutine compute_face_interpolation_fields(gamma, d, S, is_characteristic, qs, qas, fint, er, mu)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
Sinteger(kind=I4P)inWENO stencil half-width, S <= S_MAX.
is_characteristiclogicalinCharacteristic (or primitive) variables.
qsreal(kind=R8P)inStencil conservative variables.
qasreal(kind=R8P)inStencil auxiliary variables.
fintreal(kind=R8P)outFields in the WENO upwind layout.
erreal(kind=R8P)outRight eigenvectors (unused if primitive).
mureal(kind=R8P)outMagnitude of each field (WENO descaler).

Call graph

compute_face_split_fluxes ​

Project and Lax-Friedrichs-split the stencil of face i+1/2, ready for the WENO upwind reconstruction.

The stencil holds cells m = 1-S ... S relative to cell i (cell i+1 is m = 1). Characteristic variant: Roe eigenvectors of cells 0 and 1, per-wave speeds alpha_k = max_m |lambda_k(m)|, w = L q, g = L f_d(q); conservative variant: no projection, one speed alpha = max_m (|u_n| + a). Split f+ = (g + alpha w) / 2, f- = g - f+, stored in the layout of the WENO upwind primitive: fsplit(2,m,k) = f+ of cell m for m = 1-S ... S-1, fsplit(1,m,k) = f- of cell m+1. er returns the right eigenvectors for the back-projection. mu returns the magnitude of each split field, the stencil mean of sum_v |l_kv| (|f_v| + alpha_max qm_v) / 2, alpha_max the largest of the speeds alpha_k and qm_v >= |q_v| the reference magnitudes of compute_state_magnitudes: an upper bound of |f+-| cell by cell, floored at tiny, the descaler of the scale-invariant WENO weights (issue #49). It is exact under power-of-two scaling and never zero on a physical state, even for a field that vanishes identically or travels at zero speed, so round-off is never weighted as data.

Attributes: pure

fortran
subroutine compute_face_split_fluxes(gamma, d, S, is_characteristic, qs, qas, fsplit, er, mu)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
Sinteger(kind=I4P)inWENO stencil half-width, S <= S_MAX.
is_characteristiclogicalinCharacteristic (or conservative) variables.
qsreal(kind=R8P)inStencil conservative variables.
qasreal(kind=R8P)inStencil auxiliary variables.
fsplitreal(kind=R8P)outSplit fields in the WENO upwind layout.
erreal(kind=R8P)outRight eigenvectors (identity if conservative).
mureal(kind=R8P)outMagnitude of each field (WENO descaler).

Call graph

compute_face_states ​

Return the conservative left and right states of face i+1/2 from the WENO-interpolated fields.

vr(2,k) is field k interpolated from the left (left state), vr(1,k) from the right (right state), as returned by the WENO primitive on the layout of compute_face_interpolation_fields. A state with non-positive density or pressure is replaced by the state of its cell (q0 left, q1 right): the face falls back to first order.

Attributes: pure

fortran
subroutine compute_face_states(gamma, is_characteristic, er, vr, q0, q1, qL, qR)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
is_characteristiclogicalinCharacteristic (or primitive) variables.
erreal(kind=R8P)inRight eigenvectors (unused if primitive).
vrreal(kind=R8P)inInterpolated fields.
q0real(kind=R8P)inConservative variables of cell 0 (left of the face).
q1real(kind=R8P)inConservative variables of cell 1 (right of the face).
qLreal(kind=R8P)outLeft state.
qRreal(kind=R8P)outRight state.

Call graph

compute_flux ​

Compute the physical flux in direction d: rho u_d (1, u, v, w, H) + p (0, e_d, 0).

Attributes: pure

fortran
subroutine compute_flux(d, q, qa, f)

Arguments

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
qreal(kind=R8P)inConservative variables.
qareal(kind=R8P)inAuxiliary variables.
freal(kind=R8P)outPhysical flux.

Call graph

compute_roe_average ​

Compute the Roe average of two states: sqrt(rho)-weighted velocity and total enthalpy.

The average holds density, velocity, total enthalpy, speed of sound and the matching pressure p = rho a^2 / gamma; temperature is not defined for the Roe state and is set to zero.

Attributes: pure

fortran
subroutine compute_roe_average(gamma, qaL, qaR, roe)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
qaLreal(kind=R8P)inLeft state auxiliary variables.
qaRreal(kind=R8P)inRight state auxiliary variables.
roereal(kind=R8P)outRoe average.

Call graph

compute_riemann_hll ​

Compute the HLL flux of two states in direction d (Harten, Lax & van Leer 1983) with the Einfeldt speeds S_L = min(u_nL - a_L, u~_n - a~), S_R = max(u_nR + a_R, u~_n + a~) (Roe averages, Einfeldt et al. 1991): F = f(qL) if S_L >= 0, f(qR) if S_R <= 0, else (S_R f(qL) - S_L f(qR) + S_L S_R (qR - qL)) / (S_R - S_L).

Attributes: pure

fortran
subroutine compute_riemann_hll(gamma, d, qL, qR, f)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
qLreal(kind=R8P)inLeft state.
qRreal(kind=R8P)inRight state.
freal(kind=R8P)outFlux.

Call graph

compute_riemann_hllc ​

Compute the HLLC flux of two states in direction d (Toro, Spruce & Speares 1994) with the Einfeldt outer speeds S_L, S_R of compute_riemann_hll and the contact speed of Batten et al. (1997) S_M = (p_R - p_L + rho_L u_nL (S_L - u_nL) - rho_R u_nR (S_R - u_nR)) / (rho_L (S_L - u_nL) - rho_R (S_R - u_nR)); star state q*_K = c_K (1, u with u_n replaced by S_M, E_K/rho_K + (S_M - u_nK)(S_M + p_K/(rho_K (S_K - u_nK)))), c_K = rho_K (S_K - u_nK) / (S_K - S_M); F = f(qL), f(qL) + S_L (q*_L - qL), f(qR) + S_R (q*_R - qR) or f(qR) by the sign of S_L, S_M, S_R.

Attributes: pure

fortran
subroutine compute_riemann_hllc(gamma, d, qL, qR, f)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
qLreal(kind=R8P)inLeft state.
qRreal(kind=R8P)inRight state.
freal(kind=R8P)outFlux.

Call graph

compute_riemann_llf ​

Compute the local Lax-Friedrichs (Rusanov) flux of two states in direction d, F = (f(qL) + f(qR)) / 2 - alpha (qR - qL) / 2, alpha = max(|u_n| + a) of the two states.

Attributes: pure

fortran
subroutine compute_riemann_llf(gamma, d, qL, qR, f)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
qLreal(kind=R8P)inLeft state.
qRreal(kind=R8P)inRight state.
freal(kind=R8P)outFlux.

Call graph

conservative_to_auxiliary ​

Compute the auxiliary (primitive and derived) variables of a cell from its conservative variables.

Attributes: pure

fortran
subroutine conservative_to_auxiliary(gamma, R, q, qa)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
Rreal(kind=R8P)inGas constant.
qreal(kind=R8P)inConservative variables.
qareal(kind=R8P)outAuxiliary variables.

Call graph

primitive_to_conservative ​

Compute the conservative variables of a cell from its primitive variables.

Attributes: pure

fortran
subroutine primitive_to_conservative(gamma, r, u, v, w, p, q)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
rreal(kind=R8P)inDensity.
ureal(kind=R8P)inVelocity components.
vreal(kind=R8P)inVelocity components.
wreal(kind=R8P)inVelocity components.
preal(kind=R8P)inPressure.
qreal(kind=R8P)outConservative variables.

Call graph

compute_einfeldt_speeds ​

Compute the Einfeldt outer wave speeds of two states in direction d: S_L = min(u_nL - a_L, u~_n - a~), S_R = max(u_nR + a_R, u~_n + a~), ~ the Roe average.

Attributes: pure

fortran
subroutine compute_einfeldt_speeds(gamma, d, qaL, qaR, sL, sR)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
qaLreal(kind=R8P)inLeft auxiliary variables.
qaRreal(kind=R8P)inRight auxiliary variables.
sLreal(kind=R8P)outLeft and right wave speeds.
sRreal(kind=R8P)outLeft and right wave speeds.

Call graph

compute_hllc_star_flux ​

Compute the HLLC star-region flux f_K + S_K (q*_K - q_K) of the side K with outer speed s = S_K.

Attributes: pure

fortran
subroutine compute_hllc_star_flux(d, s, sM, q, qa, fK, f)

Arguments

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
sreal(kind=R8P)inOuter wave speed of the side.
sMreal(kind=R8P)inContact wave speed.
qreal(kind=R8P)inConservative variables of the side.
qareal(kind=R8P)inAuxiliary variables of the side.
fKreal(kind=R8P)inPhysical flux of the side.
freal(kind=R8P)outStar-region flux.

Call graph

compute_state_magnitudes ​

Return the reference magnitude of each conservative variable of a cell, the scale entering the WENO descaler mu in place of |q_v|: |rho|, |E| and, for every momentum component, |rho u|_1 + sqrt(rho p).

Why: a characteristic row that touches only components vanishing identically (the shear field of the out-of-plane momentum of a 2-D flow) would otherwise get a descaler of round-off size, and the scale-invariant weights would treat round-off as data: full nonlinear weights on noise, which nothing damps (issue #49, MV-7). The magnitude of the whole vector plus sqrt(rho p) never vanishes and scales exactly like a momentum component under power-of-two scaling (rho p scales by a power of four); the three terms are summed in increasing order, so rotations of the problem are bitwise invariant.

Attributes: pure

fortran
subroutine compute_state_magnitudes(q, qa, qm)

Arguments

NameTypeIntentAttributesDescription
qreal(kind=R8P)inConservative variables.
qareal(kind=R8P)inAuxiliary variables.
qmreal(kind=R8P)outReference magnitudes.

Call graph