aboutsummaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/FieldSolver/Make.package2
-rw-r--r--Source/FieldSolver/WarpXPushFieldsEM.cpp6
-rw-r--r--Source/FortranInterface/Make.package1
-rw-r--r--Source/FortranInterface/WarpX_f.H118
-rw-r--r--Source/FortranInterface/WarpX_picsar.F903
-rw-r--r--Source/Laser/LaserParticleContainer.cpp8
-rw-r--r--Source/Make.WarpX28
-rw-r--r--Source/Particles/MultiParticleContainer.H1
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp51
-rw-r--r--Source/Particles/WarpXParticleContainer.H15
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp130
-rw-r--r--Source/Utils/WarpXAlgorithmSelection.H18
-rw-r--r--Source/Utils/WarpXAlgorithmSelection.cpp8
-rw-r--r--Source/WarpX.H1
-rw-r--r--Source/WarpX.cpp5
15 files changed, 51 insertions, 344 deletions
diff --git a/Source/FieldSolver/Make.package b/Source/FieldSolver/Make.package
index 25e21c146..076be41bb 100644
--- a/Source/FieldSolver/Make.package
+++ b/Source/FieldSolver/Make.package
@@ -3,7 +3,7 @@ CEXE_headers += WarpX_FDTD.H
CEXE_sources += WarpXPushFieldsEM.cpp
ifeq ($(USE_PSATD),TRUE)
include $(WARPX_HOME)/Source/FieldSolver/SpectralSolver/Make.package
- ifeq ($(USE_CUDA),FALSE)
+ ifeq ($(USE_PSATD_PICSAR),TRUE)
include $(WARPX_HOME)/Source/FieldSolver/PicsarHybridSpectralSolver/Make.package
endif
endif
diff --git a/Source/FieldSolver/WarpXPushFieldsEM.cpp b/Source/FieldSolver/WarpXPushFieldsEM.cpp
index e390dd61a..1d4491881 100644
--- a/Source/FieldSolver/WarpXPushFieldsEM.cpp
+++ b/Source/FieldSolver/WarpXPushFieldsEM.cpp
@@ -59,7 +59,7 @@ WarpX::PushPSATD (amrex::Real a_dt)
for (int lev = 0; lev <= finest_level; ++lev) {
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(dt[lev] == a_dt, "dt must be consistent");
if (fft_hybrid_mpi_decomposition){
-#ifndef AMREX_USE_CUDA // Only available on CPU
+#ifdef WARPX_USE_PSATD_HYBRID
PushPSATD_hybridFFT(lev, a_dt);
#endif
} else {
@@ -136,7 +136,7 @@ WarpX::EvolveB (int lev, PatchType patch_type, amrex::Real a_dt)
MultiFab* cost = costs[lev].get();
const IntVect& rr = (lev > 0) ? refRatio(lev-1) : IntVect::TheUnitVector();
- // xmin is only used by the picsar kernel with cylindrical geometry,
+ // xmin is only used by the kernel for cylindrical geometry,
// in which case it is actually rmin.
const Real xmin = Geom(0).ProbLo(0);
@@ -323,7 +323,7 @@ WarpX::EvolveE (int lev, PatchType patch_type, amrex::Real a_dt)
MultiFab* cost = costs[lev].get();
const IntVect& rr = (lev > 0) ? refRatio(lev-1) : IntVect::TheUnitVector();
- // xmin is only used by the picsar kernel with cylindrical geometry,
+ // xmin is only used by the kernel for cylindrical geometry,
// in which case it is actually rmin.
const Real xmin = Geom(0).ProbLo(0);
diff --git a/Source/FortranInterface/Make.package b/Source/FortranInterface/Make.package
index fe0c2ba3d..d7b17fa56 100644
--- a/Source/FortranInterface/Make.package
+++ b/Source/FortranInterface/Make.package
@@ -1,6 +1,5 @@
CEXE_headers += WarpX_f.H
F90EXE_sources += WarpX_f.F90
-F90EXE_sources += WarpX_picsar.F90
INCLUDE_LOCATIONS += $(WARPX_HOME)/Source/FortranInterface
VPATH_LOCATIONS += $(WARPX_HOME)/Source/FortranInterface
diff --git a/Source/FortranInterface/WarpX_f.H b/Source/FortranInterface/WarpX_f.H
index aac23f781..9db54ba18 100644
--- a/Source/FortranInterface/WarpX_f.H
+++ b/Source/FortranInterface/WarpX_f.H
@@ -17,8 +17,6 @@
#if (AMREX_SPACEDIM == 3)
-#define WRPX_COMPUTE_DIVB warpx_compute_divb_3d
-#define WRPX_COMPUTE_DIVE warpx_compute_dive_3d
#define WRPX_SYNC_CURRENT warpx_sync_current_3d
#define WRPX_SYNC_RHO warpx_sync_rho_3d
@@ -28,7 +26,6 @@
#define WRPX_PUSH_PML_F warpx_push_pml_f_3d
#define WRPX_DAMP_PML warpx_damp_pml_3d
#define WRPX_DAMP_PML_F warpx_damp_pml_f_3d
-
#define WRPX_SUM_FINE_TO_CRSE_NODAL warpx_sum_fine_to_crse_nodal_3d
#define WRPX_ZERO_OUT_BNDRY warpx_zero_out_bndry_3d
#define WRPX_BUILD_MASK warpx_build_mask_3d
@@ -41,7 +38,6 @@
#elif (AMREX_SPACEDIM == 2)
-#define WRPX_COMPUTE_DIVB warpx_compute_divb_2d
#define WRPX_SYNC_CURRENT warpx_sync_current_2d
#define WRPX_SYNC_RHO warpx_sync_rho_2d
@@ -62,57 +58,13 @@
#define WRPX_PUSH_LEAPFROG warpx_push_leapfrog_2d
#define WRPX_PUSH_LEAPFROG_POSITIONS warpx_push_leapfrog_positions_2d
-#ifdef WARPX_DIM_RZ
-#define WRPX_COMPUTE_DIVE warpx_compute_dive_rz
-#else
-#define WRPX_COMPUTE_DIVE warpx_compute_dive_2d
-#endif
-
#endif
#ifdef __cplusplus
extern "C"
{
#endif
-
- // Current deposition
- void warpx_current_deposition(
- amrex::Real* jx, const long* jx_ng, const int* jx_ntot,
- amrex::Real* jy, const long* jy_ng, const int* jy_ntot,
- amrex::Real* jz, const long* jz_ng, const int* jz_ntot,
- const long* np,
- const amrex::Real* xp, const amrex::Real* yp, const amrex::Real* zp,
- const amrex::Real* uxp, const amrex::Real* uyp,const amrex::Real* uzp,
- const amrex::Real* gip, const amrex::Real* w, const amrex::Real* q,
- const amrex::Real* xmin, const amrex::Real* ymin, const amrex::Real* zmin,
- const amrex::Real* dt,
- const amrex::Real* dx, const amrex::Real* dy, const amrex::Real* dz,
- const long* nox, const long* noy,const long* noz,
- const int* l_nodal, const long* lvect, const long* current_depo_algo);
-
- // Particle pusher (velocity and position)
-
- void warpx_particle_pusher(const long* np,
- amrex::Real* xp, amrex::Real* yp, amrex::Real* zp,
- amrex::Real* uxp, amrex::Real* uyp, amrex::Real* uzp, amrex::Real* gaminv,
- const amrex::Real* exp, const amrex::Real* eyp,const amrex::Real* ezp,
- const amrex::Real* bxp, const amrex::Real* byp,const amrex::Real* bzp,
- const amrex::Real* charge, const amrex::Real* mass, const amrex::Real* dt,
- const long* particle_pusher_algo);
-
- // Particle pusher (velocity)
-
- void warpx_particle_pusher_momenta(const long* np,
- amrex::Real* xp, amrex::Real* yp, amrex::Real* zp,
- amrex::Real* uxp, amrex::Real* uyp, amrex::Real* uzp, amrex::Real* gaminv,
- const amrex::Real* exp, const amrex::Real* eyp,const amrex::Real* ezp,
- const amrex::Real* bxp, const amrex::Real* byp,const amrex::Real* bzp,
- const amrex::Real* charge, const amrex::Real* mass, const amrex::Real* dt,
- const long* particle_pusher_algo);
-
-
// Laser pusher
-
void warpx_gaussian_laser( const long* np,
amrex::Real* Xp, amrex::Real* Yp, amrex::Real* t, amrex::Real* wavelength, amrex::Real* e_max, amrex::Real* waist,
amrex::Real* duration, amrex::Real* t_peak, amrex::Real* f, amrex::Real* amplitude,
@@ -138,58 +90,6 @@ extern "C"
amrex::Real* mobility, amrex::Real* dt, const amrex::Real* c,
const amrex::Real* beta_boost, const amrex::Real* gamma_boost );
- // Maxwell solver
-
- void warpx_push_evec(
- const int* xlo, const int* xhi,
- const int* ylo, const int* yhi,
- const int* zlo, const int* zhi,
- BL_FORT_FAB_ARG_3D(ex),
- BL_FORT_FAB_ARG_3D(ey),
- BL_FORT_FAB_ARG_3D(ez),
- const BL_FORT_FAB_ARG_3D(bx),
- const BL_FORT_FAB_ARG_3D(by),
- const BL_FORT_FAB_ARG_3D(bz),
- const BL_FORT_FAB_ARG_3D(jx),
- const BL_FORT_FAB_ARG_3D(jy),
- const BL_FORT_FAB_ARG_3D(jz),
- const amrex::Real* mudt,
- const amrex::Real* dtsdx,
- const amrex::Real* dtsdy,
- const amrex::Real* dtsdz,
- const amrex::Real* xmin,
- const amrex::Real* dx);
-
- void warpx_push_bvec(
- const int* xlo, const int* xhi,
- const int* ylo, const int* yhi,
- const int* zlo, const int* zhi,
- const BL_FORT_FAB_ARG_3D(ex),
- const BL_FORT_FAB_ARG_3D(ey),
- const BL_FORT_FAB_ARG_3D(ez),
- BL_FORT_FAB_ARG_3D(bx),
- BL_FORT_FAB_ARG_3D(by),
- BL_FORT_FAB_ARG_3D(bz),
- const amrex::Real* dtsdx,
- const amrex::Real* dtsdy,
- const amrex::Real* dtsdz,
- const amrex::Real* xmin,
- const amrex::Real* dx,
- const int* maxwell_fdtd_solver_id);
-
- void warpx_push_evec_f(
- const int* xlo, const int* xhi,
- const int* ylo, const int* yhi,
- const int* zlo, const int* zhi,
- BL_FORT_FAB_ARG_3D(ex),
- BL_FORT_FAB_ARG_3D(ey),
- BL_FORT_FAB_ARG_3D(ez),
- const BL_FORT_FAB_ARG_3D(f),
- const amrex::Real* dtsdx_c2,
- const amrex::Real* dtsdy_c2,
- const amrex::Real* dtsdz_c2,
- const int* maxwell_fdtd_solver_id);
-
#ifdef USE_OPENBC_POISSON
void warpx_openbc_potential (amrex::Real* rho, amrex::Real* phi, const amrex::Real* dx);
void warpx_openbc_decompose (const int*, const int*, int*, int*);
@@ -285,24 +185,6 @@ extern "C"
// These functions are used to evolve E and B in the PML
- void WRPX_COMPUTE_DIVB (const int* lo, const int* hi,
- BL_FORT_FAB_ARG_ANYD(divb),
- const BL_FORT_FAB_ARG_ANYD(Bx),
- const BL_FORT_FAB_ARG_ANYD(By),
- const BL_FORT_FAB_ARG_ANYD(Bz),
- const amrex::Real* dx);
-
- void WRPX_COMPUTE_DIVE (const int* lo, const int* hi,
- BL_FORT_FAB_ARG_ANYD(dive),
- const BL_FORT_FAB_ARG_ANYD(ex),
- const BL_FORT_FAB_ARG_ANYD(ey),
- const BL_FORT_FAB_ARG_ANYD(ez),
- const amrex::Real* dx
-#ifdef WARPX_DIM_RZ
- ,const amrex::Real* rmin
-#endif
- );
-
void WRPX_PUSH_PML_BVEC(const int* xlo, const int* xhi,
const int* ylo, const int* yhi,
const int* zlo, const int* zhi,
diff --git a/Source/FortranInterface/WarpX_picsar.F90 b/Source/FortranInterface/WarpX_picsar.F90
index 34084d753..ff331a122 100644
--- a/Source/FortranInterface/WarpX_picsar.F90
+++ b/Source/FortranInterface/WarpX_picsar.F90
@@ -16,9 +16,6 @@
#endif
-#define LVECT_CURRDEPO 8_c_long
-#define LVECT_FIELDGATHE 64_c_long
-
! _________________________________________________________________
!
!> @brief
diff --git a/Source/Laser/LaserParticleContainer.cpp b/Source/Laser/LaserParticleContainer.cpp
index c141ae4b0..3fdd8730b 100644
--- a/Source/Laser/LaserParticleContainer.cpp
+++ b/Source/Laser/LaserParticleContainer.cpp
@@ -397,8 +397,8 @@ LaserParticleContainer::Evolve (int lev,
{
BL_PROFILE("Laser::Evolve()");
BL_PROFILE_VAR_NS("Laser::Evolve::Copy", blp_copy);
- BL_PROFILE_VAR_NS("PICSAR::LaserParticlePush", blp_pxr_pp);
- BL_PROFILE_VAR_NS("PICSAR::LaserCurrentDepo", blp_pxr_cd);
+ BL_PROFILE_VAR_NS("Laser::ParticlePush", blp_pp);
+ BL_PROFILE_VAR_NS("Laser::CurrentDepo", blp_cd);
BL_PROFILE_VAR_NS("Laser::Evolve::Accumulate", blp_accumulate);
Real t_lab = t;
@@ -466,7 +466,7 @@ LaserParticleContainer::Evolve (int lev,
//
// Particle Push
//
- BL_PROFILE_VAR_START(blp_pxr_pp);
+ BL_PROFILE_VAR_START(blp_pp);
// Find the coordinates of the particles in the emission plane
calculate_laser_plane_coordinates( &np,
m_xp[thread_num].dataPtr(),
@@ -506,7 +506,7 @@ LaserParticleContainer::Evolve (int lev,
wp.dataPtr(), amplitude_E.dataPtr(), &p_X[0], &p_X[1], &p_X[2],
&nvec[0], &nvec[1], &nvec[2], &mobility, &dt,
&PhysConst::c, &WarpX::beta_boost, &WarpX::gamma_boost );
- BL_PROFILE_VAR_STOP(blp_pxr_pp);
+ BL_PROFILE_VAR_STOP(blp_pp);
//
// Current Deposition
diff --git a/Source/Make.WarpX b/Source/Make.WarpX
index 1970c8fc6..ea06f8e06 100644
--- a/Source/Make.WarpX
+++ b/Source/Make.WarpX
@@ -116,7 +116,7 @@ ifeq ($(USE_OPENPMD), TRUE)
endif
DEFINES += -DWARPX_USE_OPENPMD
endif
-
+
ifeq ($(USE_PSATD),TRUE)
USERSuffix := $(USERSuffix).PSATD
@@ -124,15 +124,17 @@ ifeq ($(USE_PSATD),TRUE)
ifeq ($(USE_CUDA),FALSE) # Running on CPU
# Use FFTW
libraries += -lfftw3_mpi -lfftw3 -lfftw3_threads
- FFTW_HOME ?= NOT_SET
- ifneq ($(FFTW_HOME),NOT_SET)
- VPATH_LOCATIONS += $(FFTW_HOME)/include
- INCLUDE_LOCATIONS += $(FFTW_HOME)/include
- LIBRARY_LOCATIONS += $(FFTW_HOME)/lib
+ ifeq ($(USE_PSATD_PICSAR),TRUE)
+ FFTW_HOME ?= NOT_SET
+ ifneq ($(FFTW_HOME),NOT_SET)
+ VPATH_LOCATIONS += $(FFTW_HOME)/include
+ INCLUDE_LOCATIONS += $(FFTW_HOME)/include
+ LIBRARY_LOCATIONS += $(FFTW_HOME)/lib
+ endif
+ # Compile with PICSAR's Hybrid-MPI PSATD
+ DEFINES += -DWARPX_USE_PSATD_HYBRID
+ DEFINES += -DFFTW # PICSAR uses it
endif
- # Compile with PICSAR's Hybrid-MPI PSATD
- DEFINES += -DWARPX_USE_PSATD_HYBRID
- DEFINES += -DFFTW # PICSAR uses it
else
# Use cuFFT
libraries += -lcufft
@@ -159,7 +161,7 @@ ifeq ($(USE_HDF5),TRUE)
endif
DEFINES += -DWARPX_USE_HDF5
libraries += -lhdf5 -lz
-endif
+endif
# job_info support
CEXE_sources += AMReX_buildInfo.cpp
@@ -206,7 +208,7 @@ else
ifdef WarpxBinDir
-all: $(executable)
+all: $(executable)
$(SILENT) $(RM) AMReX_buildInfo.cpp
@if [ ! -d $(WarpxBinDir) ]; then mkdir -p $(WarpxBinDir); fi
$(SILENT) mv -f $(executable) $(WarpxBinDir)/
@@ -215,7 +217,7 @@ all: $(executable)
else
-all: $(executable)
+all: $(executable)
$(SILENT) $(RM) AMReX_buildInfo.cpp
@echo SUCCESS
@@ -223,7 +225,7 @@ endif
endif
-AMReX_buildInfo.cpp:
+AMReX_buildInfo.cpp:
$(AMREX_HOME)/Tools/C_scripts/makebuildinfo_C.py \
--amrex_home "$(AMREX_HOME)" \
--COMP "$(COMP)" --COMP_VERSION "$(COMP_VERSION)" \
diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H
index aaed96423..1aff7edfb 100644
--- a/Source/Particles/MultiParticleContainer.H
+++ b/Source/Particles/MultiParticleContainer.H
@@ -123,7 +123,6 @@ public:
///
/// This deposits the particle charge onto a node-centered MultiFab and returns a unique ptr
/// to it. The charge density is accumulated over all the particles in the MultiParticleContainer
- /// This version uses PICSAR routines to perform the deposition.
///
std::unique_ptr<amrex::MultiFab> GetChargeDensity(int lev, bool local = false);
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 73acd60fa..015482e3f 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -932,7 +932,7 @@ PhysicalParticleContainer::Evolve (int lev,
{
BL_PROFILE("PPC::Evolve()");
BL_PROFILE_VAR_NS("PPC::Evolve::Copy", blp_copy);
- BL_PROFILE_VAR_NS("PICSAR::FieldGather", blp_pxr_fg);
+ BL_PROFILE_VAR_NS("PPC::FieldGather", blp_fg);
BL_PROFILE_VAR_NS("PPC::ParticlePush", blp_ppc_pp);
BL_PROFILE_VAR_NS("PPC::Evolve::partition", blp_partition);
@@ -1198,7 +1198,7 @@ PhysicalParticleContainer::Evolve (int lev,
//
// Field Gather of Aux Data (i.e., the full solution)
//
- BL_PROFILE_VAR_START(blp_pxr_fg);
+ BL_PROFILE_VAR_START(blp_fg);
FieldGather(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp,
exfab, eyfab, ezfab, bxfab, byfab, bzfab,
Ex.nGrow(), e_is_nodal, 0, np_gather, thread_num, lev, lev);
@@ -1278,7 +1278,7 @@ PhysicalParticleContainer::Evolve (int lev,
thread_num, lev, lev-1);
}
- BL_PROFILE_VAR_STOP(blp_pxr_fg);
+ BL_PROFILE_VAR_STOP(blp_fg);
//
// Particle Push
@@ -1291,36 +1291,25 @@ PhysicalParticleContainer::Evolve (int lev,
//
// Current Deposition
//
- if (WarpX::use_picsar_deposition) {
- // Deposit inside domains
- DepositCurrentFortran(pti, wp, uxp, uyp, uzp, &jx, &jy, &jz,
- 0, np_current, thread_num,
- lev, lev, dt);
- if (has_buffer){
- // Deposit in buffers
- DepositCurrentFortran(pti, wp, uxp, uyp, uzp, cjx, cjy, cjz,
- np_current, np-np_current, thread_num,
- lev, lev-1, dt);
- }
+
+ int* AMREX_RESTRICT ion_lev;
+ if (do_field_ionization){
+ ion_lev = pti.GetiAttribs(particle_icomps["ionization_level"]).dataPtr();
} else {
- int* AMREX_RESTRICT ion_lev;
- if (do_field_ionization){
- ion_lev = pti.GetiAttribs(particle_icomps["ionization_level"]).dataPtr();
- } else {
- ion_lev = nullptr;
- }
-
- // Deposit inside domains
- DepositCurrent(pti, wp, uxp, uyp, uzp, ion_lev, &jx, &jy, &jz,
- 0, np_current, thread_num,
- lev, lev, dt);
- if (has_buffer){
- // Deposit in buffers
- DepositCurrent(pti, wp, uxp, uyp, uzp, ion_lev, cjx, cjy, cjz,
- np_current, np-np_current, thread_num,
- lev, lev-1, dt);
- }
+ ion_lev = nullptr;
}
+
+ // Deposit inside domains
+ DepositCurrent(pti, wp, uxp, uyp, uzp, ion_lev, &jx, &jy, &jz,
+ 0, np_current, thread_num,
+ lev, lev, dt);
+ if (has_buffer){
+ // Deposit in buffers
+ DepositCurrent(pti, wp, uxp, uyp, uzp, ion_lev, cjx, cjy, cjz,
+ np_current, np-np_current, thread_num,
+ lev, lev-1, dt);
+ }
+
//
// copy particle data back
diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H
index c4bb5e410..7393f7301 100644
--- a/Source/Particles/WarpXParticleContainer.H
+++ b/Source/Particles/WarpXParticleContainer.H
@@ -205,21 +205,6 @@ public:
int depos_lev,
amrex::Real dt);
- virtual void DepositCurrentFortran(WarpXParIter& pti,
- RealVector& wp,
- RealVector& uxp,
- RealVector& uyp,
- RealVector& uzp,
- amrex::MultiFab* jx,
- amrex::MultiFab* jy,
- amrex::MultiFab* jz,
- const long offset,
- const long np_to_depose,
- int thread_num,
- int lev,
- int depos_lev,
- amrex::Real dt);
-
// If particles start outside of the domain, ContinuousInjection
// makes sure that they are initialized when they enter the domain, and
// NOT before. Virtual function, overriden by derived classes.
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index b34e71178..80d1caa0f 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -263,132 +263,6 @@ WarpXParticleContainer::AddNParticles (int lev,
Redistribute();
}
-/* \brief Current Deposition for thread thread_num using PICSAR
- * \param pti : Particle iterator
- * \param wp : Array of particle weights
- * \param uxp uyp uzp : Array of particle
- * \param jx jy jz : Full array of current density
- * \param offset : Index of first particle for which current is deposited
- * \param np_to_depose: Number of particles for which current is deposited.
- Particles [offset,offset+np_tp_depose] deposit their
- current
- * \param thread_num : Thread number (if tiling)
- * \param lev : Level of box that contains particles
- * \param depos_lev : Level on which particles deposit (if buffers are used)
- * \param dt : Time step for particle level
- */
-void
-WarpXParticleContainer::DepositCurrentFortran(WarpXParIter& pti,
- RealVector& wp, RealVector& uxp,
- RealVector& uyp, RealVector& uzp,
- MultiFab* jx, MultiFab* jy, MultiFab* jz,
- const long offset, const long np_to_depose,
- int thread_num, int lev, int depos_lev,
- Real dt)
-{
- AMREX_ALWAYS_ASSERT_WITH_MESSAGE((depos_lev==(lev-1)) ||
- (depos_lev==(lev )),
- "Deposition buffers only work for lev-1");
- // If no particles, do not do anything
- if (np_to_depose == 0) return;
-
- const long ngJ = jx->nGrow();
- const std::array<Real,3>& dx = WarpX::CellSize(std::max(depos_lev,0));
- const long lvect = 8;
- int j_is_nodal = jx->is_nodal() and jy->is_nodal() and jz->is_nodal();
-
- BL_PROFILE_VAR_NS("PICSAR::CurrentDeposition", blp_pxr_cd);
- BL_PROFILE_VAR_NS("PPC::Evolve::Accumulate", blp_accumulate);
-
- // Get tile box where current is deposited.
- // The tile box is different when depositing in the buffers (depos_lev<lev)
- // or when depositing inside the level (depos_lev=lev)
- Box tilebox;
- if (lev == depos_lev) {
- tilebox = pti.tilebox();
- } else {
- const IntVect& ref_ratio = WarpX::RefRatio(depos_lev);
- tilebox = amrex::coarsen(pti.tilebox(),ref_ratio);
- }
-
- // Staggered tile boxes (different in each direction)
- Box tbx = convert(tilebox, WarpX::jx_nodal_flag);
- Box tby = convert(tilebox, WarpX::jy_nodal_flag);
- Box tbz = convert(tilebox, WarpX::jz_nodal_flag);
-
- // Lower corner of tile box physical domain
- const std::array<Real,3>& xyzmin_tile = WarpX::LowerCorner(tilebox, depos_lev);
- const std::array<Real, 3>& xyzmin = xyzmin_tile;
-
-#ifdef AMREX_USE_GPU
- // No tiling on GPU: jx_ptr points to the full
- // jx array (same for jy_ptr and jz_ptr).
- Real* jx_ptr = (*jx)[pti].dataPtr();
- Real* jy_ptr = (*jy)[pti].dataPtr();
- Real* jz_ptr = (*jz)[pti].dataPtr();
-
- auto jxntot = (*jx)[pti].length();
- auto jyntot = (*jy)[pti].length();
- auto jzntot = (*jz)[pti].length();
-#else
- // Tiling is on: jx_ptr points to local_jx[thread_num]
- // (same for jy_ptr and jz_ptr)
- tbx.grow(ngJ);
- tby.grow(ngJ);
- tbz.grow(ngJ);
-
- local_jx[thread_num].resize(tbx);
- local_jy[thread_num].resize(tby);
- local_jz[thread_num].resize(tbz);
-
- Real* jx_ptr = local_jx[thread_num].dataPtr();
- Real* jy_ptr = local_jy[thread_num].dataPtr();
- Real* jz_ptr = local_jz[thread_num].dataPtr();
-
- // local_jx[thread_num] is set to zero
- local_jx[thread_num].setVal(0.0);
- local_jy[thread_num].setVal(0.0);
- local_jz[thread_num].setVal(0.0);
-
- auto jxntot = local_jx[thread_num].length();
- auto jyntot = local_jy[thread_num].length();
- auto jzntot = local_jz[thread_num].length();
-#endif
- // GPU, no tiling: deposit directly in jx
- // CPU, tiling: deposit into local_jx
- // (same for jx and jz)
- BL_PROFILE_VAR_START(blp_pxr_cd);
- warpx_current_deposition(
- jx_ptr, &ngJ, jxntot.getVect(),
- jy_ptr, &ngJ, jyntot.getVect(),
- jz_ptr, &ngJ, jzntot.getVect(),
- &np_to_depose,
- m_xp[thread_num].dataPtr() + offset,
- m_yp[thread_num].dataPtr() + offset,
- m_zp[thread_num].dataPtr() + offset,
- uxp.dataPtr() + offset,
- uyp.dataPtr() + offset,
- uzp.dataPtr() + offset,
- m_giv[thread_num].dataPtr() + offset,
- wp.dataPtr() + offset, &this->charge,
- &xyzmin[0], &xyzmin[1], &xyzmin[2],
- &dt, &dx[0], &dx[1], &dx[2],
- &WarpX::nox,&WarpX::noy,&WarpX::noz, &j_is_nodal,
- &lvect,&WarpX::current_deposition_algo);
-
- BL_PROFILE_VAR_STOP(blp_pxr_cd);
-
-#ifndef AMREX_USE_GPU
- BL_PROFILE_VAR_START(blp_accumulate);
- // CPU, tiling: atomicAdd local_jx into jx
- // (same for jx and jz)
- (*jx)[pti].atomicAdd(local_jx[thread_num], tbx, tbx, 0, 0, 1);
- (*jy)[pti].atomicAdd(local_jy[thread_num], tby, tby, 0, 0, 1);
- (*jz)[pti].atomicAdd(local_jz[thread_num], tbz, tbz, 0, 0, 1);
- BL_PROFILE_VAR_STOP(blp_accumulate);
-#endif
-}
-
/* \brief Current Deposition for thread thread_num
* \param pti : Particle iterator
* \param wp : Array of particle weights
@@ -429,6 +303,8 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti,
const Real stagger_shift = j_is_nodal ? 0.0 : 0.5;
BL_PROFILE_VAR_NS("PPC::Evolve::Accumulate", blp_accumulate);
+ BL_PROFILE_VAR_NS("PPC::CurrentDeposition", blp_deposit);
+
// Get tile box where current is deposited.
// The tile box is different when depositing in the buffers (depos_lev<lev)
@@ -491,6 +367,7 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti,
// Better for memory? worth trying?
const Dim3 lo = lbound(tilebox);
+ BL_PROFILE_VAR_START(blp_deposit);
if (WarpX::current_deposition_algo == CurrentDepositionAlgo::Esirkepov) {
if (WarpX::nox == 1){
doEsirkepovDepositionShapeN<1>(
@@ -529,6 +406,7 @@ WarpXParticleContainer::DepositCurrent(WarpXParIter& pti,
stagger_shift, q);
}
}
+ BL_PROFILE_VAR_STOP(blp_deposit);
#ifndef AMREX_USE_GPU
BL_PROFILE_VAR_START(blp_accumulate);
diff --git a/Source/Utils/WarpXAlgorithmSelection.H b/Source/Utils/WarpXAlgorithmSelection.H
index 6a32513b7..54c721abf 100644
--- a/Source/Utils/WarpXAlgorithmSelection.H
+++ b/Source/Utils/WarpXAlgorithmSelection.H
@@ -5,8 +5,6 @@
#include <string>
struct MaxwellSolverAlgo {
- // These numbers corresponds to the algorithm code in WarpX's
- // `warpx_push_bvec` and `warpx_push_evec_f`
enum {
Yee = 0,
CKC = 1
@@ -14,8 +12,6 @@ struct MaxwellSolverAlgo {
};
struct ParticlePusherAlgo {
- // These numbers correspond to the algorithm code in WarpX's
- // `warpx_particle_pusher`
enum {
Boris = 0,
Vay = 1
@@ -24,12 +20,8 @@ struct ParticlePusherAlgo {
struct CurrentDepositionAlgo {
enum {
- // These numbers corresponds to the algorithm code in PICSAR's
- // `depose_jxjyjz_generic` and `depose_jxjyjz_generic_2d`
- Direct = 3,
- DirectVectorized = 2,
- EsirkepovNonOptimized = 1,
- Esirkepov = 0
+ Esirkepov = 0,
+ Direct = 1
};
};
@@ -41,11 +33,9 @@ struct ChargeDepositionAlgo {
};
struct GatheringAlgo {
- // These numbers corresponds to the algorithm code in PICSAR's
- // `geteb3d_energy_conserving_generic` function
+ // Only the Standard algorithm is implemented
enum {
- Vectorized = 0,
- Standard = 1
+ Standard = 0
};
};
diff --git a/Source/Utils/WarpXAlgorithmSelection.cpp b/Source/Utils/WarpXAlgorithmSelection.cpp
index 842085a36..24e55a77f 100644
--- a/Source/Utils/WarpXAlgorithmSelection.cpp
+++ b/Source/Utils/WarpXAlgorithmSelection.cpp
@@ -23,9 +23,6 @@ const std::map<std::string, int> particle_pusher_algo_to_int = {
const std::map<std::string, int> current_deposition_algo_to_int = {
{"esirkepov", CurrentDepositionAlgo::Esirkepov },
{"direct", CurrentDepositionAlgo::Direct },
-#if (!defined AMREX_USE_GPU)&&(AMREX_SPACEDIM == 3) // Only available on CPU and 3D
- {"direct-vectorized", CurrentDepositionAlgo::DirectVectorized },
-#endif
{"default", CurrentDepositionAlgo::Esirkepov }
};
@@ -36,12 +33,7 @@ const std::map<std::string, int> charge_deposition_algo_to_int = {
const std::map<std::string, int> gathering_algo_to_int = {
{"standard", GatheringAlgo::Standard },
-#ifndef AMREX_USE_GPU // Only available on CPU
- {"vectorized", GatheringAlgo::Vectorized },
- {"default", GatheringAlgo::Vectorized }
-#else
{"default", GatheringAlgo::Standard }
-#endif
};
diff --git a/Source/WarpX.H b/Source/WarpX.H
index 702c67301..f1a3b1479 100644
--- a/Source/WarpX.H
+++ b/Source/WarpX.H
@@ -83,7 +83,6 @@ public:
static amrex::Vector<amrex::Real> B_external;
// Algorithms
- static long use_picsar_deposition;
static long current_deposition_algo;
static long charge_deposition_algo;
static long field_gathering_algo;
diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp
index 3712d75dc..4723626ab 100644
--- a/Source/WarpX.cpp
+++ b/Source/WarpX.cpp
@@ -38,7 +38,6 @@ Vector<int> WarpX::boost_direction = {0,0,0};
int WarpX::do_compute_max_step_from_zmax = 0;
Real WarpX::zmax_plasma_to_compute_max_step = 0.;
-long WarpX::use_picsar_deposition = 0;
long WarpX::current_deposition_algo;
long WarpX::charge_deposition_algo;
long WarpX::field_gathering_algo;
@@ -526,10 +525,6 @@ WarpX::ReadParameters ()
{
ParmParse pp("algo");
- // If not in RZ mode, read use_picsar_deposition
- // In RZ mode, use_picsar_deposition is on, as the C++ version
- // of the deposition does not support RZ
- pp.query("use_picsar_deposition", use_picsar_deposition);
current_deposition_algo = GetAlgorithmInteger(pp, "current_deposition");
charge_deposition_algo = GetAlgorithmInteger(pp, "charge_deposition");
field_gathering_algo = GetAlgorithmInteger(pp, "field_gathering");