Skip to content

adam_flume_cpu_mhd_glm_kernels ​

ADAM, FLUME CPU kernels of the ideal MHD with GLM cleaning model.

The model-agnostic auxiliary-variables loop (adam_flume_cpu_aux_kernels_agnostic.INC) and the MHD dt loop (adam_flume_cpu_mhd_kernels_agnostic.INC) instantiated with NV_K = NV_MHD_GLM, NV_AUX_K = NV_AUX_MHD (issue #41, section 4). The face-flux kernel is the shared body with the MHD split (M2-P3).

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

Dependencies

Contents ​

Subroutines ​

compute_face_fluxes ​

Compute the WENO face fluxes of direction d: face (i,j,k) lies between cells (i,j,k) and (i+di,j+dj,k+dk), so the face array starts at index 0 along d.

Per face: gather the stencil m = 1-S ... S into constant-bound locals, project and split it, reconstruct every field (the local v is the packed stencil of the WENO primitive), back-project.

fortran
subroutine compute_face_fluxes(d, di, dj, dk, ni, nj, nk, ngc, blocks_number, gamma, ch, is_characteristic, weno, q, 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.
gammareal(kind=R8P)inSpecific heats ratio.
chreal(kind=R8P)inGLM cleaning speed (models with GLM only).
is_characteristiclogicalinCharacteristic (or conservative) variables.
wenotype(weno_object)inWENO coefficients.
qreal(kind=R8P)inConservative variables.
q_auxreal(kind=R8P)inAuxiliary variables.
flreal(kind=R8P)inoutFace fluxes of direction d.

Call graph

compute_q_aux ​

Compute the auxiliary variables on every cell, ghost cells included.

fortran
subroutine compute_q_aux(ni, nj, nk, ngc, blocks_number, gamma, R, q, q_aux)

Arguments

NameTypeIntentAttributesDescription
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.
gammareal(kind=R8P)inSpecific heats ratio.
Rreal(kind=R8P)inGas constant.
qreal(kind=R8P)inConservative variables.
q_auxreal(kind=R8P)inoutAuxiliary variables.

Call graph

compute_lambda_max ​

Compute max(sum_d (|u_d| + c_{f,d}) / dx_d) over the interior cells (null directions excluded), c_{f,d} the fast magnetosonic speed along d (issue #41, section 3.5).

fortran
subroutine compute_lambda_max(ni, nj, nk, ngc, blocks_number, gamma, R, dxyz, is_null, q, lambda_max)

Arguments

NameTypeIntentAttributesDescription
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.
gammareal(kind=R8P)inSpecific heats ratio.
Rreal(kind=R8P)inGas constant.
dxyzreal(kind=R8P)inBlocks space steps [3, nb].
is_nulllogicalinNull directions.
qreal(kind=R8P)inConservative variables.
lambda_maxreal(kind=R8P)outMaximum of sum_d (|u_d| + c_{f,d}) / dx_d.

Call graph

apply_floors ​

Apply the MHD positivity floors to the interior cells of a stage state, before its ghost exchange (issue #41, section 3.8): a cell with rho < rho_floor or p < p_floor gets rho = max(rho, rho_floor) at fixed velocity and p = max(p, p_floor) (internal energy added). Interior only: the exchange then carries the floored values to the ghost cells, and ghost cells that no map fills (never read by the stencils) are not inspected. Returns the floored cells, the cells with a non-positive density or pressure (counted before flooring) and the minimum density and pressure. Floors are not conservative: the caller logs the counters.

fortran
subroutine apply_floors(ni, nj, nk, ngc, blocks_number, gamma, R, rho_floor, p_floor, q, floored, nonpositive, rho_min, p_min)

Arguments

NameTypeIntentAttributesDescription
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.
gammareal(kind=R8P)inSpecific heats ratio.
Rreal(kind=R8P)inGas constant.
rho_floorreal(kind=R8P)inDensity and pressure floors.
p_floorreal(kind=R8P)inDensity and pressure floors.
qreal(kind=R8P)inoutConservative variables.
flooredinteger(kind=I4P)outFloored cells.
nonpositiveinteger(kind=I4P)outCells with non-positive density or pressure.
rho_minreal(kind=R8P)outMinimum density and pressure.
p_minreal(kind=R8P)outMinimum density and pressure.

Call graph

compute_speed_max ​

Compute max(|u_d| + c_{f,d}) over the interior cells and the active directions, the fastest wave speed (the GLM c_h check, issue #41, section 3.5).

fortran
subroutine compute_speed_max(ni, nj, nk, ngc, blocks_number, gamma, R, is_null, q, speed_max)

Arguments

NameTypeIntentAttributesDescription
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.
gammareal(kind=R8P)inSpecific heats ratio.
Rreal(kind=R8P)inGas constant.
is_nulllogicalinNull directions.
qreal(kind=R8P)inConservative variables.
speed_maxreal(kind=R8P)outMaximum of |u_d| + c_{f,d}.

Call graph

compute_divb_norms ​

Compute the div(B) norms over the interior cells (issue #41, D-10): max|div B|, sum |div B| dV and the maximum over the seam-local cells (within band cells of a block face with seam(b,face) /= 0, a 2:1 AMR or inter-realm seam). div B is the centred finite difference of the library (half stencil hs), null directions weighted zero; the cell volume includes the null directions (issue #37). The caller has refreshed the ghost cells.

fortran
subroutine compute_divb_norms(ni, nj, nk, ngc, blocks_number, hs, band, dxyz, is_null, seam, q, divb_max, divb_l1, divb_seam_max)

Arguments

NameTypeIntentAttributesDescription
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.
hsinteger(kind=I4P)inFinite difference half stencil, <= ngc.
bandinteger(kind=I4P)inSeam-local band width, in cells.
dxyzreal(kind=R8P)inBlocks space steps [3, nb].
is_nulllogicalinNull directions.
seaminteger(kind=I4P)inSeam faces flags [nb, 6] (0: not a seam face).
qreal(kind=R8P)inConservative variables.
divb_maxreal(kind=R8P)outMaximum of |div B|.
divb_l1real(kind=R8P)outSum of |div B| dV.
divb_seam_maxreal(kind=R8P)outMaximum of |div B| over the seam-local cells.

Call graph

add_glm_damping ​

Add the GLM damping source to the residuals of the interior cells, dq(psi) = dq(psi) - (c_h^2 / c_p^2) psi (mixed GLM, Dedner et al. 2002; issue #41, section 3.1): a local source, in every Runge-Kutta stage and never in the fluxes, so the reflux and the conservation of the other variables are untouched.

fortran
subroutine add_glm_damping(ni, nj, nk, ngc, blocks_number, damping, q, dq)

Arguments

NameTypeIntentAttributesDescription
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.
dampingreal(kind=R8P)inDamping rate c_h^2 / c_p^2.
qreal(kind=R8P)inConservative variables.
dqreal(kind=R8P)inoutResiduals.

Call graph

face_split_fluxes ​

Split adapter of the shared face kernel (issue #41, M2-P3): the MHD split with GLM cleaning.

Attributes: pure

fortran
subroutine face_split_fluxes(gamma, ch, d, S, is_characteristic, qs, qas, fsplit, er)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
chreal(kind=R8P)inGLM cleaning speed.
dinteger(kind=I4P)inDirection, 1=x, 2=y, 3=z.
Sinteger(kind=I4P)inWENO stencil half-width, S <= S_MAX.
is_characteristiclogicalinCharacteristic (or conservative) variables.
qsreal(kind=R8P)inStencil conservative variables.
qasreal(kind=R8P)inStencil auxiliary variables.
fsplitreal(kind=R8P)outSplit fields in the WENO upwind layout.
erreal(kind=R8P)outRight eigenvectors.

Call graph