Appearance
adam_flume_euler_baro_library
ADAM, FLUME pointwise barotropic Euler physics shared by the CPU and FNL backends (issue #100, M13 P3).
The body of adam_flume_euler_iso_library on a piecewise polytrope, [eos] type = barotropic: the energy slot is inert (D-M13-1) and the EOS argument named gamma carries the id of the realm's table in adam_flume_eos_tables_library (as a real). Only the four EOS hooks below differ from the isothermal library; the eigensystem, the Roe average and the LLF/HLL/HLLC fluxes are the body's, with c = sqrt(dP/drho) of each state.
ADAM, FLUME pointwise barotropic Euler physics, the body of adam_flume_euler_iso_library and adam_flume_euler_baro_library (issue #100, M13).
The including module renames NV_K, NV_AUX_K (its widths) and NV_BASE = NV_EULER, NV_AUX_BASE = NV_AUX (the Euler widths): the components NV_BASE+1 ... NV_K are advected scalars, as in the Euler body; with NV_K = NV_BASE every scalar loop is empty. The public interface is the Euler one, routine by routine, so the model-agnostic kernel bodies call either library unchanged; the EOS parameter keeps the Euler keyword gamma, and HERE IT IS physics%eos_arg: the isothermal sound speed squared c0^2, or the id of a barotropic table (adam_flume_eos_tables_library).
A barotropic gas, P = P(rho) (D-M13-1): the energy slot IQ_RE is inert. Its flux is zero, every Riemann flux forces it to zero, its eigenvalue is zero and its eigenvector the unit vector, so it keeps its initial value, 0. The including module provides the EOS as four pure hooks, the only places it enters: eos_pressure(gamma, rho), eos_temperature(gamma, R, rho) (P / (rho R)), eos_sound_speed(gamma, rho) (sqrt(dP/drho)) and eos_roe_sound_speed(gamma, rhoL, rhoR, pL, pR), the speed of the Roe average. The total enthalpy is undefined (0).
Eigensystem in direction d: normal n = e_d, tangents taken cyclically t1 = e_{mod(d,3)+1}, t2 = e_{mod(d+1,3)+1}, waves in the Euler order with the inert slot in the place of the entropy wave:
r1 = (1, u - a n, 0) l1 = ((u_n + a) / (2 a), -n / (2 a), 0) lambda1 = u_n - a
r2 = (0, 0, 1) l2 = (0, 0, 1) lambda2 = 0 (the inert slot)
r3 = (0, t1, 0) l3 = (-u.t1, t1, 0) lambda3 = u_n
r4 = (0, t2, 0) l4 = (-u.t2, t2, 0) lambda4 = u_n
r5 = (1, u + a n, 0) l5 = (-(u_n - a) / (2 a), n / (2 a), 0) lambda5 = u_n + achecked against dF/dU in src/tests/flume/verification/eos/eos_oracle.py (eigen). The Roe average of two barotropic states is the sqrt(rho)-weighted velocity with the speed of eos_roe_sound_speed: c0 for the isothermal gas, the secant sqrt([P] / [rho]) for a table (the Roe property [F] = A~ [U] needs exactly that speed).
Source: src/app/flume/common/adam_flume_euler_baro_library.F90
Dependencies
Contents
- compute_eigenvalues
- compute_eigenvectors
- compute_face_flux_back_projection
- compute_face_interpolation_fields
- compute_face_split_fluxes
- compute_face_states
- compute_flux
- compute_roe_average
- compute_riemann_hll
- compute_riemann_hllc
- compute_riemann_llf
- conservative_to_auxiliary
- primitive_to_conservative
- hll_flux
- compute_state_magnitudes
- eos_pressure
- eos_temperature
- eos_sound_speed
- eos_roe_sound_speed
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
ROE_SECANT_MIN | real(kind=R8P) | parameter | Relative density gap below which the Roe speed is c(rho mean). |
Subroutines
compute_eigenvalues
Compute the eigenvalues of the flux Jacobian in direction d: (u_n - a, 0, 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 | Isothermal sound speed squared c0^2 (unused: a is in qa). | |
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_interpolation_fields
Return the fields of the stencil of face i+1/2 to be WENO-interpolated to the face (scheme weno-riemann), in the layout of the Euler body: characteristic w = L q on the Roe average of cells 0 and 1, or primitive (rho, u, v, w, slot), the inert slot in the place of the pressure (P = c0^2 rho needs no separate field).
Attributes: pure
fortran
subroutine compute_face_interpolation_fields(gamma, d, S, is_characteristic, qs, qas, fint, er, mu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Isothermal sound speed squared c0^2. | |
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 (unused if primitive). | |
mu | real(kind=R8P) | out | Magnitude 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 Euler body's algorithm on the isothermal eigensystem (the inert field has speed 0, state 0 and flux 0: it splits to 0).
Attributes: pure
fortran
subroutine compute_face_split_fluxes(gamma, d, S, is_characteristic, qs, qas, fsplit, er, mu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Isothermal sound speed squared c0^2. | |
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). | |
mu | real(kind=R8P) | out | Magnitude 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. A state with a non-positive density (or an inadmissible scalar) is replaced by the state of its cell: the face falls back to first order. The pressure follows from the density, so the density is the only thermodynamic condition.
Attributes: pure
fortran
subroutine compute_face_states(gamma, is_characteristic, er, vr, q0, q1, qL, qR)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Isothermal sound speed squared c0^2. | |
is_characteristic | logical | in | Characteristic (or primitive) variables. | |
er | real(kind=R8P) | in | Right eigenvectors (unused if primitive). | |
vr | real(kind=R8P) | in | Interpolated fields. | |
q0 | real(kind=R8P) | in | Conservative variables of cell 0 (left of the face). | |
q1 | real(kind=R8P) | in | Conservative variables of cell 1 (right of the face). | |
qL | real(kind=R8P) | out | Left state. | |
qR | real(kind=R8P) | out | Right state. |
Call graph
compute_flux
Compute the physical flux in direction d: rho u_d (1, u, v, w, 0) + p (0, e_d, 0), p = c0^2 rho.
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 barotropic states: the sqrt(rho)-weighted velocity, the density sqrt(rho_L rho_R), the speed of eos_roe_sound_speed and the pressure of the average density; enthalpy and temperature are 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 | EOS parameter (eos_arg). | |
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
compute_riemann_hll
Compute the HLL flux of two isothermal states in direction d with the Einfeldt speeds S_L = min(u_nL - c0, u~_n - c0), S_R = max(u_nR + c0, u~_n + c0) (~ the Roe average); the inert slot's flux is zero.
Attributes: pure
fortran
subroutine compute_riemann_hll(gamma, d, qL, qR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Isothermal sound speed squared c0^2. | |
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
compute_riemann_hllc
Compute the isothermal HLLC flux of two states in direction d: HLL for the mass and the normal momentum, the transverse momenta and the advected scalars the HLL mass flux times the upwind specific value (the contact, the only wave the isothermal system has between the acoustic ones, carries the tangential velocity and the scalars and nothing else: it needs no star pressure). Checked against eos_oracle.py (flux: consistency, isolated contact).
Attributes: pure
fortran
subroutine compute_riemann_hllc(gamma, d, qL, qR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Isothermal sound speed squared c0^2. | |
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
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|) + c0; the inert slot's flux is zero.
Attributes: pure
fortran
subroutine compute_riemann_llf(gamma, d, qL, qR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Isothermal sound speed squared c0^2. | |
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
conservative_to_auxiliary
Compute the auxiliary variables of a cell from its conservative variables: p = P(rho), a = sqrt(dP/drho), T = P / (rho R), H = 0 (no energy equation).
Attributes: pure
fortran
subroutine conservative_to_auxiliary(gamma, R, q, qa)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter (eos_arg). | |
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: the pressure is not a state variable of the isothermal gas (P = c0^2 rho), so p is ignored and the inert slot set to 0 (the advected scalars, if any, are the caller's).
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 | Isothermal sound speed squared c0^2 (unused). | |
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 (ignored). | |
q | real(kind=R8P) | out | Conservative variables. |
Call graph
hll_flux
The HLL flux with the Einfeldt speeds, its auxiliary states, physical fluxes and speeds (shared by HLL and HLLC).
Attributes: pure
fortran
subroutine hll_flux(gamma, d, qL, qR, qaL, qaR, fL, fR, sL, sR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Isothermal sound speed squared c0^2. | |
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. | |
qaL | real(kind=R8P) | out | Left auxiliary variables. | |
qaR | real(kind=R8P) | out | Right auxiliary variables. | |
fL | real(kind=R8P) | out | Left physical flux. | |
fR | real(kind=R8P) | out | Right physical flux. | |
sL | real(kind=R8P) | out | Left and right wave speeds. | |
sR | real(kind=R8P) | out | Left and right wave speeds. | |
f | real(kind=R8P) | out | Flux. |
Call graph
compute_state_magnitudes
Return the reference magnitude of each conservative variable of a cell, the WENO descaler scale (the Euler body's definition: |rho|, the inert slot |q_5|, every momentum component |rho u|_1 + sqrt(rho p)).
Attributes: pure
fortran
subroutine compute_state_magnitudes(q, qa, qm)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
q | real(kind=R8P) | in | Conservative variables. | |
qa | real(kind=R8P) | in | Auxiliary variables. | |
qm | real(kind=R8P) | out | Reference magnitudes. |
Call graph
Functions
eos_pressure
P(rho) of the table.
Attributes: pure
Returns: real(kind=R8P)
fortran
function eos_pressure(gamma, rho) result(p)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Table id. | |
rho | real(kind=R8P) | in | Density. |
Call graph
eos_temperature
T = P / (rho R).
Attributes: pure
Returns: real(kind=R8P)
fortran
function eos_temperature(gamma, R, rho) result(t)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Table id. | |
R | real(kind=R8P) | in | Gas constant. | |
rho | real(kind=R8P) | in | Density. |
Call graph
eos_sound_speed
a = sqrt(dP/drho).
Attributes: pure
Returns: real(kind=R8P)
fortran
function eos_sound_speed(gamma, rho) result(a)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Table id. | |
rho | real(kind=R8P) | in | Density. |
Call graph
eos_roe_sound_speed
The speed of the Roe average, the secant sqrt([P] / [rho]): with it the Roe matrix satisfies [F] = A~ [U] for any P(rho). P increases with rho, so the secant is positive, between the two one-sided speeds of a segment and across breaks too. Below a relative density gap of ROE_SECANT_MIN the secant loses digits to cancellation (about eps / gap) while the mid-point speed errs by O(gap^2): there the speed is c(rho mean), both errors below 2e-10.
Attributes: pure
Returns: real(kind=R8P)
fortran
function eos_roe_sound_speed(gamma, rhoL, rhoR, pL, pR) result(a)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | Table id. | |
rhoL | real(kind=R8P) | in | Densities. | |
rhoR | real(kind=R8P) | in | Densities. | |
pL | real(kind=R8P) | in | Pressures. | |
pR | real(kind=R8P) | in | Pressures. |
Call graph