MFC
Exascale flow solver
Loading...
Searching...
No Matches
m_amr_nest Module Reference

Hierarchical child nesting for AMR regrid: each level's children are tagged by the density-gradient sensor on the old parent-level fine solution, clustered, and replayed in rank-invariant order. Also holds the shared tag sensor. More...

Functions/Subroutines

impure subroutine s_amr_grow_pack (sidx, skb, nloc, extra)
 Grow the pack buffers sidx/skb geometrically to hold nloc+extra entries, preserving the first nloc.
impure subroutine s_amr_pack_gwin_pairs (gwin, mlo, mhi, mg, ng, kb, sidx, skb, nloc)
 Append this rank's tagged cells of child window [mlo:mhi] as (int8 linear index, parent kb) pairs; the encode matches the s_amr_nest_window_tags decode. gwin is not modified.
impure subroutine, public s_amr_regrid_nest_children (boxes, nboxes, box_level)
 Regrid phase 3b: nest child boxes inside each level-(l-1) box for l = 2..amr_max_level (parents first) and set box_level. A child's extent is the density-gradient sensor on the old parent-level fine solution, coarsened and clustered; a new region with no fine data gets a centred inset.
impure subroutine s_amr_nest_mark_parents (boxes, plo, phi, lev, mine, covered)
 mine(kb): this rank holds a level-(lev-1) block overlapping parent kb; covered(kb): any rank does (one LOR; every block has one owner).
pure subroutine, public s_amr_nest_window (box, mlo, mhi)
 The nesting window of a parent: its box inset by amr_cpat_mar, so a child's ghost prolongation reads valid parent interior.
pure logical function f_amr_nest_window_empty (lo, hi)
 Too small to nest a child in some active dimension.
impure subroutine s_amr_nest_tag_parent (box, lev, mlo, mhi, gwin, covered)
 Pass 1 for one parent: tag its window from owned level-(lev-1) blocks (amr_block_level still holds the old levels). IB: also mark the body bbox with margin max(amr_buf, 4) + amr_cpat_mar, so the clamp to the window keeps a full image-point stencil.
impure subroutine s_amr_nest_route_pairs (powner, plo, sidx, skb, nloc, gidx, gkb, ntot)
 Route each parent's (index, kb) pairs to its clustering owner with a stable counting sort by owner. Serial: the send list is the gathered list.
impure subroutine s_amr_nest_window_tags (kb, mlo, mhi, gidx, gkb, ntot, ctags, nct)
 Pass 2 for one parent: rebuild its dense window from the routed pairs with gkb == kb (dedups replicated tags) and extract the tags in (k,j,i) order. The int8 decode matches s_amr_pack_gwin_pairs.
impure subroutine s_amr_nest_cluster_children (ctags, nct, mlo, mhi, lev, kb, mych, nmych)
 Cluster a parent's tagged cells into children, padded by amr_buf and clamped into the nesting window. IB: expand over bodies and re-clamp (the window already holds the body plus margin).
impure subroutine s_amr_nest_inset_child (box, lev, kb, mych, nmych)
 Brand-new region (no old fine data yet): a centred inset so the child still appears this regrid.
pure subroutine s_amr_nest_clamp (clo, chi, mlo, mhi, pad)
 Pad a child by pad and clamp it into the nesting window; collapsed dims are pinned to 0.
impure subroutine s_amr_nest_emit (clo, chi, lev, kb, mych, nmych)
 Tile a child to the level's slot cap, amr_maxc_fit/amr_ref_ratio**(lev-1) coarse cells, and append the tiles to this rank's list.
impure subroutine s_amr_nest_gather_children (mych, nmych, plo, phi, gch, chord, ntot)
 Assemble every rank's children (7 ints each: lo, hi, parent kb) and order them by parent kb with a stable counting sort: chord(1:ntot) indexes gch in the canonical (kb ascending, emission) order.
impure subroutine s_amr_tag_child_from_fine (ob, win_lo, win_hi, ctag, any_tag)
 Sensor-on-fine child tagging: OR the density-gradient tags of an old fine block into an L0 tag grid over a parent window. Reads the flat store on the host (caller refreshes it); one-sided differences at the fine edges avoid stale ghosts.
real(wp) function f_amr_tag_val_st (loc, ci, cj, ck)
 The tagged variable at one cell (amr_tag_var): 1 total density (sum of the continuity variables), 2 volume fraction of fluid 1, 3 velocity magnitude, 4 pressure (five-equation mixture). _st reads the flat store, _sf the level-0 field.
real(wp) function, public f_amr_tag_val_sf (q, ci, cj, ck)
real(wp) function f_amr_tag_grad_st (loc, ci, cj, ck, fm1, fm2, fm3)
 Tag indicator (jump of the amr_tag_var variable) at one cell of a block in the flat store, max over the active dimensions. The stencil is clamped to the block (fm1:fm3 = block extents) since its ghosts are stale.
pure real(wp) function, public f_amr_tag_ind (rp, r0, rm)
 Tag indicator from the tagged variable at i+1, i, i-1: central difference over 2*r_i, or with amr_tag_abs the larger absolute face jump.

Variables

logical amr_child_dropped = .false.
 Nested children were dropped for lack of block capacity (warn once per regrid).

Detailed Description

Hierarchical child nesting for AMR regrid: each level's children are tagged by the density-gradient sensor on the old parent-level fine solution, clustered, and replayed in rank-invariant order. Also holds the shared tag sensor.

Function/Subroutine Documentation

◆ f_amr_nest_window_empty()

pure logical function m_amr_nest::f_amr_nest_window_empty ( integer, dimension(3), intent(in) lo,
integer, dimension(3), intent(in) hi )
private

Too small to nest a child in some active dimension.

Definition at line 584 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ f_amr_tag_grad_st()

real(wp) function m_amr_nest::f_amr_tag_grad_st ( integer, intent(in) loc,
integer, intent(in) ci,
integer, intent(in) cj,
integer, intent(in) ck,
integer, intent(in) fm1,
integer, intent(in) fm2,
integer, intent(in) fm3 )
private

Tag indicator (jump of the amr_tag_var variable) at one cell of a block in the flat store, max over the active dimensions. The stencil is clamped to the block (fm1:fm3 = block extents) since its ghosts are stale.

Definition at line 983 of file m_amr_nest.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ f_amr_tag_ind()

pure real(wp) function, public m_amr_nest::f_amr_tag_ind ( real(wp), intent(in) rp,
real(wp), intent(in) r0,
real(wp), intent(in) rm )

Tag indicator from the tagged variable at i+1, i, i-1: central difference over 2*r_i, or with amr_tag_abs the larger absolute face jump.

Definition at line 1000 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ f_amr_tag_val_sf()

real(wp) function, public m_amr_nest::f_amr_tag_val_sf ( type(scalar_field), dimension(:), intent(in) q,
integer, intent(in) ci,
integer, intent(in) cj,
integer, intent(in) ck )

Definition at line 933 of file m_amr_nest.fpp.f90.

◆ f_amr_tag_val_st()

real(wp) function m_amr_nest::f_amr_tag_val_st ( integer, intent(in) loc,
integer, intent(in) ci,
integer, intent(in) cj,
integer, intent(in) ck )
private

The tagged variable at one cell (amr_tag_var): 1 total density (sum of the continuity variables), 2 volume fraction of fluid 1, 3 velocity magnitude, 4 pressure (five-equation mixture). _st reads the flat store, _sf the level-0 field.

Parameters
[in]locflat-store slot

Definition at line 882 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_grow_pack()

impure subroutine m_amr_nest::s_amr_grow_pack ( integer(8), dimension(:), intent(inout), allocatable sidx,
integer, dimension(:), intent(inout), allocatable skb,
integer, intent(in) nloc,
integer, intent(in) extra )
private

Grow the pack buffers sidx/skb geometrically to hold nloc+extra entries, preserving the first nloc.

Definition at line 395 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_nest_clamp()

pure subroutine m_amr_nest::s_amr_nest_clamp ( integer, dimension(3), intent(inout) clo,
integer, dimension(3), intent(inout) chi,
integer, dimension(3), intent(in) mlo,
integer, dimension(3), intent(in) mhi,
integer, intent(in) pad )
private

Pad a child by pad and clamp it into the nesting window; collapsed dims are pinned to 0.

Definition at line 751 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_nest_cluster_children()

impure subroutine m_amr_nest::s_amr_nest_cluster_children ( integer, dimension(:,:), intent(inout) ctags,
integer, intent(in) nct,
integer, dimension(3), intent(in) mlo,
integer, dimension(3), intent(in) mhi,
integer, intent(in) lev,
integer, intent(in) kb,
integer, dimension(:,:), intent(inout) mych,
integer, intent(inout) nmych )
private

Cluster a parent's tagged cells into children, padded by amr_buf and clamped into the nesting window. IB: expand over bodies and re-clamp (the window already holds the body plus margin).

Definition at line 714 of file m_amr_nest.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_nest_emit()

impure subroutine m_amr_nest::s_amr_nest_emit ( integer, dimension(3), intent(in) clo,
integer, dimension(3), intent(in) chi,
integer, intent(in) lev,
integer, intent(in) kb,
integer, dimension(:,:), intent(inout) mych,
integer, intent(inout) nmych )
private

Tile a child to the level's slot cap, amr_maxc_fit/amr_ref_ratio**(lev-1) coarse cells, and append the tiles to this rank's list.

Definition at line 762 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_nest_gather_children()

impure subroutine m_amr_nest::s_amr_nest_gather_children ( integer, dimension(:,:), intent(in) mych,
integer, intent(in) nmych,
integer, intent(in) plo,
integer, intent(in) phi,
integer, dimension(:,:), intent(out), allocatable gch,
integer, dimension(:), intent(out), allocatable chord,
integer, intent(out) ntot )
private

Assemble every rank's children (7 ints each: lo, hi, parent kb) and order them by parent kb with a stable counting sort: chord(1:ntot) indexes gch in the canonical (kb ascending, emission) order.

Definition at line 789 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_nest_inset_child()

impure subroutine m_amr_nest::s_amr_nest_inset_child ( type(t_box), intent(in) box,
integer, intent(in) lev,
integer, intent(in) kb,
integer, dimension(:,:), intent(inout) mych,
integer, intent(inout) nmych )
private

Brand-new region (no old fine data yet): a centred inset so the child still appears this regrid.

Definition at line 736 of file m_amr_nest.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_nest_mark_parents()

impure subroutine m_amr_nest::s_amr_nest_mark_parents ( type(t_box), dimension(:), intent(in) boxes,
integer, intent(in) plo,
integer, intent(in) phi,
integer, intent(in) lev,
logical, dimension(plo:), intent(out) mine,
logical, dimension(plo:), intent(out) covered )
private

mine(kb): this rank holds a level-(lev-1) block overlapping parent kb; covered(kb): any rank does (one LOR; every block has one owner).

Definition at line 546 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_nest_route_pairs()

impure subroutine m_amr_nest::s_amr_nest_route_pairs ( integer, dimension(plo:), intent(in) powner,
integer, intent(in) plo,
integer(8), dimension(:), intent(inout), allocatable sidx,
integer, dimension(:), intent(inout), allocatable skb,
integer, intent(in) nloc,
integer(8), dimension(:), intent(out), allocatable gidx,
integer, dimension(:), intent(out), allocatable gkb,
integer, intent(out) ntot )
private

Route each parent's (index, kb) pairs to its clustering owner with a stable counting sort by owner. Serial: the send list is the gathered list.

Definition at line 623 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_nest_tag_parent()

impure subroutine m_amr_nest::s_amr_nest_tag_parent ( type(t_box), intent(in) box,
integer, intent(in) lev,
integer, dimension(3), intent(in) mlo,
integer, dimension(3), intent(in) mhi,
logical, dimension(mlo(1):,mlo(2):,mlo(3):), intent(out) gwin,
logical, intent(inout) covered )
private

Pass 1 for one parent: tag its window from owned level-(lev-1) blocks (amr_block_level still holds the old levels). IB: also mark the body bbox with margin max(amr_buf, 4) + amr_cpat_mar, so the clamp to the window keeps a full image-point stencil.

Definition at line 594 of file m_amr_nest.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_nest_window()

pure subroutine, public m_amr_nest::s_amr_nest_window ( type(t_box), intent(in) box,
integer, dimension(3), intent(out) mlo,
integer, dimension(3), intent(out) mhi )

The nesting window of a parent: its box inset by amr_cpat_mar, so a child's ghost prolongation reads valid parent interior.

Definition at line 574 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_nest_window_tags()

impure subroutine m_amr_nest::s_amr_nest_window_tags ( integer, intent(in) kb,
integer, dimension(3), intent(in) mlo,
integer, dimension(3), intent(in) mhi,
integer(8), dimension(:), intent(in) gidx,
integer, dimension(:), intent(in) gkb,
integer, intent(in) ntot,
integer, dimension(:,:), intent(out), allocatable ctags,
integer, intent(out) nct )
private

Pass 2 for one parent: rebuild its dense window from the routed pairs with gkb == kb (dedups replicated tags) and extract the tags in (k,j,i) order. The int8 decode matches s_amr_pack_gwin_pairs.

Definition at line 680 of file m_amr_nest.fpp.f90.

Here is the caller graph for this function:

◆ s_amr_pack_gwin_pairs()

impure subroutine m_amr_nest::s_amr_pack_gwin_pairs ( logical, dimension(mlo(1):,mlo(2):,mlo(3):), intent(in) gwin,
integer, dimension(3), intent(in) mlo,
integer, dimension(3), intent(in) mhi,
integer, intent(in) mg,
integer, intent(in) ng,
integer, intent(in) kb,
integer(8), dimension(:), intent(inout), allocatable sidx,
integer, dimension(:), intent(inout), allocatable skb,
integer, intent(inout) nloc )
private

Append this rank's tagged cells of child window [mlo:mhi] as (int8 linear index, parent kb) pairs; the encode matches the s_amr_nest_window_tags decode. gwin is not modified.

Definition at line 420 of file m_amr_nest.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ s_amr_regrid_nest_children()

impure subroutine, public m_amr_nest::s_amr_regrid_nest_children ( type(t_box), dimension(:), intent(inout), allocatable boxes,
integer, intent(inout) nboxes,
integer, dimension(:), intent(inout) box_level )

Regrid phase 3b: nest child boxes inside each level-(l-1) box for l = 2..amr_max_level (parents first) and set box_level. A child's extent is the density-gradient sensor on the old parent-level fine solution, coarsened and clustered; a new region with no fine data gets a centred inset.

Per level: pass 1 tags each parent's window from owned old blocks and packs (index, kb) pairs; an alltoall routes them to the parent's round-robin owner; pass 2 rebuilds the window and clusters it into children; an allgatherv plus a stable sort by kb replays the children in serial order, so the list and its truncation are rank-invariant. IB nesting is np=1 only.

Definition at line 450 of file m_amr_nest.fpp.f90.

Here is the call graph for this function:

◆ s_amr_tag_child_from_fine()

impure subroutine m_amr_nest::s_amr_tag_child_from_fine ( integer, intent(in) ob,
integer, dimension(3), intent(in) win_lo,
integer, dimension(3), intent(in) win_hi,
logical, dimension(win_lo(1):,win_lo(2):,win_lo(3):), intent(inout) ctag,
logical, intent(inout) any_tag )
private

Sensor-on-fine child tagging: OR the density-gradient tags of an old fine block into an L0 tag grid over a parent window. Reads the flat store on the host (caller refreshes it); one-sided differences at the fine edges avoid stale ghosts.

Definition at line 837 of file m_amr_nest.fpp.f90.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ amr_child_dropped

logical m_amr_nest::amr_child_dropped = .false.
private

Nested children were dropped for lack of block capacity (warn once per regrid).

Definition at line 390 of file m_amr_nest.fpp.f90.