diff options
author | 2021-07-06 15:35:01 -0700 | |
---|---|---|
committer | 2021-07-06 15:35:01 -0700 | |
commit | 0356216f504643a0e33a6932efc5c2cbf9a2abe1 (patch) | |
tree | 73266aaec6dec16bde6349e49e55e1bd9c8bfca5 /Source/Utils/WarpXAlgorithmSelection.cpp | |
parent | 82eec2a5032286c617449ea45a341b72b6f8bed2 (diff) | |
download | WarpX-0356216f504643a0e33a6932efc5c2cbf9a2abe1.tar.gz WarpX-0356216f504643a0e33a6932efc5c2cbf9a2abe1.tar.zst WarpX-0356216f504643a0e33a6932efc5c2cbf9a2abe1.zip |
Reflective particle boundary condition (#1728)
* Added ParticleBoundaries and reflecting boundary conditions
* Added ParticleBoundaries::AllNone
* Allowed different particle boundary conditions on each side of the domain
* Updated the documentation for particle boundaries
* Fix end of line space in Docs/source/running_cpp/parameters.rst
* Updated the reflecting BC to use boundary input group
* Fixes to reflective boundary conditions
* Bug fix in AsStored
* Added particle boundaries regression test particle_boundaries_3d
* Fixed particle_boundaries_3d.json
* Minor updates
* Added algo.particle_shape to test case
* Remove do_pml from test case
Co-authored-by: Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com>
* Need to explicitly turn off pml in CI test
* Re-add include
* Fixed includes
Co-authored-by: Remi Lehe <remi.lehe@normalesup.org>
Co-authored-by: Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com>
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
Diffstat (limited to 'Source/Utils/WarpXAlgorithmSelection.cpp')
-rw-r--r-- | Source/Utils/WarpXAlgorithmSelection.cpp | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/Source/Utils/WarpXAlgorithmSelection.cpp b/Source/Utils/WarpXAlgorithmSelection.cpp index e73d3e30e..e250a92c1 100644 --- a/Source/Utils/WarpXAlgorithmSelection.cpp +++ b/Source/Utils/WarpXAlgorithmSelection.cpp @@ -90,7 +90,7 @@ const std::map<std::string, int> FieldBCType_algo_to_int = { {"default", FieldBoundaryType::PML} }; -const std::map<std::string, int> ParticleBCType_algo_to_int = { +const std::map<std::string, ParticleBoundaryType> ParticleBCType_algo_to_enum = { {"absorbing", ParticleBoundaryType::Absorbing}, {"open", ParticleBoundaryType::Open}, {"reflecting", ParticleBoundaryType::Reflecting}, @@ -161,22 +161,35 @@ GetAlgorithmInteger( amrex::ParmParse& pp, const char* pp_search_key ){ } int -GetBCTypeInteger( std::string BCType, bool field ){ +GetFieldBCTypeInteger( std::string BCType ){ std::transform(BCType.begin(), BCType.end(), BCType.begin(), ::tolower); - std::map<std::string, int> BCType_to_int; + if (FieldBCType_algo_to_int.count(BCType) == 0) { + std::string error_message = "Invalid string for field/particle BC. : " + BCType + "\nThe valid values are : \n"; + for (const auto &valid_pair : FieldBCType_algo_to_int) { + if (valid_pair.first != "default"){ + error_message += " - " + valid_pair.first + "\n"; + } + } + amrex::Abort(error_message); + } + // return FieldBCType_algo_to_int[BCType]; // This operator cannot be used for a const map + return FieldBCType_algo_to_int.at(BCType); +} - if (field) BCType_to_int = FieldBCType_algo_to_int; // set field boundary - else BCType_to_int = ParticleBCType_algo_to_int; // set particle boundary +ParticleBoundaryType +GetParticleBCTypeInteger( std::string BCType ){ + std::transform(BCType.begin(), BCType.end(), BCType.begin(), ::tolower); - if (BCType_to_int.count(BCType) == 0) { - std::string error_message = "Invalid string for field/particle BC. : " + BCType + "\nThe valid values are : \n"; - for (const auto &valid_pair : BCType_to_int) { + if (ParticleBCType_algo_to_enum.count(BCType) == 0) { + std::string error_message = "Invalid string for particle BC. : " + BCType + "\nThe valid values are : \n"; + for (const auto &valid_pair : ParticleBCType_algo_to_enum) { if (valid_pair.first != "default"){ error_message += " - " + valid_pair.first + "\n"; } } amrex::Abort(error_message); } - return BCType_to_int[BCType]; + // return ParticleBCType_algo_to_enum[BCType]; // This operator cannot be used for a const map + return ParticleBCType_algo_to_enum.at(BCType); } |