Appearance
adam_realm_object
ADAM, realm class definition — common per-realm state and orchestrator contract.
A realm is the unit the forest_object orchestrator tends. The name is the crasi of two aspects this type entails simultaneously:
- A physical-numerical model: the PDE system, numerics configuration, time integrator, boundary conditions, etc. (math layer).
- A spatial region modelization: the grid, the AMR Morton tree, the field data, the communication maps (where layer).
A realm has both laws (1) and borders (2). Neither name equation_object (math-only) nor subdomain_object (region-only) captured both aspects — hence realm_object, evoking a bounded territory governed by its own rules.
Consumer apps (PRISM, NASTO, CHASE, ...) extend realm_object to define their specific PDE family (prism_common_object extends realm_object, etc.). Each extended type adds app-private data and overrides the orchestrator contract TBPs.
The orchestrator contract is the set of TBPs carrying the _forest suffix. These are the methods forest_object may call on a realm; grep "_forest" across the codebase reveals the entire orchestrator contract surface. Three architectural rules govern these TBPs:
- O1 — signature uses only ADAM-lib-visible types (intrinsic kinds plus
class(realm_object),grid_object, etc.). Apps override the implementation; signatures are sacred. - O2 — app-specific dispatch (which integrator, which physics) lives in
self%'s components, not in orchestrator-supplied arguments. - O3 —
qis never public onrealm_object. Halo exchange between realms goes through realm-side TBPs that operate on q internally; the orchestrator schedules but never touches q.
Source: src/lib/common/adam_realm_object.F90
Dependencies
Contents
- realm_object
- compute_block_total_variation_interface
- compute_curl_interface
- compute_derivative1_interface
- compute_derivative2_interface
- compute_derivative4_interface
- compute_divergence_interface
- compute_gradient_interface
- compute_laplacian_interface
- initialize
- load_fdv_from_file
- initialize_forest
- compute_local_dt_forest
- advance_one_step_forest
- coupling_descriptor_forest
- open_step_forest
- begin_stage_forest
- end_stage_forest
- close_step_forest
- post_step_forest
- is_done_forest
- finalize_forest
- finalize_mpi_forest
- fill_seam_from_peer_forest
- after_topology_build_forest
- apply_reflux_to_stage_forest
- close_block_xh5f
- close_file_xh5f
- open_block_xh5f
- open_file_xh5f
- save_q_xh5f
- compute_block_total_variation_fd
- compute_curl_fd
- compute_curl_fv
- compute_derivative1_fd
- compute_derivative1_fv
- compute_derivative2_fd
- compute_derivative2_fv
- compute_derivative4_fd
- compute_divergence_fd
- compute_divergence_fv
- compute_gradient_fd
- compute_gradient_fv
- compute_laplacian_fd
- compute_laplacian_fv
- stages_per_step_forest
Derived Types
realm_object
Realm system class definition, common data to all backends and applications.
@NOTE: the orchestrator contract methods carrying the _forest suffix are the surface forest_object may call on a realm. Default implementations here error-stop with a "not overridden" message; each consumer app must override.
Inheritance
Components
| Name | Type | Attributes | Description |
|---|---|---|---|
io | type(io_object) | IO handler. | |
amr | type(amr_object) | AMR marker handler. | |
slices | type(slices_object) | Slices handler. | |
blanesmoan | type(blanesmoan_object) | Blanes-Moan integrator. | |
cfm | type(cfm_object) | Commutator-Free Magnus integrator. | |
leapfrog | type(leapfrog_object) | Leapfrog integrator. | |
flail | type(flail_object) | Linear algebra methods handler. | |
weno | type(weno_object) | WENO reconstructor. | |
ib | type(ib_object) | Immersed boundary. | |
rk | type(rk_object) | Runge-Kutta integrator. | |
adam | type(adam_object) | ADAM, grid + tree + field + maps orchestrator. | |
fdv_scheme | character(len=:) | allocatable | FDV scheme, fd/fv. |
fdv_order | integer(kind=I4P) | Order of finite difference/volume schemes, general order. | |
fdv_half_stencil | integer(kind=I4P) | Half stencil length of finite difference/volume schemes. | |
fdv_half_stencils | integer(kind=I4P) | Half stencil length of fdv schemes for each derivative up to 6. | |
ngc | integer(kind=I4P) | pointer | Number of ghost cells. |
ni | integer(kind=I4P) | pointer | Number of cells in i direction. |
nj | integer(kind=I4P) | pointer | Number of cells in j direction. |
nk | integer(kind=I4P) | pointer | Number of cells in k direction. |
nb | integer(kind=I4P) | pointer | Total blocks number for MPI. |
blocks_number | integer(kind=I4P) | pointer | Actual blocks number. |
nv | integer(kind=I4P) | pointer | Number of variables in q vector. |
realm_index | integer(kind=I4P) | Inter-realm seam coupling — currently-published stage buffer key. | |
stage_active | integer(kind=I4P) | Procedure pointer TBPs for FDV operators (set at initialization by backend). | |
compute_block_total_variation | procedure(compute_block_total_variation_interface) | pass(self), pointer | Compute TV. |
compute_curl | procedure(compute_curl_interface) | pass(self), pointer | Compute curl. |
compute_derivative1 | procedure(compute_derivative1_interface) | pass(self), pointer | Compute deriv1. |
compute_derivative2 | procedure(compute_derivative2_interface) | pass(self), pointer | Compute deriv2. |
compute_derivative4 | procedure(compute_derivative4_interface) | pass(self), pointer | Compute deriv4. |
compute_divergence | procedure(compute_divergence_interface) | pass(self), pointer | Compute dive. |
compute_gradient | procedure(compute_gradient_interface) | pass(self), pointer | Compute grad. |
compute_laplacian | procedure(compute_laplacian_interface) | pass(self), pointer | Compute laplac. |
Type-Bound Procedures
| Name | Attributes | Description |
|---|---|---|
initialize | pass(self) | Initialize common data. |
load_fdv_from_file | pass(self) | Load FDV config from file. |
initialize_forest | pass(self) | Invoked by forest%initialize per realm at startup. |
compute_local_dt_forest | pass(self) | Invoked by forest%compute_global_dt during the min reduction. |
advance_one_step_forest | pass(self) | Invoked by forest%evolve_one_step per realm per timestep. |
stages_per_step_forest | pass(self) | Number of integrator stages this realm exposes per step. |
coupling_descriptor_forest | pass(self) | Report (scheme_time, rk_scheme, nv) for β admissibility. |
open_step_forest | pass(self) | Per-step prologue (multi-realm path). |
begin_stage_forest | pass(self) | Begin one integrator stage on this realm (multi-realm path). |
end_stage_forest | pass(self) | End the stage: residuals + assignment (multi-realm path). |
close_step_forest | pass(self) | Per-step epilogue (multi-realm path). |
post_step_forest | pass(self) | Invoked by forest%post_step per realm per timestep. |
is_done_forest | pass(self) | Invoked by forest%is_done during the termination reduction. |
finalize_forest | pass(self) | Invoked by forest%finalize per realm at shutdown. |
finalize_mpi_forest | pass(self) | Process-global MPI finalize; forest calls it ONCE after all. |
fill_seam_from_peer_forest | pass(self) | Receive-side roundtrip: copy peer's interior into self's ghosts. |
after_topology_build_forest | pass(self) | Backend hook invoked once after the forest builds the seam maps. |
apply_reflux_to_stage_forest | pass(self) | Apply Berger-Colella reflux to self's stage buffer. |
close_block_xh5f | nopass | Close XH5F file block. |
close_file_xh5f | nopass | Close XH5F file. |
open_block_xh5f | pass(self) | Open block file XH5F. |
open_file_xh5f | pass(self) | Open file XH5F. |
save_q_xh5f | pass(self) | Save in XH5F (XDMF/HDF5) format. |
compute_block_total_variation_fd | pass(self) | Return the max of block total variation for a given var. |
compute_curl_fd | pass(self) | Compute curl of vector field, finite difference. |
compute_curl_fv | pass(self) | Compute curl of vector field, finite volume. |
compute_derivative1_fd | pass(self) | Compute derivative1 of scalar field, finite difference. |
compute_derivative1_fv | pass(self) | Compute derivative1 of scalar field, finite volume. |
compute_derivative2_fd | pass(self) | Compute derivative2 of scalar field, finite difference. |
compute_derivative2_fv | pass(self) | Compute derivative2 of scalar field, finite volume. |
compute_derivative4_fd | pass(self) | Compute derivative4 of scalar field, finite difference. |
compute_divergence_fd | pass(self) | Compute divergence of vector field, finite difference. |
compute_divergence_fv | pass(self) | Compute divergence of vector field, finite volume. |
compute_gradient_fd | pass(self) | Compute gradient of scalar field, finite difference. |
compute_gradient_fv | pass(self) | Compute gradient of scalar field, finite volume. |
compute_laplacian_fd | pass(self) | Compute laplacian of scalar field, finite difference. |
compute_laplacian_fv | pass(self) | Compute laplacian of scalar field, finite volume. |
Interfaces
compute_block_total_variation_interface
compute_curl_interface
compute_derivative1_interface
compute_derivative2_interface
compute_derivative4_interface
compute_divergence_interface
compute_gradient_interface
compute_laplacian_interface
Subroutines
initialize
Initialize common data: MPI, ADAM, grid, field and data replica pointers.
fortran
subroutine initialize(self, filename, memory_avail, nv, verbose, L0)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | target | The equation. |
filename | character(len=*) | in | Input parameters file name. | |
memory_avail | real(kind=R8P) | in | value | Memory available for single MPI process. |
nv | integer(kind=I4P) | in | optional | Number of field variables. |
verbose | logical | in | optional | Trigger verbose output. |
L0 | real(kind=R8P) | in | optional | Adimensionalization parameter. |
Call graph
load_fdv_from_file
Load FDV config from file.
fortran
subroutine load_fdv_from_file(self, file_parameters, go_on_fail)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
file_parameters | type(file_ini) | in | Simulation parameters ini file handler. | |
go_on_fail | logical | in | optional | Go on if load fails. |
Call graph
initialize_forest
Initialize this realm from scratch: app-level initialize, IC injection (or restart load), initial AMR, IO file open, initial diagnostics dump.
Invoked by forest%initialize once per realm at startup, before the time loop begins. This is the single per-realm setup entry point the orchestrator uses: it both runs the basic per-realm initialize (which the legacy simulate did via realm%initialize_prism(filename) or equivalent) and performs the post-init / pre-loop setup that has to happen before forest%evolve_one_step can be called.
Realm-position context: the forest sets self%realm_index = is BEFORE invoking this TBP, so the override body can already read its own 1-based forest position from self%realm_index for per-realm IO filenames, log prefixes, etc.
Default implementation error-stops: every consumer app MUST override this method (the initial-condition catalog, AMR strategy, and which IO files to open are app-specific).
fortran
subroutine initialize_forest(self, filename, realms_number, memory_avail, nv, verbose)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
filename | character(len=*) | in | Input parameters file name. | |
realms_number | integer(kind=I4P) | in | optional | Realm count in the forest. |
memory_avail | real(kind=R8P) | in | optional | Per-process memory budget override. |
nv | integer(kind=I4P) | in | optional | Number of field variables override. |
verbose | logical | in | optional | Trigger verbose output. |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The realm. | |
dt_local | real(kind=R8P) | out | Local stability-limited dt. |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size. |
Call graph
coupling_descriptor_forest
Report this realm's coupling descriptor for β admissibility.
Returns the identity of the realm's ODE solver + physics layout. Two realms may share a seam with CADENCE_STAGE_COINCIDENT only if all three values match between them; otherwise the forest rejects the manifest. Spatial operator (scheme_space) and grid resolution are NOT in the descriptor — those are precisely the dimensions β allows to differ between realms.
Default implementation returns empty strings and sentinel nv = -1: a realm that does not override this TBP cannot participate in β. App-side overrides (e.g. prism_common_object) report numerics%scheme_time, rk%scheme, physics%nv.
fortran
subroutine coupling_descriptor_forest(self, scheme_time, rk_scheme, nv)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The realm. | |
scheme_time | character(len=:) | out | allocatable | Time-integration family tag ("runge_kutta", "leapfrog", ...). |
rk_scheme | character(len=:) | out | allocatable | Within-family scheme tag ("runge-kutta-ssp-54", ...). |
nv | integer(kind=I4P) | out | Number of conserved variables on this realm. |
Call graph
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 RK realms: rk%initialize_stages), 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size from the forest. |
Call graph
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 RK realms: rk%compute_stage(s=k) populating rk%q_rk(:,...,k) from prior stages and self%q), 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
k | integer(kind=I4P) | in | Stage index (1..K_total). | |
K_total | integer(kind=I4P) | in | Forest-wide stage count for this step. | |
dt | real(kind=R8P) | in | Timestep size from the forest. | |
realm | class(realm_object) | inout | target, optional | Sibling realms (contract parity). |
Call graph
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 RK realms: compute_residuals + rk%assign_stage). 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
k | integer(kind=I4P) | in | Stage index (1..K_total). | |
K_total | integer(kind=I4P) | in | Forest-wide stage count for this step. | |
dt | real(kind=R8P) | in | Timestep size from the forest. | |
realm | class(realm_object) | inout | target, optional | Sibling realms (parity only). |
flux_register | class(flux_register_object) | inout | optional | Forest's flux register for FV reflux. |
Call graph
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 RK realms: rk%update_q), 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size from the forest. |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
dt | real(kind=R8P) | in | Timestep size just advanced. | |
t | real(kind=R8P) | in | Simulation time after the advance. | |
it | integer(kind=I4P) | in | Iteration index after the advance. | |
do_save_state | logical | in | optional | Save state output this step. |
do_save_residuals | logical | in | optional | Save residuals output this step. |
do_save_restart | logical | in | optional | Save restart dump this step. |
do_amr | logical | in | optional | Run AMR update this step. |
realm | class(realm_object) | inout | target, optional | Sibling realms for inter-realm halo refresh. |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The realm. | |
done | logical | out | True if this realm is done evolving. |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm (carries no MPI state; dispatch picks the backend handler). |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | ||
peer | class(realm_object) | in | target | |
p_idx | integer(kind=I4P) | in |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout |
Call graph
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 (for RK realms: self%rk%ark(stage)), and writes the correction delta into its OWN stage buffer (for RK realms: self%rk%q_rk(:, i, j, k, b, stage)).
Architectural role: this TBP keeps the per-realm reflux write integrator-private. The forest never names q_rk, ark, or any other RK-specific identifier — those live realm-side, so a future Leapfrog / Yoshida / CFM realm can implement reflux on its own buffer naming 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The realm. | |
stage | integer(kind=I4P) | in | Integrator stage 1..K_total. | |
dt | real(kind=R8P) | in | Time step. | |
flux_register | class(flux_register_object) | in | Forest's flux register (read-only). |
Call graph
close_block_xh5f
Close XH5F file block.
fortran
subroutine close_block_xh5f(xh5f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
xh5f | type(xh5f_file_object) | inout | XH5F file handler. |
Call graph
close_file_xh5f
Close XH5F file.
fortran
subroutine close_file_xh5f(xh5f)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
xh5f | type(xh5f_file_object) | inout | XH5F file handler. |
Call graph
open_block_xh5f
Open XH5F file block.
fortran
subroutine open_block_xh5f(self, xh5f, b, nijk, t, time)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
xh5f | type(xh5f_file_object) | inout | XH5F file handler. | |
b | integer(kind=I4P) | in | Block index. | |
nijk | integer(kind=I8P) | in | Blocks dimensions. | |
t | integer(kind=I4P) | in | optional | Time iteration. |
time | real(kind=R8P) | in | optional | Time. |
Call graph
open_file_xh5f
Open XH5F file.
fortran
subroutine open_file_xh5f(self, basename, xh5f, directory)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
basename | character(len=*) | in | Base name of output files. | |
xh5f | type(xh5f_file_object) | out | XH5F file handler. | |
directory | character(len=*) | in | optional | Directory name of output files. |
Call graph
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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | inout | The equation. | |
basename | character(len=*) | in | Base name of output files. | |
q | real(kind=R8P) | in | Q-vector variables [nv,ni,nj,nk,nb]. | |
q_name | character(len=*) | in | optional | Q-vector variables names [nv]. |
directory | character(len=*) | in | optional | Directory name of output files. |
with_ghost | logical | in | optional | Flag to save ghost cells. |
with_cell_morton | logical | in | optional | Flag to save Morton code also in cells. |
t | integer(kind=I4P) | in | optional | Time iteration. |
time | real(kind=R8P) | in | optional | Time. |
Call graph
compute_block_total_variation_fd
Return the max of block total variation for a given var.
fortran
subroutine compute_block_total_variation_fd(self, hs, dxyz, ivar, q, tot_var_field, total_variation)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
dxyz | real(kind=R8P) | in | Space steps. | |
ivar | integer(kind=I4P) | in | Index of first component of vec field. | |
q | real(kind=R8P) | in | Field variables. | |
tot_var_field | real(kind=R8P) | inout | Total variation field on blocks. | |
total_variation | real(kind=R8P) | out | Max total variation on given block. |
Call graph
compute_curl_fd
Compute curl of vector fields, div(q(ivar:ivar+2), using finite difference schemes.
fortran
subroutine compute_curl_fd(self, hs, ivar, q, curl)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
curl | real(kind=R8P) | inout | Curl. |
Call graph
compute_curl_fv
Compute curl of vector fields, div(q(ivar:ivar+2), using finite volume schemes.
fortran
subroutine compute_curl_fv(self, hs, ivar, q, curl)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
curl | real(kind=R8P) | inout | Curl. |
Call graph
compute_derivative1_fd
Compute derivative1 of scalar fields, dq(ivar)/ds, using finite difference schemes.
fortran
subroutine compute_derivative1_fd(self, hs, dir, ivar, q, dq_ds)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of (vec.) variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
dq_ds | real(kind=R8P) | inout | Derivative1, dq/ds. |
Call graph
compute_derivative1_fv
Compute derivative1 of scalar fields, dq(ivar)/ds, using finite volume schemes.
fortran
subroutine compute_derivative1_fv(self, hs, dir, ivar, q, dq_ds)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of (vec.) variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
dq_ds | real(kind=R8P) | inout | Derivative1, dq/ds. |
Call graph
compute_derivative2_fd
Compute derivative2 of scalar fields, d2q(ivar)/ds2, using finite difference schemes.
fortran
subroutine compute_derivative2_fd(self, hs, dir, ivar, q, d2q_ds2)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of vec variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
d2q_ds2 | real(kind=R8P) | inout | Derivative2, d2q/ds2. |
Call graph
compute_derivative2_fv
Compute derivative2 of scalar fields, d2q(ivar)/ds2, using finite volume schemes.
fortran
subroutine compute_derivative2_fv(self, hs, dir, ivar, q, d2q_ds2)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
d2q_ds2 | real(kind=R8P) | inout | Derivative2, d2q/ds2. |
compute_derivative4_fd
Compute derivative2 of scalar fields, d4q(ivar)/ds4, using finite difference schemes.
fortran
subroutine compute_derivative4_fd(self, hs, dir, ivar, q, d4q_ds4)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
dir | integer(kind=I4P) | in | Direction, 1=X, 2=Y, 3=Z. | |
ivar | integer(kind=I4P) | in | Start index of variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
d4q_ds4 | real(kind=R8P) | inout | Derivative4, d4q/ds4. |
Call graph
compute_divergence_fd
Compute divergence of vector fields, div(q(ivar:ivar+2), using finite difference schemes.
fortran
subroutine compute_divergence_fd(self, hs, ivar, q, divergence)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Start index of field of q. | |
q | real(kind=R8P) | in | Field variables. | |
divergence | real(kind=R8P) | inout | Divergence. |
Call graph
compute_divergence_fv
Compute divergence of vector fields, div(q(ivar:ivar+2), using finite volume schemes.
fortran
subroutine compute_divergence_fv(self, hs, ivar, q, divergence)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Start index of field of q. | |
q | real(kind=R8P) | in | Field variables. | |
divergence | real(kind=R8P) | inout | Divergence. |
Call graph
compute_gradient_fd
Compute gradient of scalar variable q(ivar), finite difference schemes.
fortran
subroutine compute_gradient_fd(self, hs, ivar, q, gradient)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Index of scalar variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
gradient | real(kind=R8P) | inout | Gradient. |
Call graph
compute_gradient_fv
Compute gradient of scalar variable q(ivar), finite volume schemes.
fortran
subroutine compute_gradient_fv(self, hs, ivar, q, gradient)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Index of scalar variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
gradient | real(kind=R8P) | inout | Gradient. |
Call graph
compute_laplacian_fd
Compute laplacian of scalar variable q(ivar), finite difference schemes.
fortran
subroutine compute_laplacian_fd(self, hs, ivar, q, laplacian)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Index of scalar variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
laplacian | real(kind=R8P) | inout | Gradient. |
Call graph
compute_laplacian_fv
Compute laplacian of scalar variable q(ivar), finite volume schemes.
fortran
subroutine compute_laplacian_fv(self, hs, ivar, q, laplacian)Arguments
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The equation. | |
hs | integer(kind=I4P) | in | FDV half stencil length. | |
ivar | integer(kind=I4P) | in | Index of scalar variable of q. | |
q | real(kind=R8P) | in | Field variables. | |
laplacian | real(kind=R8P) | inout | Gradient. |
Functions
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. For SSP-RK realms K = rk%nrk; for Leapfrog realms K = 2 (kick, drift); for Yoshida composition K is the number of sub-operators; for an operator-split realm that does all its work atomically and only needs one peer-sync per step, 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
| Name | Type | Intent | Attributes | Description |
|---|---|---|---|---|
self | class(realm_object) | in | The realm. |
Call graph