aboutsummaryrefslogtreecommitdiff
path: root/Source/Particles/PhysicalParticleContainer.cpp
diff options
context:
space:
mode:
authorGravatar L. Diana Amorim <LDianaAmorim@lbl.gov> 2020-06-25 09:31:33 -0700
committerGravatar GitHub <noreply@github.com> 2020-06-25 09:31:33 -0700
commitf44fde71eb7013cec7bcc2769d3ac12531b5c68b (patch)
tree858e5bd4eedda1096061d214ad18e9c815edefa9 /Source/Particles/PhysicalParticleContainer.cpp
parent7dd3c0be2722cce973c884ae68469988054d85dc (diff)
downloadWarpX-f44fde71eb7013cec7bcc2769d3ac12531b5c68b.tar.gz
WarpX-f44fde71eb7013cec7bcc2769d3ac12531b5c68b.tar.zst
WarpX-f44fde71eb7013cec7bcc2769d3ac12531b5c68b.zip
[small] Inject Particles from openPMD in RZ (#1113)
* Added description of singleparticle particle injection style * Revert "Added description of singleparticle particle injection style" This reverts commit f02d842c935311458024da6e661950742de24f63. * Tried to inject particles only in simulation Box * Added Todo for multiple levels of mesh refinement * Explain todo better * Added x and y_shifts and replaced cascading ifs by bools and continue * Replaced cascading ifs by bools and continue * Replaced TODO by FIXME as reviewer suggested * Made the insidebounds function use box limits as defaults * Fixed identation issue * Fixed identation issue * Fixed identation issue * Added to Docs the default for xmin,xmax and other dirs * Fix missing y and z dirs * Update Source/Initialization/PlasmaInjector.cpp * Fixed PlasmaInjector limits with periodic condition * Removed check if 3D because now ylims are +/-inf * Restored if to check for y velocity also in 2D/RZ * Fixed Docs to recent changes * Update Source/Initialization/PlasmaInjector.cpp * Fix extra bracket * Added information about RZ geometry for openPMD external file * Fix to issue without periodic boundaries * Added variable rz_take_absolute, to allow to inject x<0 particles in RZ * Fix to declaration of addplasmafromfile rz_take_absolute * Fix to declaration of addplasmafromfile rz_take_absolute * Fixed documentation to include rz_take_absolute option * Fix merging conflict * Final fix to xmax=inf in RZ * In RZ particles are injected in x,y,z * Fixed remaining rz_take_absolute * Converted (x,y,z) to (r,0,z) * Fixed bounds limits (r,z) but injection is in 3D * Re-fix to insideBounds() * AMReX assert of periodic in RZ * Removed Assert -> went to PR 1115 by @dpgrote * Fixed issues pointed out by reviewer @dpgrote * Undo changes for future PR * Undo changes for future PR
Diffstat (limited to '')
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 12e18e4f4..88498b954 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -239,7 +239,7 @@ PhysicalParticleContainer::AddGaussianBeam (
npart /= 4;
}
for (long i = 0; i < npart; ++i) {
-#if (defined WARPX_DIM_3D) || (WARPX_DIM_RZ)
+#if (defined WARPX_DIM_3D) || (defined WARPX_DIM_RZ)
const Real weight = q_tot/(npart*charge);
const Real x = distx(mt);
const Real y = disty(mt);
@@ -328,7 +328,7 @@ PhysicalParticleContainer::AddPlasmaFromFile(ParticleReal q_tot,
double const momentum_unit_x = ps["momentum"]["x"].unitSI();
std::shared_ptr<ParticleReal> ptr_uz = ps["momentum"]["z"].loadChunk<ParticleReal>();
double const momentum_unit_z = ps["momentum"]["z"].unitSI();
-# ifdef WARPX_DIM_3D
+# ifndef WARPX_DIM_XZ
std::shared_ptr<ParticleReal> ptr_y = ps["position"]["y"].loadChunk<ParticleReal>();
double const position_unit_y = ps["position"]["y"].unitSI();
# endif
@@ -361,10 +361,10 @@ PhysicalParticleContainer::AddPlasmaFromFile(ParticleReal q_tot,
for (auto i = decltype(npart){0}; i<npart; ++i){
ParticleReal const x = ptr_x.get()[i]*position_unit_x;
ParticleReal const z = ptr_z.get()[i]*position_unit_z+z_shift;
-# ifndef WARPX_DIM_3D
- ParticleReal const y = 0.0_prt;
-# else
+# if (defined WARPX_DIM_3D) || (defined WARPX_DIM_RZ)
ParticleReal const y = ptr_y.get()[i]*position_unit_y;
+# else
+ ParticleReal const y = 0.0_prt;
# endif
if (plasma_injector->insideBounds(x, y, z)) {
ParticleReal const ux = ptr_ux.get()[i]*momentum_unit_x/PhysConst::m_e;