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_sgs_fluxes_o2
- add_sgs_fluxes_o4
- compute_sgs_dissipation
- compute_lambda_sgs
- compute_turbulence_integrals
- 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, suth, 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. | |
suth | 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, suth, 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. | |
suth | 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_sgs_fluxes_o2
Add to fl the subgrid-scale fluxes of direction d (2nd order), those of add_dissipative_fluxes_o2 with mu = mu_t and k = mu_t cp / Pr_t in place of the laws (issue #119, T1): the mean of the two cells at the face, whose stencil stays positive, the cell value in the correction.
fortran
subroutine add_sgs_fluxes_o2(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, cp_prt, dxyz, is_null, q_aux, mu_t, 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. | |
cp_prt | real(kind=R8P) | in | cp / Pr_t. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
mu_t | real(kind=R8P) | in | Eddy viscosity. | |
fl | real(kind=R8P) | inout | Face fluxes of direction d. |
Call graph
add_sgs_fluxes_o4
Add to fl the subgrid-scale fluxes of direction d (4th order), those of add_dissipative_fluxes_o4 with mu = mu_t and k = mu_t cp / Pr_t in place of the laws (issue #119, T1): the mean of the two cells at the face, whose stencil stays positive, the cell value in the correction.
fortran
subroutine add_sgs_fluxes_o4(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, cp_prt, dxyz, is_null, q_aux, mu_t, 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. | |
cp_prt | real(kind=R8P) | in | cp / Pr_t. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
mu_t | real(kind=R8P) | in | Eddy viscosity. | |
fl | real(kind=R8P) | inout | Face fluxes of direction d. |
Call graph
compute_sgs_dissipation
Compute the volume integral of the subgrid-scale dissipation tau_sgs_ij d u_i / d x_j on this rank (issue #119, T1), as eps of compute_turbulence_integrals with mu = mu_t; the column eps_sgs of the turbulence history.
fortran
subroutine compute_sgs_dissipation(ni, nj, nk, ngc, blocks_number, dxyz, is_null, q_aux, mu_t, eps)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
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. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
mu_t | real(kind=R8P) | in | Eddy viscosity. | |
eps | real(kind=R8P) | out | The integral. |
Call graph
compute_lambda_sgs
Compute max(2 factor mu_t / rho sum_d 1 / dx_d^2) over the interior cells (issue #119, T1): the part of the time step limit of the eddy viscosity, factor = max(4/3, gamma / Pr_t).
fortran
subroutine compute_lambda_sgs(ni, nj, nk, ngc, blocks_number, factor, dxyz, is_null, q_aux, mu_t, lambda_sgs)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
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. | |
factor | real(kind=R8P) | in | max(4/3, gamma / Pr_t). | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
mu_t | real(kind=R8P) | in | Eddy viscosity. | |
lambda_sgs | real(kind=R8P) | out | The maximum. |
Call graph
compute_turbulence_integrals
Compute the volume integrals of the turbulence history over the interior cells of this rank (issue #119, T0.1), from 4th-order central velocity gradients; the volume includes the null directions, whose gradients are zero (issue #37).
fortran
subroutine compute_turbulence_integrals(ni, nj, nk, ngc, blocks_number, mu0, tref, suth, omega_mu, dxyz, is_null, q_aux, integrals)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
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 law. | |
tref | real(kind=R8P) | in | Viscosity law. | |
suth | real(kind=R8P) | in | Viscosity law. | |
omega_mu | real(kind=R8P) | in | Viscosity law. | |
dxyz | real(kind=R8P) | in | Blocks space steps [3, nb]. | |
is_null | logical | in | Null directions. | |
q_aux | real(kind=R8P) | in | Auxiliary variables. | |
integrals | real(kind=R8P) | out | Integrals (compute_turbulence_integrands). |
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