Skip to content

Commit

Permalink
Solve an issue with particles async IO when having runtime added vari…
Browse files Browse the repository at this point in the history
…ables (AMReX-Codes#2966)
  • Loading branch information
rporcu authored Sep 29, 2022
1 parent cd07b0d commit d65e09e
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion Src/Particle/AMReX_WriteBinaryParticleData.H
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,25 @@ void WriteBinaryParticleDataAsync (PC const& pc,
if (np_per_grid_local[lev][mfi.index()] > 0)
{
const auto& ptile = pc.ParticlesAt(lev, mfi);
new_ptile.resize(np_per_grid_local[lev][mfi.index()]);

const auto np = np_per_grid_local[lev][mfi.index()];

new_ptile.resize(np);

const auto runtime_real_comps = ptile.NumRuntimeRealComps();
const auto runtime_int_comps = ptile.NumRuntimeIntComps();

constexpr auto NReal = NArrayReal + NStructReal;
constexpr auto NInt = NArrayInt + NStructInt;

new_ptile.define(runtime_real_comps, runtime_int_comps);

for (auto comp(0); comp < runtime_real_comps; ++comp)
new_ptile.push_back_real(NReal+comp, np, 0.);

for (auto comp(0); comp < runtime_int_comps; ++comp)
new_ptile.push_back_int(NInt+comp, np, 0);

amrex::filterParticles(new_ptile, ptile, KeepValidFilter());
}
}
Expand Down

0 comments on commit d65e09e

Please sign in to comment.