Skip to content

adam_flume_bc_object ​

ADAM, FLUME boundary conditions class definition.

periodic is the library BC_PERIODIC, so the tree builds true periodic neighbors and the ghost exchange fills periodic ghosts across blocks and ranks (verified by src/tests/amr/test_periodic_ghost); the other kinds are filled by the backends on the boundary crown maps.

Realm edges and corners. A crown row beyond several realm faces (an edge or a corner of the realm) is filled by the kind of one of those faces, realm_edge_face, applied to the donor realm_edge_donor: mirrored (wall) or clamped (extrapolation) along that face's axis, so the donor lies beyond the other faces only and is a ghost already filled. The backends fill the rows beyond one face first, then two, then three (issue #65 P0).

No-slip walls (issue #65, D-M4-7). wall-noslip (adiabatic) and wall-isothermal mirror the interior cell like wall-inviscid but reflect the whole velocity about the wall velocity, u_g = 2 u_w - u (wall_u, wall_v, wall_w, tangential, default 0; a normal component is fatal), so the mean of the two cells is the wall velocity. The pressure is mirrored. The adiabatic wall mirrors the temperature (and the density); the isothermal wall sets the ghost temperature to the geometric mirror T_g = wall_temperature^2 / T, so the geometric mean of the two cells is the wall temperature, and the density from the mirrored pressure, rho_g = p / (R T_g). The geometric mirror is positive for any positive T; the linear one, 2 wall_temperature - T (P1), gave a negative ghost density beside gas hotter than twice the wall (issue #65 P2). For T = T_w + delta the two differ by delta^2 / T_w, so both are second-order at the wall. The field follows the MHD wall rule of wall-inviscid (normal component odd), psi is even.

Modelled wall (issue #119, T3.3). wall-modelled, with wall_temperature: the ghosts mirror as wall-inviscid; the flux through the face comes from the wall model (adam_flume_wall_model_library), sampled at the 3rd cell off the wall or at wall_model_height (interpolated between cells), damping wall_model_damping classical (wall units) or semi-local (local density and viscosity), the samples averaged in time over wall_model_filter (an exponential filter, 0 for none). wall_model = inverse-transformation (T3.5) takes the model of Griffin, Fu & Moin (2023) instead of the equilibrium one, with the state at the edge of the layer wall_model_edge_velocity, wall_model_edge_temperature. Euler with a viscosity only. wall_model_eddy_viscosity = .true. (default .false.) adds in the cells below the matching height the model's own eddy viscosity, kappa y sqrt(rho tau_w) D^2 from the instantaneous (unfiltered) sample's tau_w, the damping of the face (semi-local for the inverse model), the cell's density and viscosity, the larger of it and a subgrid-scale model's: the resolved layer then carries the modelled stress and heat flux to the face. Without it nothing below h does (issue #119, the Mach 3 first-cell drain).

Hydrostatic (issue #73, M7-G0). hydrostatic closes a stratified atmosphere under the constant gravity of [gravity]: the ghost density and pressure continue the isothermal hydrostatic equilibrium from the first interior cell along the normal, rho_g = rho_1 exp(g_d s / T_1), p_g = rho_g T_1 (T_1 = p_1 / rho_1, s the signed distance from that cell to the ghost along the axis d), so an isothermal atmosphere has exact ghosts; the velocity is mirrored as at wall-inviscid (normal component odd, no mass flux), the field and psi are mirrored even (the field lines pass through the boundary, so a uniform field along or across gravity stays uniform; a reflecting wall is wall-inviscid). Without gravity along the normal it is a slip wall that copies the thermodynamic state of the first interior cell (Zingale et al. 2002, ApJS 143, 539: hydrostatic ghosts integrated at constant temperature, reflecting velocity).

Non-reflecting (issue #121, S2). non-reflecting, with the target state r, u, v, w, p, nr_sigma (default 0.28) and nr_length (L, required), is a characteristic boundary for outflow and far-field faces in ghost-cell form: the ghosts are the first interior cell plus the jumps of the characteristic variables linearised about it (outward normal velocity u_n, sound speed c). An outgoing wave (speed > 0) is extrapolated (zero jump). The incoming acoustic wave (u_n - c < 0) has its normal gradient set by the relaxation of Rudy & Strikwerda (1980) and Poinsot & Lele (1992), d(p - rho c u_n)/dn = K (p - p_t) / (u_n - c), K = sigma (1 - M^2) c / L, so the mean pressure is pulled toward the target and a wave leaving the box is not sent back; ghost m lies m cells off the interior cell. Flow into the domain (u_n < 0) takes the entropy and the tangential velocity of the target; u_n + c <= 0 (supersonic inflow) the whole target state. A supersonic outflow, or sigma = 0 at an outflow, is extrapolation bit for bit. Euler (ideal gas, no passive scalars, no dual energy) only; the edge and corner rows beyond it are extrapolated. Digital-filter inflow (issue #119, T3.7). inflow-digital-filter feeds a turbulent boundary layer through the face: the keys and the method are in adam_flume_inflow_df_object (component df). The backends write its ghost states after the face pass; in the edge and corner passes it is extrapolated.

Source: src/app/flume/common/adam_flume_bc_object.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
BC_EXTRAPOLATIONinteger(kind=I4P)parameterZeroth-order extrapolation.
BC_INFLOWinteger(kind=I4P)parameterPrescribed state.
BC_WALL_INVISCIDinteger(kind=I4P)parameterInviscid (slip) wall: mirror with normal momentum negated.
BC_WALL_NOSLIPinteger(kind=I4P)parameterNo-slip adiabatic wall: velocity reflected about the wall's.
BC_WALL_ISOTHERMALinteger(kind=I4P)parameterNo-slip isothermal wall: also the temperature set.
BC_HYDROSTATICinteger(kind=I4P)parameterHydrostatic ghosts under gravity, mirrored velocity.
BC_INFLOW_DFinteger(kind=I4P)parameterDigital-filter turbulent inflow (issue #119, T3.7).
BC_NONREFLECTINGinteger(kind=I4P)parameterCharacteristic non-reflecting outflow (issue #121, S2).
BC_SHOCK_GENERATORinteger(kind=I4P)parameterOblique-shock generator on a y face (issue #121, S3).
BC_EXTRAPOLATION_STRcharacter(len=13)parameterAccepted spelling of BC_EXTRAPOLATION.
BC_INFLOW_STRcharacter(len=6)parameterAccepted spelling of BC_INFLOW.
BC_WALL_MODELLED_STRcharacter(len=13)parameterA modelled wall: mirrored as wall-inviscid, the wall-face flux by the wall model (issue #119, T3.3).
BC_WALL_INVISCID_STRcharacter(len=13)parameterAccepted spelling of BC_WALL_INVISCID.
BC_PERIODIC_STRcharacter(len=8)parameterAccepted spelling of BC_PERIODIC.
BC_WALL_NOSLIP_STRcharacter(len=11)parameterAccepted spelling of BC_WALL_NOSLIP.
BC_WALL_ISOTHERMAL_STRcharacter(len=15)parameterAccepted spelling of BC_WALL_ISOTHERMAL.
BC_HYDROSTATIC_STRcharacter(len=11)parameterAccepted spelling of BC_HYDROSTATIC.
BC_INFLOW_DF_STRcharacter(len=21)parameterAccepted spelling of BC_INFLOW_DF.
BC_NONREFLECTING_STRcharacter(len=14)parameterAccepted spelling of BC_NONREFLECTING.
BC_SHOCK_GENERATOR_STRcharacter(len=15)parameterAccepted spelling of BC_SHOCK_GENERATOR.
NR_SIGMA_DEFAULTreal(kind=R8P)parameterNon-reflecting: relaxation (Rudy & Strikwerda 1980).
WALL_VELOCITY_KEYcharacter(len=6)parameterWall velocity keys.
INFLOW_KEYcharacter(len=2)parameterInflow primitive state keys (MHD: all 8).
SECTION_NAMEcharacter(len=8)parameterINI section names of the 6 faces.

Derived Types ​

flume_bc_object ​

FLUME boundary conditions class definition.

Components ​

NameTypeAttributesDescription
bc_typeinteger(kind=I4P)Boundary condition type of each face.
q_inflowreal(kind=R8P)allocatableConservative inflow state of each face [nv, 6].
wall_signreal(kind=R8P)allocatableWall mirror sign of each variable per direction [nv, 3] (+1 or -1).
wall_velocityreal(kind=R8P)No-slip walls: wall velocity of each face.
wall_modelledlogicalFaces of a wall model (issue #119, T3.3).
wm_heightreal(kind=R8P)Wall model: matching height per face, 0 for the 3rd cell.
wm_semilocallogicalWall model: semi-local damping per face.
wm_filterreal(kind=R8P)Wall model: time scale of the input filter per face, 0 for none.
wm_viscositylogicalWall model: its eddy viscosity in the cells below the matching height per face.
wm_inverselogicalWall model: the inverse-transformation model (Griffin et al. 2023) per face, else the equilibrium one.
wm_edge_ureal(kind=R8P)Inverse model: speed at the edge of the layer per face.
wm_edge_treal(kind=R8P)Inverse model: temperature at the edge of the layer per face.
wall_temperaturereal(kind=R8P)Isothermal walls: wall temperature of each face.
nr_parreal(kind=R8P)Non-reflecting faces: target r, u, v, w, p, then sigma and L.
sg_parreal(kind=R8P)Shock generators: the post-shock conservative state, then the x range [x0, x1).
dftype(flume_inflow_df_object)Digital-filter inflow (issue #119, T3.7).

Type-Bound Procedures ​

NameAttributesDescription
descriptionpass(self)Return pretty-printed object description.
initializepass(self)Initialize boundary conditions.
load_from_filepass(self)Load config from file.

Subroutines ​

initialize ​

Initialize boundary conditions.

fortran
subroutine initialize(self, file_parameters, physics)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_bc_object)inoutBoundary conditions.
file_parameterstype(file_ini)inSimulation parameters ini file handler.
physicstype(flume_physics_object)inPhysics (for the inflow state conversion).

Call graph

load_from_file ​

Load config from file; type is required on every face and an unknown value is fatal.

fortran
subroutine load_from_file(self, file_parameters, physics)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_bc_object)inoutBoundary conditions.
file_parameterstype(file_ini)inSimulation parameters ini file handler.
physicstype(flume_physics_object)inPhysics (for the inflow state conversion).

Call graph

realm_edge_donor ​

Donor of the ghost (i, j, k) filled by the condition of face: the cell mirrored about the face (walls) or the first interior cell along its normal (extrapolation); the indexes along the other axes are kept.

Attributes: pure

fortran
subroutine realm_edge_donor(face, face_kind, ni, nj, nk, i, j, k, iref, jref, kref)

Arguments

NameTypeIntentAttributesDescription
faceinteger(kind=I4P)inFace (1..6: -x, +x, -y, +y, -z, +z).
face_kindinteger(kind=I4P)inKind of the face.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
iinteger(kind=I4P)inGhost cell.
jinteger(kind=I4P)inGhost cell.
kinteger(kind=I4P)inGhost cell.
irefinteger(kind=I4P)outDonor cell.
jrefinteger(kind=I4P)outDonor cell.
krefinteger(kind=I4P)outDonor cell.

Call graph

wall_noslip_ghost ​

Ghost state of a no-slip wall (normal axis d) from its mirrored interior state q: the velocity reflected about the wall velocity, u_g = 2 u_w - u; the pressure mirrored; the temperature mirrored (adiabatic) or set to the geometric mirror T_w^2 / T (isothermal, the density then p / (R T_g), positive for any positive T); the normal field odd, psi even.

Model-agnostic: the field components are IQ_BX..min(IQ_BZ, nv_mhd) (none for Euler) and psi the slots beyond them up to nv_mhd; psi_energy (1 with EGLM, 0 otherwise) says whether the total energy holds psi^2 / 2. The slots beyond nv_mhd up to nv_entropy are the advected entropy (Euler with dual energy, issue #91): the ghost's own, p rho_g^(1-gamma); those beyond nv_entropy are passive scalars (issue #92), their specific value mirrored.

Attributes: pure

fortran
subroutine wall_noslip_ghost(nv, nv_mhd, nv_entropy, d, gamma, R, psi_energy, isothermal, wall_velocity, wall_temperature, q, qg)

Arguments

NameTypeIntentAttributesDescription
nvinteger(kind=I4P)inConservative variables number.
nv_mhdinteger(kind=I4P)inLast slot of the MHD state: 5 (hydrodynamic models) or nv (MHD).
nv_entropyinteger(kind=I4P)inLast entropy slot: 6 (dual energy) or nv_mhd.
dinteger(kind=I4P)inWall-normal axis.
gammareal(kind=R8P)inSpecific heats ratio.
Rreal(kind=R8P)inGas constant.
psi_energyreal(kind=R8P)in1 if the total energy holds psi^2 / 2 (EGLM), else 0.
isothermallogicalinIsothermal (else adiabatic) wall.
wall_velocityreal(kind=R8P)inWall velocity.
wall_temperaturereal(kind=R8P)inWall temperature (isothermal).
qreal(kind=R8P)inMirrored interior state.
qgreal(kind=R8P)outGhost state.

Call graph

oblique_shock ​

The state behind an oblique shock in the x-y plane (issue #121, S3; Anderson, Modern Compressible Flow, ch. 4): the upstream primitive state up (r, u, v, w, p), the shock entering through a y face of outward sign s (+1 the top), so that it turns the flow by -s theta (toward the face opposite). deg is the deflection theta (the weak solution) or, by_angle, the shock angle beta from the upstream velocity, in degrees. The normal Mach number M_n = M sin(beta), with M of the in-plane velocity; w, tangent to the shock, is unchanged. error: 0, 1 not supersonic, 2 beta out of (mu, 90], 3 theta out of (0, theta_max).

Attributes: pure

fortran
subroutine oblique_shock(gamma, s, up, deg, by_angle, post, beta, theta, error)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
sreal(kind=R8P)inOutward normal sign of the face along y.
upreal(kind=R8P)inUpstream primitive state.
degreal(kind=R8P)inDeflection or shock angle, degrees.
by_anglelogicalindeg is the shock angle.
postreal(kind=R8P)outPost-shock primitive state.
betareal(kind=R8P)outShock angle and deflection, degrees.
thetareal(kind=R8P)outShock angle and deflection, degrees.
errorinteger(kind=I4P)outError status.

Call graph

nonreflecting_ghost ​

Ghost state of a non-reflecting face (issue #121, S2) from the first interior cell q1 (Euler, conservative), dist off it along the outward normal of axis d, sign s (-1 for a min face, +1 for a max face); par = target r, u, v, w, p, sigma, L. The jumps of the characteristic variables linearised about q1 (outward normal velocity u_n, sound speed c): outgoing waves none; the incoming acoustic one, w1 = p - rho c u_n with speed u_n - c < 0, dist K (p - p_t) / (u_n - c), K = sigma (1 - M^2) c / L, with w5 = p + rho c u_n unchanged, so dp = A / 2, du_n = -A / (2 rho c); inflow through the face (u_n < 0) the entropy rho - p / c^2 and the tangential velocity of the target; u_n + c <= 0 the whole target.

Attributes: pure

fortran
subroutine nonreflecting_ghost(gamma, d, s, dist, par, q1, qg)

Arguments

NameTypeIntentAttributesDescription
gammareal(kind=R8P)inSpecific heats ratio.
dinteger(kind=I4P)inNormal axis.
sreal(kind=R8P)inOutward normal sign along d.
distreal(kind=R8P)inDistance from the interior cell to the ghost.
parreal(kind=R8P)inTarget r, u, v, w, p, sigma, L.
q1real(kind=R8P)inFirst interior cell, conservative.
qgreal(kind=R8P)outGhost state, conservative.

Call graph

hydrostatic_ghost ​

Ghost state of a hydrostatic boundary (issue #73, M7-G0): the density and the pressure of the isothermal hydrostatic equilibrium continued from the first interior cell q1, rho_g = rho_1 exp(gs / T_1), p_g = rho_g T_1, T_1 = p_1 / rho_1, gs = g_d s (the gravity along the normal times the signed distance from q1 to the ghost); the velocity of the mirrored cell qm times the wall signs (normal component odd), its field and psi unchanged (even).

Model-agnostic as wall_noslip_ghost: the field components are IQ_BX..min(IQ_BZ, nv_mhd), psi the slots beyond up to nv_mhd, the advected entropy past nv_mhd up to nv_entropy (issue #91) the ghost's own, the passive scalars beyond (issue #92) the mirrored cell's specific value.

Attributes: pure

fortran
subroutine hydrostatic_ghost(nv, nv_mhd, nv_entropy, gamma, psi_energy, gs, wall_sign, qm, q1, qg)

Arguments

NameTypeIntentAttributesDescription
nvinteger(kind=I4P)inConservative variables number.
nv_mhdinteger(kind=I4P)inLast slot of the MHD state: 5 (hydrodynamic models) or nv (MHD).
nv_entropyinteger(kind=I4P)inLast entropy slot: 6 (dual energy) or nv_mhd.
gammareal(kind=R8P)inSpecific heats ratio.
psi_energyreal(kind=R8P)in1 if the total energy holds psi^2 / 2 (EGLM), else 0.
gsreal(kind=R8P)inGravity along the normal times the distance from q1 to the ghost.
wall_signreal(kind=R8P)inWall mirror sign of each variable along the normal (momentum used).
qmreal(kind=R8P)inMirrored interior state.
q1real(kind=R8P)inFirst interior state along the normal.
qgreal(kind=R8P)outGhost state.

Call graph

Functions ​

description ​

Return a pretty-formatted object description.

Returns: character(len=:)

fortran
function description(self) result(desc)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_bc_object)inBoundary conditions.

Call graph

realm_edge_face ​

Face whose condition fills a crown row beyond the realm faces of the edge or corner fec: the first inflow face among them (an inflow ghost holds the inflow state whatever else it lies beyond), else the first physical one, 0 when every one is a seam (the row lies outside the forest).

Attributes: pure

Returns: integer(kind=I4P)

fortran
function realm_edge_face(fec, face_kind) result(face)

Arguments

NameTypeIntentAttributesDescription
fecinteger(kind=I4P)inTree boundary fec of the row (7..26).
face_kindinteger(kind=I4P)inKind of each realm face (-x, +x, -y, +y, -z, +z), BC_SEAM for a seam.

Call graph