diff options
Diffstat (limited to 'Source/Particles/Collision')
6 files changed, 53 insertions, 33 deletions
diff --git a/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp b/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp index 1f45062b7..8bc0d6dba 100644 --- a/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp +++ b/Source/Particles/Collision/BackgroundMCC/BackgroundMCCCollision.cpp @@ -5,12 +5,13 @@ * License: BSD-3-Clause-LBNL */ #include "BackgroundMCCCollision.H" + #include "ImpactIonization.H" #include "Particles/ParticleCreation/FilterCopyTransform.H" #include "Particles/ParticleCreation/SmartCopy.H" +#include "Utils/Parser/ParserUtils.H" #include "Utils/TextMsg.H" #include "Utils/ParticleUtils.H" -#include "Utils/WarpXUtil.H" #include "Utils/WarpXProfilerWrapper.H" #include "WarpX.H" @@ -29,36 +30,42 @@ BackgroundMCCCollision::BackgroundMCCCollision (std::string const collision_name amrex::ParmParse pp_collision_name(collision_name); amrex::ParticleReal background_density = 0; - if (queryWithParser(pp_collision_name, "background_density", background_density)) { + if (utils::parser::queryWithParser(pp_collision_name, "background_density", background_density)) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( - (background_density > 0), "The background density must be greater than 0." - ); - m_background_density_parser = makeParser(std::to_string(background_density), {"x", "y", "z", "t"}); + (background_density > 0), + "The background density must be greater than 0."); + m_background_density_parser = + utils::parser::makeParser( + std::to_string(background_density), {"x", "y", "z", "t"}); } else { std::string background_density_str; pp_collision_name.get("background_density(x,y,z,t)", background_density_str); - m_background_density_parser = makeParser(background_density_str, {"x", "y", "z", "t"}); + m_background_density_parser = + utils::parser::makeParser(background_density_str, {"x", "y", "z", "t"}); } amrex::ParticleReal background_temperature; - if (queryWithParser(pp_collision_name, "background_temperature", background_temperature)) { + if (utils::parser::queryWithParser(pp_collision_name, "background_temperature", background_temperature)) { WARPX_ALWAYS_ASSERT_WITH_MESSAGE( (background_temperature >= 0), "The background temperature must be positive." ); - m_background_temperature_parser = makeParser(std::to_string(background_temperature), {"x", "y", "z", "t"}); + m_background_temperature_parser = + utils::parser::makeParser(std::to_string(background_temperature), {"x", "y", "z", "t"}); } else { std::string background_temperature_str; pp_collision_name.get("background_temperature(x,y,z,t)", background_temperature_str); - m_background_temperature_parser = makeParser(background_temperature_str, {"x", "y", "z", "t"}); + m_background_temperature_parser = + utils::parser::makeParser(background_temperature_str, {"x", "y", "z", "t"}); } // compile parsers for background density and temperature m_background_density_func = m_background_density_parser.compile<4>(); m_background_temperature_func = m_background_temperature_parser.compile<4>(); - queryWithParser(pp_collision_name, "max_background_density", m_max_background_density); + utils::parser::queryWithParser( + pp_collision_name, "max_background_density", m_max_background_density); // if the background density is constant we can use that number to calculate // the maximum collision probability, if `max_background_density` was not // specified @@ -75,7 +82,8 @@ BackgroundMCCCollision::BackgroundMCCCollision (std::string const collision_name // will be used. If no neutral mass is specified and ionization is not // included the mass of the colliding species will be used m_background_mass = -1; - queryWithParser(pp_collision_name, "background_mass", m_background_mass); + utils::parser::queryWithParser( + pp_collision_name, "background_mass", m_background_mass); // query for a list of collision processes // these could be elastic, excitation, charge_exchange, back, etc. @@ -95,7 +103,8 @@ BackgroundMCCCollision::BackgroundMCCCollision (std::string const collision_name if (scattering_process.find("excitation") != std::string::npos || scattering_process.find("ionization") != std::string::npos) { std::string kw_energy = scattering_process + "_energy"; - getWithParser(pp_collision_name, kw_energy.c_str(), energy); + utils::parser::getWithParser( + pp_collision_name, kw_energy.c_str(), energy); } MCCProcess process(scattering_process, cross_section_file, energy); diff --git a/Source/Particles/Collision/BackgroundStopping/BackgroundStopping.cpp b/Source/Particles/Collision/BackgroundStopping/BackgroundStopping.cpp index dbfc1b1d4..2f438c8d6 100644 --- a/Source/Particles/Collision/BackgroundStopping/BackgroundStopping.cpp +++ b/Source/Particles/Collision/BackgroundStopping/BackgroundStopping.cpp @@ -5,8 +5,9 @@ * License: BSD-3-Clause-LBNL */ #include "BackgroundStopping.H" + +#include "Utils/Parser/ParserUtils.H" #include "Utils/ParticleUtils.H" -#include "Utils/WarpXUtil.H" #include "Utils/WarpXProfilerWrapper.H" #include "WarpX.H" @@ -35,12 +36,14 @@ BackgroundStopping::BackgroundStopping (std::string const collision_name) amrex::ParticleReal background_density; std::string background_density_str; - if (queryWithParser(pp_collision_name, "background_density", background_density)) { + if (utils::parser::queryWithParser(pp_collision_name, "background_density", background_density)) { AMREX_ALWAYS_ASSERT_WITH_MESSAGE(background_density > 0, "For background stopping, the background density must be greater than 0"); - m_background_density_parser = makeParser(std::to_string(background_density), {"x", "y", "z", "t"}); + m_background_density_parser = + utils::parser::makeParser(std::to_string(background_density), {"x", "y", "z", "t"}); } else if (pp_collision_name.query("background_density(x,y,z,t)", background_density_str)) { - m_background_density_parser = makeParser(background_density_str, {"x", "y", "z", "t"}); + m_background_density_parser = + utils::parser::makeParser(background_density_str, {"x", "y", "z", "t"}); } else { AMREX_ALWAYS_ASSERT_WITH_MESSAGE(false, "For background stopping, the background density must be specified."); @@ -48,12 +51,14 @@ BackgroundStopping::BackgroundStopping (std::string const collision_name) amrex::ParticleReal background_temperature; std::string background_temperature_str; - if (queryWithParser(pp_collision_name, "background_temperature", background_temperature)) { + if (utils::parser::queryWithParser(pp_collision_name, "background_temperature", background_temperature)) { AMREX_ALWAYS_ASSERT_WITH_MESSAGE(background_temperature > 0, "For background stopping, the background temperature must be greater than 0"); - m_background_temperature_parser = makeParser(std::to_string(background_temperature), {"x", "y", "z", "t"}); + m_background_temperature_parser = + utils::parser::makeParser(std::to_string(background_temperature), {"x", "y", "z", "t"}); } else if (pp_collision_name.query("background_temperature(x,y,z,t)", background_temperature_str)) { - m_background_temperature_parser = makeParser(background_temperature_str, {"x", "y", "z", "t"}); + m_background_temperature_parser = + utils::parser::makeParser(background_temperature_str, {"x", "y", "z", "t"}); } else { AMREX_ALWAYS_ASSERT_WITH_MESSAGE(false, "For background stopping, the background temperature must be specified."); @@ -65,10 +70,13 @@ BackgroundStopping::BackgroundStopping (std::string const collision_name) if (m_background_type == BackgroundStoppingType::ELECTRONS) { m_background_mass = PhysConst::m_e; - queryWithParser(pp_collision_name, "background_mass", m_background_mass); + utils::parser::queryWithParser( + pp_collision_name, "background_mass", m_background_mass); } else if (m_background_type == BackgroundStoppingType::IONS) { - getWithParser(pp_collision_name, "background_mass", m_background_mass); - getWithParser(pp_collision_name, "background_charge_state", m_background_charge_state); + utils::parser::getWithParser( + pp_collision_name, "background_mass", m_background_mass); + utils::parser::getWithParser( + pp_collision_name, "background_charge_state", m_background_charge_state); } AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_background_mass > 0, "For background stopping, the background mass must be greater than 0"); diff --git a/Source/Particles/Collision/BinaryCollision/Coulomb/PairWiseCoulombCollisionFunc.H b/Source/Particles/Collision/BinaryCollision/Coulomb/PairWiseCoulombCollisionFunc.H index 0acdc9af8..a1b8979e8 100644 --- a/Source/Particles/Collision/BinaryCollision/Coulomb/PairWiseCoulombCollisionFunc.H +++ b/Source/Particles/Collision/BinaryCollision/Coulomb/PairWiseCoulombCollisionFunc.H @@ -11,7 +11,7 @@ #include "ElasticCollisionPerez.H" #include "Particles/Pusher/GetAndSetPosition.H" #include "Particles/WarpXParticleContainer.H" -#include "Utils/WarpXUtil.H" +#include "Utils/Parser/ParserUtils.H" #include <AMReX_DenseBins.H> #include <AMReX_ParmParse.H> @@ -49,7 +49,8 @@ public: amrex::ParmParse pp_collision_name(collision_name); // default Coulomb log, if < 0, will be computed automatically m_CoulombLog = -1.0_prt; - queryWithParser(pp_collision_name, "CoulombLog", m_CoulombLog); + utils::parser::queryWithParser( + pp_collision_name, "CoulombLog", m_CoulombLog); } /** diff --git a/Source/Particles/Collision/BinaryCollision/NuclearFusion/NuclearFusionFunc.H b/Source/Particles/Collision/BinaryCollision/NuclearFusion/NuclearFusionFunc.H index 391682b46..25624469d 100644 --- a/Source/Particles/Collision/BinaryCollision/NuclearFusion/NuclearFusionFunc.H +++ b/Source/Particles/Collision/BinaryCollision/NuclearFusion/NuclearFusionFunc.H @@ -14,8 +14,8 @@ #include "Particles/Pusher/GetAndSetPosition.H" #include "Particles/MultiParticleContainer.H" #include "Particles/WarpXParticleContainer.H" +#include "Utils/Parser/ParserUtils.H" #include "Utils/TextMsg.H" -#include "Utils/WarpXUtil.H" #include "WarpX.H" #include <AMReX_Algorithm.H> @@ -94,15 +94,17 @@ public: // default fusion multiplier m_fusion_multiplier = 1.0_prt; - queryWithParser(pp_collision_name, "fusion_multiplier", m_fusion_multiplier); + utils::parser::queryWithParser( + pp_collision_name, "fusion_multiplier", m_fusion_multiplier); // default fusion probability threshold m_probability_threshold = 0.02_prt; - queryWithParser(pp_collision_name, "fusion_probability_threshold", - m_probability_threshold); + utils::parser::queryWithParser( + pp_collision_name, "fusion_probability_threshold", m_probability_threshold); // default fusion probability target_value m_probability_target_value = 0.002_prt; - queryWithParser(pp_collision_name, "fusion_probability_target_value", - m_probability_target_value); + utils::parser::queryWithParser( + pp_collision_name, "fusion_probability_target_value", + m_probability_target_value); } /** diff --git a/Source/Particles/Collision/BinaryCollision/ParticleCreationFunc.H b/Source/Particles/Collision/BinaryCollision/ParticleCreationFunc.H index 510c59094..be77ae9e0 100644 --- a/Source/Particles/Collision/BinaryCollision/ParticleCreationFunc.H +++ b/Source/Particles/Collision/BinaryCollision/ParticleCreationFunc.H @@ -15,7 +15,6 @@ #include "Particles/ParticleCreation/SmartCopy.H" #include "Particles/MultiParticleContainer.H" #include "Particles/WarpXParticleContainer.H" -#include "Utils/WarpXUtil.H" #include "WarpX.H" #include <AMReX_DenseBins.H> diff --git a/Source/Particles/Collision/CollisionBase.cpp b/Source/Particles/Collision/CollisionBase.cpp index 948f277c3..08376d6fa 100644 --- a/Source/Particles/Collision/CollisionBase.cpp +++ b/Source/Particles/Collision/CollisionBase.cpp @@ -6,7 +6,7 @@ */ #include "CollisionBase.H" -#include "Utils/WarpXUtil.H" +#include "Utils/Parser/ParserUtils.H" #include <AMReX_ParmParse.H> @@ -19,6 +19,7 @@ CollisionBase::CollisionBase (std::string collision_name) // number of time steps between collisions m_ndt = 1; - queryWithParser(pp_collision_name, "ndt", m_ndt); + utils::parser::queryWithParser( + pp_collision_name, "ndt", m_ndt); } |