From 0dd2d6f892f6c7886c6fd03f50bfa101b6494355 Mon Sep 17 00:00:00 2001 From: "L. Diana Amorim" Date: Fri, 24 Apr 2020 19:24:51 -0700 Subject: Read species distribution from OPMD - part 3 (#883) * Added .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 * Update Source/Particles/PhysicalParticleContainer.cpp Co-Authored-By: Axel Huebl * Update Source/Particles/PhysicalParticleContainer.cpp Co-Authored-By: Axel Huebl * Update Source/Particles/PhysicalParticleContainer.H Co-Authored-By: Axel Huebl * Update Source/Particles/PhysicalParticleContainer.cpp Co-Authored-By: Axel Huebl * 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 * Correct for new type of npart Co-Authored-By: Axel Huebl * 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 to 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 --- Source/Initialization/PlasmaInjector.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'Source/Initialization/PlasmaInjector.cpp') 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); + } } } -- cgit v1.2.3