Appearance
adam_flume_mhd_baro_library
ADAM, FLUME pointwise barotropic MHD physics and Riemann solvers shared by the CPU and FNL backends (issue #100, M13 P5).
Every routine is pure, takes explicit-size dummies and is tagged !$acc routine seq + !$omp declare target. The public interface repeats, routine by routine, the one adam_flume_mhd_library and adam_flume_mhd_riemann_library give the MHD kernels and objects without divergence control and with the mixed GLM (EGLM is refused for these gases). 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). The body (adam_flume_mhd_iso_library_body.INC) documents the eigensystem (Kim et al. 1999) and the HLLD solver (Mignone 2007).
Source: src/app/flume/common/adam_flume_mhd_baro_library.F90
Dependencies
Contents
- mhd_conservative_to_auxiliary
- mhd_eigenvalues
- mhd_eigenvectors
- mhd_face_average
- mhd_face_flux_back_projection
- mhd_face_split_fluxes
- mhd_flux
- mhd_frame_indexes
- mhd_glm_eigenvalues
- mhd_glm_eigenvectors
- mhd_glm_face_flux_back_projection
- mhd_glm_face_split_fluxes
- mhd_glm_flux
- mhd_primitive_to_conservative
- mhd_state_magnitudes
- mhd_backbone_flux
- mhd_face_interpolation_fields
- mhd_face_states
- mhd_glm_face_interpolation_fields
- mhd_glm_face_states
- mhd_glm_riemann_hll
- mhd_glm_riemann_hlld
- mhd_glm_riemann_llf
- mhd_riemann_hll
- mhd_riemann_hlld
- mhd_riemann_llf
- mhd_eigenvectors_core
- mhd_wave_eigenvalues
- frame_flux
- frame_hll
- frame_hlld
- frame_llf
- frame_speeds
- frame_state
- glm_face_subsystem
- hll_select
- hlld_star
- scatter_glm_flux
- mhd_fast_speed
- mhd_sum3
- frame_fast_speed
- is_admissible
- wu_speed
- eos_pressure
- eos_temperature
- eos_sound_speed
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
EPS_BT | real(kind=R8P) | parameter | Degenerate transverse field: |B_t| <= EPS_BT max(|B|, sqrt(rho) a). |
EPS_FS | real(kind=R8P) | parameter | Degenerate fast-slow pair (triple umbilic): c_f^2 - c_s^2 <= EPS_FS c_f^2. |
EPS_HLLD | real(kind=R8P) | parameter | Degenerate HLLD star: rho* |(S-S*_L)(S-S*_R)| <= EPS_HLLD (rho (S-u)^2 + B_n^2). |
Subroutines
mhd_conservative_to_auxiliary
Compute the auxiliary variables of a cell: qa(IA_P) = P(rho), qa(IA_A) = sqrt(dP/drho), qa(IA_H) the total pressure over the density (no enthalpy without an energy equation), the field copied into qa(IA_BX:IA_BZ).
Attributes: pure
fortran
subroutine mhd_conservative_to_auxiliary(gamma, R, q, qa)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
R | real(kind=R8P) | in | Gas constant. | |
q | real(kind=R8P) | in | Conservative variables. | |
qa | real(kind=R8P) | out | Auxiliary variables. |
Call graph
mhd_eigenvalues
Compute the eigenvalues in direction d: (u_n - c_f, u_n - c_a, u_n - c_s, u_n + c_s, u_n + c_a, u_n + c_f, 0, 0), the last two of the inert energy slot and of the decoupled B_n.
Attributes: pure
fortran
subroutine mhd_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
mhd_eigenvectors
Compute the left (rows) and right (columns) eigenvectors in direction d at state qa: the 6x6 core of Kim et al. on (rho, rho u_n, rho u_t1, rho u_t2, B_t1, B_t2), the inert energy slot and the decoupled B_n (unit rows).
Attributes: pure
fortran
subroutine mhd_eigenvectors(gamma, d, qa, el, er)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter (unused: the core reads qa(IA_A)). | |
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
qa | real(kind=R8P) | in | Auxiliary variables (e.g. a face 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
mhd_face_average
Compute the arithmetic average of two states for the face eigenvectors: density, velocity and field averaged, the pressure and the speed of sound of the averaged density (a physical state, so its eigensystem is exact).
Attributes: pure
fortran
subroutine mhd_face_average(gamma, qaL, qaR, avg)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
qaL | real(kind=R8P) | in | Left state auxiliary variables. | |
qaR | real(kind=R8P) | in | Right state auxiliary variables. | |
avg | real(kind=R8P) | out | Average state auxiliary variables. |
Call graph
mhd_face_flux_back_projection
Return the face flux in conservative variables from the reconstructed split fields, F = R (f+ + f-).
Attributes: pure
fortran
subroutine mhd_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
mhd_face_split_fluxes
Project and Lax-Friedrichs-split the stencil of face i+1/2 (no divergence control), as the adiabatic library: the eigenvectors of the arithmetic face average; the energy slot and the B_n row have speed 0 and zero flux.
Attributes: pure
fortran
subroutine mhd_face_split_fluxes(gamma, d, S, is_characteristic, qs, qas, fsplit, er, mu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_flux
Compute the physical flux in direction d: (rho u_n, rho u u_n + p_t n - B B_n, 0, B u_n - u B_n), `p_t = P(rho)
- |B|^2 / 2
, the energy slot and theB_n` component zero.
Attributes: pure
fortran
subroutine mhd_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
mhd_frame_indexes
Return the conservative variables in the frame order of direction d, (rho, rho u_n, rho u_t1, rho u_t2, slot5, B_n, B_t1, B_t2), tangents cyclic (bitwise rotation invariance, issue #41, MV-4).
Attributes: pure
fortran
subroutine mhd_frame_indexes(d, pv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
pv | integer(kind=I4P) | out | Full-state index of each frame variable. |
Call graph
mhd_glm_eigenvalues
Compute the eigenvalues with GLM cleaning in direction d: the six waves, the energy slot (0) and the (B_n, psi) pair -c_h, +c_h.
Attributes: pure
fortran
subroutine mhd_glm_eigenvalues(ch, d, qa, lambda)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
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
mhd_glm_eigenvectors
Compute the left (rows) and right (columns) eigenvectors with GLM cleaning in direction d: block-diagonal, the core, the energy slot and the (B_n, psi) pair of the flux (psi, c_h^2 B_n), r = (1, -+c_h), l = (1, -+1/c_h) / 2.
Attributes: pure
fortran
subroutine mhd_glm_eigenvectors(ch, gamma, d, qa, el, er)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
gamma | real(kind=R8P) | in | EOS parameter (unused: the core reads qa(IA_A)). | |
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
qa | real(kind=R8P) | in | Auxiliary variables (e.g. a face 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
mhd_glm_face_flux_back_projection
Return the face flux in conservative variables from the reconstructed split fields, F = R (f+ + f-) (GLM).
Attributes: pure
fortran
subroutine mhd_glm_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
mhd_glm_face_split_fluxes
Project and Lax-Friedrichs-split the stencil of face i+1/2 (GLM cleaning): as mhd_face_split_fluxes, with the (B_n, psi) pair at speeds -+c_h (conservative variant: one speed, max(|u_n| + c_f, c_h)).
Attributes: pure
fortran
subroutine mhd_glm_face_split_fluxes(ch, gamma, d, S, is_characteristic, qs, qas, fsplit, er, mu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_glm_flux
Compute the physical flux with GLM cleaning in direction d: the flux with the B_n component psi and the psi component c_h^2 B_n (mixed GLM).
Attributes: pure
fortran
subroutine mhd_glm_flux(ch, d, q, qa, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
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
mhd_primitive_to_conservative
Compute the conservative variables of a cell from its primitive variables: the energy slot is inert (0), the pressure p is that of the gas law and is not read (psi, if any, is set by the caller).
Attributes: pure
fortran
subroutine mhd_primitive_to_conservative(gamma, r, u, v, w, p, bx, by, bz, q)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter (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 (unused: P(rho)). | |
bx | real(kind=R8P) | in | Magnetic field components. | |
by | real(kind=R8P) | in | Magnetic field components. | |
bz | real(kind=R8P) | in | Magnetic field components. | |
q | real(kind=R8P) | out | Conservative variables. |
Call graph
mhd_state_magnitudes
Return the reference magnitude of each conservative variable of a cell (the WENO descaler scales, as the adiabatic library: momentum |rho u|_1 + sqrt(rho p), field |B|_1 + sqrt(p), p = P(rho); the inert slot its own value).
Attributes: pure
fortran
subroutine mhd_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
mhd_backbone_flux
Compute the positivity backbone flux of two states in direction d (no divergence control): the Lax-Friedrichs flux with the Wu speed, as the adiabatic library.
Attributes: pure
fortran
subroutine mhd_backbone_flux(gamma, d, qL, qR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_face_interpolation_fields
Compute the fields of the stencil of face i+1/2 to interpolate (no divergence control), in the WENO upwind layout: characteristic, or primitive (rho, u, v, w, 0, B_x, B_y, B_z) (the inert slot in place of p).
Attributes: pure
fortran
subroutine mhd_face_interpolation_fields(gamma, d, S, is_characteristic, qs, qas, fint, er, mu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_face_states
Compute the two face states from the interpolated fields (no divergence control): the left state from vr(2,:), the right one from vr(1,:); a state with non-positive density falls back to its cell.
Attributes: pure
fortran
subroutine mhd_face_states(gamma, is_characteristic, er, vr, q0, q1, qL, qR)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
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. | |
q1 | real(kind=R8P) | in | Conservative variables of cell 1. | |
qL | real(kind=R8P) | out | Left state. | |
qR | real(kind=R8P) | out | Right state. |
Call graph
mhd_glm_face_interpolation_fields
Compute the fields of the stencil of face i+1/2 to interpolate (GLM): as mhd_face_interpolation_fields, psi the ninth field (primitive) or the GLM eigenvectors (characteristic).
Attributes: pure
fortran
subroutine mhd_glm_face_interpolation_fields(ch, gamma, d, S, is_characteristic, qs, qas, fint, er, mu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_glm_face_states
Compute the two face states from the interpolated fields (GLM): as mhd_face_states, psi included.
Attributes: pure
fortran
subroutine mhd_glm_face_states(gamma, is_characteristic, er, vr, q0, q1, qL, qR)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
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. | |
q1 | real(kind=R8P) | in | Conservative variables of cell 1. | |
qL | real(kind=R8P) | out | Left state. | |
qR | real(kind=R8P) | out | Right state. |
Call graph
mhd_glm_riemann_hll
Compute the HLL flux of two states in direction d (GLM, the (B_n, psi) subsystem solved exactly).
Attributes: pure
fortran
subroutine mhd_glm_riemann_hll(ch, gamma, d, qL, qR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_glm_riemann_hlld
Compute the HLLD flux of two states in direction d (GLM, the (B_n, psi) subsystem solved exactly); fallback is set when HLL replaced HLLD.
Attributes: pure
fortran
subroutine mhd_glm_riemann_hlld(ch, gamma, d, qL, qR, f, fallback)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
gamma | real(kind=R8P) | in | EOS parameter. | |
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. | |
fallback | logical | out | HLL used instead of HLLD. |
Call graph
mhd_glm_riemann_llf
Compute the LLF flux of two states in direction d (GLM, the (B_n, psi) subsystem solved exactly).
Attributes: pure
fortran
subroutine mhd_glm_riemann_llf(ch, gamma, d, qL, qR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_riemann_hll
Compute the HLL flux of two states in direction d (no divergence control, each state's own B_n).
Attributes: pure
fortran
subroutine mhd_riemann_hll(gamma, d, qL, qR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_riemann_hlld
Compute the HLLD flux of two states in direction d (no divergence control, B_n the average of the two states, its flux zero); fallback is set when HLL replaced HLLD.
Attributes: pure
fortran
subroutine mhd_riemann_hlld(gamma, d, qL, qR, f, fallback)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
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. | |
fallback | logical | out | HLL used instead of HLLD. |
Call graph
mhd_riemann_llf
Compute the LLF flux of two states in direction d (no divergence control, each state's own B_n).
Attributes: pure
fortran
subroutine mhd_riemann_llf(gamma, d, qL, qR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
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
mhd_eigenvectors_core
Compute the 6x6 eigenvectors of Kim et al. (1999) in direction d at the physical state qa (a = qa(IA_A)), core variables (rho, rho u_n, rho u_t1, rho u_t2, B_t1, B_t2) in the full-state indexes mp, waves ordered (u_n - c_f, u_n - c_a, u_n - c_s, u_n + c_s, u_n + c_a, u_n + c_f); l6(k,:) the row l_k, r6(:,k) the column r_k, l6 r6 = I. Kim's b = B / sqrt(rho); alpha_f = alf c_f / a, alpha_s = als with the cancellation-free Ryu-Jones pair (alf, als) and the degenerate values of the adiabatic core (see the module); Kim's eq. 2-53 flips the slow pair (a^2 > c_a^2) or the fast pair (a^2 < c_a^2) with the sign of the transverse field.
Attributes: pure
fortran
subroutine mhd_eigenvectors_core(d, qa, l6, r6, mp)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. | |
l6 | real(kind=R8P) | out | Left eigenvectors, rows. | |
r6 | real(kind=R8P) | out | Right eigenvectors, columns. | |
mp | integer(kind=I4P) | out | Full-state index of each core variable. |
Call graph
mhd_wave_eigenvalues
Compute the six wave speeds in direction d, (u_n - c_f, u_n - c_a, u_n - c_s, u_n + c_s, u_n + c_a, u_n + c_f).
Attributes: pure
fortran
subroutine mhd_wave_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 | Wave speeds. |
Call graph
frame_flux
Compute the physical flux along the frame normal, the energy slot and the B_n component zero.
Attributes: pure
fortran
subroutine frame_flux(w, u, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
w | real(kind=R8P) | in | Frame primitive variables (w(5) = P(rho)). | |
u | real(kind=R8P) | in | Frame conservative variables. | |
f | real(kind=R8P) | out | Frame flux. |
Call graph
frame_hll
Compute the HLL flux in the frame.
Attributes: pure
fortran
subroutine frame_hll(gamma, wL, uL, wR, uR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
wL | real(kind=R8P) | in | Left frame primitive variables. | |
uL | real(kind=R8P) | in | Left frame conservative variables. | |
wR | real(kind=R8P) | in | Right frame primitive variables. | |
uR | real(kind=R8P) | in | Right frame conservative variables. | |
f | real(kind=R8P) | out | Frame flux. |
Call graph
frame_hlld
Compute the isothermal HLLD flux in the frame (Mignone 2007, section 3), B_n = wL(6) = wR(6): the HLL averages, the advective velocity u* = F_rho^hll / rho^hll, the rotational speeds u* -+ |B_n| / sqrt(rho*), the outer star states (eqs. 30-33) and the centre state (eqs. 34-37), sampled by eq. 38.
Attributes: pure
fortran
subroutine frame_hlld(gamma, wL, uL, wR, uR, f, fallback)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
wL | real(kind=R8P) | in | Left frame primitive variables. | |
uL | real(kind=R8P) | in | Left frame conservative variables. | |
wR | real(kind=R8P) | in | Right frame primitive variables. | |
uR | real(kind=R8P) | in | Right frame conservative variables. | |
f | real(kind=R8P) | out | Frame flux. | |
fallback | logical | out | HLL used instead of HLLD. |
Call graph
frame_llf
Compute the LLF (Rusanov) flux in the frame, speed max(|u_n| + c_f) of the two states.
Attributes: pure
fortran
subroutine frame_llf(gamma, wL, uL, wR, uR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
wL | real(kind=R8P) | in | Left frame primitive variables. | |
uL | real(kind=R8P) | in | Left frame conservative variables. | |
wR | real(kind=R8P) | in | Right frame primitive variables. | |
uR | real(kind=R8P) | in | Right frame conservative variables. | |
f | real(kind=R8P) | out | Frame flux. |
Call graph
frame_speeds
Compute the outer wave speeds S_L = min(u_nL, u_nR) - max(c_fL, c_fR), S_R = max(u_nL, u_nR) + max(c_fL, c_fR).
Attributes: pure
fortran
subroutine frame_speeds(gamma, wL, wR, sL, sR)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
wL | real(kind=R8P) | in | Left frame primitive variables. | |
wR | real(kind=R8P) | in | Right frame primitive variables. | |
sL | real(kind=R8P) | out | Outer wave speeds. | |
sR | real(kind=R8P) | out | Outer wave speeds. |
Call graph
frame_state
Compute the frame primitive and conservative variables of a state whose normal field is set to bn: w(5) = P(rho), the energy slot of u zero (q may be longer than NV_MHD: its leading entries).
Attributes: pure
fortran
subroutine frame_state(gamma, pv, q, bn, w, u)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
pv | integer(kind=I4P) | in | State in the frame order. | |
q | real(kind=R8P) | in | Conservative variables. | |
bn | real(kind=R8P) | in | Normal field of the frame state. | |
w | real(kind=R8P) | out | Frame primitive variables. | |
u | real(kind=R8P) | out | Frame conservative variables. |
Call graph
glm_face_subsystem
Solve the linear (B_n, psi) subsystem of the mixed GLM exactly at the face (Dedner et al. 2002, eq. 42).
Attributes: pure
fortran
subroutine glm_face_subsystem(ch, bnL, bnR, psiL, psiR, bn, psi)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
bnL | real(kind=R8P) | in | Normal fields of the two states. | |
bnR | real(kind=R8P) | in | Normal fields of the two states. | |
psiL | real(kind=R8P) | in | GLM scalars of the two states. | |
psiR | real(kind=R8P) | in | GLM scalars of the two states. | |
bn | real(kind=R8P) | out | Face normal field and GLM scalar. | |
psi | real(kind=R8P) | out | Face normal field and GLM scalar. |
Call graph
hll_select
Return the HLL flux of two frame states from their outer speeds and physical fluxes.
Attributes: pure
fortran
subroutine hll_select(sL, sR, uL, uR, fL, fR, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
sL | real(kind=R8P) | in | Outer wave speeds. | |
sR | real(kind=R8P) | in | Outer wave speeds. | |
uL | real(kind=R8P) | in | Left frame conservative variables. | |
uR | real(kind=R8P) | in | Right frame conservative variables. | |
fL | real(kind=R8P) | in | Left physical flux. | |
fR | real(kind=R8P) | in | Right physical flux. | |
f | real(kind=R8P) | out | Flux. |
Call graph
hlld_star
Build the outer star state of a side (Mignone 2007, eqs. 20-21 and 30-33): the HLL density and normal momentum, the transverse momentum and field from the jump across the outer wave. Near the degeneracy (s - S*_L)(s - S*_R) -> 0 (no transverse field, B_n^2 > a^2 rho) the outer transverse state is kept.
Attributes: pure
fortran
subroutine hlld_star(s, ssL, ssR, rs, ms, us, w, ust)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
s | real(kind=R8P) | in | Outer wave speed of the side. | |
ssL | real(kind=R8P) | in | Rotational wave speeds. | |
ssR | real(kind=R8P) | in | Rotational wave speeds. | |
rs | real(kind=R8P) | in | HLL density and normal momentum. | |
ms | real(kind=R8P) | in | HLL density and normal momentum. | |
us | real(kind=R8P) | in | Advective velocity. | |
w | real(kind=R8P) | in | Frame primitive variables of the side. | |
ust | real(kind=R8P) | out | Star state. |
Call graph
scatter_glm_flux
Return the GLM face flux in the global order: the frame flux scattered, the B_n flux psi~, the psi flux c_h^2 B~_n.
Attributes: pure
fortran
subroutine scatter_glm_flux(ch, pv, fr, bn, psi, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ch | real(kind=R8P) | in | GLM cleaning speed. | |
pv | integer(kind=I4P) | in | State in the frame order. | |
fr | real(kind=R8P) | in | Frame flux. | |
bn | real(kind=R8P) | in | Face normal field and GLM scalar. | |
psi | real(kind=R8P) | in | Face normal field and GLM scalar. | |
f | real(kind=R8P) | out | Flux. |
Call graph
Functions
mhd_fast_speed
Return the fast magnetosonic speed of a cell along direction d (as the adiabatic library, a = qa(IA_A)).
Attributes: pure
Returns: real(kind=R8P)
fortran
function mhd_fast_speed(d, qa) result(cf)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. |
Call graph
mhd_sum3
Return a + b + c summed in increasing order (rotation-invariant sums, issue #41, MV-4).
Attributes: pure
Returns: real(kind=R8P)
fortran
function mhd_sum3(a, b, c) result(s)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
a | real(kind=R8P) | in | Terms. | |
b | real(kind=R8P) | in | Terms. | |
c | real(kind=R8P) | in | Terms. |
Call graph
frame_fast_speed
Return the fast magnetosonic speed along the frame normal, a^2 = dP/drho of the state.
Attributes: pure
Returns: real(kind=R8P)
fortran
function frame_fast_speed(gamma, w) result(cf)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
gamma | real(kind=R8P) | in | EOS parameter. | |
w | real(kind=R8P) | in | Frame primitive variables. |
Call graph
is_admissible
Return true when a state has positive density (the one positive quantity without an energy equation).
Attributes: pure
Returns: logical
fortran
function is_admissible(q) result(ok)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
q | real(kind=R8P) | in | Conservative variables. |
Call graph
wu_speed
Return the Wu (2018) Lax-Friedrichs speed of two states in direction d (as the adiabatic library).
Attributes: pure
Returns: real(kind=R8P)
fortran
function wu_speed(d, qaL, qaR) result(sigma)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
qaL | real(kind=R8P) | in | Left auxiliary variables. | |
qaR | real(kind=R8P) | in | Right auxiliary variables. |
Call graph
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