Skip to content

Fix issues #233-#239 - #265

Merged
WeiqunZhang merged 7 commits into
AMReX-Fluids:developmentfrom
asalmgren:fix-issues-233-239
Sep 21, 2026
Merged

WeiqunZhang merged 7 commits into
AMReX-Fluids:developmentfrom
asalmgren:fix-issues-233-239

Conversation

@asalmgren

Copy link
Copy Markdown
Contributor

Fixes #233, #234, #235, #236, #237, #238, #239.

What's in here

Issue File Change
#233 src/convection/incflo_compute_MAC_projected_velocities.cpp The direction_dependent inflow tests read a zeroed scratch MultiFab, whose ghost cells hold the interior copy (0) on the outflow part of an in/out face. The non-strict >=/<= tests treated that as zero inflow and overwrote the extrapolated outflow face velocity with 0, after which Hydro aborts with "no outflow from the direction dependent boundaries". Tests made strict.
#234 src/prob/prob_bc.H The Burggraf (probtype 16) lid profile 16x²(1-x)² is the tangential velocity u on the high-y wall, not the normal velocity v. The PR #122 refactor assigned it to norm_vel, so benchmark.burggraf ran a uniform-speed lid with a spurious normal velocity through it. Pre-#122 behaviour restored.
#235 src/prob/prob_init_fluid.cpp probtype 43 shared probtype 42's zero initial velocity, so the outflow part of its direction_dependent x faces started at 0 and InitialProjection's in/out solvability check saw no outflux. probtype 43 now starts from the zero-net-flux profile u = 6y(1-y)-1 that IncfloVelFill imposes on those faces.
#236 src/incflo_compute_dt.cpp The explicit-diffusion limit used the constant m_mu, ignoring the strain-rate dependent viscosity and the tracer/temperature diffusivities, which are advanced explicitly by the same m_diff_type switch. The effective diffusivity is now built per cell from compute_viscosity_at_level, max_n mu_s[n] and mu_T/cp, divided by rho, with covered cells zeroed.
#237 src/incflo_regrid.cpp, src/incflo.cpp particleData.Redistribute() inside RemakeLevel/MakeNewLevelFromCoarse runs before AmrCore::regrid installs the new BoxArrays, DistributionMappings and finest_level, so it redistributed against the old layout and the first step after a regrid indexed u_mac with stale grid indices. Now redistributes once after regrid() returns.
#238 src/incflo_apply_predictor.cpp ApplyPredictor advected the tracer particles during InitialIterations. The fields are restored after each initial iteration but the particle positions are not, so particles started the run m_initial_iterations*dt ahead of the fluid. Skipped when incremental_projection is set.
#239 src/prob/prob_bc.H IncfloDenFill/IncfloTracFill/IncfloTempFill never wrote the outflow part of a direction_dependent face (filcc has no case for that BC type and the functors were inflow-only), and decided inflow/outflow from the raw input velocity rather than the probtype profile IncfloVelFill uses. The prescribed normal velocity is factored into incflo_bc_normal_velocity(), used by all four functors, and the scalar functors gained the same "outflow: copy the first interior cell" branch IncfloVelFill has.

Verification

Baseline below is pristine ab031bed; both built DOUBLE/optimized. All five build configurations (2D/3D × EB/no-EB, plus USE_PARTICLES=TRUE) compile with no new diagnostics.

#233 + #235 — benchmark.inout: baseline aborts "Cannot enforce solvability, no outflow from the direction dependent boundaries"; with these fixes it runs all 10 steps in both 2D and 3D.

#234 — Burggraf u error at steady state (stop_time=20):

N baseline Norm0 fixed Norm0 fixed Norm2
16 1.55 1.042e-2 3.580e-3
32 1.02 3.258e-3 9.529e-4
64 — 9.140e-4 2.407e-4

Second order (Norm2 orders 1.91, 1.98) where the baseline error was O(1) and non-convergent. 3D at N=16 agrees: 0.428 → 0.0102.

#236 — Bingham (mu=1, tau_0=1, papa_reg=1e-3) with diffusion_type=0: baseline dt = 4.883e-5, fixed dt = 4.878e-8 — a factor of 1001, exactly eta(sr→0)/mu.

#237 — rayleigh_taylor with amr.max_level=2 amr.regrid_int=2 and tracer particles: baseline segfaults (exit 11) on the step after the first regrid; fixed runs 12 steps through 5 regrids.

#238 — plt00000 particle data with initial_iterations 0 vs 3 (Godunov): baseline differs, fixed is identical.

No regressions — plt files bit-identical to baseline (fcompare) on 24 benchmarks: 5 in test_no_eb_2d, 5 in test_2d, 9 in test_no_eb_3d, 10 in test_3d — including every 3D-only probtype routed through the new helper (311, 32, 322, 33, 333, 1102, 41, 42).

Pre-existing issues noticed while testing (not addressed here)

  1. init_burggraf (prob_init_fluid.cpp) uses x = (i+0.5)*dx - 0.5, i.e. a domain shifted to [-0.5, 0.5], while DiffFromExact and the probtype-16 forcing use x = (i+0.5)*dx. The IC is not the exact solution it is meant to be.
  2. benchmark.burggraf sets stop_time = 5, which does not reach steady state — the 32² error is 0.040 at t=5 versus 0.0033 at t≥15. test_convergence_burggraf therefore measures a transient and needs stop_time ≈ 15-20 to show the convergence above.
  3. benchmark.inout's fixed_dt = 0.01 exceeds the CFL limit by ~7× with the corrected IC (the warning is printed; the run is stable since the problem is inviscid).
  4. test_no_eb_3d/benchmark.burggraf sets a 2-component amr.n_cell, so it aborts in 3D before doing anything; at 32×32×8 the nodal MLMG then fails identically in baseline and with these fixes.
  5. In single precision (PRECISION = FLOAT) MLMG cannot reach its default rtol, so most benchmarks abort with "Failed to converge" regardless of this branch — e.g. untouched benchmark.double_shear_layer stalls at resid/bnorm = 1.65e-6.

🤖 Generated with Claude Code

asalmgren and others added 7 commits May 18, 2026 09:38
AMReX-Fluids#233 compute_MAC_projected_velocities: the direction_dependent inflow tests
read a zeroed scratch MultiFab, whose ghost cells hold the interior copy (0)
on the outflow part of an in/out face. The non-strict >= / <= tests therefore
treated that as zero inflow and overwrote the extrapolated outflow face
velocity with 0, after which Hydro aborts with "no outflow from the direction
dependent boundaries". Make the tests strict.

AMReX-Fluids#234 IncfloVelFill: the Burggraf (probtype 16) lid profile 16 x^2 (1-x)^2 is
the tangential velocity u on the high-y wall, not the normal velocity v. The
PR AMReX-Fluids#122 refactor assigned it to norm_vel, so benchmark.burggraf ran a
uniform-speed lid with a spurious normal velocity through it. Restore the
pre-AMReX-Fluids#122 behaviour.

AMReX-Fluids#235 init_plane_poiseuille: probtype 43 shared probtype 42's zero initial
velocity, so the outflow part of its direction_dependent x faces started at 0
and InitialProjection's in/out solvability check saw no outflux. Give
probtype 43 the zero-net-flux profile u = 6y(1-y)-1 that IncfloVelFill imposes
on those faces.

AMReX-Fluids#236 ComputeDt: the explicit-diffusion limit used the constant m_mu, ignoring
the strain-rate dependent viscosity and the tracer/temperature diffusivities,
which are advanced explicitly by the same m_diff_type switch. Build the
effective diffusivity per cell from compute_viscosity_at_level, max_n mu_s[n]
and mu_T/cp, divide by rho, and take its max.

AMReX-Fluids#237 particleData.Redistribute() inside RemakeLevel / MakeNewLevelFromCoarse
runs before AmrCore::regrid installs the new BoxArrays, DistributionMappings
and finest_level, so it redistributes against the old layout and the first
step after a regrid indexes u_mac with stale grid indices. Redistribute once
after regrid() returns instead.

AMReX-Fluids#238 ApplyPredictor advected the tracer particles during InitialIterations.
The fields are restored after each initial iteration but the particle
positions are not, so the particles started the run m_initial_iterations*dt
ahead of the fluid. Skip the advection when incremental_projection is set.

AMReX-Fluids#239 IncfloDenFill / IncfloTracFill / IncfloTempFill never wrote the outflow
part of a direction_dependent face (filcc has no case for that BC type and
the functors were inflow-only), and decided inflow/outflow from the raw input
velocity rather than the probtype profile that IncfloVelFill uses. Factor the
prescribed normal velocity into incflo_bc_normal_velocity(), use it in all
four functors, and give the scalar functors the same "outflow: copy the first
interior cell" branch IncfloVelFill has.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@WeiqunZhang
WeiqunZhang merged commit 80d8436 into AMReX-Fluids:development Sep 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants