Skip to content

adam_flume_cpu_dissipation_kernels ​

ADAM, FLUME CPU kernels of the dissipative face fluxes (issue #65, M4).

The viscous and heat-conduction face fluxes are ADDED to the inviscid face fluxes of direction d (fl), before the seam accumulation and the flux difference: the AMR reflux and the inter-realm register then see the total flux. They read W = (u, v, w, T) from the auxiliary variables, whose indexes are those of every model, so one kernel serves Euler and MHD; the host selects the kernel of the order (2 or 4, [numerics] dissipative_order), never a branch inside the loops.

Face (i,j,k) lies between cells (i,j,k) and (i,j,k) + e_d; m counts the cells along d from the left one (m = 0). A null direction has a zero step, so its derivatives are differences of a cell with itself, zero exactly, and its ghost cells are never read.

Order 2: h = G(W_f, grad W_f), W_f = (W_0 + W_1) / 2, normal derivative (W_1 - W_0) / dx, tangential ones the mean of the two cells' central differences.

Order 4 (Shu & Osher 1989, J. Comput. Phys. 83, 32): the conservative flux of a point-value scheme is h = G_f - dx^2 / 24 G''_f + O(dx^4), with

 W_f       = (9 (W_0 + W_1) - (W_-1 + W_2)) / 16
 dW/dn_f   = (27 (W_1 - W_0) - (W_2 - W_-1)) / (24 dx)
 dW/dt_f   = (9 (D_0 + D_1) - (D_-1 + D_2)) / 16,  D_m = (8 (W_+1 - W_-1) - (W_+2 - W_-2)) / (12 dt)  at cell m
 G''_f dx^2 = (G_2 - G_1 - G_0 + G_-1) / 2,        G_m from 2nd-order central gradients at cell m

so h = G_f - (G_2 - G_1 - G_0 + G_-1) / 48. Across a strong temperature jump the 4-point face temperature can undershoot below zero (a power law is then NaN): where it is not positive, the face takes the mean of its two cells. Cells -2 ... 3 along d and -2 ... 2 along the tangents are read: ngc >= 3. The correction is built from 2nd-order cell fluxes for every term, linear or not, so for constant mu the scheme is a 4th-order u_xx on 6 points, not the compact 5-point one; the order is verified by measurement.

The Ohmic fluxes (MHD, issue #65 P3) use the same stencils on W = B (auxiliary IA_BX..IA_BZ), adding to the field and energy fluxes: the kernels add_resistive_fluxes_o2/o4, called by the host only when the resistivity is on.

Source: src/app/flume/cpu/adam_flume_cpu_dissipation_kernels.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
IWinteger(kind=I4P)parameterAuxiliary indexes of W = (u, v, w, T).
IBinteger(kind=I4P)parameterAuxiliary indexes of the magnetic field.

Subroutines ​

add_dissipative_fluxes_o2 ​

Add the 2nd-order dissipative face fluxes of direction d to fl.

fortran
subroutine add_dissipative_fluxes_o2(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, mu0, k0, tref, omega_mu, omega_k, dxyz, is_null, q_aux, fl)

Arguments

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
diinteger(kind=I4P)inUnit step along d.
djinteger(kind=I4P)inUnit step along d.
dkinteger(kind=I4P)inUnit step along d.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
blocks_numberinteger(kind=I4P)inActual blocks number.
mu0real(kind=R8P)inViscosity and conductivity.
k0real(kind=R8P)inViscosity and conductivity.
trefreal(kind=R8P)inTemperature laws.
omega_mureal(kind=R8P)inTemperature laws.
omega_kreal(kind=R8P)inTemperature laws.
dxyzreal(kind=R8P)inBlocks space steps [3, nb].
is_nulllogicalinNull directions.
q_auxreal(kind=R8P)inAuxiliary variables.
flreal(kind=R8P)inoutFace fluxes of direction d.

Call graph

add_dissipative_fluxes_o4 ​

Add the 4th-order conservative dissipative face fluxes of direction d to fl.

fortran
subroutine add_dissipative_fluxes_o4(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, mu0, k0, tref, omega_mu, omega_k, dxyz, is_null, q_aux, fl)

Arguments

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
diinteger(kind=I4P)inUnit step along d.
djinteger(kind=I4P)inUnit step along d.
dkinteger(kind=I4P)inUnit step along d.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
blocks_numberinteger(kind=I4P)inActual blocks number.
mu0real(kind=R8P)inViscosity and conductivity.
k0real(kind=R8P)inViscosity and conductivity.
trefreal(kind=R8P)inTemperature laws.
omega_mureal(kind=R8P)inTemperature laws.
omega_kreal(kind=R8P)inTemperature laws.
dxyzreal(kind=R8P)inBlocks space steps [3, nb].
is_nulllogicalinNull directions.
q_auxreal(kind=R8P)inAuxiliary variables.
flreal(kind=R8P)inoutFace fluxes of direction d.

Call graph

add_resistive_fluxes_o2 ​

Add the 2nd-order Ohmic face fluxes of direction d to fl (MHD).

fortran
subroutine add_resistive_fluxes_o2(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, eta, dxyz, is_null, q_aux, fl)

Arguments

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
diinteger(kind=I4P)inUnit step along d.
djinteger(kind=I4P)inUnit step along d.
dkinteger(kind=I4P)inUnit step along d.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
blocks_numberinteger(kind=I4P)inActual blocks number.
etareal(kind=R8P)inMagnetic diffusivity.
dxyzreal(kind=R8P)inBlocks space steps [3, nb].
is_nulllogicalinNull directions.
q_auxreal(kind=R8P)inAuxiliary variables.
flreal(kind=R8P)inoutFace fluxes of direction d.

Call graph

add_resistive_fluxes_o4 ​

Add the 4th-order conservative Ohmic face fluxes of direction d to fl (MHD): the stencils of add_dissipative_fluxes_o4 on W = B, with the Shu-Osher correction.

fortran
subroutine add_resistive_fluxes_o4(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, eta, dxyz, is_null, q_aux, fl)

Arguments

NameTypeIntentAttributesDescription
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
diinteger(kind=I4P)inUnit step along d.
djinteger(kind=I4P)inUnit step along d.
dkinteger(kind=I4P)inUnit step along d.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
ngcinteger(kind=I4P)inGrid dimensions.
blocks_numberinteger(kind=I4P)inActual blocks number.
etareal(kind=R8P)inMagnetic diffusivity.
dxyzreal(kind=R8P)inBlocks space steps [3, nb].
is_nulllogicalinNull directions.
q_auxreal(kind=R8P)inAuxiliary variables.
flreal(kind=R8P)inoutFace fluxes of direction d.

Call graph

Functions ​

steps ​

Return the unit steps along each direction, o(:,t) = e_t, zero along the null directions.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function steps(is_null) result(o)

Arguments

NameTypeIntentAttributesDescription
is_nulllogicalinNull directions.

Call graph

inverse_steps ​

Return the inverse space steps, zero along the null directions.

Attributes: pure

Returns: real(kind=R8P)

fortran
function inverse_steps(ds, is_null) result(rdx)

Arguments

NameTypeIntentAttributesDescription
dsreal(kind=R8P)inSpace steps.
is_nulllogicalinNull directions.

Call graph