MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_amr_registers.fpp.f90 File Reference

Contains module m_amr_registers. More...

Go to the source code of this file.

Data Types

type  m_amr_registers::t_face_reg
 Registers for the two block faces normal to one direction: (1:sys_size, transverse-1, transverse-2, slot). More...

Modules

module  m_amr_registers
 AMR flux registers: per-RK-stage refluxing at the coarse/fine block boundary. Depends only on m_derived_types and m_global_parameters so m_rhs (capture) and m_time_steppers (apply) can use it without cycles. creg is indexed 0-based relative to the rank's block intersection; freg 0-based local fine (children of coarse cell t are 2*t, 2*t+1). The slot dimension grows on demand (s_amr_reg_reserve). The captured flux is the 1:sys_size advective flux of flux_rsx_vf plus the viscous, species-diffusion and conduction fluxes of flux_src_rsx_vf; the non-conservative alpha*div(u) remainder is not captured (held by mpp_lim).

Functions/Subroutines

impure subroutine m_amr_registers::s_amr_reg_reserve (nslot)
 Grow the registers to at least nslot slots (doubling, never shrinking), preserving contents: freg accumulates across RK stages. Growth stages through a device temporary like the store, so the host mirror is undefined afterwards.
impure subroutine, public m_amr_registers::s_amr_reg_prepare ()
 Build the dense participation-local register index (amr_reg_of/amr_reg_n) and size and zero the registers. Keyed on the mesh epoch (block-count change is the tripwire). Block g maps iff this rank owns g or g's parent, or reflux-face-participates in g per s_amr_reflux_faces, so the map covers every capture, receive and apply that indexes g's slot. Dense slots alias across rebuilds, hence the zeroing; contents are dead at a rebuild because stage 1 overwrites them.
pure subroutine, public m_amr_registers::s_amr_reflux_faces (sidx, ext, clip, s_lo, s_hi)
 Faces of the current block whose outside coarse layer lies in the coarse subdomain [sidx, sidx + ext] with transverse overlap (the faces that rank refluxes). With clip, fine-fine seam faces are dropped. Every reflux participant test derives from this.
pure logical function, public m_amr_registers::f_amr_block_near (k, sidx, ext)
 False only if block k's region widened by its outside face layer misses the coarse subdomain [sidx, sidx + ext].
impure subroutine, public m_amr_registers::s_amr_reflux_face_flags (sidx, ext, own_lo, own_hi, tlo, thi)
 This rank's seam-clipped reflux faces and the global transverse overlap [tlo, thi], in the block-relative frame of the owner's freg.
pure logical function, public m_amr_registers::f_amr_face_is_seam (d, side)
 True iff the current block's face on side (+1 high / -1 low) in dim d abuts an adjacent block with matching transverse extents (a fine-fine seam, not a c/f boundary).
impure subroutine, public m_amr_registers::s_initialize_amr_registers (maxc_fit)
pure logical function, public m_amr_registers::f_amr_is_child (kc, g)
 Block kc is a level+1 child of block g: one level finer with an overlapping region box.
pure subroutine, public m_amr_registers::s_amr_parent_foot (k, pblk, plo, phi)
 Parent-fine footprint of block k inside its parent pblk from replicated metadata, so every rank gets the same box (the block's own amr_isect_lo/hi is empty on non-owners). Lives here because "use m_amr" would cycle.
subroutine m_amr_registers::s_amr_bat_member (ibm, ko, ext)
 Select batch member ibm's slot; returns its offset ko in the batch slab and its extents ext (ko = 0 outside a batch).
subroutine m_amr_registers::s_amr_capture_slot (set, sreg, id, blo, bhi, wlo, whi, clo, chi)
 Fill capture table set, slot sreg, for one block's face pair along id: blo/bhi is the block box in local flux indices (faces at blo(id)-1 and bhi(id)), wlo/whi the transverse window, clo/chi the per-face gates. Transverse indices are 0-based from blo, aligned across the coarse and fine registers.
impure subroutine m_amr_registers::s_amr_capture_batch (set, nb, id, fine, advective, cf, acc, maxt1, maxt2, eqb, eqe)
 Batched boundary-flux capture: reg(id)lo/hi(eq, t1, t2, slot) [+=/=] cf * flux over each slot's window (bcap rows 5:8) for eq in [eqb:eqe]; reg is freg (fine) or creg. acc selects accumulate vs overwrite; advective selects flux_rsx_vf vs flux_src_rsx_vf. Inactive slots and out-of-window cells are cycled.
impure subroutine m_amr_registers::s_amr_capture_total (set, nb, id, fine, cf, acc)
 Capture the filled slots (s_amr_capture_slot) into freg (fine) or creg: advective, viscous (mom..E), and chemistry diffusion (species, plus the energy flux only when not viscous, since the viscous pass already captured it). Coarse and fine share this routine so the reflux subtracts matching fluxes. Set 0 is pushed here and cleared after.
impure subroutine, public m_amr_registers::s_amr_capture_boundary_flux (id, stage)
 Capture c/f boundary-face fluxes for direction id from the finalized flux array, inside s_compute_rhs. The coarse call fills creg at block faces; the fine call (amr_in_fine_advance, globals swapped to the fine block) fills freg at the fine faces.
impure subroutine m_amr_registers::s_amr_coarse_tables ()
 Build the coarse per-direction capture tables (bcap sets 1:3) and reflux apply tables (aint/areal) once per topology change and push them to the device. Each face is captured by the rank owning the coarse cells just outside it, over its owned transverse overlap [tlo:thi] in the block-relative frame. Called only on the coarse grid.
impure subroutine, public m_amr_registers::s_amr_apply_reflux (rhs_vf)
 Correct the coarse rhs in the first cell outside each block face so the update sees the child-averaged fine flux: the low face is the outside cell's right face (rhs += (F_coarse - Fbar_fine)/dx), the high face its left face (rhs += (Fbar_fine - F_coarse)/dx). c1/c2 are relative 0-based coarse transverse indices. CCE 19.0.0: two or more of the per-direction loop nests in one procedure fail (ftn-7991 on offload, bad code on CPU), so each lives in its own procedure (s_amr_apply_reflux_d1/d2/d3); keep them separate.
impure subroutine m_amr_registers::s_amr_apply_reflux_d1 (rhs_vf)
 Reflux correction for the faces normal to direction 1. Called only when amr_dim(1).
impure subroutine m_amr_registers::s_amr_apply_reflux_d2 (rhs_vf)
 Reflux correction for the faces normal to direction 2. Called only when amr_dim(2).
impure subroutine m_amr_registers::s_amr_apply_reflux_d3 (rhs_vf)
 Reflux correction for the faces normal to direction 3. Called only when amr_dim(3).
impure subroutine m_amr_registers::s_amr_zero_registers (fine, slo, shi)
 Zero register slots slo..shi of freg (fine) or creg in every active direction.
impure subroutine, public m_amr_registers::s_amr_reflux_apply_faces (q, islot, rr, dtl, olo, ohi, glo, ghi, woff, w_lo, w_hi, mlo, mhi)
 Berger-Colella state reflux: q(outside) += w*dtl*(F_coarse - Fbar_fine)/m on the low face and the negative on the high face, per active dim, with F_coarse = creg and Fbar_fine = freg averaged over the rr**(ndim-1) covering fine faces. Framing is caller-passed: islot dense register slot; olo/ohi outside coarse-cell index below/above the face; glo/ghi creg-local loop range; woff transverse write origin; w_lo/w_hi per-face weight; mlo/mhi outside-cell width. A zero weight skips the write because the outside index may be out of bounds on an unowned face.
impure subroutine, public m_amr_registers::s_amr_set_rk_table (coef)
 amr_rk_w and amr_rk_c from the rows (c1, c2, c3, c4) of q <- (c1*q + c2*q^n + c3*dt*L(q))/c4, one per stage.
impure subroutine, public m_amr_registers::s_finalize_amr_registers ()

Variables

real(wp), dimension(:), allocatable, public m_amr_registers::amr_rk_w
 The SSP-RK scheme's per-stage effective flux weights (the step is q^n + dt*sum_s amr_rk_w(s)*L(q^(s-1))) and stage-entry times in units of the step; s_amr_set_rk_table derives both from the stage coefficients.
real(wp), dimension(:), allocatable, public m_amr_registers::amr_rk_c
type(t_face_reg), dimension(3), public m_amr_registers::creg
 coarse flux at block boundary faces (relative 0-based transverse)
type(t_face_reg), dimension(3), public m_amr_registers::freg
 fine flux at covering fine faces (0-based fine transverse)
integer, parameter m_amr_registers::amr_reg_floor = 64
 Slot capacity the registers are sized for (grows geometrically; amr_max_blocks is only a cap) and the transverse extents.
integer m_amr_registers::amr_reg_cap = 0
integer, dimension(3) m_amr_registers::rc
integer, dimension(3) m_amr_registers::rf
 coarse / fine transverse extents (creg is 0:rc-1, freg is 0:rf)
integer(8) m_amr_registers::amr_reg_epoch_built = -1_8
 Mesh-epoch and block-count keys of the last s_amr_reg_prepare build.
integer m_amr_registers::amr_reg_nblk_built = -1
integer, dimension(:,:,:), allocatable m_amr_registers::bcap
 Per-slot capture tables, host-filled then GPU_UPDATE'd once. Rows: 1:2 normal-face flux indices (jlo, jhi), 3:4 transverse origins, 5:8 transverse window (t1lo, t1hi, t2lo, t2hi), 9:10 low/high face gates, 11 slot gate. Set 0 is the fine side's per-call table; sets 1:3 are the coarse per-direction tables (s_amr_coarse_tables). bmax(:, set) holds each set's caps.
integer, dimension(2, 0:3) m_amr_registers::bmax = 0
integer, dimension(:,:,:), allocatable m_amr_registers::aint
 Per-slot reflux apply tables, built with the coarse capture tables. aint rows: 1:2 outside coarse-cell index in the face dim (low, high), 3:4 transverse origins, 5:8 transverse windows, 9:10 per-face applies, 11 slot gate; areal rows 1:2 outside-cell widths. a_n/a_m hold each direction's active count and caps.
real(wp), dimension(:,:,:), allocatable m_amr_registers::areal
integer, dimension(3) m_amr_registers::a_n = 0
integer, dimension(2, 3) m_amr_registers::a_m = 0
integer(8) m_amr_registers::amr_ctab_epoch_built = -1_8
 Mesh-epoch and block-count keys of the last coarse-table build.
integer m_amr_registers::amr_ctab_nblk_built = -1

Detailed Description

Contains module m_amr_registers.

Definition in file m_amr_registers.fpp.f90.