Appearance
adam_flume_dissipation_library
ADAM, FLUME pointwise dissipative physics shared by the CPU and FNL backends (issue #65, M4).
Every routine is pure, takes explicit-size dummies and is tagged !$acc routine seq + !$omp declare target, as in adam_flume_euler_library: the CPU loops and the FNL device kernels call the same source.
The dissipative flux of direction d (issue #65, section 2), added to the inviscid one, is
momentum u_i: -tau_{di}, tau = mu (grad u + grad u^T - 2/3 div(u) I) (Stokes hypothesis)
energy: -u_i tau_{di} - k dT/dx_dwith mu = mu0 L(T, omega_mu), k = k0 L(T, omega_k) (temperature_law): L = (T / T_ref)^omega, times the Sutherland factor (T_ref + S) / (T + S) when S > 0 and omega > 0 (Sutherland's law is omega = 3/2 with it). A constant law has T_ref = 1, zero exponents and S = 0, and x**0 = 1 exactly, so it costs flops; the Sutherland test is on scalars, the same in every thread. The gradient is stored g(a,b) = d W_a / d x_b with W = (u, v, w, T).
The Ohmic flux (MHD, issue #65 P3), with the magnetic diffusivity eta and J = curl B (code units), follows from dB/dt = -curl(E), E = -u x B + eta J, and the Poynting flux E x B:
field B_i: -eta (dB_i/dx_d - dB_d/dx_i) (the curl form: eps_idk eta J_k)
energy: eta (J x B)_d = eta (B_j dB_d/dx_j - B_j dB_j/dx_d)The curl form differs from -eta grad B by eta grad(div B), which is not zero under GLM: the curl form keeps the resistive term out of the divergence constraint. (#65 section 2 printed the field flux with the opposite sign, an anti-diffusion; the sign here is the derived one, and VV-5 measures the decay rate.) The gradient is stored g(a,b) = d B_a / d x_b.
Source: src/app/flume/common/adam_flume_dissipation_library.F90
Contents
- compute_dissipative_flux
- compute_resistive_flux
- compute_turbulence_integrands
- dissipative_diffusivity
- temperature_law
Subroutines
compute_dissipative_flux
Compute the dissipative flux of direction d from the state w = (u, v, w, T) and its gradient g: f(1:3) the momentum components, f(4) the energy.
Attributes: pure
fortran
subroutine compute_dissipative_flux(d, mu0, k0, tref, suth, omega_mu, omega_k, w, g, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
mu0 | real(kind=R8P) | in | Viscosity and conductivity at the reference temperature. | |
k0 | real(kind=R8P) | in | Viscosity and conductivity at the reference temperature. | |
tref | real(kind=R8P) | in | Reference temperature, Sutherland constant (0: power law). | |
suth | real(kind=R8P) | in | Reference temperature, Sutherland constant (0: power law). | |
omega_mu | real(kind=R8P) | in | Exponents of the laws. | |
omega_k | real(kind=R8P) | in | Exponents of the laws. | |
w | real(kind=R8P) | in | Velocity and temperature. | |
g | real(kind=R8P) | in | Gradient, g(a,b) = d w_a / d x_b. | |
f | real(kind=R8P) | out | Flux: momentum (3), energy. |
Call graph
compute_resistive_flux
Compute the Ohmic flux of direction d from the field b and its gradient g: f(1:3) the field components, f(4) the energy.
Attributes: pure
fortran
subroutine compute_resistive_flux(d, eta, b, g, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
eta | real(kind=R8P) | in | Magnetic diffusivity. | |
b | real(kind=R8P) | in | Magnetic field. | |
g | real(kind=R8P) | in | Gradient, g(a,b) = d B_a / d x_b. | |
f | real(kind=R8P) | out | Flux: field (3), energy. |
Call graph
compute_turbulence_integrands
Return the integrands of the turbulence history at a cell (issue #119, T0.1), per unit volume: f(1) kinetic energy rho |u|^2 / 2, f(2) enstrophy rho |omega|^2 / 2, f(3) solenoidal dissipation mu |omega|^2, f(4) dilatational dissipation 4/3 mu theta^2, f(5) the viscous work tau_ij du_i/dx_j, f(6) the pressure dilatation p theta.
Attributes: pure
fortran
subroutine compute_turbulence_integrands(mu0, tref, suth, omega_mu, rho, p, T, u, g, f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
mu0 | real(kind=R8P) | in | Viscosity law, as in compute_dissipative_flux. | |
tref | real(kind=R8P) | in | Viscosity law, as in compute_dissipative_flux. | |
suth | real(kind=R8P) | in | Viscosity law, as in compute_dissipative_flux. | |
omega_mu | real(kind=R8P) | in | Viscosity law, as in compute_dissipative_flux. | |
rho | real(kind=R8P) | in | Density, pressure, temperature. | |
p | real(kind=R8P) | in | Density, pressure, temperature. | |
T | real(kind=R8P) | in | Density, pressure, temperature. | |
u | real(kind=R8P) | in | Velocity. | |
g | real(kind=R8P) | in | Velocity gradient, g(a,b) = d u_a / d x_b. | |
f | real(kind=R8P) | out | Integrands. |
Call graph
Functions
dissipative_diffusivity
Return the largest diffusivity of a cell, max(4/3 mu / rho, gamma k / (rho cp), eta), the one of the diffusive time step limit (issue #65, D-M4-3).
The laws are evaluated at max(T, t_wall^2 / T): t_wall is the hottest isothermal wall temperature (0 without one, or with constant laws), and t_wall^2 / T the geometric-mirror ghost temperature of the cell beside it, which bounds the temperature of the wall face (both laws increase with T, Sutherland's too). Without it a power law at a wall much hotter than the gas gives the wall face a coefficient far above every cell's, and the cell bound is not a bound (a wall 330 times hotter than the gas blew up at CFL 0.5 and ran at 0.01). The exponents are non-negative, so the larger temperature is the bound.
Attributes: pure
Returns: real(kind=R8P)
fortran
function dissipative_diffusivity(rho, T, t_wall, gamma, cp, mu0, k0, eta, tref, suth, omega_mu, omega_k) result(nu)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
rho | real(kind=R8P) | in | Density and temperature. | |
T | real(kind=R8P) | in | Density and temperature. | |
t_wall | real(kind=R8P) | in | Hottest isothermal wall temperature, 0 if none. | |
gamma | real(kind=R8P) | in | Specific heats ratio and specific heat at constant pressure. | |
cp | real(kind=R8P) | in | Specific heats ratio and specific heat at constant pressure. | |
mu0 | real(kind=R8P) | in | Viscosity, conductivity (at the reference temperature), resistivity. | |
k0 | real(kind=R8P) | in | Viscosity, conductivity (at the reference temperature), resistivity. | |
eta | real(kind=R8P) | in | Viscosity, conductivity (at the reference temperature), resistivity. | |
tref | real(kind=R8P) | in | Reference temperature, Sutherland constant (0: power law). | |
suth | real(kind=R8P) | in | Reference temperature, Sutherland constant (0: power law). | |
omega_mu | real(kind=R8P) | in | Exponents of the laws. | |
omega_k | real(kind=R8P) | in | Exponents of the laws. |
Call graph
temperature_law
Return the ratio of a transport coefficient to its reference value, (t / tref)^omega, times the Sutherland factor (tref + suth) / (t + suth) when suth > 0 and omega > 0: the power law for suth = 0 (the same operations as before Sutherland, so the power and constant laws are unchanged bit for bit), Sutherland's law for omega = 3/2. A zero exponent is a constant coefficient under either law (the conductivity not given by the Prandtl number).
Attributes: pure
Returns: real(kind=R8P)
fortran
function temperature_law(t, tref, suth, omega) result(r)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
t | real(kind=R8P) | in | Temperature. | |
tref | real(kind=R8P) | in | Reference temperature. | |
suth | real(kind=R8P) | in | Sutherland constant (code temperature units), 0 for the power law. | |
omega | real(kind=R8P) | in | Exponent. |
Call graph