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 (T / T_ref)^omega_mu, k = k0 (T / T_ref)^omega_k: a constant law has T_ref = 1 and zero exponents, and x**0 = 1 exactly, so it costs flops, never a branch. 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

Dependencies

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, 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 of the laws.
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

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. 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, 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 of the laws.
omega_mureal(kind=R8P)inExponents of the laws.
omega_kreal(kind=R8P)inExponents of the laws.

Call graph