Appearance
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) / 2eigenvalues (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
- compute_eigenvalues
- compute_eigenvectors
- compute_face_flux_back_projection
- compute_face_split_fluxes
- compute_flux
- compute_roe_average
- conservative_to_auxiliary
- primitive_to_conservative
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
qa | real(kind=R8P) | in | Auxiliary variables. | |
lambda | real(kind=R8P) | out | Eigenvalues. |
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
qa | real(kind=R8P) | in | Auxiliary variables (e.g. a Roe average). | |
el | real(kind=R8P) | out | Left eigenvectors, el(k,:) = l_k. | |
er | real(kind=R8P) | out | Right 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
is_characteristic | logical | in | Reconstruction variables: characteristic or conservative. | |
er | real(kind=R8P) | in | Right eigenvectors, er(:,k) = r_k (unused if conservative). | |
vr | real(kind=R8P) | in | Reconstructed split fields at the face. | |
flux | real(kind=R8P) | out | Face 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
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 (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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
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
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
qaL | real(kind=R8P) | in | Left state auxiliary variables. | |
qaR | real(kind=R8P) | in | Right state auxiliary variables. | |
roe | real(kind=R8P) | out | Roe 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
R | real(kind=R8P) | in | Gas constant. | |
q | real(kind=R8P) | in | Conservative variables. | |
qa | real(kind=R8P) | out | Auxiliary 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Specific heats ratio. | |
r | real(kind=R8P) | in | Density. | |
u | real(kind=R8P) | in | Velocity components. | |
v | real(kind=R8P) | in | Velocity components. | |
w | real(kind=R8P) | in | Velocity components. | |
p | real(kind=R8P) | in | Pressure. | |
q | real(kind=R8P) | out | Conservative variables. |
Call graph