1#ifdef REMORA_USE_PARTICLES
4#include <AMReX_ParmParse.H>
8void REMORAPC::readInputs ()
51void REMORAPC::InitializeParticles (
const std::unique_ptr<MultiFab>&
a_height_ptr)
59 <<
" is not a valid initialization for "
60 <<
m_name <<
" particle species.\n";
61 Error(
"See error message!");
68void REMORAPC::initializeParticlesUniformDistributionInBox (
const std::unique_ptr<MultiFab>&
a_height_ptr,
71 BL_PROFILE(
"REMORAPC::initializeParticlesUniformDistributionInBox");
74 const auto dx =
Geom(
lev).CellSizeArray();
84#pragma omp parallel if (Gpu::notInLaunchRegion())
93 Real
x =
plo[0] + (
i + Real(0.5))*
dx[0];
94 Real
y =
plo[1] + (
j + Real(0.5))*
dx[1];
107 Real
x =
plo[0] + (
i + Real(0.5))*
dx[0];
108 Real
y =
plo[1] + (
j + Real(0.5))*
dx[1];
109 Real
z =
plo[2] + (
k + Real(0.5))*
dx[2];
129#pragma omp parallel if (Gpu::notInLaunchRegion())
139 np = Scan::PrefixSum<int>(
ncell,
142 Scan::Type::exclusive,
152 auto*
vx_ptr =
soa.GetRealData(REMORAParticlesRealIdxSoA::vx).data();
153 auto*
vy_ptr =
soa.GetRealData(REMORAParticlesRealIdxSoA::vy).data();
154 auto*
vz_ptr =
soa.GetRealData(REMORAParticlesRealIdxSoA::vz).data();
155 auto*
mass_ptr =
soa.GetRealData(REMORAParticlesRealIdxSoA::mass).data();
159 auto my_proc = ParallelDescriptor::MyProc();
162#pragma omp critical (remora_particle_nextid)
165 pid = ParticleType::NextID();
166 ParticleType::NextID(
pid+
np);
169 "Error: overflow on particle id numbers!" );
186 Real
sx[] = {
one -
r[0],
r[0]};
187 Real
sy[] = {
one -
r[1],
r[1]};
190 for (
int ii = 0;
ii < 2; ++
ii) {
191 for (
int jj = 0;
jj < 2; ++
jj) {
196 for (
int ii = 0;
ii < 2; ++
ii) {
197 for (
int jj = 0;
jj < 2; ++
jj) {
208 p.pos(0) =
x;
p.pos(1) =
y;
p.pos(2) =
z;
210 p.idata(REMORAParticlesIntIdxAoS::k) =
k;
226 Real
r[3] = {Real(0.3), Real(0.7), Real(0.25)};
232 Real
sx[] = {
one -
r[0],
r[0]};
233 Real
sy[] = {
one -
r[1],
r[1]};
236 for (
int ii = 0;
ii < 2; ++
ii) {
237 for (
int jj = 0;
jj < 2; ++
jj) {
242 for (
int ii = 0;
ii < 2; ++
ii) {
243 for (
int jj = 0;
jj < 2; ++
jj) {
254 p.pos(0) =
x;
p.pos(1) =
y;
p.pos(2) =
z;
256 p.idata(REMORAParticlesIntIdxAoS::k) =
k;
282 p.pos(0) =
x;
p.pos(1) =
y;
p.pos(2) =
z;
284 p.idata(REMORAParticlesIntIdxAoS::k) =
k;
298 Real
r[3] = {Real(0.3), Real(0.7), Real(0.25)};
309 p.pos(0) =
x;
p.pos(1) =
y;
p.pos(2) =
z;
311 p.idata(REMORAParticlesIntIdxAoS::k) =
k;
constexpr amrex::Real one
constexpr amrex::Real zero
mf_h setVal(geomdata.ProbHi(2))
integer, dimension(ngrids) n