Repository navigation
AMR follow-up: STL regrid and motion, controllers with an IB, fine T_cond restart, chemistry IB wall, subcycling with bubbles, IGR, moving bodies, any depth and ratio 4, particles - #2539
Conversation
…inner runs Every other test forwards the arguments after the test command's "--" (e.g. -c <computer>) to ./mfc.sh run; run_amr_check did not, so inside a batch job the amr_check inner runs used the default template and failed. 11 of the 13 amr_check tests now pass inside a Frontier job (none did); the two chemistry ones still need their case-specific build, which a Frontier compute node cannot make.
…#2240) s_amr_body_bbox bounds an STL body (geometries 5, 12) by the model's rotated box, from the new s_get_ib_aabb that s_get_bounding_indices now shares, so regrid keeps the blocks containing the body. The STL models and the body orientations are set up before the initial blocks are placed, which read that box. Against a uniform 128^2 run over the body (coarse cells 24..39), 20 steps: a static Circle_IBM.stl body under regrid every 2 steps differs by 3.9e-12 (the analytic circle: 3.8e-12); the same body translating at 0.5 differs by 2.4e-3 (the analytic circle: 5.7e-3, the moving-body difference documented for ib_mass_relax). On the PR head both runs are rejected, and s_amr_body_bbox aborted for STL.
…lowCode#2231) The fine body-force hook zeroed mean_dpdx/mean_mflux and mean_qdot/ mean_temp in solid cells by the coarse ib_markers read at block indices. It now loads the block's own markers (ib_markers_fine) and s_compute_body_forces_rhs takes the frame's markers, so the ib exclusion for both controllers is lifted. amr_check against the uniform fine grid, static circle on a periodic block (block core): mean_dpdx(1) = -5 differs by 2.5e-3 on the PR head and 8.9e-9 now (the same case without the source: 8.9e-9 next to the body); chemistry diffusion with mean_qdot = 1e11: 1.7 before, 2.0e-12 now.
The 1.3 at the block edge of the chemistry-diffusion IB amr_check is y-momentum, 8e-5 kg/(m^2 s) after one step, on the edge cells over the H2/air jump. It is the same without the body and follows the jump when it is moved along the edge (x = L/2 to 0.4 L); a smaller body, ten coarse cells off the edge, gives the same 8e-5. The coarse grid alone has none there. With the body its flow sets the y-momentum scale to 3e-4, hence 1.3; without it the scale is 1 and the edge reports the x-momentum 5.6e-3. The cells one in match the uniform grid to 2e-11.
With chemistry the isothermal wall (thermal_bc = 1) sets only the ghost state and its T_cond, which each fine block now takes from its own ghosts (s_ibm_fine_conduction_temperature), so the validator allows it. The reacting surface (its wall sources are coarse-grid state), the lumped and energy-balance walls, and the initial thermal layer stay rejected. amr_check against the uniform fine grid, H2/air diffusion past the static circle (block core): Twall = 400 K inert, 3.2e-11; Twall = 1200 K with the gas reactions on, 5.7e-12. Rejected on the PR head.
The ib_tcond restart file held only the coarse ghosts, so a restarted AMR run with chemistry diffusion and a body started the fine ghosts without their T_cond. Each level now writes its own file (ib_tcond_<step>_L<lev>.dat, the same format keyed by the level's global cell index) from the ghosts parked in gp_park, and the restart reads it back after s_amr_setup_ib. The writer and reader are split so the coarse and fine files share them. Restart roundtrip of a 4-step H2/air diffusion case past a static isothermal circle (Twall = 400 K) on a static block: on the PR head the restarted run differs from the straight run by 1.25 absolute (6.8e-2 relative) in the conserved fields; now it matches within the test tolerance.
The cloud advances with level 0's stages before s_amr_subcycle_fine runs; the fine RHS skips the EL hooks (.not. amr_in_fine_advance) and the per-stage overlap check and the regrid clipping keep the blocks clear of the cloud, so the subcycled fine substeps never read or write the bubbles. The ordering is correct as is: lift the rejection. Check (2D two-way bubble case, a pressure patch inside a static block): subcycled against lock-step, the bubble history and every cell away from the block are bit-identical; inside the block they differ by 9e-8 (lock-step against the no-block run: 3e-5).
) s_amr_subcycle_level took two substeps per parent step with literal 0.5 factors. It now takes amr_ref_ratio substeps of dt/ratio, with fractions 1/ratio; at ratio 2 every factor is the same power of two, so the two-level results are bit-identical (the existing subcycled goldens regenerate unchanged). Level >= 2 blocks already blend their parent's substep-start backup (amr_stor_st) per block, so depth needs nothing more. Lift the ratio and depth rejections; amr_prolong = 2 stays ratio 2. Checks: three-level subcycled Sod conserves mass and energy as lock-step does (-9.1e-13, -1.3e-12; the same boundary loss); ratio 4, two levels, static and dynamic: 3e-16 and 0. A smooth periodic density wave: subcycled minus lock-step is 6.5e-7 (three levels, ratio 2) and 3.5e-8 (ratio 4) and halves with dt; mass and energy stay within 4e-16.
Under subcycling the coarse step moves the bodies to the step-end pose before the fine substeps, which never rebuilt their IB data. Each fine stage now sets the bodies to the pose of its own time (s_amr_ib_pose: the kinematics for kin_model > 0, else the blend of the step-start and step-end poses), and after the stage sets the pose of the state it produced and runs the rebuild and correction the stage left waiting (s_amr_fine_stage_ib). The end pose is restored exactly. Force-driven bodies stay rejected: their force needs the fine faces at the coarse stage. Check (translating circle, static 2:1 block, 20 steps): subcycled against a uniform 128^2 run at the fine dt: 1.9e-10 near the body, 8.8e-9 over the block; lock-step against 128^2 at its dt: 4.7e-12 and 4.3e-9.
The fine sigma seed read the coarse sigma left by level 0's last stage (stage time 1/2 for RK3) at every substep. Keep the coarse sigma solved at stage times 0 and 1 (stages 1 and 2) and blend it to each fine stage's time before its seed; restore the step-end sigma after the substeps (the coarse warm start). IGR has no flux registers, so the coupling stays restriction-only. Check (2D IGR case, static block, single rank): block core against the uniform fine grid, density 9.5e-6 subcycled (fine dt) and 1.1e-5 lock-step; the coupling's truncation error dominates both.
- m_rhs: the particle dynamics, the two-way source and s_compute_particle_gradients run on the coarse grid only (.not. amr_in_fine_advance), as the bubble hooks do. - s_lag_particle_bbox_local, and s_amr_lag_bbox_local picking the bubble or particle cloud; the regrid clipping (s_amr_compute_lag_supp), the per-stage overlap check (s_amr_check_lag_clear) and the coarse-halo hoist exclusion now key on euler_lagrange. The mapCells + 2 pad covers the particle kernel (1 cell), interpolation (<= 3) and gradient stencils. The alpha closure is kept: the particles' fluid alphas sum to one. - Vet particles_lagrange and particle_params%*; this lifts the specific rejection added in 9ac1124. Checks (2D, a static block across the y = 0.8 jump, clear of the particles): one-way and two-way against the no-block run: 3e-11 away from the block, particle histories within 1e-16; np = 2 runs (no stall) and matches np = 1 to 1e-14; a block over the particles aborts with the overlap message.
|
Claude Code Review Head SHA: 5ade0b8 No review was produced. Claude ran but wrote no review (Claude step: failure). Run and transcript: https://github.com/MFlowCode/MFC/actions/runs/46091352093 |
|
Claude Code Review Head SHA: 5ade0b8 No review was produced. Claude ran but wrote no review (Claude step: failure). Run and transcript: https://github.com/MFlowCode/MFC/actions/runs/46091358107 |
…bsteps Under amr_subcycle the reports ran before s_amr_subcycle_fine, so the substeps' counts landed a step late and the last step's were lost.
The static builder insets each level in its parent without looking at the bodies, so from level 3 on a body could straddle a level boundary with no abort. Master rejected static amr_max_level > 2 outright; keep that rejection when ib = T.
The static builder aborts unless amr_max_blocks >= level-1 block count + amr_max_level - 1; the validator checked only amr_max_blocks >= 2. With at least one level-1 block, require amr_max_blocks >= amr_max_level.
Operator-split reaction and burn substeps now run on each block, STL bodies are allowed on static blocks, and the isothermal wall is allowed without chemistry; multi-level needs amr_max_blocks >= amr_max_level.
A pointer to the current frame's markers (ib_markers, or ib_markers_fine in the fine advance) replaces the six if/else pairs that repeated each call with only the marker field changed. The callee still receives the module variable itself, so device presence is unchanged.
The coarse set, coarse restore and fine-frame paths were three copies of the same ghost loop; s_ibm_conduction_temperature(q_T_sf, set) holds the coarse and fine forms. The fine path keeps one kernel per batch member.
With chemistry and burn substeps, s_amr_split_fine swapped every block in and out twice. Both are cell-local, so one pass per block runs both.
The fine RHS and the fine reaction substep write their temperatures into q_T_sf at block-frame indices, so level-0 cells (inside and outside the blocks) took the next conversion and split guesses from unrelated fine cells. Save and restore q_T_sf around the fine stage, the subcycled advance and the fine split. In a reactive shock tube with a static block on the front this moves minor species by up to 1e-7 relative (Newton tolerance level); flow variables agree to 4e-13.
…arse boundary fill s_get_capillary filled the ghost layer of the colour-function gradient with s_populate_capillary_buffers, which on a fine frame applies the coarse grid's physical or MPI boundary at the block faces (at np = 1 with periodic bc, a copy across the slab). On fine frames the gradient is now computed one layer into the block's own ghost primitives and the boundary fill is skipped; the coarse path is unchanged.
The capillary stress and work ride on flux_src_rsx_vf (mom..E), which the registers captured only if viscous, so an inviscid surface-tension run was not refluxed at coarse/fine faces.
The colour function's rhs pairs its advective flux with c*(u_r - u_l)/dx, as a volume fraction does, but only the flux was refluxed, so c drifted in the coarse cells along a block face (to 0.95 inside a droplet) and the spurious colour gradient drove currents there. eqn_idx%c joins the face-velocity corrected equations with coefficient c.
Vets surface_tension under AMR with amr_max_level = 1 (static or regridded blocks, lock-step or subcycled, multi-rank); multi-level stays rejected. Tests: a static capillary droplet whose block cuts the interface (one and two ranks, regrid, amr_subcycle) and an amr_check of a square drop.
The compact face-normal gradient is already the default with weno_Re_flux, and fine frames difference across the face with the block's own spacing. An explicit T was rejected only because the flag was missing from the vetted list.
grcbc_in, grcbc_out and grcbc_vel_out only change the characteristic BC's L, which s_cbc applies on the coarse grid at the domain boundary; fine frames return before it. Golden: a 1D static block with a GRCBC inflow and outflow.
post_process reads level 0 with the fine solution restricted into it, as for its other derived outputs. The volume and total energy sums equal the composite ones, since the restriction conserves them; the kinetic and internal energies are level-0 values.
The coarse stages move a two-way body on their own faces; the fine substeps then collect their faces' impulse (substep dt times the stage weight) less the covered coarse faces', and after the substeps that difference corrects the body's step-end velocity and pose, as the reflux does for the fluid. Each fine stage sets the pose at its own time, as for prescribed motion. The validator no longer rejects moving_ibm = 2 with amr_subcycle.
The fine blocks' thermally developed source reads each member's own temperatures, copied from the batch slab at its offset with the primitive state, and the viscous-dissipation removal in the fine RHS uses the block's markers. The source arrays are sized for the fine frames. The coarse source already reads the level-0 temperatures after the fine stage: mean_temp_wall requires chemistry, whose fine passes save and restore them. The validator no longer rejects mean_temp_wall with amr. The thermal channel example gains a --body option (an isothermal square) for the AMR tests.
Without ib_flux_wall (still rejected under AMR, MFlowCode#2230) a reacting wall is ghost state only: each ghost point solves the surface balance from its image point and sets its ghost state and T_cond, which the per-block swap and gp_park already carry. ib_wall_src is read only under ib_flux_wall, so it needs no per-block storage. Lift the surface_reaction gate; thermal_bc = 2, 3 and thermal_layer stay rejected. The surface report says its counts cover all AMR levels. run_amr_check put a second "--" before the test command's run arguments when a case had its own (-j 4), which hid -c <computer> from the inner runs: the chemistry amr_checks failed inside a batch job for that reason. Checks (MI250X, amdflang OpenMP offload): - amr_check, the 2D_ibm_reacting_surface wall (1200 K, gas reactions) in a closed box with the body in the block core: 9.8e-11 (inert wall 9.8e-11); before: rejected. - 200 steps, block vs no block against the uniform 2x grid: CO the wall produced 1.1e-5 off (coarse 1.2), gas mass and energy within 2R of the body 3.4e-6 and 1.6e-6 (coarse 2.4e-4 and 1.2e-3).
The bubble variables are ordinary conserved variables, the bubble source and the divergence it reads are cell-local on the block's own grid, and the adv_n closure already runs per block (m_stage_hooks). Two seams remain: s_compute_ptilde wrote the level-0 probe field ptil from the fine frames (now skipped there), and adap_dt advances the bubble ODE on level 0 only (rejected under AMR). Allowed: one fluid, polytropic, with adv_n or polydisperse; rejected: adap_dt, QBMM (an AMR run segfaults at start-up), non-polytropic, num_fluids > 1, amr_prolong = 2 and immersed bodies. The shared bubble test parameters move to BUBBLE_EE_MODS (the existing cases' parameters are unchanged). Checks (MI250X, amdflang OpenMP offload), before: rejected: - amr_check, block core against the uniform 2x grid after one step: 1D 1.3e-11, adv_n 1.3e-11, polydisperse (nb = 3) 1.8e-11, RK2 1.3e-11, 2D (block split in four members) 1.3e-11. - Evolving cloud, no acoustic source: 2D bubbly liquid (4 % void) with a square at twice the pressure inside the block, L1 error against the uniform 2x grid inside the block, block over coarse: at t = 1, 0.13 for density, energy, void fraction and nR, 1.13 for momentum, 0.99 for nV; at t = 2 and 3, 0.34 to 0.61 for every variable.
…walls are now tested The suite lint requires every AMR-vetted flag to be set by an AMR test: adv_n and polydisperse were covered only by amr_check convergence cases, so a static- block golden of each joins the existing bubbles_euler one. The mean_temp_wall tests set bc_[xyz]%isothermal_*, so it leaves AMR_UNTESTED_FLAGS.
# Conflicts: # toolchain/mfc/case_validator.py
Lines of Code
|
NVHPC 25.5 and 25.11 on a V100 differ from the amdflang MI250X goldens by up to 2.5e-10 (DCA29D70, through the regrids) and 1.3e-10 (5EF5DE01), past the 1e-10 bubble default; 1e-9 keeps a 4x margin.
…ance override_tol = 1e-9 dropped their single comparison to the 1e-4 floor (it was 1e-2, the bubble default scaled for single); a --single run differs from the double golden by 5.5e-4.
|
CI fix (2ceafb7): single-precision tolerance for the static-block bubble goldens In the GNU no-debug ( These three static-block tests now use (Posted with Claude Code.) |
…ized dx allocation
|
CI fix (856483b): GRCBC relaxation length under AMR 4B973840 ( Cause. Fix. The reduction now runs over the grid's own range, Checks (Frontier):
The golden is unchanged, and the precheck passes. (Posted with Claude Code.) |
Contribution Policy
All contributions are expected to demonstrate:
If these expectations are not met, we would prefer to implement the changes ourselves rather than spend time reviewing low-effort submissions.
Follow-up to #2536.
Closes #2240, closes #2232, closes #2255, closes #2244, closes #2225, closes #2231, closes #2226, closes #2233, closes #2266.
Where the remainders live. #2543 to #2554 hold the follow-up work, with #2227, #2228, #2229 and #2230 already open. QBMM (#2235) stays open: it segfaults at start-up under AMR on GPU.
Draft until the final GPU, Cray and NVIDIA runs on this head pass.
Added since opening:
m_rhs, and one routine now sets and restores the IB conduction temperature.viscouswas off.amr_checkmatches to about 1e-13, and two ranks are bit-identical to one.amr_subcycle(AMR: moving immersed bodies with amr_max_level > 1 or with amr_subcycle #2225). The fine substeps' face impulses replace the covered coarse faces' in the body's step impulse, as the reflux does for the fluid. Two-way cylinder against uniform 128²: velocity error 6.1e-4 subcycled; lock-step's own dt against dt/2 is 8.5e-4; uniform 64² is 2.5e-2. Tests F04F413E and 4DCA0CC4 (np = 2).mean_temp_wall(AMR: bulk-flow controllers (mean_dpdx / mean_mflux, mean_qdot / mean_temp) average the coarse grid only #2231). Each block's temperatures and markers reach the fine body-force hook and the dissipation removal. Thermal channel with a block and with an isothermal body: block interior within 2e-6 (lock-step) and 2.4e-6 (subcycled) of uniform 96², against 3e-5 to 0.86 for uniform 48². Tests 17E3181C and 729A5D7A.surface_reaction(AMR: validate IB thermal walls (thermal_bc = 1, 2) and surface reactions (surface_reaction, thermal_layer) #2226).surface_reactionwithoutib_flux_wallis ghost-point state only, which the per-block ghost parking already carries. amr_check of a 1200 K reacting wall: 9.8e-11. Over 200 steps the block brings the CO produced at the wall from 120 % error (coarse) to 1.1e-5. Tests A7851281 and 6302A303.adv_norpolydisperse; not withadap_dt, QBMM, immersed bodies oramr_prolong = 2.s_compute_ptildeis skipped on fine frames. amr_check: 1.3e-11 to 1.8e-11 in 1D, 1Dadv_n, 1D polydisperse, RK2 and 2D. In an evolving bubbly cloud the block's L1 error is 0.13 to 0.61 of the coarse run's, except momentum and nV at early time. Tests DEE4D382, BD5899D9, 4446A089, 59D50C59, 5EF5DE01 and DCA29D70.weno_Re_flux_compact = Texplicitly (amr_check 2.0e-10, D6FDFC47). The GRCBC switches (4B973840).sim_data(post_process reads level 0 with the fine data folded in).--in front of the test command's, which hid-c <computer>from the inner runs. That, not a missing case build, is why the chemistry amr_checks failed inside a batch job. With the fix, every amr_check passes inside a Frontier job.The full verification runs once those are in.
What is in it
s_get_ib_aabbgives an STL body's rotated box fors_amr_body_bbox. Fixes a segfault: the initial blocks were placed before the STL models were loaded.mean_dpdx2.5e-3 → 8.9e-9;mean_qdotwith chemistry 1.7 → 2.0e-12T_condT_cond.amr_subcyclewith Lagrangian bubblesamr_ref_ratio = 4amr_ref_ratiosubsteps with 1/ratio fractions in the recursive driver.amr_subcyclewith prescribed motionamr_subcyclewith IGR (single rank)run_amr_checkpasses the test command's run arguments (-c <computer>) to its inner runs.Still rejected
surface_reaction;thermal_bc = 2and3, andthermal_layer;mean_temp_wall: it needs its own temperature scratch space in the fine RHS;amr_prolong = 2at ratio 4.1. Does it solve the problem?
See the check column above: each item compares against a uniform fine grid, a no-block run, a lock-step run or an exact invariant.
2. Does it create another one?
--gpu mpand CCE--gpu acc/--gpu mpon each half; the combined branch is pending3. Is it slower?
Pending: benchmarked on an MI250X against master once the branch is final.
Made with Claude Code.