aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/PlasmaInjector.cpp
diff options
context:
space:
mode:
authorGravatar L. Diana Amorim <LDianaAmorim@lbl.gov> 2020-04-24 19:24:51 -0700
committerGravatar GitHub <noreply@github.com> 2020-04-24 19:24:51 -0700
commit0dd2d6f892f6c7886c6fd03f50bfa101b6494355 (patch)
tree7af9c5b36bc77932c7a958bec827a9ba12080639 /Source/Initialization/PlasmaInjector.cpp
parent3ef8e08c65dfd04bc98c8b9238b9f230d4c10cde (diff)
downloadWarpX-0dd2d6f892f6c7886c6fd03f50bfa101b6494355.tar.gz
WarpX-0dd2d6f892f6c7886c6fd03f50bfa101b6494355.tar.zst
WarpX-0dd2d6f892f6c7886c6fd03f50bfa101b6494355.zip
Read species distribution from OPMD - part 3 (#883)
* Added <species>.profile=external_file and .profile_file * Added description of input parameters to Docs * Changed from profile to injection option for external file * Fix typo in amrex abort message (due to copy paste) * Added the OpenPMD use amrex abort message * Minor fix - not sure how to remove EOL issue * Tried to add AddExternalFileBeam functon to PhysicalParticleContainer * Trued to fix EOL white space issue * Added read/print species name from OPMD file * Fixed OpenPMD charge and mass read * Added number of particles in species * Added nparts and converted charge/mass units to SI * Fix to nr of particles * Added q_tot parameter to determine part weight * Added macroparticle's weight * Fixed std::int typo - use only int * Added read x,y and z + ifdef 3D * Added velocity of particles and stored in container * Converted velocities to SI * No need to specfy momentum distribution if external file is used * Update Source/Initialization/PlasmaInjector.cpp Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Particles/PhysicalParticleContainer.cpp Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Particles/PhysicalParticleContainer.cpp Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Particles/PhysicalParticleContainer.H Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja> * Update Source/Particles/PhysicalParticleContainer.cpp Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja> * No need to include openPMD header yet * Fixed const in AddExternalFileBeam * Fix compatibility with read_opmd and read_opmd_2 * Corrected position and charge units/sign * Added Doc note and abort message for RZ * Fix typo and EOL * Minor fixes * Fixed details. Added fix to EOL - testing * Changed to physical_charge and explained it in Docs * Fix header extra openPMD include files * Removed additional debugging comments * Try doxygen again * Fix plasmainjector physical_q_tot * Change apart to auto (not long as in gaussian beam injection style) Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja> * Correct for new type of npart Co-Authored-By: Axel Huebl <axel.huebl@plasma.ninja> * Removed Geant4 renormalization * Read openPMD file and checked its units * Trying to correct momentum information in plotfiles * Compilation error - > SegFault 11 * Added unitSI() to each position/momentum direction. Compilation SegFault * Re-structured code to use only once series.flush() * Commented out amrex::Print() s * Path to fix issue * Update after review * Chanegd <physical_q_tot> to <q_tot> and made it optional * Fixed documentation typo and re-organized it * Added const to npart as per reviewer recommendation * Fixed issue with velocity - which became momentum * Fixed 2D and 3D options + documentation * Implemented fixes from past reviewsand fixed duplicate entry in Docs * Fix auto in iterator in for loop * Added fixes according to reviewer * Revert "Added fixes according to reviewer" This reverts commit 0a485d83c28014c8b6f53a30f26719f23f89bad5. * Fixed IO block and reordered logic with Axel * Fix spaces Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Source/Initialization/PlasmaInjector.cpp')
-rw-r--r--Source/Initialization/PlasmaInjector.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp
index ec2c454e2..e34447411 100644
--- a/Source/Initialization/PlasmaInjector.cpp
+++ b/Source/Initialization/PlasmaInjector.cpp
@@ -229,10 +229,14 @@ PlasmaInjector::PlasmaInjector (int ispecies, const std::string& name)
parseDensity(pp);
parseMomentum(pp);
} else if (part_pos_s == "external_file") {
+#ifdef WARPX_DIM_RZ
+ amrex::Abort("The option of reading particle data from an external "
+ "file has not been implemented nor tested in RZ geometry");
+#endif
#ifdef WARPX_USE_OPENPMD
external_file = true;
- pp.get("injection_file",str_injection_file);
- pp.get("q_tot",q_tot);
+ pp.get("injection_file", str_injection_file);
+ pp.query("q_tot", q_tot);
#else
amrex::Abort("WarpX has to be compiled with USE_OPENPMD=TRUE to be able"
" to read the external openPMD file with species data");
@@ -398,7 +402,12 @@ void PlasmaInjector::parseMomentum (ParmParse& pp)
makeParser(str_momentum_function_uy,{"x","y","z"}),
makeParser(str_momentum_function_uz,{"x","y","z"})));
} else {
- StringParseAbortMessage("Momentum distribution type", mom_dist_s);
+ //No need for momentum definition if external file is used
+ std::string s_inj_style;
+ pp.query("injection_style", s_inj_style);
+ if (s_inj_style != "external_file") {
+ StringParseAbortMessage("Momentum distribution type", mom_dist_s);
+ }
}
}