From d3987ddc9c402e490c1223a79c87e47c9cddb5e1 Mon Sep 17 00:00:00 2001 From: Liwei Ji Date: Wed, 11 Mar 2026 21:18:32 -0400 Subject: [PATCH] Particles: call Redistribute() once per patch instead of once per level Move the Redistribute() call out of PushAndDeposeParticles() and into the test thorns' patch loops, so it runs once after all levels are processed rather than redundantly for each level. Closes #34 --- Particles/src/NuParticleContainers.cxx | 3 --- TestNuParticles/src/testnuparticles.cxx | 1 + TestNuPcsArdBH/src/testnupcsardbh.cxx | 1 + 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Particles/src/NuParticleContainers.cxx b/Particles/src/NuParticleContainers.cxx index 33156ea..6ffd98d 100644 --- a/Particles/src/NuParticleContainers.cxx +++ b/Particles/src/NuParticleContainers.cxx @@ -155,9 +155,6 @@ void NuParticleContainer::PushAndDeposeParticles(const amrex::MultiFab &lapse, ptd.rdata(PIdx::time)[i] += dt; }); } - - // tidy after the full step - this->Redistribute(); } void NuParticleContainer::OutputParticlesAscii(const cGH *cctkGH) { diff --git a/TestNuParticles/src/testnuparticles.cxx b/TestNuParticles/src/testnuparticles.cxx index 6a6204f..fcd2cfa 100644 --- a/TestNuParticles/src/testnuparticles.cxx +++ b/TestNuParticles/src/testnuparticles.cxx @@ -246,6 +246,7 @@ extern "C" void TestNuParticles_PushAndDeposeParticles(CCTK_ARGUMENTS) { pc->PushAndDeposeParticles(lapse, shift, met3d, dt, lev); } + pc->Redistribute(); } // for patch // IO diff --git a/TestNuPcsArdBH/src/testnupcsardbh.cxx b/TestNuPcsArdBH/src/testnupcsardbh.cxx index 41bd324..f3d1ee4 100644 --- a/TestNuPcsArdBH/src/testnupcsardbh.cxx +++ b/TestNuPcsArdBH/src/testnupcsardbh.cxx @@ -109,6 +109,7 @@ extern "C" void TestNuPcsArdBH_PushAndDeposeParticles(CCTK_ARGUMENTS) { pc->PushAndDeposeParticles(lapse, shift, met3d, dt, lev); } + pc->Redistribute(); } // for patch // IO