diff options
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 211 |
1 files changed, 0 insertions, 211 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 9ba783173..7af9bdac8 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -767,217 +767,6 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox) // The function that calls this is responsible for redistributing particles. } -#ifdef WARPX_DO_ELECTROSTATIC -void -PhysicalParticleContainer:: -FieldGatherES (const amrex::Vector<std::array<std::unique_ptr<amrex::MultiFab>, 3> >& E, - const amrex::Vector<std::unique_ptr<amrex::FabArray<amrex::BaseFab<int> > > >& masks) -{ - - const int num_levels = E.size(); - const int ng = E[0][0]->nGrow(); - - if (num_levels == 1) { - const int lev = 0; - const auto& gm = m_gdb->Geom(lev); - const auto& ba = m_gdb->ParticleBoxArray(lev); - - BoxArray nba = ba; - nba.surroundingNodes(); - - const Real* dx = gm.CellSize(); - const Real* plo = gm.ProbLo(); - - BL_ASSERT(OnSameGrids(lev, *E[lev][0])); - - for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti) { - const Box& box = nba[pti]; - - const auto& particles = pti.GetArrayOfStructs(); - int nstride = particles.dataShape().first; - const long np = pti.numParticles(); - auto& attribs = pti.GetAttribs(); - auto& Exp = attribs[PIdx::Ex]; - auto& Eyp = attribs[PIdx::Ey]; -#if AMREX_SPACEDIM == 3 - auto& Ezp = attribs[PIdx::Ez]; -#endif - Exp.assign(np,0.0); - Eyp.assign(np,0.0); -#if AMREX_SPACEDIM == 3 - Ezp.assign(np,0.0); -#endif - - const FArrayBox& exfab = (*E[lev][0])[pti]; - const FArrayBox& eyfab = (*E[lev][1])[pti]; -#if AMREX_SPACEDIM == 3 - const FArrayBox& ezfab = (*E[lev][2])[pti]; -#endif - - WRPX_INTERPOLATE_CIC(particles.dataPtr(), nstride, np, - Exp.dataPtr(), Eyp.dataPtr(), -#if AMREX_SPACEDIM == 3 - Ezp.dataPtr(), -#endif - exfab.dataPtr(), eyfab.dataPtr(), -#if AMREX_SPACEDIM == 3 - ezfab.dataPtr(), -#endif - box.loVect(), box.hiVect(), plo, dx, &ng); - } - - return; - } - - const BoxArray& fine_BA = E[1][0]->boxArray(); - const DistributionMapping& fine_dm = E[1][0]->DistributionMap(); - BoxArray coarsened_fine_BA = fine_BA; - coarsened_fine_BA.coarsen(IntVect(AMREX_D_DECL(2,2,2))); - - MultiFab coarse_Ex(coarsened_fine_BA, fine_dm, 1, 1); - MultiFab coarse_Ey(coarsened_fine_BA, fine_dm, 1, 1); -#if AMREX_SPACEDIM == 3 - MultiFab coarse_Ez(coarsened_fine_BA, fine_dm, 1, 1); -#endif - - coarse_Ex.copy(*E[0][0], 0, 0, 1, 1, 1); - coarse_Ey.copy(*E[0][1], 0, 0, 1, 1, 1); -#if AMREX_SPACEDIM == 3 - coarse_Ez.copy(*E[0][2], 0, 0, 1, 1, 1); -#endif - - for (int lev = 0; lev < num_levels; ++lev) { - const auto& gm = m_gdb->Geom(lev); - const auto& ba = m_gdb->ParticleBoxArray(lev); - - BoxArray nba = ba; - nba.surroundingNodes(); - - const Real* dx = gm.CellSize(); - const Real* plo = gm.ProbLo(); - - BL_ASSERT(OnSameGrids(lev, *E[lev][0])); - - for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti) { - const Box& box = nba[pti]; - - const auto& particles = pti.GetArrayOfStructs(); - int nstride = particles.dataShape().first; - const long np = pti.numParticles(); - - auto& attribs = pti.GetAttribs(); - auto& Exp = attribs[PIdx::Ex]; - auto& Eyp = attribs[PIdx::Ey]; -#if AMREX_SPACEDIM == 3 - auto& Ezp = attribs[PIdx::Ez]; -#endif - Exp.assign(np,0.0); - Eyp.assign(np,0.0); -#if AMREX_SPACEDIM == 3 - Ezp.assign(np,0.0); -#endif - - const FArrayBox& exfab = (*E[lev][0])[pti]; - const FArrayBox& eyfab = (*E[lev][1])[pti]; -#if AMREX_SPACEDIM == 3 - const FArrayBox& ezfab = (*E[lev][2])[pti]; -#endif - - if (lev == 0) { - WRPX_INTERPOLATE_CIC(particles.dataPtr(), nstride, np, - Exp.dataPtr(), Eyp.dataPtr(), -#if AMREX_SPACEDIM == 3 - Ezp.dataPtr(), -#endif - exfab.dataPtr(), eyfab.dataPtr(), -#if AMREX_SPACEDIM == 3 - ezfab.dataPtr(), -#endif - box.loVect(), box.hiVect(), plo, dx, &ng); - } else { - - const FArrayBox& exfab_coarse = coarse_Ex[pti]; - const FArrayBox& eyfab_coarse = coarse_Ey[pti]; -#if AMREX_SPACEDIM == 3 - const FArrayBox& ezfab_coarse = coarse_Ez[pti]; -#endif - const Box& coarse_box = coarsened_fine_BA[pti]; - const Real* coarse_dx = Geom(0).CellSize(); - - WRPX_INTERPOLATE_CIC_TWO_LEVELS(particles.dataPtr(), nstride, np, - Exp.dataPtr(), Eyp.dataPtr(), -#if AMREX_SPACEDIM == 3 - Ezp.dataPtr(), -#endif - exfab.dataPtr(), eyfab.dataPtr(), -#if AMREX_SPACEDIM == 3 - ezfab.dataPtr(), -#endif - box.loVect(), box.hiVect(), dx, - exfab_coarse.dataPtr(), eyfab_coarse.dataPtr(), -#if AMREX_SPACEDIM == 3 - ezfab_coarse.dataPtr(), -#endif - (*masks[1])[pti].dataPtr(), - coarse_box.loVect(), coarse_box.hiVect(), coarse_dx, - plo, &ng, &lev); - } - } - } -} - -void -PhysicalParticleContainer::EvolveES (const Vector<std::array<std::unique_ptr<MultiFab>, 3> >& E, - Vector<std::unique_ptr<MultiFab> >& rho, - Real t, Real dt) -{ - WARPX_PROFILE("PPC::EvolveES()"); - - int num_levels = rho.size(); - for (int lev = 0; lev < num_levels; ++lev) { - BL_ASSERT(OnSameGrids(lev, *rho[lev])); - const auto& gm = m_gdb->Geom(lev); - const RealBox& prob_domain = gm.ProbDomain(); - for (WarpXParIter pti(*this, lev); pti.isValid(); ++pti) { - // Particle structs - auto& particles = pti.GetArrayOfStructs(); - int nstride = particles.dataShape().first; - const long np = pti.numParticles(); - - // Particle attributes - auto& attribs = pti.GetAttribs(); - auto& uxp = attribs[PIdx::ux]; - auto& uyp = attribs[PIdx::uy]; - -#if AMREX_SPACEDIM == 3 - auto& uzp = attribs[PIdx::uz]; -#endif - - auto& Exp = attribs[PIdx::Ex]; - auto& Eyp = attribs[PIdx::Ey]; - -#if AMREX_SPACEDIM == 3 - auto& Ezp = attribs[PIdx::Ez]; -#endif - // - // Particle Push - // - WRPX_PUSH_LEAPFROG(particles.dataPtr(), nstride, np, - uxp.dataPtr(), uyp.dataPtr(), -#if AMREX_SPACEDIM == 3 - uzp.dataPtr(), -#endif - Exp.dataPtr(), Eyp.dataPtr(), -#if AMREX_SPACEDIM == 3 - Ezp.dataPtr(), -#endif - &this->charge, &this->mass, &dt, - prob_domain.lo(), prob_domain.hi()); - } - } -} -#endif // WARPX_DO_ELECTROSTATIC - void PhysicalParticleContainer::AssignExternalFieldOnParticles(WarpXParIter& pti, RealVector& Exp, RealVector& Eyp, RealVector& Ezp, |