Skip to content

adam_ripple_common_object ​

RIPPLE, the common realm: what the CPU and FNL backends share.

RIPPLE solves the scalar linear advection u_t + a . grad(u) = 0 on a periodic box: the worked example of the "build your own solver" tutorial (issue #59). A RIPPLE realm extends the library's realm_object, which already owns the grid, the tree, the field, the maps, the WENO and the Runge-Kutta objects; this module adds the state q, the advection velocity, the time bookkeeping, the initial condition (a smooth profile with an exact translated solution), the initial AMR and the parts of the forest contract that do not depend on where q lives.

The scheme is the Shu-Osher conservative finite difference: point values at the cell centres, the upwind split flux a+ u / a- u reconstructed at every face by the library's WENO, dq = -sum_d (F_{i+1/2} - F_{i-1/2}) / dx_d. The backends own the residuals and the integration.

Source: src/app/ripple/common/adam_ripple_common_object.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
PI2real(kind=R8P)parameter2 pi.

Derived Types ​

ripple_common_object ​

RIPPLE common realm.

Inheritance

Extends: realm_object

Components ​

NameTypeAttributesDescription
iotype(io_object)IO handler.
amrtype(amr_object)AMR marker handler.
slicestype(slices_object)Slices handler.
blanesmoantype(blanesmoan_object)Blanes-Moan integrator.
cfmtype(cfm_object)Commutator-Free Magnus integrator.
leapfrogtype(leapfrog_object)Leapfrog integrator.
flailtype(flail_object)FLAIL, the elliptic solver library (issue #84).
wenotype(weno_object)WENO reconstructor.
ibtype(ib_object)Immersed boundary.
rktype(rk_object)Runge-Kutta integrator.
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.
realm_indexinteger(kind=I4P)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
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.
qreal(kind=R8P)allocatableState, point values u [1, 1-ngc:ni+ngc, ..., nb].
dqreal(kind=R8P)allocatableResiduals, same shape.
areal(kind=R8P)Advection velocity.
cflreal(kind=R8P)CFL number.
timereal(kind=R8P)Current time.
time_maxreal(kind=R8P)Final time.
dtreal(kind=R8P)Current time step.
itinteger(kind=I4P)Current iteration.
it_maxinteger(kind=I4P)Iterations number; <= 0: run to time_max.
history_unitinteger(kind=I4P)Unit of the history file (rank 0).
amr_criteriatype(amr_criterion_pointer)allocatableRegistered refinement criteria (issue #110).

Type-Bound Procedures ​

NameAttributesDescription
initializepass(self)Initialize common data.
load_fdv_from_filepass(self)Load FDV config from file.
initialize_forestpass(self)Invoked by forest%initialize per realm at startup.
advance_one_step_forestpass(self)Invoked by forest%evolve_one_step per realm per timestep.
coupling_descriptor_forestpass(self)Report (scheme_time, rk_scheme, nv) for β admissibility.
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.
runtime_amr_forestpass(self)Whether this realm regrids during the run (#74).
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).
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
initialize_ripplepass(self)Initialize the common data.
check_inputpass(self)Refuse the inputs RIPPLE cannot honour.
set_initial_conditionspass(self)Set the initial profile on the interior cells.
amr_updatepass(self)Initial AMR: box markers and registered criteria.
register_amr_criterionpass(self)Register a refinement criterion by name (issue #110).
compute_totalpass(self)Total of u dV on this rank.
save_outputpass(self)Save one history row and the state (XH5F).
advance_timepass(self)Count the step and cap dt on time_max.
accumulate_seam_skinpass(self)Route one seam face skin to the flux register.
apply_refluxpass(self)Berger-Colella correction of the coarse seam cells of q.
compute_local_dt_forestpass(self)Local CFL time step.
is_done_forestpass(self)True when the run is over.
stages_per_step_forestpass(self)Runge-Kutta stages per step (staged path).

Subroutines ​

initialize_ripple ​

Initialize the common data: the library objects (realm_object%initialize), periodic faces, [ripple] and [time], the state, the uniform refinement. MPI is initialized by the backend, before.

fortran
subroutine initialize_ripple(self, filename, memory_avail)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inoutThe realm.
filenamecharacter(len=*)inInput file name.
memory_availreal(kind=R8P)inMemory (GB) the blocks budget may use.

Call graph

check_input ​

Refuse the inputs RIPPLE cannot honour, at initialization: a library key that the app silently ignored would run a different scheme than the input asks for.

fortran
subroutine check_input(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inThe realm.

Call graph

set_initial_conditions ​

Set the initial profile u0 (exact_solution at t = 0) on the interior cells of every block.

fortran
subroutine set_initial_conditions(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inoutThe realm.

Call graph

amr_update ​

Initial AMR, [amr] iters sweeps over the [amr_marker_N] sections: a box (mode 1, primitive-box) refines the blocks whose centroid lies in it until they reach its target_level; a registered criterion (mode 6, issue #110) marks with its own votes (mark with initial = .true.). Other markers are refused by check_input.

fortran
subroutine amr_update(self)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inoutThe realm.

Call graph

register_amr_criterion ​

Register a refinement criterion (issue #110): [amr_marker_N] mode = 6, name = <criterion%name> selects it. RIPPLE refines at initialization only, so the criterion must act there (runtime_only = .false.). The realm keeps a pointer: the program owns the instance (a TARGET of the main program, outliving the run).

fortran
subroutine register_amr_criterion(self, criterion)

Arguments

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

Call graph

save_output ​

Append one row (it, time, total of u dV over the domain) to the history file and, when fields, save the host q in XH5F (one HDF5 file per rank, interior cells, <output_basename>-<it>).

fortran
subroutine save_output(self, fields)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inoutThe realm.
fieldslogicalinSave the fields too.

Call graph

advance_time ​

Count the step and take the forest's dt, capped so that a time-driven run lands on time_max.

fortran
subroutine advance_time(self, dt)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inoutThe realm.
dtreal(kind=R8P)inTime step from the forest.

Call graph

accumulate_seam_skin ​

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

skin(1, c) is the face flux with c running over the two tangential axes, inner fastest (x faces: j, k; y faces: i, k; z faces: i, j). A positive register index marks the coarse side of a 2:1 face: the skin is the coarse face. A negative one marks a fine block: its skin is restricted (2x2 average, 2x1 on a quadtree) into its quadrant of the coarse face. Weighting every stage by its SSP coefficient makes the register hold sum_s beta_s F_s, the flux of the committed step.

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

Arguments

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

Call graph

apply_reflux ​

Berger-Colella reflux on the host q: every coarse seam cell this rank owns receives sgn dt / dx (F_coarse - F_fine), the coarse flux the step used replaced by the restricted fine one, so that the total of u dV is conserved across the 2:1 faces to round-off.

fortran
subroutine apply_reflux(self, flux_register)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inoutThe realm.
flux_registerclass(flux_register_object)inForest's flux register.

Call graph

compute_local_dt_forest ​

Return the local CFL time step, CFL / max_b sum_d |a_d| / dx_d (the forest takes the minimum over the ranks).

fortran
subroutine compute_local_dt_forest(self, dt_local)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inThe realm.
dt_localreal(kind=R8P)outLocal time step.

Call graph

is_done_forest ​

Return true when it_max steps are done or, with it_max <= 0, when time_max is reached.

fortran
subroutine is_done_forest(self, done)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inThe realm.
donelogicaloutTrue if the realm is done.

Call graph

Functions ​

compute_total ​

Return the total of u dV over the interior cells of this rank's blocks (host q).

Returns: real(kind=R8P)

fortran
function compute_total(self) result(total)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inThe realm.

Call graph

stages_per_step_forest ​

Return the Runge-Kutta stages per step: the staged path (2:1 AMR faces) needs an SSP scheme.

Returns: integer(kind=I4P)

fortran
function stages_per_step_forest(self) result(K)

Arguments

NameTypeIntentAttributesDescription
selfclass(ripple_common_object)inThe realm.

Call graph

exact_solution ​

Return the exact solution at point x, time t: the profile u0 = prod_d sin(2 pi (x_d - emin_d) / L_d) over the non-null axes, translated by a t (periodic box).

Attributes: pure

Returns: real(kind=R8P)

fortran
function exact_solution(x, t, a, emin, emax, is_null) result(u)

Arguments

NameTypeIntentAttributesDescription
xreal(kind=R8P)inPoint.
treal(kind=R8P)inTime.
areal(kind=R8P)inAdvection velocity.
eminreal(kind=R8P)inDomain minimum corner.
emaxreal(kind=R8P)inDomain maximum corner.
is_nulllogicalinNull axes.

Call graph