Severity: medium · Category: correctness
Locations: src/incflo_apply_predictor.cpp:229-235, src/setup/init.cpp:484-494, src/particles/incflo_Tracers.cpp:69-87, src/utilities/io.cpp:361
Based on commit 46de3367 (line numbers refer to that tree).
The defect
InitialIterations (init.cpp:484-494) calls ApplyPredictor(true) m_initial_iterations times (default 3) and
after each call restores the state with copy_from_old_to_new_{velocity,density,tracer,temperature}(): the
iterations exist only to converge the initial pressure/gp, and the fluid state is meant to be unchanged
when Evolve starts. ApplyPredictor, however, ends with
#ifdef INCFLO_USE_PARTICLES
if (m_advection_type != "MOL") {
evolveTracerParticles(AMREX_D_DECL(GetVecOfConstPtrs(u_mac), ...)); // :233
}
#endif
unconditionally on incremental_projection. evolveTracerParticles -> incflo_PC::AdvectWithFlow moves the
particles by m_dt with the MAC velocities of that iteration, and nothing in InitialIterations moves them
back (there is no old/new copy of particle positions). With Godunov/BDS the particles are therefore advanced
m_initial_iterations pseudo-steps of m_dt = init_shrink*dt_cfl before step 1, while the fluid is not.
With MOL the particles are advected in ApplyCorrector, which the initial iterations never call, so MOL is
unaffected -- another Godunov-vs-MOL asymmetry that changes answers.
Why it matters
Every particle trajectory is offset from the flow by m_initial_iterations*m_dt (default 3 x 0.1 x dt_cfl,
larger with incflo.init_shrink closer to 1). The plt00000 written by InitData right after
InitialIterations (io.cpp:361 writes the particles into every plotfile) no longer shows the initial
particle positions, and chk00000 restarts from the displaced particles. For a tracer-particle validation
(e.g. comparing particle paths to streamlines of a Taylor-Green or Rayleigh-Taylor run) this is a systematic
phase error present from t = 0.
How to reach it
Any -DINCFLO_PARTICLES=ON build, any DIM, EB or not, with incflo.use_tracer_particles = 1,
incflo.advection_type = Godunov (default) and incflo.initial_iterations > 0 (default 3). Example:
test_no_eb_2d/benchmark.taylor_green_vortices plus incflo.use_tracer_particles = 1; compare the particle
positions in plt00000 with the seeding pattern of incflo_PCInit -- they have already moved. Setting
incflo.initial_iterations = 0 makes the displacement disappear, confirming the source.
Suggested fix
Skip the particle advection in the initial-iteration calls (incremental_projection is true only from
InitialIterations; Advance always calls ApplyPredictor() with the default false).
--- a/src/incflo_apply_predictor.cpp
+++ b/src/incflo_apply_predictor.cpp
@@ -229,7 +229,9 @@
// **************************************************************************************
// Update the particle positions
// **************************************************************************************
- if (m_advection_type != "MOL") {
+ // Not during the initial pressure iterations: the fields are reset after
+ // each of those, but particle positions would not be.
+ if (m_advection_type != "MOL" && !incremental_projection) {
evolveTracerParticles(AMREX_D_DECL(GetVecOfConstPtrs(u_mac), GetVecOfConstPtrs(v_mac),
GetVecOfConstPtrs(w_mac)));
}
(audit/notes/T3-scratch/009.diff, checked with git apply --check.)
Severity: medium · Category: correctness
Locations:
src/incflo_apply_predictor.cpp:229-235,src/setup/init.cpp:484-494,src/particles/incflo_Tracers.cpp:69-87,src/utilities/io.cpp:361Based on commit
46de3367(line numbers refer to that tree).The defect
InitialIterations(init.cpp:484-494) callsApplyPredictor(true)m_initial_iterationstimes (default 3) andafter each call restores the state with
copy_from_old_to_new_{velocity,density,tracer,temperature}(): theiterations exist only to converge the initial pressure/
gp, and the fluid state is meant to be unchangedwhen
Evolvestarts.ApplyPredictor, however, ends withunconditionally on
incremental_projection.evolveTracerParticles->incflo_PC::AdvectWithFlowmoves theparticles by
m_dtwith the MAC velocities of that iteration, and nothing inInitialIterationsmoves themback (there is no old/new copy of particle positions). With Godunov/BDS the particles are therefore advanced
m_initial_iterationspseudo-steps ofm_dt = init_shrink*dt_cflbefore step 1, while the fluid is not.With MOL the particles are advected in
ApplyCorrector, which the initial iterations never call, so MOL isunaffected -- another Godunov-vs-MOL asymmetry that changes answers.
Why it matters
Every particle trajectory is offset from the flow by
m_initial_iterations*m_dt(default 3 x 0.1 x dt_cfl,larger with
incflo.init_shrinkcloser to 1). Theplt00000written byInitDataright afterInitialIterations(io.cpp:361 writes the particles into every plotfile) no longer shows the initialparticle positions, and
chk00000restarts from the displaced particles. For a tracer-particle validation(e.g. comparing particle paths to streamlines of a Taylor-Green or Rayleigh-Taylor run) this is a systematic
phase error present from t = 0.
How to reach it
Any
-DINCFLO_PARTICLES=ONbuild, any DIM, EB or not, withincflo.use_tracer_particles = 1,incflo.advection_type = Godunov(default) andincflo.initial_iterations > 0(default 3). Example:test_no_eb_2d/benchmark.taylor_green_vorticesplusincflo.use_tracer_particles = 1; compare the particlepositions in
plt00000with the seeding pattern ofincflo_PCInit-- they have already moved. Settingincflo.initial_iterations = 0makes the displacement disappear, confirming the source.Suggested fix
Skip the particle advection in the initial-iteration calls (
incremental_projectionis true only fromInitialIterations;Advancealways callsApplyPredictor()with the defaultfalse).(
audit/notes/T3-scratch/009.diff, checked withgit apply --check.)