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_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.

Attributes: pure

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

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).

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

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