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 (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
| 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 of the laws. | |
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
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
| 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 of the laws. | |
omega_mu | real(kind=R8P) | in | Exponents of the laws. | |
omega_k | real(kind=R8P) | in | Exponents of the laws. |
Call graph