Skip to content

Commit

Permalink
Merge pull request #31 from atmyers/fix_increment_call
Browse files Browse the repository at this point in the history
Call redistribute before calling increment.
  • Loading branch information
asalmgren authored Sep 18, 2023
2 parents b0ea9a7 + d8607a4 commit aabb8e4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
1 change: 1 addition & 0 deletions Source/IO/Plotfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ ROMSX::WritePlotFile (int which, Vector<std::string> plot_var_names)
{
MultiFab temp_dat(mf[lev].boxArray(), mf[lev].DistributionMap(), 1, 0);
temp_dat.setVal(0);
tracer_particles->Redistribute();
tracer_particles->Increment(temp_dat, lev);
MultiFab::Copy(mf[lev], temp_dat, 0, mf_comp, 1, 0);
mf_comp += 1;
Expand Down
2 changes: 0 additions & 2 deletions Source/Particles/TerrainFittedPC.H
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ public:

void AdvectWithUmac (amrex::MultiFab* umac, int level, amrex::Real dt,
const amrex::MultiFab& a_z_height);

void Increment (amrex::MultiFab& mf, int level);
};

#endif
27 changes: 0 additions & 27 deletions Source/Particles/TerrainFittedPC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,30 +199,3 @@ TerrainFittedPC::AdvectWithUmac (MultiFab* umac, int lev, Real dt, const MultiFa
#endif
}
}

/*
/brief Uses midpoint method to advance particles using umac.
*/
void
TerrainFittedPC::Increment (MultiFab& mf, int lev)
{
AMREX_ASSERT(OK());
AMREX_ASSERT(numParticlesOutOfRange(*this, 0) == 0);

const auto& geom = Geom(lev);
const auto plo = geom.ProbLoArray();
const auto dxi = geom.InvCellSizeArray();
const auto domain = geom.Domain();
amrex::ParticleToMesh(*this, mf, lev,
[=] AMREX_GPU_DEVICE (const typename ParticleTileType::ConstParticleTileDataType& ptd, int ip,
amrex::Array4<amrex::Real> const& count)
{
const auto& p = make_particle<ConstParticleType>{}(ptd, ip);
// auto iv = getParticleCell(p, plo, dxi, domain);
IntVect iv(
AMREX_D_DECL(int(amrex::Math::floor((p.pos(0)-plo[0])*dxi[0])),
int(amrex::Math::floor((p.pos(1)-plo[1])*dxi[1])),
p.idata(0)));
amrex::Gpu::Atomic::AddNoRet(&count(iv), 1.0_rt);
}, false);
}

0 comments on commit aabb8e4

Please sign in to comment.