Skip to content

adam_flume_common_object ​

ADAM, FLUME common object: data and methods shared by all backends.

flume_common_object extends the library realm_object (which owns grid, tree, field, maps, IO, AMR, IB, RK and WENO objects) with the FLUME physics layer. The backends (flume_cpu_object, flume_fnl_object) extend it and implement the forest contract. Initialization order (issue #35, section 6.1): IO, numerics, physics (decides nv), blocks budget with the real per-block fields count, realm, BCs (before the first map build, so periodicity is seen by the tree), time, IC, diagnostics, fields allocation, uniform refinement.

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

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
SCHEME_TIME_TAGcharacter(len=11)parameterTime-integration family tag (forest admissibility).
MHD_DERIVED_NAMEcharacter(len=4)parameterMHD derived fields names.

Derived Types ​

regrid_phases_t ​

The state of one runtime regrid across its phases, regrid_begin/mark/apply/end_forest (issue #110): a single-realm regrid runs them in a row (regrid_forest), a multi-realm forest one realm after the other.

Components

NameTypeAttributesDescription
activelogicalThe cadence asks for a regrid at this step.
markedlogicalThe realm marked its blocks (and refreshed its ghosts) in the current sweep.
sweepsinteger(kind=I4P)Sweeps that changed the grid.
refinedinteger(kind=I4P)Blocks refined over the sweeps (replicated tree).
coarsenedinteger(kind=I4P)Families of children merged into their parent.
blocksinteger(kind=I4P)Blocks of this rank before the regrid.
secondsreal(kind=R8P)Wall time at the start of the regrid (the FNL log).

flume_common_object ​

FLUME common object: data and methods shared by all backends.

Inheritance

Extends: realm_object

Components

NameTypeAttributesDescription
iotype(io_object)IO handler.
amrtype(amr_object)AMR marker handler.
slicestype(slices_object)Slices handler.
flailtype(flail_object)FLAIL, the elliptic solver library (issue #84).
wenotype(weno_object)WENO reconstructor.
with_wenologicalRead [weno] and initialize weno (the app clears it when unused, #80 P5).
with_fdvlogicalRead [fdv] and bind the FD/FV operators (cleared when unused, #80 P5).
ibtype(ib_object)Immersed boundary.
tstype(stepper_object)Time integrator on SELAH (stepper_object, #132).
selah_layoutinteger(kind=I4P)Layout of the fields ts integrates (the FNL apps set LAYOUT_V_LAST, their (b, i, j, k, v) device fields).
selah_partitionsinteger(kind=I4P)The variables (first, last) of the two partitions of a splitting scheme (PRISM's Yoshida: B then D); 0 for none.
adamtype(adam_object)ADAM, grid + tree + field + maps orchestrator.
fdv_schemecharacter(len=:)allocatableFDV scheme, fd/fv.
fdv_orderinteger(kind=I4P)Order of finite difference/volume schemes, general order.
fdv_half_stencilinteger(kind=I4P)Half stencil length of finite difference/volume schemes.
fdv_half_stencilsinteger(kind=I4P)Half stencil length of fdv schemes for each derivative up to 6.
ngcinteger(kind=I4P)pointerNumber of ghost cells.
niinteger(kind=I4P)pointerNumber of cells in i direction.
njinteger(kind=I4P)pointerNumber of cells in j direction.
nkinteger(kind=I4P)pointerNumber of cells in k direction.
nbinteger(kind=I4P)pointerTotal blocks number for MPI.
blocks_numberinteger(kind=I4P)pointerActual blocks number.
nvinteger(kind=I4P)pointerNumber of variables in q vector. 1-based position of this realm in the forest's realm(:) array, or 0 in the N=1 single-realm legacy path (where the program driver calls realm%initialize_forest directly, bypassing the forest orchestrator).
realm_indexinteger(kind=I4P)
realms_numberinteger(kind=I4P)Realms in the forest (set by initialize_forest, #80 P3). Inter-realm seam coupling — currently-published stage buffer key.
stage_activeinteger(kind=I4P)A copy of the forest's flux register (its faces and lookup, the accumulators unused), refreshed by the forest each time it builds the register (init, regrid). A realm can accumulate one residual evaluation's seam fluxes into it for a diagnostic without touching the forest's step accumulators (FLUME's D_flux, issue #68 A2).
flux_register_copytype(flux_register_object)Procedure pointer TBPs for FDV operators (set at initialization by backend).
compute_block_total_variationprocedure(compute_block_total_variation_interface)pass(self), pointerCompute TV.
compute_curlprocedure(compute_curl_interface)pass(self), pointerCompute curl.
compute_curl_extendedprocedure(compute_curl_interface)pass(self), pointerCompute curl on extended support.
compute_derivative1procedure(compute_derivative1_interface)pass(self), pointerCompute deriv1.
compute_derivative2procedure(compute_derivative2_interface)pass(self), pointerCompute deriv2.
compute_derivative4procedure(compute_derivative4_interface)pass(self), pointerCompute deriv4.
compute_divergenceprocedure(compute_divergence_interface)pass(self), pointerCompute dive.
compute_gradientprocedure(compute_gradient_interface)pass(self), pointerCompute grad.
compute_gradient_extendedprocedure(compute_gradient_interface)pass(self), pointerCompute gradient on extended support.
compute_laplacianprocedure(compute_laplacian_interface)pass(self), pointerCompute laplac.
amr_locked_logicalRuntime AMR locked after initialization.
regrid_phasetype(regrid_phases_t)The state of the current runtime regrid (issue #110).
amr_criteriatype(amr_criterion_pointer)allocatableRegistered refinement criteria (issue #110, P4).
amr_marker_listtype(amr_criterion_pointer)allocatableThe [amr_marker_N] criteria, in input order: built-in and registered (issue #110, P4.2).
ib_mapstype(maps_object)The ghost maps restricted to the cells the eikonal sweeps read (#156 L2): ghost layer 1 next to a solid cell, on a block face.
ib_maps_generationinteger(kind=I4P)Builds of ib_maps so far (a backend copy follows it).
save_auxiliary_fieldslogicalSave the auxiliary variables with the fields.
glm_speed_reportedreal(kind=R8P)Largest wave speed above c_h reported so far.
divb_reportedreal(kind=R8P)Largest monitored measure above divb_tol reported so far.
divb_seaminteger(kind=I4P)allocatableSeam faces flags of the div(B) history [nb, 6].
qreal(kind=R8P)allocatableConservative variables [nv, 1-ngc:ni+ngc, ..., nb].
dqreal(kind=R8P)allocatableResiduals [nv, 1-ngc:ni+ngc, ..., nb].
q_auxreal(kind=R8P)allocatableAuxiliary variables [nv_aux, 1-ngc:ni+ngc, ..., nb].
turbulencetype(turbulence_object)Subgrid-scale model ([turbulence], issue #119, T1).
forcingtype(flume_forcing_object)Mass-flow forcing ([forcing], issue #119, T3.1).
wm_facesinteger(kind=I4P)allocatableWall model: block faces it holds [nb, 6] (issue #119, T3.3).
has_wall_modellogicalSome face of the domain is modelled.
ns_facesinteger(kind=I4P)allocatableNo-slip walls: block faces on them [nb, 6] (issue #119, the #65 mass leak).
has_nosliplogicalSome face of the domain is a no-slip wall of a hydrodynamic model.
wm_avg_xreal(kind=R8P)allocatableWall model input filter: the averaged u, v, w, p, rho and the pressure gradient along u (#121 S4d) on the x faces [6, 2, nj, nk, nb], side 1 low.
wm_avg_yreal(kind=R8P)allocatableThe same on the y faces [6, ni, 2, nk, nb].
wm_avg_zreal(kind=R8P)allocatableThe same on the z faces [6, ni, nj, 2, nb].
has_wm_filterlogicalSome modelled face filters its samples (wall_model_filter > 0) or its pressure gradient (wall_model_pressure_gradient_filter > 0).
wm_avg_nvinteger(kind=I4P)Averages per wall face: the sample (5), the pressure gradient, and with wall_model_convection the convection of WM_CONV_CELLS cells (#121 P2), and with wall_model_resolved_stress four averages per cell for its resolved stress (#121 P3).
has_wm_viscositylogicalSome modelled face puts its eddy viscosity below the matching height.
wm_filter_freshlogicalThe averages hold no history (start, regrid, a checkpoint without them): the next commit takes the sample.
wm_filter_itinteger(kind=I4P)The iteration whose sample the averages hold.
hybrid_facesinteger(kind=I4P)allocatableHybrid scheme: block faces it must not read across [nb, 6].
hybrid_has_faceslogicalHybrid scheme: some block of the realm has such a face.
sgs_lambdareal(kind=R8P)Local time step limit of the eddy viscosity.
phi_gravreal(kind=R8P)allocatableGravitational potential [1-ngc:ni+ngc, ..., nb] (issue #81); a one-cell placeholder without a potential.
poisson_wallreal(kind=R8P)Wall time of the last Poisson solve (s).
q_nametype(string)allocatableConservative variables names.
dq_nametype(string)allocatableResiduals names.
q_aux_nametype(string)allocatableAuxiliary variables names.
bctype(flume_bc_object)Boundary conditions.
diagnosticstype(flume_diagnostics_object)Diagnostics.
ictype(flume_ic_object)Initial conditions.
numericstype(flume_numerics_object)Numerics.
physicstype(flume_physics_object)Physics.
unitstype(flume_reference_object)Reference layer (dimensional input, issue #49).
limiter_dtreal(kind=R8P)Forward-Euler step the positivity limiter makes admissible: the active stage's (#134 D4).
flowstype(additive_splitting)The field step and the post-step flows (cooling, sinks): SELAH's composition (lie, the field first; #134 D4).
sinkstype(flume_sinks_object)Sink particles (issue #94).
timetype(flume_time_object)Time handler.

Type-Bound Procedures

NameAttributesDescription
load_fdv_from_filepass(self)Load FDV config from file.
initialize_process_contextpass(self)Process-global MPI (+ device) init; forest calls it ONCE first.
initialize_forestpass(self), non_overridableInvoked by forest%initialize per realm: the template.
initialize_app_forestpass(self)Template hook: parse, build, backend, before the state.
restart_state_forestpass(self)Template hook: the state from the restart files.
amr_update_initial_forestpass(self)Template hook: one initial regrid.
rebalance_initial_forestpass(self)Template hook: the static rebalance of the initial grid.
post_initial_state_forestpass(self)Template hook: everything after the initial state.
compute_local_dt_forestpass(self)Invoked by forest%compute_global_dt during the min reduction.
advance_one_step_forestpass(self)Invoked by forest%evolve_one_step per realm per timestep.
stages_per_step_forestpass(self)Number of integrator stages this realm exposes per step.
open_step_forestpass(self)Per-step prologue (multi-realm path).
begin_stage_forestpass(self)Begin one integrator stage on this realm (multi-realm path).
end_stage_forestpass(self)End the stage: residuals + assignment (multi-realm path).
close_step_forestpass(self)Per-step epilogue (multi-realm path).
post_step_forestpass(self)Invoked by forest%post_step per realm per timestep.
regrid_forestpass(self)Invoked by forest%regrid per realm per timestep (#74).
regrid_begin_forestpass(self)Multi-realm regrid, phase 1: is it a regrid step (#110).
regrid_mark_forestpass(self)Phase 2: mark one sweep, marks on the tree (#110).
regrid_apply_forestpass(self)Phase 3: adapt to the (balanced) tree marks (#110).
regrid_end_forestpass(self)Phase 4: refresh the grid-dependent state (#110).
is_done_forestpass(self)Invoked by forest%is_done during the termination reduction.
finalize_forestpass(self)Invoked by forest%finalize per realm at shutdown.
finalize_mpi_forestpass(self)Process-global MPI finalize; forest calls it ONCE after all.
fill_seam_from_peer_forestpass(self)Receive-side roundtrip: copy peer's interior into self's ghosts.
pack_seam_cells_forestpass(self)Pack own cells of the cross-rank seam send rows.
unpack_seam_cells_forestpass(self)Unpack the cross-rank seam receive rows into own ghosts.
after_topology_build_forestpass(self)Backend hook invoked once after the forest builds the seam maps.
apply_reflux_to_stage_forestpass(self)Apply Berger-Colella reflux to self's stage buffer.
close_block_xh5fnopassClose XH5F file block.
close_file_xh5fnopassClose XH5F file.
open_block_xh5fpass(self)Open block file XH5F.
open_file_xh5fpass(self)Open file XH5F.
save_q_xh5fpass(self)Save in XH5F (XDMF/HDF5) format.
compute_curl_fd_extendedpass(self)Compute curl of vector field, finite difference, even for half gcs.
compute_gradient_fd_extendedpass(self)Compute gradient of scalar field, finite difference, even for half gcs. private FDV operators
amr_updatepass(self)Do AMR update (initialization-time only).
initial_amr_iterations_forestpass(self)Template hook: [initial_conditions] AMR passes.
reset_time_forestpass(self)Template hook: time and step counter to zero.
set_initial_state_forestpass(self)Template hook: initial conditions and solids distance.
runtime_amr_forestpass(self)Whether this realm regrids during the run (issue #74).
mark_by_geometrypass(self)Mark blocks to be refined by a primitive geometric box.
mark_by_gradientpass(self)Mark blocks by the gradient of a conservative or auxiliary variable.
mark_by_solidpass(self)Mark blocks crossed by the surface of an immersed solid.
mark_by_lohnerpass(self)Mark blocks by the Loehner estimator of a variable (issue #74).
mark_by_jeanspass(self)Mark blocks by the cells per Jeans length (issue #91).
mark_by_kolmogorovpass(self)Mark blocks by the local Kolmogorov resolution r = h/eta (issue #133).
mark_runtimepass(self)Combine the markers into the flags of a runtime regrid (issue #74).
register_amr_criterionpass(self)Register a refinement criterion by name (issue #110, P4).
check_regridded_statepass(self)Stop on an inadmissible state after a regrid (issue #74).
is_regrid_steppass(self)Whether the step just closed is a runtime regrid step (issue #74).
accumulate_seam_skinpass(self)Route one weighted seam face skin to the forest's flux register.
add_seam_gravity_workpass(self)Add the seam gravity work of self-gravity to a seam skin.
allocate_commonpass(self)Allocate common data.
compute_fields_numberpass(self)Compute the block-sized fields allocated per block.
compute_phipass(self)Compute the immersed solids distance function (host).
make_ib_mapspass(self)Build the ghost maps of the eikonal sweeps (#156 L2).
destroy_commonpass(self)Free common data.
glm_lambdapass(self)Return the GLM bound of the local dt, c_h max sum_d 1/dx_d.
initializepass(self)Initialize the common data.
log_dt_limitpass(self)Log which limit, hyperbolic or diffusive, sets dt.
log_gravity_regimepass(self)Log the velocity gravity adds in a step (issue #73).
log_self_gravitypass(self)Log the self-gravity regime (issue #81).
poisson_iterationspass(self)FCG iterations of the last multigrid solve.
wall_temperature_boundpass(self)Return the hottest isothermal wall temperature of the dt bound.
null_freezepass(self)Return the variable each null direction freezes.
output_factorspass(self)Return the output factors of written variables.
output_namespass(self)Return the names of every written variable.
report_divbpass(self)Reduce and save the div(B) norms, apply the divb_tol monitor.
report_glm_speedpass(self)Check c_h against the fastest wave (warning or stop).
nonfinite_totalpass(self)Sum the non-finite values count over the ranks.
stop_nonfinitepass(self)Stop on a non-finite state, locating it on every rank.
load_restart_filespass(self)Load restart files.
save_restart_filespass(self)Save restart files.
load_wm_filterpass(self)Load the wall-model input filter averages of a restart (issue #119).
save_wm_filterpass(self)Save the wall-model input filter averages (issue #119).
wm_filter_to_hostpass(self)Bring the filter averages to the host arrays (FNL: from the device).
wm_filter_to_devicepass(self)Send the host filter averages where the backend reads them (FNL: the device).
advance_inflow_dfpass(self)Move the digital-filter inflow on by the step (issue #119, T3.7).
inflow_df_to_devicepass(self)Send the inflow ghost rows where the backend reads them (FNL: the device).
advance_inflow_rrpass(self)Rebuild the recycling inflow's ghost rows from the committed state (issue #121, S5).
inflow_rr_gatherpass(self)Gather the recycling plane's cells of this rank on the host (FNL: from the device).
inflow_rr_to_devicepass(self)Send the recycling inflow's ghost rows where the backend reads them (FNL: the device).
save_wall_historypass(self)Save the wall-model history on its cadence (issue #119, T3.7).
wall_history_to_hostpass(self)Bring the state to the host for the wall-model history (FNL: from the device).
save_slicespass(self)Save the slices on their cadence.
save_xh5fpass(self)Save fields in XH5F format.
set_divb_seampass(self)Set the seam faces flags of the div(B) history.
set_glm_dampingpass(self)Set the GLM damping once the grid exists.
set_potentialpass(self)Set the gravitational potential of the current grid.
solve_potentialpass(self)Solve the self-gravity potential of a host state.
solve_potential_packedpass(self)Solve the self-gravity potential of a packed density.
compute_sink_accelerationspass(self)Mesh gravity at the sinks (issue #94).
deposit_sinkspass(self)Add the sinks' CIC mass to a packed density (issue #94).
set_limiter_dtpass(self)The positivity limiter's forward-Euler step of a stage.
refresh_sink_accelerationspass(self)Re-solve the potential, the sinks' accelerations (#94).
step_sinkspass(self)Kick-drift-kick of the sinks, SELAH's Strang (#94, #134 D4).
wrap_sinkspass(self)Wrap the sinks on periodic faces, refuse a sink outside (#94).
sink_stencilpass(self)CIC stencil of a point: target points and weights (issue #94).
sinks_dt_limitpass(self)Time step limit of the sinks (issue #94).
accrete_sinkspass(self)Threshold accretion of the committed host state (issue #94).
accrete_cellspass(self)Threshold accretion on gathered cells (issue #94).
sink_accretion_cellspass(self)The cells within an accretion radius (issue #94).
create_sinkspass(self)Sink creation, Federrath et al. 2010 (issue #94).
merge_sinkspass(self)Merge bound, converging sinks (issue #94).
sink_accretion_radiuspass(self)Accretion radius of a point (issue #94).
coupling_descriptor_forestpass(self)Return the realm coupling descriptor.
block_spacingpass(self)Return the spacing of a block by a delta criterion.
check_ngc_numberpass(self)Check the ghost cells number against the stencils.
check_dissipationpass(self)Refuse the dissipative terms not implemented yet.
check_hybridpass(self)Refuse what the hybrid scheme does not handle.
set_wall_model_facespass(self)Flag the block faces of the wall model.
set_hybrid_facespass(self)Flag the block faces the central flux must not read across.
check_runtime_amrpass(self)Check [amr] frequency, default the prolongation (#74).
build_amr_marker_listpass(self)The [amr_marker_N] criteria, in input order (#110).
check_divb_fluxpass(self)Check [diagnostics] divb_flux (#68 A2).
check_positivity_limiterpass(self)Refuse the limiter where it cannot work.
check_gravitypass(self)Refuse gravity where it is not defined (issue #73).
check_barotropicpass(self)Refuse what a barotropic gas does not define (#100).
check_slicespass(self)Check the slices interpolation types.
check_weno_schemepass(self)Refuse the centred WENO schemes.
initialize_riemann_schemepass(self)Check and set up the weno-riemann scheme.
compute_mhd_derivedpass(self)Compute the MHD derived output fields of one block.
compute_q_aux_hostpass(self)Compute the auxiliary variables of the host q.
io_initializepass(self)Build the variables names.

flume_common_object%load_fdv_from_file ​

Load FDV config from file.

fortran
subroutine load_fdv_from_file(self, file_parameters)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe equation.
file_parameterstype(file_ini)inSimulation parameters ini file handler.

Call graph

flume_common_object%initialize_process_context ​

Initialize the process-global MPI handler (and the device, on the device backends).

MPI and the device context are process-global: the forest calls this ONCE, on a single realm, before any realm is initialized (issue #80 P3, the mirror of finalize_mpi_forest); a realm never initializes them itself. The default initializes the CPU mpih singleton; the FNL backends override it to initialize mpih_fnl (device binding, the ranks sharing a device) first. mpih%initialize is once-only, so a test driver that called it already is harmless.

fortran
subroutine initialize_process_context(self, verbose)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm (carries no MPI state; dispatch picks the backend).
verboselogicalinoptionalTrigger verbose output.

Call graph

flume_common_object%initialize_forest ​

Initialize this realm, the library template (issue #80 P3): the sequence every application shares, its steps delegated to the *_forest hooks below.

fortran
 call self%initialize_app_forest(filename, realms_number) ! parse, build the library and app objects, the backend
 if (self%io%restart) then
    call self%restart_state_forest                        ! the state from the restart files
 else
    do i=1, self%initial_amr_iterations_forest()          ! the initial state, then a regrid on it, n times
       call self%set_initial_state_forest
       call self%amr_update_initial_forest
    enddo
    call self%rebalance_initial_forest                    ! [amr].(balance_static)
    call self%set_initial_state_forest                    ! the initial state on the final grid
    call self%adam%make_comm_local_maps_ghost_bc          ! the maps of the final grid
    call self%reset_time_forest
 endif
 call self%post_initial_state_forest                     ! device push, ghosts, t0 diagnostics, history files

Invoked by forest%initialize once per realm at startup, before the time loop; MPI and the device are up already (initialize_process_context). The forest sets self%realm_index = is BEFORE invoking it, so the hooks can read their forest position for per-realm IO filenames, log prefixes, etc. The template is non-overridable: an application implements the hooks, whose defaults error-stop, except restart_state_forest, which refuses [IO].(restart) = .true..

fortran
subroutine initialize_forest(self, filename, realms_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
filenamecharacter(len=*)inInput parameters file name.
realms_numberinteger(kind=I4P)inoptionalRealm count in the forest.

Call graph

flume_common_object%initialize_app_forest ​

Template hook: everything before the initial state (parse the input, build the library and app objects, set up the backend); realms_number divides the memory budget in a forest. Default error-stops.

fortran
subroutine initialize_app_forest(self, filename, realms_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
filenamecharacter(len=*)inInput parameters file name.
realms_numberinteger(kind=I4P)inoptionalRealm count in the forest.

Call graph

flume_common_object%restart_state_forest ​

Template hook: the state from the restart files (time and step counter included). Default refuses the restart.

fortran
subroutine restart_state_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.

Call graph

flume_common_object%amr_update_initial_forest ​

Template hook: one regrid of the initial grid on the current state. Default error-stops.

fortran
subroutine amr_update_initial_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.

Call graph

flume_common_object%rebalance_initial_forest ​

Template hook: the static rebalance of the initial grid, [amr].(balance_static) (default .true.: every application decides what it does with it). Default error-stops.

fortran
subroutine rebalance_initial_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.

Call graph

flume_common_object%post_initial_state_forest ​

Template hook: everything after the initial state, restart or not (device push, ghost update, t0 diagnostics, history files, the AMR lock). Default error-stops.

fortran
subroutine post_initial_state_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.

Call graph

flume_common_object%compute_local_dt_forest ​

Compute this realm's local stability-limited dt (no MPI reduction).

Invoked by forest%compute_global_dt during the min reduction across all realms in the forest. The reduction itself is the orchestrator's job; this method computes only the value local to self.

Default implementation error-stops: every consumer app MUST override this method (the CFL criterion and umax are app-specific). PRISM's override lives on prism_cpu_object/prism_fnl_object.

fortran
subroutine compute_local_dt_forest(self, dt_local)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe realm.
dt_localreal(kind=R8P)outLocal stability-limited dt.

Call graph

flume_common_object%advance_one_step_forest ​

Advance this realm by one full timestep of size dt.

Invoked by forest%evolve_one_step once per realm per timestep when the forest contains a single realm (N=1 fast path). For N>1 the forest drives the stage loop itself via open_step_forest, begin_stage_forest, end_stage_forest, close_step_forest, and this TBP is NOT invoked — see forest_object%evolve_one_step for the multi-realm path.

The orchestrator owns global dt selection (compute_global_dt) and the termination check; this method owns the integration itself — RK substages, BC application, intra-realm ghost exchange, divergence cleaning — i.e. everything that turns q at time t into q at time t + dt.

Default implementation error-stops: every consumer app MUST override this method (the integrator catalog and the substage layout are app-specific). PRISM's override lives on prism_cpu_object and prism_fnl_object as a thin wrapper around the legacy integrate / integrate_dev dispatch.

fortran
subroutine advance_one_step_forest(self, dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
dtreal(kind=R8P)inTimestep size.

Call graph

flume_common_object%stages_per_step_forest ​

Return the number of integrator stages this realm exposes per step.

Integrator-agnostic: K is the number of inter-realm seam-coherence boundaries the realm wants visible to the forest: K = ts%stages() for the SSP schemes the staged path admits (FLUME and PRISM refuse the others here). A realm that does all its work atomically and needs one peer-sync per step would report K = 1.

Invoked by forest%evolve_one_step on the multi-realm path to size the stage loop. Under α (end-of-step seam coupling) realms may report different K values: the orchestrator iterates k = 1..max(K_realm) and gates each per-stage TBP on k <= K_realm(is). Under β (stage-coincident) admissibility requires equal K on both endpoints of every β seam (enforced at init).

Default implementation error-stops: every realm that participates in a multi-realm forest MUST override this. Apps that only ever run as N=1 may leave it (the N=1 fast path doesn't call this).

Returns: integer(kind=I4P)

fortran
function stages_per_step_forest(self) result(K)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe realm.

Call graph

flume_common_object%open_step_forest ​

Per-step prologue on the multi-realm path: pre-stage-loop setup.

Invoked once per realm per timestep, BEFORE the forest's stage loop starts. Body owns whatever the integrator does once per step before its first stage: external-field prelude, integrator-private state initialization (for SELAH realms: ts%begin_step), time bookkeeping (it increment, dt capping for time_max), progress prints.

Default implementation error-stops: every multi-realm participant MUST override this. N=1 apps can leave it.

fortran
subroutine open_step_forest(self, dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
dtreal(kind=R8P)inTimestep size from the forest.

Call graph

flume_common_object%begin_stage_forest ​

Open one integrator stage on this realm — multi-realm path.

Invoked once per (realm, stage) by the forest, with k iterating from 1 to K_total. Body publishes the realm's stage-k buffer to peers: it runs whatever integrator-private work is needed BEFORE residuals (for SELAH realms: ts%begin_stage(k) building the stage state from self%q and the prior stages), and assigns self%stage_active = k so peer-realm reads pick up the right buffer. Crucially it does NOT touch ghost cells from peer realms; peer realms may not yet have opened their own stage-k buffer when this fires.

The forest invokes begin_stage_forest on EVERY realm before proceeding to the seam fill and end_stage_forest, so by the time residuals evaluate, every peer realm has its stage-k buffer populated and the inter-realm ghost exchange returns coherent values.

Default implementation error-stops: every multi-realm participant MUST override this.

fortran
subroutine begin_stage_forest(self, k, K_total, dt, realm)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
kinteger(kind=I4P)inStage index (1..K_total).
K_totalinteger(kind=I4P)inForest-wide stage count for this step.
dtreal(kind=R8P)inTimestep size from the forest.
realmtype(realm_pointer)inouttarget, optionalSibling realms (contract parity).

Call graph

flume_common_object%end_stage_forest ​

Close one integrator stage on this realm — multi-realm path.

Invoked once per (realm, stage) by the forest AFTER its Phase 2 inter-realm seam fill has populated the seam ghost cells. The body runs the integrator's per-stage work that needs valid peer ghosts: residual computation and stage assignment in a single sweep (for SELAH realms: compute_residuals + ts%set_rhs). The read-after- overwrite race that originally required a three-phase split is eliminated by the upstream seam fill, which decouples peer state reads from the in-place overwrite of the stage buffer's interior.

flux_register is an optional dummy used by FV residuals (compute_residuals_fv_centered) to accumulate seam-face flux contributions for Phase-A Berger–Colella reflux. Backends that don't implement FV reflux (e.g. FNL's FD-centered path) ignore it.

Default implementation error-stops: every multi-realm participant MUST override this. realm accepted on contract for parity but is not needed: peer state is read via the seam fill, not here.

fortran
subroutine end_stage_forest(self, k, K_total, dt, realm, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
kinteger(kind=I4P)inStage index (1..K_total).
K_totalinteger(kind=I4P)inForest-wide stage count for this step.
dtreal(kind=R8P)inTimestep size from the forest.
realmtype(realm_pointer)inouttarget, optionalSibling realms (parity only).
flux_registerclass(flux_register_object)inoutoptionalForest's flux register for FV reflux.

Call graph

flume_common_object%close_step_forest ​

Per-step epilogue on the multi-realm path: post-stage-loop finalization.

Invoked once per realm per timestep, AFTER the forest's stage loop completes. Body owns whatever the integrator does once per step at the end: assembly of the committed state from stage buffers (for SELAH realms: ts%finish_step), BC update, divergence cleaning, coil current refresh, residual save, time advance. Should also clear self%stage_active = 0 so any inter-step fill_seam_from_peer_forest query reads from the committed state rather than a stale stage buffer.

Default implementation error-stops: every multi-realm participant MUST override this.

fortran
subroutine close_step_forest(self, dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
dtreal(kind=R8P)inTimestep size from the forest.

Call graph

flume_common_object%post_step_forest ​

Run this realm's per-timestep post-step work: diagnostics, IO, AMR.

Invoked by forest%post_step once per realm per timestep, after the advance. The orchestrator owns cadence decisions (when to save state, when to refine the mesh, etc.) and conveys them via the optional do_* flags; this method executes the work that those flags enable. Cadence flags absent ⇒ caller wants the default cadence (today: do everything every step, since save_*_data routines internally respect the realm's own it_save settings).

Default implementation error-stops: every consumer app MUST override this method (the diagnostic catalog and IO layout are app-specific). PRISM's override lives on prism_cpu_object and prism_fnl_object.

Optional realm(:): forest realm array threaded for inter-realm halo refresh inside save_simulation_data (which calls update_ghost). FNL backend forwards it through; CPU backend ignores it.

fortran
subroutine post_step_forest(self, dt, t, it, do_save_state, do_save_residuals, do_save_restart, do_amr, realm)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
dtreal(kind=R8P)inTimestep size just advanced.
treal(kind=R8P)inSimulation time after the advance.
itinteger(kind=I4P)inIteration index after the advance.
do_save_statelogicalinoptionalSave state output this step.
do_save_residualslogicalinoptionalSave residuals output this step.
do_save_restartlogicalinoptionalSave restart dump this step.
do_amrlogicalinoptionalRun AMR update this step.
realmtype(realm_pointer)inouttarget, optionalSibling realms for inter-realm halo refresh.

Call graph

flume_common_object%regrid_forest ​

Regrid this realm if its cadence asks for it now (issue #74, runtime AMR).

Invoked by forest%regrid once per realm after post_step_forest, on committed q (no stage active). The realm marks its blocks, calls adam%amr_update and refreshes its grid-dependent state; regridded tells the forest whether the tree changed, so it rebuilds what it owns (the flux register). Default: never regrid.

fortran
subroutine regrid_forest(self, regridded)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
regriddedlogicaloutTrue if the tree changed.

Call graph

flume_common_object%regrid_begin_forest ​

Start a multi-realm regrid of this realm: active if its cadence asks for a regrid now (issue #110).

fortran
subroutine regrid_begin_forest(self, active)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
activelogicaloutThis realm marks its blocks at this step.

Call graph

flume_common_object%regrid_mark_forest ​

Mark the blocks of this realm for sweep sweep and gather the marks on its replicated tree (issue #110).

marked is false when the realm does not mark in this sweep (no regrid step, or more sweeps than its [amr] iters); the forest then clears its tree marks before balancing the seams.

fortran
subroutine regrid_mark_forest(self, sweep, marked)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
sweepinteger(kind=I4P)inSweep of the regrid, from 1.
markedlogicaloutThe realm marked its blocks.

Call graph

flume_common_object%regrid_apply_forest ​

Adapt this realm to the marks on its replicated tree, as the forest balanced them (issue #110).

fortran
subroutine regrid_apply_forest(self, changed)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
changedlogicaloutThe tree changed.

Call graph

flume_common_object%regrid_end_forest ​

End a multi-realm regrid of this realm: refresh the state of the new grid, regridded if any sweep changed it.

fortran
subroutine regrid_end_forest(self, regridded)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
regriddedlogicaloutThe tree changed in some sweep.

Call graph

flume_common_object%is_done_forest ​

Decide whether this realm's local termination criterion is met.

Invoked by forest%is_done during the termination reduction across all realms in the forest. The reduction itself (typically a logical AND or OR depending on coupling semantics) is the orchestrator's job; this method computes only the predicate local to self.

Default implementation error-stops: every consumer app MUST override this method (the termination criterion mixes iteration count, simulated time, and app-specific physics signals). PRISM's override lives on prism_cpu_object/prism_fnl_object.

fortran
subroutine is_done_forest(self, done)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe realm.
donelogicaloutTrue if this realm is done evolving.

Call graph

flume_common_object%finalize_forest ​

Shut this realm down: final state dump, final diagnostics, close output files, finalize the realm's MPI handler.

Invoked by forest%finalize once per realm at shutdown, after the time loop exits. Mirror of initialize_forest: every IO file opened in initialize_forest is closed here; every per-realm resource the orchestrator did not acquire is released here.

Default implementation error-stops: every consumer app MUST override this method (the close-order and final-dump catalog are app-specific). PRISM's override lives on prism_cpu_object/prism_fnl_object.

fortran
subroutine finalize_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.

Call graph

flume_common_object%finalize_mpi_forest ​

Finalize the process-global MPI handler.

MPI_FINALIZE is process-global and must run EXACTLY ONCE, after every realm has completed all MPI-using teardown. The forest therefore calls this on a SINGLE realm after the per-realm finalize_forest loop — not inside finalize_forest (which runs per realm; doing the finalize there tore MPI down while later realms still had IO/ghost work pending — the next realm's update_ghost would hit MPI_Type_f2c on a finalized communicator). The default targets the CPU mpih singleton; the FNL backend overrides to finalize mpih_fnl.

fortran
subroutine finalize_mpi_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm (carries no MPI state; dispatch picks the backend handler).

Call graph

flume_common_object%fill_seam_from_peer_forest ​

Fill THIS realm's seam ghost cells for peer slot p_idx from peer's interior. Default: error_stops; every multi-realm participant MUST override (the receiver is the dispatch target).

fortran
subroutine fill_seam_from_peer_forest(self, peer, p_idx)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inout
peerclass(realm_object)intarget
p_idxinteger(kind=I4P)in

Call graph

flume_common_object%pack_seam_cells_forest ​

Pack this realm's cells of the cross-rank seam send rows of peer slot p_idx (maps%seam_mpi_send_cell), from the active buffer (stage_active rule of fill_seam_from_peer_forest), nv values per row in row order. Default: error_stops; every multi-realm participant MUST override.

fortran
subroutine pack_seam_cells_forest(self, p_idx, buf)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe realm.
p_idxinteger(kind=I4P)inPeer slot (the realm that owns the ghosts).
bufreal(kind=R8P)outPacked values, nv * rows.

Call graph

flume_common_object%unpack_seam_cells_forest ​

Unpack buf into this realm's seam ghosts of the cross-rank receive rows of peer slot p_idx (maps%seam_mpi_recv_cell), on the active buffer, nv values per row in row order. Default: error_stops; every multi-realm participant MUST override.

fortran
subroutine unpack_seam_cells_forest(self, p_idx, buf)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
p_idxinteger(kind=I4P)inPeer slot (the realm that owns the cells).
bufreal(kind=R8P)inPacked values, nv * rows.

Call graph

flume_common_object%after_topology_build_forest ​

Backend hook invoked by forest%populate_inter_realm_topology AFTER all host-side seam maps have been built. CPU default is a no-op (host maps are the production state). GPU backends override to propagate the freshly-built host seam maps to device-resident copies (e.g. via maps_fnl%copy_cpu_gpu).

fortran
subroutine after_topology_build_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inout

Call graph

flume_common_object%apply_reflux_to_stage_forest ​

Apply the Berger-Colella reflux correction to THIS realm's stage-stage buffer for every flux-register face where self is the coarse side.

Invoked by forest_object%evolve_one_step once per realm per stage, AFTER flux_register%reduce_fine_sums has globalised the fine-side accumulators. The realm filters the register's face array by face%coarse_realm == self%realm_index, picks up its OWN integrator- specific stage weight (self%ts%stage_weight(stage)), and writes the correction delta into its OWN stage buffer (the stepper's registers).

Architectural role: this TBP keeps the per-realm reflux write integrator-private. The forest never names a stepper register or a stage weight: those live realm-side (ts), so a realm can change its integrator without touching the orchestrator.

The realm's 1-based forest position is read from self%realm_index, which the forest writes once at initialize-time; no per-call plumbing of is through the dispatch is needed.

Default implementation error-stops: every multi-realm participant that uses FV reflux MUST override this. Multi-realm participants that DO NOT accumulate flux contributions (e.g. an FD-only realm) should override with a no-op body.

fortran
subroutine apply_reflux_to_stage_forest(self, stage, dt, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe realm.
stageinteger(kind=I4P)inIntegrator stage 1..K_total.
dtreal(kind=R8P)inTime step.
flux_registerclass(flux_register_object)inForest's flux register (read-only).

Call graph

flume_common_object%close_block_xh5f ​

Close XH5F file block.

fortran
subroutine close_block_xh5f(xh5f)

Arguments

NameTypeIntentAttributesDescription
xh5ftype(xh5f_file_object)inoutXH5F file handler.

Call graph

flume_common_object%close_file_xh5f ​

Close XH5F file.

fortran
subroutine close_file_xh5f(xh5f)

Arguments

NameTypeIntentAttributesDescription
xh5ftype(xh5f_file_object)inoutXH5F file handler.

Call graph

flume_common_object%open_block_xh5f ​

Open XH5F file block; length_scale multiplies the written block origin and spacing (output units of an application, e.g. FLUME [reference] output_units). The origin is the corner of the first stored cell: ngc_saved cells below the block's first interior cell, ngc_saved the ghost layers the caller writes (default all, ngc; 0 for the interior only, e.g. the restart snapshot, issue #109).

fortran
subroutine open_block_xh5f(self, xh5f, b, nijk, t, time, length_scale, ngc_saved)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe equation.
xh5ftype(xh5f_file_object)inoutXH5F file handler.
binteger(kind=I4P)inBlock index.
nijkinteger(kind=I8P)inBlocks dimensions.
tinteger(kind=I4P)inoptionalTime iteration.
timereal(kind=R8P)inoptionalTime.
length_scalereal(kind=R8P)inoptionalScale of the written origin and spacing.
ngc_savedinteger(kind=I4P)inoptionalGhost layers written (default ngc).

Call graph

flume_common_object%open_file_xh5f ​

Open XH5F file.

fortran
subroutine open_file_xh5f(self, basename, xh5f, directory)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe equation.
basenamecharacter(len=*)inBase name of output files.
xh5ftype(xh5f_file_object)outXH5F file handler.
directorycharacter(len=*)inoptionalDirectory name of output files.

Call graph

flume_common_object%save_q_xh5f ​

Save ADAM in XH5F format.

fortran
subroutine save_q_xh5f(self, basename, q, q_name, directory, with_ghost, with_cell_morton, t, time)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inoutThe equation.
basenamecharacter(len=*)inBase name of output files.
qreal(kind=R8P)inQ-vector variables [nv,ni,nj,nk,nb].
q_namecharacter(len=*)inoptionalQ-vector variables names [nv].
directorycharacter(len=*)inoptionalDirectory name of output files.
with_ghostlogicalinoptionalFlag to save ghost cells.
with_cell_mortonlogicalinoptionalFlag to save Morton code also in cells.
tinteger(kind=I4P)inoptionalTime iteration.
timereal(kind=R8P)inoptionalTime.

Call graph

flume_common_object%compute_curl_fd_extended ​

Compute curl of vector fields, div(q(ivar:ivar+2), using finite difference schemes.

fortran
subroutine compute_curl_fd_extended(self, hs, ivar, q, curl)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe equation.
hsinteger(kind=I4P)inFDV half stencil length.
ivarinteger(kind=I4P)inStart index of variable of q.
qreal(kind=R8P)inField variables.
curlreal(kind=R8P)inoutCurl.

Call graph

flume_common_object%compute_gradient_fd_extended ​

Compute gradient of scalar variable q(ivar), finite difference schemes.

fortran
subroutine compute_gradient_fd_extended(self, hs, ivar, q, gradient)

Arguments

NameTypeIntentAttributesDescription
selfclass(realm_object)inThe equation.
hsinteger(kind=I4P)inFDV half stencil length.
ivarinteger(kind=I4P)inIndex of scalar variable of q.
qreal(kind=R8P)inField variables.
gradientreal(kind=R8P)inoutGradient.

Call graph

flume_box_marker ​

Geometric box (mode = 1, geo_type = box): a block-local vote.

Inheritance

Extends: amr_criterion_object

Components

NameTypeAttributesDescription
namecharacter(len=:)allocatableThe name an input selects it by ([amr_marker_N] name).
runtime_onlylogicalSkipped by the AMR of the initial condition.
mtype(amr_marker_object)Its [amr_marker_N] parameters.

Type-Bound Procedures

NameAttributesDescription
votepass(self)The geometric box's vote for block b at a runtime regrid: refine inside the box below its target level, keep inside at the target level, derefine elsewhere (outside the box, or inside above the target); as a vote it must not pin the grid outside its box, as it would if "untouched" vetoed the other markers there.
markpass(self)The geometric box: at the initial AMR the additive mark_by_geometry (refine inside below the target, leave the rest untouched), at a runtime regrid the per-block vote (box_vote).

flume_sweep_marker ​

A built-in marker that marks every block at once (it compares neighbours, dilates its marks or needs the realm's auxiliaries): it overrides mark; a per-block vote does not exist for it.

Inheritance

Extends: amr_criterion_object

Attributes: abstract

Components

NameTypeAttributesDescription
namecharacter(len=:)allocatableThe name an input selects it by ([amr_marker_N] name).
runtime_onlylogicalSkipped by the AMR of the initial condition.
mtype(amr_marker_object)Its [amr_marker_N] parameters.

Type-Bound Procedures

NameAttributesDescription
markpass(self)The votes of every block of the rank.
votepass(self)A marker that marks every block at once has no per-block vote: mark is the only entry.

flume_sweep_marker%mark ​

The votes of every block of this rank (votes(b) for local block b), by default vote block by block. An override may read and update the realm (ghost refreshes, auxiliary fields), and may act differently for the AMR of the initial condition (initial).

fortran
subroutine mark(self, realm, votes, initial)

Arguments

NameTypeIntentAttributesDescription
selfclass(amr_criterion_object)inoutThe criterion.
realmclass(realm_object)inoutThe realm.
votesinteger(kind=I4P)outOne vote per local block.
initiallogicalinThe AMR of the initial condition (the default votes alike).

Call graph

flume_solid_marker ​

Solid distance (mode = 1, geo_type = solid).

Inheritance

Extends: flume_sweep_marker

Components

NameTypeAttributesDescription
namecharacter(len=:)allocatableThe name an input selects it by ([amr_marker_N] name).
runtime_onlylogicalSkipped by the AMR of the initial condition.
mtype(amr_marker_object)Its [amr_marker_N] parameters.

Type-Bound Procedures

NameAttributesDescription
votepass(self)A marker that marks every block at once has no per-block vote: mark is the only entry.
markpass(self)The solid marker (mark_by_solid); at the initial AMR the distance function is computed first.

flume_gradient_marker ​

Field gradient (mode = 2).

Inheritance

Extends: flume_sweep_marker

Components

NameTypeAttributesDescription
namecharacter(len=:)allocatableThe name an input selects it by ([amr_marker_N] name).
runtime_onlylogicalSkipped by the AMR of the initial condition.
mtype(amr_marker_object)Its [amr_marker_N] parameters.

Type-Bound Procedures

NameAttributesDescription
votepass(self)A marker that marks every block at once has no per-block vote: mark is the only entry.
markpass(self)The gradient marker (mark_by_gradient). It reads the ghosts across internal block faces (issue #76): at the initial AMR the IC sets the interior only, so the host ghosts are refreshed first (local copies and MPI exchange; the physical faces are not read); without a uniform refinement (iu_ref_levels = 0) no ghost map is built before the first initial AMR update. At a runtime regrid the caller has refreshed them.

flume_lohner_marker ​

Loehner estimator (mode = 4), runtime regrids only.

Inheritance

Extends: flume_sweep_marker

Components

NameTypeAttributesDescription
namecharacter(len=:)allocatableThe name an input selects it by ([amr_marker_N] name).
runtime_onlylogicalSkipped by the AMR of the initial condition.
mtype(amr_marker_object)Its [amr_marker_N] parameters.

Type-Bound Procedures

NameAttributesDescription
votepass(self)A marker that marks every block at once has no per-block vote: mark is the only entry.
markpass(self)The Loehner marker (mark_by_lohner), runtime regrids only (runtime_only): the estimator also reads the ghosts of the physical faces, which the host cannot fill at the initial AMR (the boundary conditions are the backends').

flume_jeans_marker ​

Jeans length resolution (mode = 5).

Inheritance

Extends: flume_sweep_marker

Components

NameTypeAttributesDescription
namecharacter(len=:)allocatableThe name an input selects it by ([amr_marker_N] name).
runtime_onlylogicalSkipped by the AMR of the initial condition.
mtype(amr_marker_object)Its [amr_marker_N] parameters.

Type-Bound Procedures

NameAttributesDescription
votepass(self)A marker that marks every block at once has no per-block vote: mark is the only entry.
markpass(self)The Jeans marker (mark_by_jeans): cell-local (no ghosts); at the initial AMR it refines only, never derefines.

flume_kolmogorov_marker ​

Local Kolmogorov resolution r = h/eta (mode = 7).

Inheritance

Extends: flume_sweep_marker

Components

NameTypeAttributesDescription
namecharacter(len=:)allocatableThe name an input selects it by ([amr_marker_N] name).
runtime_onlylogicalSkipped by the AMR of the initial condition.
mtype(amr_marker_object)Its [amr_marker_N] parameters.

Type-Bound Procedures

NameAttributesDescription
votepass(self)A marker that marks every block at once has no per-block vote: mark is the only entry.
markpass(self)The Kolmogorov marker (mark_by_kolmogorov). It reads the ghosts across internal block faces, as the gradient marker: at the initial AMR they are refreshed on the host first (the physical faces are not read), at a runtime regrid the caller has refreshed them. At the initial AMR it refines only, never derefines.

Subroutines ​

reset_time_forest ​

The time and the step counter of a run from scratch to zero.

fortran
subroutine reset_time_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

set_initial_state_forest ​

The initial conditions on the current grid (host) and the solids distance function.

fortran
subroutine set_initial_state_forest(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

amr_update ​

Do AMR update: amr%iters sweeps over the markers until the grid stabilizes (initialization-time only). The markers are the criteria of amr_marker_list (issue #110, P4.2), each marking with initial = .true. and followed by an AMR update; a criterion that acts at runtime regrids only (runtime_only: the Loehner marker, which also reads the ghosts of the physical faces the backends fill, and every registered criterion) is skipped here.

fortran
subroutine amr_update(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

mark_by_geometry ​

Mark blocks to be refined by a primitive axis-aligned box (deterministic, solution-independent).

A block is flagged TO_BE_REFINED iff its centroid lies inside [box_emin, box_emax] and its refinement level is below target_level; every other block is left untouched (the marker is additive).

fortran
subroutine mark_by_geometry(self, box_emin, box_emax, target_level, do_init)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
box_eminreal(kind=R8P)inBox minimum corner.
box_emaxreal(kind=R8P)inBox maximum corner.
target_levelinteger(kind=I4P)inRefine blocks below this level.
do_initlogicalinoptionalRe-initialize refinements queries.

Call graph

mark_by_gradient ​

Mark blocks by the gradient magnitude of a conservative (field = 1) or auxiliary (field = 2) variable.

CHASE semantics: the admissible cell spacing of a block is delta_fine where max |grad var| > tol, else delta_coarse; a block coarser than admissible is refined, a block whose parent (spacing doubled) would still be admissible is derefined, any other block is left untouched. The spacing of a block is chosen by delta_type (x, y, z or max). The gradient is centred, across the block faces too: a jump lying on an internal face (between two blocks, or periodic) is seen by the cells on both sides of it (issue #76: with interior-only differences each block saw a constant state up to the face, and Sod on [0, 1], its jump on a block face at every level, was never refined there). It is one-sided at the faces on the realm boundary (physical or seam), whose ghosts it never reads. The caller refreshes the ghosts of the internal faces: the initial AMR on the host (amr_update), the runtime regrids with the backend's full ghost update (regrid_forest).

fortran
subroutine mark_by_gradient(self, field, ivar, tol, delta_type, delta_fine, delta_coarse)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
fieldinteger(kind=I4P)inMarker field: 1 conservative, 2 auxiliary variables.
ivarinteger(kind=I4P)inVariable index in the marker field.
tolreal(kind=R8P)inGradient magnitude tolerance.
delta_typecharacter(len=*)inBlock spacing criterion: x, y, z, max.
delta_finereal(kind=R8P)inAdmissible spacing where the gradient exceeds tol.
delta_coarsereal(kind=R8P)inAdmissible spacing elsewhere.

Call graph

mark_by_solid ​

Mark blocks by the surface of immersed solid solid: CHASE semantics, with the refine/derefine rule of the gradient marker.

A block is crossed by the surface when its distance function (interior and ghost cells) changes sign; its admissible spacing is then delta_fine, delta_coarse otherwise. The distance function must be current (the caller computes it on the present grid). A run without solids, or a solid index out of range, is fatal (CHASE read phi unallocated in that case, issue #35 C-8).

fortran
subroutine mark_by_solid(self, solid, delta_type, delta_fine, delta_coarse)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
solidinteger(kind=I4P)inSolid index.
delta_typecharacter(len=*)inBlock spacing criterion: x, y, z, max.
delta_finereal(kind=R8P)inAdmissible spacing across the surface.
delta_coarsereal(kind=R8P)inAdmissible spacing elsewhere.

Call graph

mark_by_lohner ​

Mark blocks by the Loehner (1987) estimator of a conservative (field = 1) or auxiliary (field = 2) variable (issue #74, D-M5-8).

The dimension-sum form of FLASH and PLUTO: on a cell, E = sqrt(sum_d N_d^2 / sum_d D_d^2) over the active directions, N_d = |u_+ - 2 u + u_-| and D_d = |u_+ - u| + |u - u_-| + epsilon (|u_+| + 2 |u| + |u_-|) + floor, with u_+- the neighbours along d. E lies in [0, 1], independent of the scale of u and of the cell size: about 0 where u is smooth on the grid, about 1 at a jump; epsilon keeps ripples small relative to u from triggering. On a variable that vanishes in quiet regions (the field outside a magnetic loop) that filter filters nothing: round-off noise is all there is, and it reads E ~ 1; floor, an absolute variation (default 0, the FLASH/PLUTO form), turns the variations well below it into noise (#74 P4). A block takes the largest E over its interior cells and buffer ghost layers (a feature at a neighbour's edge marks this block too): refined above refine_tol, derefined below derefine_tol, untouched between (the hysteresis band keeps a block near the threshold from flipping at every regrid). The caller refreshes the ghost cells of q.

fortran
subroutine mark_by_lohner(self, field, ivar, refine_tol, derefine_tol, epsilon, floor, buffer)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
fieldinteger(kind=I4P)inMarker field: 1 conservative, 2 auxiliary variables.
ivarinteger(kind=I4P)inVariable index in the marker field.
refine_tolreal(kind=R8P)inRefine above this estimator value.
derefine_tolreal(kind=R8P)inDerefine below this estimator value.
epsilonreal(kind=R8P)inNoise filter, relative to the variable.
floorreal(kind=R8P)inNoise filter, absolute variation.
bufferinteger(kind=I4P)inGhost layers the estimator reads.

Call graph

mark_by_jeans ​

Mark blocks by the resolution of the local Jeans length (issue #91; Truelove et al. 1997, ApJ 489, L179).

On a cell, lambda_J = sqrt(pi c_s^2 / (G rho)) with the thermal sound speed c_s^2 = gamma p / rho, and for a barotropic gas dP/drho (issue #100, D-M13-4: the piecewise polytrope's Gamma_k P / rho). Magnetic support is not counted, so an MHD run refines at least as early as the hydrodynamic criterion asks. A block takes the smallest lambda_J / h over its interior cells, h its spacing by delta_type: refined below jeans_cells (Truelove: at least 4), derefined above jeans_cells_derefine, untouched between (the hysteresis band of Federrath et al. 2010). Cell-local: it reads no ghost cell. refine_only (the initial AMR) never asks to derefine.

fortran
subroutine mark_by_jeans(self, jeans_cells, jeans_cells_derefine, delta_type, refine_only)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
jeans_cellsreal(kind=R8P)inRefine below this many cells per lambda_J.
jeans_cells_derefinereal(kind=R8P)inDerefine above this many cells per lambda_J.
delta_typecharacter(len=*)inDelta criterion of the block spacing.
refine_onlylogicalinoptionalNever ask to derefine.

Call graph

mark_by_kolmogorov ​

Mark blocks by the local Kolmogorov resolution r = h / eta (issue #133, phase 2; kolmogorov_block_max).

On a cell eta = (nu^3 / eps)^(1/4), eps = 2 nu S_d:S_d with S_d the deviatoric strain rate, nu = mu(T) / rho by the viscosity law of the run (molecular: an SGS eddy viscosity is not counted), and h = (prod_d dx_d)^(1/n) over the n active axes (a null axis does not enter). A block takes the largest r over its interior cells: refined above refine_tol, derefined below derefine_tol, untouched between (0 < derefine_tol < refine_tol / 2, checked at load: r halves across a level). The velocity gradient is the gradient marker's (centred, across the internal block faces; one-sided at the faces on the realm boundary, whose ghosts it never reads). The caller refreshes the ghosts of the internal faces. refine_only (the initial AMR) never asks to derefine.

fortran
subroutine mark_by_kolmogorov(self, refine_tol, derefine_tol, refine_only)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
refine_tolreal(kind=R8P)inRefine above this r.
derefine_tolreal(kind=R8P)inDerefine below this r.
refine_onlylogicalinoptionalNever ask to derefine.

Call graph

mark_runtime ​

Combine the markers into the flags of a runtime regrid (issue #74, D-M5-8).

Each marker votes per block: refine, keep (untouched) or derefine. A block is refined when any marker asks for it, derefined only when every marker agrees, untouched otherwise; a block at the base level (iu_ref_levels, the uniform level of the initial grid) is never derefined. The geometric box votes refine inside the box below its target level, keep inside at the target level, derefine elsewhere (outside the box, or inside above the target): as a vote it must not pin the grid outside its box, as it would if "untouched" vetoed the other markers there. The initial AMR (amr_update) is unchanged: there the markers act one after the other. The caller refreshes the ghost cells of q (the Loehner marker and the solid marker read them).

fortran
subroutine mark_runtime(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

box_mark ​

The geometric box: at the initial AMR the additive mark_by_geometry (refine inside below the target, leave the rest untouched), at a runtime regrid the per-block vote (box_vote).

fortran
subroutine box_mark(self, realm, votes, initial)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_box_marker)inoutThe marker.
realmclass(realm_object)inoutThe realm.
votesinteger(kind=I4P)outOne vote per local block.
initiallogicalinThe AMR of the initial condition.

Call graph

solid_mark ​

The solid marker (mark_by_solid); at the initial AMR the distance function is computed first.

fortran
subroutine solid_mark(self, realm, votes, initial)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_solid_marker)inoutThe marker.
realmclass(realm_object)inoutThe realm.
votesinteger(kind=I4P)outOne vote per local block.
initiallogicalinThe AMR of the initial condition.

gradient_mark ​

The gradient marker (mark_by_gradient). It reads the ghosts across internal block faces (issue #76): at the initial AMR the IC sets the interior only, so the host ghosts are refreshed first (local copies and MPI exchange; the physical faces are not read); without a uniform refinement (iu_ref_levels = 0) no ghost map is built before the first initial AMR update. At a runtime regrid the caller has refreshed them.

fortran
subroutine gradient_mark(self, realm, votes, initial)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_gradient_marker)inoutThe marker.
realmclass(realm_object)inoutThe realm.
votesinteger(kind=I4P)outOne vote per local block.
initiallogicalinThe AMR of the initial condition.

Call graph

lohner_mark ​

The Loehner marker (mark_by_lohner), runtime regrids only (runtime_only): the estimator also reads the ghosts of the physical faces, which the host cannot fill at the initial AMR (the boundary conditions are the backends').

fortran
subroutine lohner_mark(self, realm, votes, initial)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_lohner_marker)inoutThe marker.
realmclass(realm_object)inoutThe realm.
votesinteger(kind=I4P)outOne vote per local block.
initiallogicalinThe AMR of the initial condition (never: runtime only).

Call graph

jeans_mark ​

The Jeans marker (mark_by_jeans): cell-local (no ghosts); at the initial AMR it refines only, never derefines.

fortran
subroutine jeans_mark(self, realm, votes, initial)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_jeans_marker)inoutThe marker.
realmclass(realm_object)inoutThe realm.
votesinteger(kind=I4P)outOne vote per local block.
initiallogicalinThe AMR of the initial condition.

kolmogorov_mark ​

The Kolmogorov marker (mark_by_kolmogorov). It reads the ghosts across internal block faces, as the gradient marker: at the initial AMR they are refreshed on the host first (the physical faces are not read), at a runtime regrid the caller has refreshed them. At the initial AMR it refines only, never derefines.

fortran
subroutine kolmogorov_mark(self, realm, votes, initial)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_kolmogorov_marker)inoutThe marker.
realmclass(realm_object)inoutThe realm.
votesinteger(kind=I4P)outOne vote per local block.
initiallogicalinThe AMR of the initial condition.

Call graph

register_amr_criterion ​

Register a refinement criterion (issue #110, P4): [amr_marker_N] mode = 6, name = <criterion%name> selects it at runtime regrids. The realm keeps a pointer: the program owns the instance, which must have the TARGET attribute and outlive the simulation (a variable of the main program, or a SAVEd one; not a local of a procedure that returns before the run); a second criterion with the same name stops the run.

fortran
subroutine register_amr_criterion(self, criterion)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
criterionclass(amr_criterion_object)inpointerThe criterion (a TARGET actual is pointed to).

Call graph

check_regridded_state ​

Stop on an inadmissible state after a runtime regrid (issue #74): density or pressure not positive on an interior cell. The conservative prolongation keeps every conserved variable in the range of its stencil, so the density stays positive, but the pressure is a nonlinear function of the conserved variables and a child of a cell next to a strong jump can lose it; the run is stopped here, at its cause, rather than later at a non-finite flux.

fortran
subroutine check_regridded_state(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

accumulate_seam_skin ​

Route one seam face skin of block b, face fec, weighted by weight, to the forest's flux register.

Shared by the backends (the register is host-side): the CPU packs skin from its face fluxes, the FNL backend packs it on the device and copies it to the host. skin(v, c) is the face flux with the cell index c running over the two tangential axes, inner fastest (x faces: j, k; y faces: i, k; z faces: i, j), the register order. Coarse side (positive register index): the skin is the coarse face. Fine side (negative index): on an intra-realm AMR seam the skin is 2:1-restricted (2x2 average; 2x1 across the unrefined z of a quadtree, issue #46) into this block's quadrant of the coarse face, the quadrant offset precomputed by the forest from the Morton codes (maps%amr_seam_quadrant); on an inter-realm mirror seam (same resolution) it is accumulated unrestricted into the register faces it overlaps (maps%seam_overlap, issue #51: the blocks of the two realms need not line up; one full-skin overlap when they do).

FLUME weighs every stage by its SSP coefficient, weight = beta_s: the register then holds the flux of the whole step, sum_s beta_s F_s, exactly the flux the committed update q + dt sum_s beta_s dq_s used, and the end-of-step correction restores conservation to round-off (issue #35, P5; AMReX non-subcycled flux register).

fortran
subroutine accumulate_seam_skin(self, flux_register, b, fec, weight, skin)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
flux_registerclass(flux_register_object)inoutForest's flux register.
binteger(kind=I4P)inBlock index.
fecinteger(kind=I4P)inFace (1..6: -x, +x, -y, +y, -z, +z).
weightreal(kind=R8P)inStage weight.
skinreal(kind=R8P)inFace skin (nv, inner_n*outer_n).

Call graph

add_seam_gravity_work ​

Add the gravity work of self-gravity across a 2:1 AMR seam to the energy row of a seam skin (issue #81, P5b), so that the end-of-step reflux makes E + W telescope exactly at the seam.

The potential sources give each cell 1/2 g F per face (add_potential_sources), g its own face gravity and F the face mass flux. The mass update moves A_f F_f across every fine sub-face f of a coarse face, which changes W by s A_f F_f (Phi_f - Phi_C) (s = +1 when the fine side lies at +axis of the coarse cell C), so exact E + W needs the seam's energy sources to sum to s sum_f A_f F_f (Phi_C - Phi_f); the two kernels give instead the multigrid's mean-flux gravity ((mean_f - Phi_C) / (1.5 h) on both sides). The difference rides on the register's energy entry, which the reflux turns into sgn (G_coarse - G_fine) / H in the coarse cell:

  • coarse skin: G_c = -s 1/2 g_c F_c H (takes the coarse cell's own seam source back);
  • fine skin: G_f = -F_f (Phi_C - Phi_f) + s 1/2 g_f F_f h (the exact two-point work, less the fine cell's own source, which stays: the fine cells keep the consistent gravity). The fine side recovers Phi_C from its ghost, Phi_C = mean_f - 1.5 (Phi_f - Phi_ghost) (the multigrid's ghost fill), mean_f the mean of the fine skin cells of the coarse face. Every term is per stage, weighted with the fluxes, so the identity holds stage by stage. Exact only where the reflux corrects every seam cell (not under the troubled reflux policy) and the positivity limiter does not act (its gravity energy correction, M7).
fortran
subroutine add_seam_gravity_work(self, flux_register, b, fec, skin)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
flux_registerclass(flux_register_object)inForest's flux register.
binteger(kind=I4P)inBlock index.
fecinteger(kind=I4P)inFace (1..6: -x, +x, -y, +y, -z, +z).
skinreal(kind=R8P)inoutFace skin (nv, inner_n*outer_n).

Call graph

allocate_common ​

Allocate common data.

fortran
subroutine allocate_common(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

compute_phi ​

Compute the distance function of the immersed solids on the host (a no-op without solids); the solids are static, so the backends compute it once per grid (initialization, restart, initial AMR). The ghost maps of the eikonal sweeps follow the distance function (make_ib_maps).

fortran
subroutine compute_phi(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

make_ib_maps ​

Build the ghost maps of the eikonal sweeps (#156 L2): the realm's ghost maps restricted to the ghost cells the sweeps read. A sweep updates only the interior cells inside a solid (phi > 0) from their six face neighbours (ib_object%evolve_eikonal and its FNL twin), so the only ghost values it reads lie in the ghost layer next to a solid cell on a block face. The exchanges before and between the sweeps fill those cells only; the main exchange after the sweeps fills every ghost. Collective. Rebuilt with phi, after every map change.

fortran
subroutine make_ib_maps(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

compute_fields_number ​

Compute the block-sized fields FLUME allocates per block, the fields_number of the blocks budget.

Both backends allocate the same nb-sized arrays, on the host (CPU) or on the device (FNL): q, dq (2 nv), q_aux (nv_aux), the three face fluxes (3 nv, counted as full block fields) and the Runge-Kutta stages (the SELAH stepper's registers, stepper_stored_fields nv, its residual register included, #132), plus the positivity limiter's cell factors (nv, q-shaped for the ghost exchange), the fourth-order gravity energy correction (1, every run, issue #73 M7-G2a), the equilibrium residual of the well-balanced mode (nv, M7-G2b), the gravitational potential (1, issue #81) and the eddy viscosity (1, issue #119). Requires physics, numerics and turbulence initialized; parses [runge_kutta] into ts (its library parser).

fortran
subroutine compute_fields_number(self, file_parameters, fields_number)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
file_parameterstype(file_ini)inSimulation parameters ini file handler.
fields_numberinteger(kind=I4P)outBlock-sized fields allocated per block.

Call graph

destroy_common ​

Free common data.

fortran
subroutine destroy_common(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

initialize ​

Initialize the common data (issue #35, section 6.1, step 3).

fortran
subroutine initialize(self, filename, memory_avail, nv, fields_number, verbose, L0)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inouttargetThe equation.
filenamecharacter(len=*)inInput file name.
memory_availreal(kind=R8P)invalueMemory available for single MPI process.
nvinteger(kind=I4P)inoptionalUnused: nv is decided by the physics.
fields_numberinteger(kind=I4P)inoptionalBlock-sized fields per block (default: computed).
verboselogicalinoptionalTrigger verbose output.
L0real(kind=R8P)inoptionalUnused: FLUME is dimensional.

Call graph

report_divb ​

Reduce the div(B) norms of this rank over all ranks, save the div(B) history row and apply the monitor (issue #41, D-10; on the normalised D_flux since issue #68 G1): max h|D_flux| / max|B| > [mhd].(divb_tol) (> 0) is fatal with divb_error, otherwise a warning logged by rank 0 each time the measure exceeds the largest one reported so far. The D_flux norms come with [diagnostics] divb_flux, which divb_tol > 0 requires (check_divb_flux).

fortran
subroutine report_divb(self, norms)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
normsreal(kind=R8P)inThis rank's max|div B|, sum |div B| dV, seam-local max|div B|; with divb_flux (issue #68 A2) then max|D_flux|, sum |D_flux| dV, seam-local max|D_flux|, max h|D_flux|, max|B|.

Call graph

log_dt_limit ​

Log, once per run (rank 0, all ranks reduce), whether the time step is limited by the hyperbolic or by the diffusive part of dt = CFL / max(lambda_hyp + lambda_dif) (issue #65, D-M4-3), with the minimum cell Reynolds number.

fortran
subroutine log_dt_limit(self, lambda_hyp, lambda_dif, re_cell_min)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
lambda_hypreal(kind=R8P)inMaximum of the hyperbolic part of this rank.
lambda_difreal(kind=R8P)inMaximum of the diffusive part of this rank.
re_cell_minreal(kind=R8P)inMinimum cell Reynolds number of this rank.

Call graph

report_glm_speed ​

Check the GLM cleaning speed against the fastest wave (issue #41, section 3.5, D-9): max(|u_d| + c_{f,d}) > c_h is fatal with [mhd].(glm_ch_check) = error, otherwise a warning logged by rank 0 each time the speed exceeds the largest one reported so far (GLM stays stable, dt includes c_h, but the cleaning is slower than the fastest wave).

fortran
subroutine report_glm_speed(self, speed_max)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
speed_maxreal(kind=R8P)inFastest wave speed of this rank.

Call graph

stop_nonfinite ​

Stop the run on a non-finite (NaN or infinite) committed state (issue #45), reporting on every rank the first non-finite value of the host q (the caller has made it current): block Morton code, cell centre, variable. Every rank calls it after the reduction, so the stop is collective (the first error_stop aborts the others, #43).

fortran
subroutine stop_nonfinite(self, n_total)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
n_totalinteger(kind=I8P)inNon-finite values number of all ranks.

Call graph

load_restart_files ​

Load restart files.

fortran
subroutine load_restart_files(self, t, time)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
tinteger(kind=I4P)outTime iteration.
timereal(kind=R8P)outTime.

Call graph

load_wm_filter ​

Load the wall-model input filter averages of this rank from <basename>-proc<rank>.wmf (issue #119), so a restart continues the run bit for bit. The blocks must be the restart's own, in the same order (checked by their Morton codes: fatal otherwise). A checkpoint without the file (written before the averages were saved, or by a run without the filter) restarts the averages from the next sample.

fortran
subroutine load_wm_filter(self, basename)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
basenamecharacter(len=*)inRestart files basename.

Call graph

save_wm_filter ​

Save the wall-model input filter averages of this rank to <basename>-proc<rank>.wmf (issue #119): every rank writes its file, with zero blocks if it owns none (as save_blocks), the Morton code of each block before its averages.

fortran
subroutine save_wm_filter(self, basename)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
basenamecharacter(len=*)inRestart files basename.

Call graph

wm_filter_to_host ​

Bring the wall-model filter averages to the host arrays: there already on the CPU backend (FNL overrides it).

fortran
subroutine wm_filter_to_host(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

wm_filter_to_device ​

Send the host wall-model filter averages where the backend reads them: nothing to do on the CPU backend (FNL overrides it).

fortran
subroutine wm_filter_to_device(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

advance_inflow_df ​

Move the digital-filter inflow on by the step time%dt (issue #119, T3.7): once per step, before the first stage, on every rank alike (the forest's step is global); then the backend refreshes its ghost rows.

fortran
subroutine advance_inflow_df(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

advance_inflow_rr ​

Rebuild the recycling inflow's plane from the committed state (issue #121, S5): once per step, before the first stage, on every rank alike (the plane's allreduce is collective); the backend gathers this rank's plane cells. The ghost rows are listed from the plane where the backend lists the digital filter's (the CPU at every boundary fill, FNL when it copies them to the device), so they follow the map. Nothing without the face.

fortran
subroutine advance_inflow_rr(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

inflow_rr_gather ​

Gather the recycling plane's cells of this rank (bc%rr%rec_cells) from the committed state: the host field on the CPU backend (FNL overrides it: from the device).

fortran
subroutine inflow_rr_gather(self, q_rec)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
q_recreal(kind=R8P)inoutConservative state of the cells [5, nrec].

Call graph

inflow_rr_to_device ​

List the recycling inflow's ghost rows and send them where the backend reads them: nothing on the CPU backend, which lists and writes them at every boundary fill (FNL overrides it).

fortran
subroutine inflow_rr_to_device(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

inflow_df_to_device ​

Send the inflow ghost rows where the backend reads them: nothing on the CPU backend, which lists them at every boundary fill (FNL overrides it).

fortran
subroutine inflow_df_to_device(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

save_wall_history ​

Save the wall-model history on its cadence ([diagnostics] wall_history_save, issue #119, T3.7): for every modelled face, the wall shear stress along wall_history_axis and the wall heat flux (k dT/dy at the wall, positive when the gas is hotter), area-averaged over the face cells in wall_history_bins bins along that axis, to <output_basename>-wall_<face>_history.dat (code units; it, time, the bins' stress, then their heat flux). The model is evaluated on the committed state at its sample, as overwrite_wall_fluxes takes it without the input filter: with wall_model_filter the stress applied differs from this one by the filter's lag. The same host code on every backend.

fortran
subroutine save_wall_history(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

wall_history_to_host ​

Bring the committed state to the host for the wall-model history: there already on the CPU backend (FNL overrides it).

fortran
subroutine wall_history_to_host(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

save_restart_files ​

Save restart files.

fortran
subroutine save_restart_files(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

save_xh5f ​

Save fields in XH5F format: q always, dq when [IO].(save_residual_fields), the auxiliary variables (computed from the saved q, ghost cells included) when [IO].(save_auxiliary_fields). With [reference] output_units = dimensional every field, the grid and the time are multiplied by their output factors (a scaled copy of each block, the state itself is untouched).

fortran
subroutine save_xh5f(self, output_basename, with_ghost)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
output_basenamecharacter(len=*)inoptionalOutput basename.
with_ghostlogicalinoptionalFlag to save ghost cells.

Call graph

set_wall_model_faces ​

Flag the block faces on a wall-modelled domain face; at the start and after each step, so after a regrid (T3.6). Sized by the block capacity.

fortran
subroutine set_wall_model_faces(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

set_hybrid_faces ​

Flag the block faces whose ghost cells are not a same-level copy (issue #119, T2.4): a 2:1 seam, a physical face, a forest seam. The central stencil must not read them. A flag acts along the normal of its face only: a seam along y must not change a flux along x, or the two blocks of an x interface could disagree on its one flux. hybrid_has_faces: some block in the realm has one, so that the sensor is exchanged, its ghost cells then exact copies (a ghost computed locally reads edge ghosts near a seam, which two blocks fill differently). Sized by the block capacity, as divb_seam.

fortran
subroutine set_hybrid_faces(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

set_divb_seam ​

Set the seam faces flags of the div(B) history (issue #41, D-10): a block face is a seam face when the forest registered it in the flux register (a 2:1 AMR or inter-realm seam, inter_realm_face_register_index /= 0). Sized by the block capacity nb, as every block-indexed device array: on a rank that owns no block (blocks_number = 0) a blocks_number-sized array is empty and its device copy (FNL) a zero-byte allocation, which the device allocator returns as a null pointer and FUNDAL reports as failed (issue #82). The rows past blocks_number stay 0 and are never read.

fortran
subroutine set_divb_seam(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

set_potential ​

Set the gravitational potential of the current grid, ghost cells included (issue #81, M8-P1). With [gravity] potential = linear it is Phi = -g . x at the cell centres, the constant field written as a potential; with self_gravity (M8-P3) the Poisson solver is set up on the current grid and Phi is solved from the host state q: on a uniform grid the FFT solver (periodic or isolated), on an AMR grid (leaves at more than one level, P5b) the multigrid solver, its coarsest level solved by the FFT solver of the backend, periodic or isolated (the symmetric James step, issue #87: every leaf on the domain boundary at the coarsest level, which a regrid that refines a boundary block breaks, fatal in the solver's initialize, D-87-4); without a potential the array is a one-cell placeholder (the kernels take it and do not read it). Sized by the block capacity nb, as the other block arrays; call it after the initial grid and after every regrid.

fortran
subroutine set_potential(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

solve_potential ​

Solve the self-gravity potential of the host state q (issue #81, M8-P3): L_h Phi = 4 pi G (rho - mean rho), every ghost layer filled (the FFT solver's wrap, or the multigrid's ghost fill on AMR), the wall time kept in poisson_wall; optionally the energy sum_cells rho Phi dV (every rank). The FNL backend solves from the device state with solve_potential_gpu, through solve_potential_packed. Packed density. Counters.

fortran
subroutine solve_potential(self, q, energy)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
qreal(kind=R8P)inState.
energyreal(kind=R8P)outoptionalsum_cells rho Phi dV.

Call graph

solve_potential_packed ​

Solve the self-gravity potential from the packed interior density of the active blocks (block-major, i fastest), into phi_grav with every ghost filled (issue #81): the FNL backend's host step. Optionally the energy sum_cells rho Phi dV (every rank).

fortran
subroutine solve_potential_packed(self, buf, energy)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
bufreal(kind=R8P)inPacked density.
energyreal(kind=R8P)outoptionalsum_cells rho Phi dV.

Call graph

sink_stencil ​

Return the CIC stencil of a point (issue #94): up to 8 target points (cell centres of the level of the block that holds the point) and their weights, and the cell spacing there. Computed from the replicated tree, so every rank obtains the same stencil; a null direction takes the point itself with weight 1, a periodic one wraps, a closed one clamps the targets to the first interior centre (the weight stays in the domain: the deposit conserves mass).

fortran
subroutine sink_stencil(self, point, npt, pts, w, h)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
pointreal(kind=R8P)inPoint.
nptinteger(kind=I4P)outTarget points number.
ptsreal(kind=R8P)outTarget points.
wreal(kind=R8P)outWeights.
hreal(kind=R8P)outCell spacing at the point.

Call graph

deposit_sinks ​

Add the sinks' mass to a packed density of the local blocks (issue #94, D-M12-2): each sink spreads its mass over its CIC stencil; the rank that owns a target cell adds m w / dV there (a null direction spreads it evenly over its cells). Every rank walks every sink and keeps its own targets, so the total deposited mass is the sinks' mass.

fortran
subroutine deposit_sinks(self, buf)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
bufreal(kind=R8P)inoutPacked density, block-major, i fastest.

Call graph

compute_sink_accelerations ​

Compute the mesh gravity at every sink (issue #94): the centred difference of the host potential phi_grav at the cells of the sink's CIC stencil, interpolated with the deposit's weights (the same CIC pair, Hockney & Eastwood: no self-force on a uniform grid); each rank sums its own cells, an MPI reduction completes the list.

fortran
subroutine compute_sink_accelerations(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

set_limiter_dt ​

Set the forward-Euler step the positivity limiter makes admissible (#134 D4): stage s of the step takes its residual into steps of at most stage_euler_fraction(s) dt (SELAH, from the scheme's Shu-Osher form: f_s = max_i beta_is / alpha_is), so a stage state plus that step of its residual kept admissible keeps every later stage and the step admissible; f_s = 1 for every stage of SSP-11/22/33, 0.39 to 0.66 for SSP-54. Without a stage (a residual outside the step: the equilibrium residual, the D_flux diagnostic) the step dt.

fortran
subroutine set_limiter_dt(self, s)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
sinteger(kind=I4P)inoptionalStage.

Call graph

refresh_sink_accelerations ​

Re-solve the self-gravity potential of the committed state and the mesh gravity at the sinks (issue #94): the CPU backend's (solve_potential of the host state); the FNL backend overrides it with its device state.

fortran
subroutine refresh_sink_accelerations(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

step_sinks ​

Advance the sinks over dt by kick-drift-kick (issue #94) through SELAH (#134 D4): the stepper's Strang splitting of the velocities (partition 1, the kick v' = a) and the positions (partition 2, the drift x' = v), each an exact sub-flow, so the composition is Stoermer-Verlet with SELAH's fractions (1/2, 1, 1/2) and SELAH's update. A kick takes the accelerations of the last computation; after a drift they are recomputed at the new positions (refresh_sink_accelerations, the potential re-solved) before the next kick. A direction the grid does not have does not drift (its residual is 0); after a drift a periodic direction wraps and a sink outside a closed domain is fatal (wrap_sinks). The list is replicated on every rank and short: it is packed into a SELAH field p(6, n) (positions, velocities; device memory in a device build) and unpacked after every flow.

fortran
subroutine step_sinks(self, dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
dtreal(kind=R8P)inTime step of the flow.

Call graph

wrap_sinks ​

Bring a sink that left the domain through a periodic direction back in it; a sink outside a closed domain is fatal (no outflow for sinks, issue #94).

fortran
subroutine wrap_sinks(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

accrete_sinks ​

Threshold accretion of the committed host state (issue #94, D-M12-4): the cells within an accretion radius of a sink (sink_accretion_cells) are gathered from q, accreted (accrete_cells) and written back. The FNL backend does the same with its device state (accrete_sinks_gpu), so both run the same arithmetic.

fortran
subroutine accrete_sinks(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

sink_accretion_cells ​

Return the interior cells of this rank within an accretion radius of some sink, blocks then k, j, i (issue #94): the cells accrete_cells reads.

fortran
subroutine sink_accretion_cells(self, cells)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
cellsinteger(kind=I4P)outallocatableCells (i, j, k, b) [4, n].

Call graph

accrete_cells ​

Threshold accretion on gathered cells (issue #94, D-M12-4; Federrath et al. 2010, section 2.3). A cell within the accretion radius of a sink gives up the mass above rho_thr = pi c_s^2 / (4 G r_acc^2) (c_s^2 = dP/drho of the cell) if that gas is bound to the sink and falls in (0.5 |u - v_s|^2 - G m_s / r < 0, (u - v_s) . (x - x_s) < 0); the cell that holds the sink, and every cell of a sink formed this step, are accreted without the checks. A cell within several radii gives its gas to the most bound sink. The cell keeps its specific values: every conservative variable is scaled by rho_thr / rho (velocity, specific energy and passive scalars unchanged), the dual-energy entropy rebuilt from the scaled energy. Each sink gains the mass and the momentum given up and moves to the centre of mass, from MPI-reduced sums: mass and momentum are conserved exactly. A sink formed this step that accreted nothing is removed.

fortran
subroutine accrete_cells(self, cells, values)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
cellsinteger(kind=I4P)inCells (i, j, k, b) [4, n].
valuesreal(kind=R8P)inoutTheir conservative variables [nv, n].

Call graph

create_sinks ​

Form sinks from the committed host state (issue #94, D-M12-3; Federrath et al. 2010, section 2.2), on cells of the finest level present (with runtime regridding, of the finest level allowed): the density above the threshold of the accretion radius, no sink within that radius, and on the control volume (the cells within the radius, read through the ghost cells: accretion_radius_cells <= ngc) a minimum of the potential at the cell (ties allowed), a flow converging along every principal axis (the symmetric velocity gradient negative definite, Sylvester's criterion), Jeans instability (|E_grav| > 2 E_th) and boundedness (E_grav + E_th + E_kin < 0, the kinetic energy relative to the centre of mass), E_grav summed over the pairs of cells. The candidates of every rank are gathered and taken deepest potential first, one per accretion radius, so every rank forms the same sinks; a new sink has no mass and takes the gas above the threshold at its first accretion (accrete_sinks, unchecked). The host ghost cells of q and the potential must be current.

fortran
subroutine create_sinks(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

merge_sinks ​

Merge two sinks within an accretion radius that are bound and converging (0.5 mu |dv|^2 - G m1 m2 / d < 0, dv . dx < 0; Federrath et al. 2010): the pair becomes one sink at its centre of mass with its mass and momentum (issue #94). The list is replicated: every rank merges the same pairs.

fortran
subroutine merge_sinks(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

set_glm_damping ​

Set the GLM damping once the grid exists (issue #41, section 3.5): the minimum cell spacing of the realm over the active directions (MPI-reduced) is the min-cell damping length. With runtime regridding ([amr] frequency > 0, issue #74) it is the spacing of the finest level allowed ([amr] max_level), fixed for the run whatever the grid holds. A no-op without GLM.

fortran
subroutine set_glm_damping(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

save_slices ​

Save the slices (library slices_object, [slices] / [slice_N]) of the conservative variables on their cadence; the caller has refreshed the ghost cells of the host q (the interpolation stencils read them).

fortran
subroutine save_slices(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

coupling_descriptor_forest ​

Return the realm coupling descriptor checked by the forest for stage-coincident admissibility.

fortran
subroutine coupling_descriptor_forest(self, scheme_time, rk_scheme, nv)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
scheme_timecharacter(len=:)outallocatableTime-integration family tag.
rk_schemecharacter(len=:)outallocatableWithin-family scheme tag.
nvinteger(kind=I4P)outNumber of conserved variables on this realm.

Call graph

seam_skin_cell ​

Return the interior cell (i, j, k) of skin cell c on the face of normal axis and side sgn (register order, inner tangential axis fastest). Shared by the host and device reflux applications.

Attributes: pure

fortran
subroutine seam_skin_cell(axis, sgn, ni, nj, nk, c, i, j, k)

Arguments

NameTypeIntentAttributesDescription
axisinteger(kind=I4P)inFace normal axis, 1..3.
sgninteger(kind=I4P)inFace side, +1 maximum, -1 minimum.
niinteger(kind=I4P)inGrid dimensions.
njinteger(kind=I4P)inGrid dimensions.
nkinteger(kind=I4P)inGrid dimensions.
cinteger(kind=I4P)inSkin cell index.
iinteger(kind=I4P)outInterior cell (0 on a malformed axis).
jinteger(kind=I4P)outInterior cell (0 on a malformed axis).
kinteger(kind=I4P)outInterior cell (0 on a malformed axis).

Call graph

check_slices ​

Check the interpolation type of every slice: the library interpolation leaves the value undefined for an unknown type, so an unknown one is fatal here.

fortran
subroutine check_slices(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

compute_mhd_derived ​

Compute the MHD derived output fields of block b (issue #41, section 9) from the host q and q_aux: total pressure pt = p + |B|^2 / 2, plasma beta 2 p / |B|^2 (huge where B = 0), |B| (every cell), and div B (interior cells, zero on the ghost cells) by the centred finite difference of the div(B) history (the library derivative, half stencil [fdv], null directions weighted zero). The caller has refreshed the ghost cells.

fortran
subroutine compute_mhd_derived(self, b, derived)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
binteger(kind=I4P)inBlock index.
derivedreal(kind=R8P)outpt, beta, bmag, divb.

Call graph

compute_q_aux_host ​

Compute the auxiliary variables of the host q on every cell, ghost cells included (output and AMR marking only: the backends compute their own auxiliary variables in the space operator). The model is selected outside the loops.

fortran
subroutine compute_q_aux_host(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

check_ngc_number ​

Check the ghost cells number against the WENO stencil half-width (weno-riemann: at least 2, the correction reads cells i-1 ... i+2), and with gravity one more (the face beyond each block end, issue #73, M7-G2a).

fortran
subroutine check_ngc_number(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

check_positivity_limiter ​

Refuse the positivity limiter (issue #47, D-9, D-10) where it cannot work: with the mixed GLM (psi changes B_n outside the energy, so no backbone is admissible, M3-P0), with a Runge-Kutta scheme that is not SSP (the limiter makes each forward-Euler step of size dt admissible, and only an SSP scheme is a convex combination of such steps, all of size at most dt), and with immersed solids (the cut-cell flux difference is not the backbone's). The backends refuse it on multi-realm runs (the inter-realm seam carries no limiting factor).

fortran
subroutine check_positivity_limiter(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

check_barotropic ​

Refuse, with a barotropic gas (issue #100), what is not defined for it yet: immersed solids (their ghost states rebuild the energy) and the IC types whose density needs gamma. Dissipation and cooling are refused with the physics, [reference] by its own layer (it runs first), the no-slip and hydrostatic walls with the boundary conditions. The positivity limiter is defined (P4): the models' internal_energy is the density, so it keeps the density above its relative floor (a density-only limiter).

fortran
subroutine check_barotropic(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

check_gravity ​

Refuse the external gravity (issue #73, M7-G1) where its sources are not defined: a component along a null direction (the energy source comes from the face mass fluxes, which a null direction does not have, so the momentum would gain kinetic energy that the energy does not) and immersed solids (the flux difference there uses the spacing cut by the surface, the energy source does not).

fortran
subroutine check_gravity(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

log_gravity_regime ​

Log once (rank 0, at the first step; every rank reduces) how stiff gravity is (issue #73, D-M7-6): |g| dt against the signal speed bound CFL h_min / dt (dt = CFL / lambda_max and lambda_max >= c_max / h_min), so the ratio |g| dt^2 / (CFL h_min) is at least the velocity gravity adds in a step over the fastest wave speed. No time step limit is imposed: a ratio near 1 or above says gravity, not the waves, should set dt.

fortran
subroutine log_gravity_regime(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

log_self_gravity ​

Log once, with log_gravity_regime, the self-gravity regime (issue #81): the free-fall time of the densest cell, t_ff = sqrt(3 pi / (32 G rho_max)), against dt (a warning above t_ff / 10: the collapse would be under-resolved in time), and the wall time of the last Poisson solve.

fortran
subroutine log_self_gravity(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

check_dissipation ​

Refuse the dissipative terms where they are not computed (issue #65): immersed solids, whose walls are inviscid (the eikonal inversion mirrors the normal velocity only), and the 4th-order fluxes without the 3 ghost cells they read (the 2nd-order ones read 1). The viscous and heat fluxes exist for every model (P2, P3), the Ohmic ones for MHD (P3; resistivity on Euler is refused by the dissipation object).

fortran
subroutine check_dissipation(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

check_hybrid ​

Refuse what scheme_space = hybrid-kep-weno does not handle (issue #119, T2): Euler only, 6 cells of stencil.

fortran
subroutine check_hybrid(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

check_runtime_amr ​

Check [amr] frequency, the runtime regrid cadence (issue #74, M5): 0 disables runtime regridding (the AMR of the initial condition only, as before M5), n > 0 regrids every n steps with the markers of [amr_marker_N] (mark_runtime). A negative value is an input error, and so are runtime regridding without markers, a Loehner marker reading more ghost layers than the stencil has (buffer <= ngc - 1) and an STL geometry marker.

[amr] regrid_prolongation defaults to conservative in FLUME (owner decision D-M5-2): a regrid then keeps the conserved integrals; the library default, linear, is kept only when the input asks for it, and so is conservative-state (one limit for the whole state, for collapsing self-gravitating flows, issue #88).

fortran
subroutine check_runtime_amr(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

build_amr_marker_list ​

Build amr_marker_list, the criteria of the [amr_marker_N] sections in input order (issue #110, P4.2): a built-in marker becomes its FLUME criterion (box, solid, gradient, Loehner, Jeans, Kolmogorov), holding its section's parameters; mode = 6 points to the criterion the program registered under that name (check_runtime_amr has checked it exists). A marker FLUME does not implement stops the run here, at initialisation: total variation (mode = 3), an STL geometry, an unknown mode or geometry kind.

fortran
subroutine build_amr_marker_list(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

check_divb_flux ​

Check [diagnostics] divb_flux (issue #68 A2): D_flux is the divergence of the interface field the cleaning acts on, read from the psi face fluxes, so it needs GLM or EGLM; its residual evaluation runs on the idle RK stage buffers (the committed state copied into the first, the residual into the second), so it needs two stages.

fortran
subroutine check_divb_flux(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

check_weno_scheme ​

Refuse the scale-invariant weights on primitive variables (the centred WENO names are refused by weno_object itself, issue #139 D6; the flux splitting calls the upwind kernels only, issue #47): their descaler is the magnitude of each field, and a velocity or a magnetic field component crossing zero has none of its own, so the weights would lose accuracy on smooth data (issue #49; the characteristic and conservative variables take the magnitude of the projected state).

fortran
subroutine check_weno_scheme(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

initialize_riemann_scheme ​

Check the Riemann solver against the physical model (weno-riemann only, issue #47): the Euler model takes llf, hll, hllc; the MHD models llf, hll, hlld. The WENO interpolation is SETH's (seth_weno<2S-1>_js_interp_wr, compile-time coefficients: no table to build, #139).

fortran
subroutine initialize_riemann_scheme(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

io_initialize ​

Build the variables names from the physical model (the same predicate that decided nv).

fortran
subroutine io_initialize(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

Functions ​

initial_amr_iterations_forest ​

The passes of initial conditions + regrid before the final initial conditions, ic%amr_iterations.

Returns: integer(kind=I4P)

fortran
function initial_amr_iterations_forest(self) result(n)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

box_vote ​

The geometric box's vote for block b at a runtime regrid: refine inside the box below its target level, keep inside at the target level, derefine elsewhere (outside the box, or inside above the target); as a vote it must not pin the grid outside its box, as it would if "untouched" vetoed the other markers there.

Returns: integer(kind=I4P)

fortran
function box_vote(self, realm, b) result(mark)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_box_marker)inoutThe marker.
realmclass(realm_object)inThe realm.
binteger(kind=I4P)inLocal block index.

Call graph

sweep_vote ​

A marker that marks every block at once has no per-block vote: mark is the only entry.

Returns: integer(kind=I4P)

fortran
function sweep_vote(self, realm, b) result(mark)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_sweep_marker)inoutThe marker.
realmclass(realm_object)inThe realm.
binteger(kind=I4P)inLocal block index.

Call graph

is_regrid_step ​

Return whether the step just closed is a runtime regrid step: [amr] frequency > 0 and the step count a multiple of it (issue #74). The step count is restored by a restart, so a restarted run regrids on the same steps.

Returns: logical

fortran
function is_regrid_step(self) result(yes)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

glm_lambda ​

Return the GLM bound of the local time step, c_h max_b sum_{d active} 1 / dx_d (issue #41, section 3.5): the (B_n, psi) waves travel at c_h along every active direction, the multi-dimensional form of dt <= CFL dx / c_h consistent with the fluid bound sum_d (|u_d| + c_{f,d}) / dx_d. Zero without GLM; local (the forest reduces dt).

Returns: real(kind=R8P)

fortran
function glm_lambda(self) result(lambda)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

output_factors ​

Return the output factors of written variables (1 with code output units, issue #49 N2c).

Returns: real(kind=R8P)

fortran
function output_factors(self, names) result(factor)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
namestype(string)inVariables names.

Call graph

output_names ​

Return the names of every variable FLUME may write: conservative, residuals, auxiliary and, for MHD, derived.

Returns: type(string)

fortran
function output_names(self) result(names)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

null_freeze ​

Return, per direction, the conservative variable whose residual a null direction freezes (0: none).

Euler: the momentum along the null direction (CHASE semantics, issue #35, section 3.4). MHD: none, the 1-D MHD Riemann problems evolve the transverse momentum and field through the fluxes of the active directions (issue #41, M2-P3). Host data passed to the model-independent flux difference: no model branch in the kernels.

Returns: integer(kind=I4P)

fortran
function null_freeze(self) result(freeze)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

wall_temperature_bound ​

Return the hottest isothermal wall temperature that the diffusive time step bound must cover (issue #65, P2): 0 without isothermal walls, and with constant laws (the coefficients then do not depend on the temperature).

Attributes: pure

Returns: real(kind=R8P)

fortran
function wall_temperature_bound(self) result(t_wall)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

nonfinite_total ​

Return the number of non-finite values of the committed state over every rank (issue #45).

Returns: integer(kind=I8P)

fortran
function nonfinite_total(self, n_local) result(n_total)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
n_localinteger(kind=I8P)inNon-finite values number of this rank.

Call graph

sink_accretion_radius ​

Return the accretion radius at a point: accretion_radius_cells cells of the level of the block that holds it (the smallest active spacing), the same on every rank (issue #94). With runtime regridding ([amr] frequency > 0) it is in cells of the finest level allowed ([amr] max_level), fixed for the run (Federrath et al. 2010, section 2.1): the sinks form there only (create_sinks) and their neighbourhood stays there (mark_runtime).

Returns: real(kind=R8P)

fortran
function sink_accretion_radius(self, point) result(r_acc)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.
pointreal(kind=R8P)inPoint.

Call graph

sink_separation ​

Return b - a, the minimum image along the periodic directions and 0 along the null ones (issue #94).

Attributes: pure

Returns: real(kind=R8P)

fortran
function sink_separation(grid, a, b) result(dx)

Arguments

NameTypeIntentAttributesDescription
gridtype(grid_object)inThe grid.
areal(kind=R8P)inFirst point.
breal(kind=R8P)inSecond point.

Call graph

sinks_dt_limit ​

Return the time step limit of the sinks (issue #94): a sink moves at most half a cell of its level per step, and the gas a cell away, pulled by a = G m / h^2 (the mesh force peaks at about a cell), at most half a cell from rest, dt <= 0.5 sqrt(h / a) = 0.5 sqrt(h^3 / (G m)) (the acceleration limit of Federrath et al. 2010: a cold dense medium has a CFL step far longer than the fall onto a sink, and the self-gravity source is not limited by the CFL condition). huge without sinks. The list is replicated: every rank returns the same limit.

Returns: real(kind=R8P)

fortran
function sinks_dt_limit(self) result(dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inoutThe equation.

Call graph

ib_cut_spacing ​

Return the spacing of a fluid cell along one direction, shortened where the solid surface crosses its stencil (CHASE semantics, issue #35 D-9).

When the fluid cell (phi_c < 0) has one neighbour inside the solid (phi_m phi_p < 0), the surface lies at the distance delta = -phi_c / (phi_s - phi_c) ds from the cell centre towards the solid neighbour s, and the spacing becomes ds / 2 + delta; otherwise it is ds. phi_s > 0 > phi_c there, so phi_s - phi_c > 0 needs no guard: CHASE added an absolute 1e-12, a length that broke the scaling covariance of the scheme (issue #49).

Attributes: pure

Returns: real(kind=R8P)

fortran
function ib_cut_spacing(phi_c, phi_m, phi_p, ds) result(ds_cut)

Arguments

NameTypeIntentAttributesDescription
phi_creal(kind=R8P)inDistance function of the cell (negative in the fluid).
phi_mreal(kind=R8P)inDistance function of the minus neighbour.
phi_preal(kind=R8P)inDistance function of the plus neighbour.
dsreal(kind=R8P)inSpacing.

Call graph

refinement_by_spacing ​

Return the refinement query of a block of spacing dc against the admissible spacing delta: refine when too coarse, derefine when its parent (spacing doubled) would still be admissible, untouched otherwise.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function refinement_by_spacing(dc, delta) result(refinement)

Arguments

NameTypeIntentAttributesDescription
dcreal(kind=R8P)inBlock spacing.
deltareal(kind=R8P)inAdmissible spacing.

Call graph

reflux_positivity_theta ​

Largest fraction theta in [0, 1] of the end-of-step reflux correction d that keeps the coarse cell q admissible (issue #88): the density and the internal energy of q + theta d stay at least POSITIVITY_LIMITER_KAPPA times those of q, the positivity limiter's relative floor. The correction is applied after the stages, where the limiter has already acted, so without this a near-vacuum coarse cell at a 2:1 seam can be driven to a negative internal energy. The internal energy E - |m|^2 / (2 rho) - mag_w |B|^2 / 2 - psi_w psi^2 / 2 (mag_w 1 for MHD, psi_w 1 for EGLM, as the models' internal_energy) is concave in theta, so the admissible fractions are an interval holding 0, whose end the bisection finds. 1 when the full correction is admissible, and for a cell that is not admissible to begin with (left to the scheme). A barotropic gas (cs2_inert > 0, issue #100 P4) has no internal energy: the density and the kinetic chord of the cell limiter take its place, rho W - |m|^2 / (2 rho) with W = (4 |u|^2 + c^2) / 2 of q (c^2 = cs2_inert), which bounds the speed of the corrected cell by about sqrt(4 |u|^2 + c^2).

Attributes: pure

Returns: real(kind=R8P)

fortran
function reflux_positivity_theta(nv, q, d, mag_w, psi_w, cs2_inert) result(theta)

Arguments

NameTypeIntentAttributesDescription
nvinteger(kind=I4P)inVariables number.
qreal(kind=R8P)inCoarse cell state before the correction.
dreal(kind=R8P)inFull correction (scale times the flux mismatch).
mag_wreal(kind=R8P)inWeight of the magnetic energy (1 MHD, 0 Euler).
psi_wreal(kind=R8P)inWeight of psi^2/2 in the total energy (1 EGLM, 0 otherwise).
cs2_inertreal(kind=R8P)inBarotropic gas: the reference c^2 of the kinetic chord (0 otherwise).

Call graph

reflux_internal_energy ​

Internal energy per unit volume of a state, any model by the weights of reflux_positivity_theta; for a barotropic gas (w > 0, issue #100) the kinetic chord's rho w - |m|^2 / (2 rho) in its place.

Attributes: pure

Returns: real(kind=R8P)

fortran
function reflux_internal_energy(nv, q, mag_w, psi_w, w) result(e)

Arguments

NameTypeIntentAttributesDescription
nvinteger(kind=I4P)inVariables number.
qreal(kind=R8P)inConservative variables.
mag_wreal(kind=R8P)inWeight of the magnetic energy.
psi_wreal(kind=R8P)inWeight of psi^2/2.
wreal(kind=R8P)inBarotropic gas: the kinetic chord's specific energy (0 otherwise).

Call graph

block_spacing ​

Return the spacing of block b by the AMR delta criterion: x, y, z, or max over the active directions.

Returns: real(kind=R8P)

fortran
function block_spacing(self, b, delta_type) result(dc)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.
binteger(kind=I4P)inBlock index.
delta_typecharacter(len=*)inDelta criterion.

Call graph

poisson_iterations ​

FCG iterations of the last multigrid solve (0 without the multigrid solver).

Returns: integer(kind=I4P)

fortran
function poisson_iterations(self) result(iterations)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph

runtime_amr_forest ​

Return whether this realm regrids during the run: [amr] frequency > 0 (issue #74).

Returns: logical

fortran
function runtime_amr_forest(self) result(yes)

Arguments

NameTypeIntentAttributesDescription
selfclass(flume_common_object)inThe equation.

Call graph