Skip to content

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_d

with 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 ​

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

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
mu0real(kind=R8P)inViscosity and conductivity at the reference temperature.
k0real(kind=R8P)inViscosity and conductivity at the reference temperature.
trefreal(kind=R8P)inReference temperature, Sutherland constant (0: power law).
suthreal(kind=R8P)inReference temperature, Sutherland constant (0: power law).
omega_mureal(kind=R8P)inExponents of the laws.
omega_kreal(kind=R8P)inExponents of the laws.
wreal(kind=R8P)inVelocity and temperature.
greal(kind=R8P)inGradient, g(a,b) = d w_a / d x_b.
freal(kind=R8P)outFlux: 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

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
etareal(kind=R8P)inMagnetic diffusivity.
breal(kind=R8P)inMagnetic field.
greal(kind=R8P)inGradient, g(a,b) = d B_a / d x_b.
freal(kind=R8P)outFlux: 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

NameTypeIntentAttributesDescription
mu0real(kind=R8P)inViscosity law, as in compute_dissipative_flux.
trefreal(kind=R8P)inViscosity law, as in compute_dissipative_flux.
suthreal(kind=R8P)inViscosity law, as in compute_dissipative_flux.
omega_mureal(kind=R8P)inViscosity law, as in compute_dissipative_flux.
rhoreal(kind=R8P)inDensity, pressure, temperature.
preal(kind=R8P)inDensity, pressure, temperature.
Treal(kind=R8P)inDensity, pressure, temperature.
ureal(kind=R8P)inVelocity.
greal(kind=R8P)inVelocity gradient, g(a,b) = d u_a / d x_b.
freal(kind=R8P)outIntegrands.

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

NameTypeIntentAttributesDescription
rhoreal(kind=R8P)inDensity and temperature.
Treal(kind=R8P)inDensity and temperature.
t_wallreal(kind=R8P)inHottest isothermal wall temperature, 0 if none.
gammareal(kind=R8P)inSpecific heats ratio and specific heat at constant pressure.
cpreal(kind=R8P)inSpecific heats ratio and specific heat at constant pressure.
mu0real(kind=R8P)inViscosity, conductivity (at the reference temperature), resistivity.
k0real(kind=R8P)inViscosity, conductivity (at the reference temperature), resistivity.
etareal(kind=R8P)inViscosity, conductivity (at the reference temperature), resistivity.
trefreal(kind=R8P)inReference temperature, Sutherland constant (0: power law).
suthreal(kind=R8P)inReference temperature, Sutherland constant (0: power law).
omega_mureal(kind=R8P)inExponents of the laws.
omega_kreal(kind=R8P)inExponents 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

NameTypeIntentAttributesDescription
treal(kind=R8P)inTemperature.
trefreal(kind=R8P)inReference temperature.
suthreal(kind=R8P)inSutherland constant (code temperature units), 0 for the power law.
omegareal(kind=R8P)inExponent.

Call graph