Appearance
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 mso 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
- add_dissipative_fluxes_o2
- add_dissipative_fluxes_o4
- add_resistive_fluxes_o2
- add_resistive_fluxes_o4
- steps
- inverse_steps
Variables
| Name | Type | Attributes | Description |
|---|---|---|---|
IW | integer(kind=I4P) | parameter | Auxiliary indexes of W = (u, v, w, T). |
IB | integer(kind=I4P) | parameter | Auxiliary 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
di | integer(kind=I4P) | in | Unit step along d. | |
dj | integer(kind=I4P) | in | Unit step along d. | |
dk | integer(kind=I4P) | in | Unit step along d. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
mu0 | real(kind=R8P) | in | Viscosity and conductivity. | |
k0 | real(kind=R8P) | in | Viscosity and conductivity. | |
tref | real(kind=R8P) | in | Temperature laws. | |
omega_mu | real(kind=R8P) | in | Temperature laws. | |
omega_k | real(kind=R8P) | in | Temperature laws. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
fl | real(kind=R8P) | inout | Face 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
di | integer(kind=I4P) | in | Unit step along d. | |
dj | integer(kind=I4P) | in | Unit step along d. | |
dk | integer(kind=I4P) | in | Unit step along d. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
mu0 | real(kind=R8P) | in | Viscosity and conductivity. | |
k0 | real(kind=R8P) | in | Viscosity and conductivity. | |
tref | real(kind=R8P) | in | Temperature laws. | |
omega_mu | real(kind=R8P) | in | Temperature laws. | |
omega_k | real(kind=R8P) | in | Temperature laws. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
fl | real(kind=R8P) | inout | Face 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
di | integer(kind=I4P) | in | Unit step along d. | |
dj | integer(kind=I4P) | in | Unit step along d. | |
dk | integer(kind=I4P) | in | Unit step along d. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
eta | real(kind=R8P) | in | Magnetic diffusivity. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
fl | real(kind=R8P) | inout | Face 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
d | integer(kind=I4P) | in | Direction, 1=x, 2=y, 3=z. | |
di | integer(kind=I4P) | in | Unit step along d. | |
dj | integer(kind=I4P) | in | Unit step along d. | |
dk | integer(kind=I4P) | in | Unit step along d. | |
ni | integer(kind=I4P) | in | Grid dimensions. | |
nj | integer(kind=I4P) | in | Grid dimensions. | |
nk | integer(kind=I4P) | in | Grid dimensions. | |
ngc | integer(kind=I4P) | in | Grid dimensions. | |
blocks_number | integer(kind=I4P) | in | Actual blocks number. | |
eta | real(kind=R8P) | in | Magnetic diffusivity. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
fl | real(kind=R8P) | inout | Face 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
is_null | logical | in | Null 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
ds | real(kind=R8P) | in | Space steps. | |
is_null | logical | in | Null directions. |
Call graph