aboutsummaryrefslogtreecommitdiff
path: root/Source/Utils/WarpXAlgorithmSelection.cpp
diff options
context:
space:
mode:
authorGravatar Revathi Jambunathan <41089244+RevathiJambunathan@users.noreply.github.com> 2021-03-16 14:36:34 -0700
committerGravatar GitHub <noreply@github.com> 2021-03-16 14:36:34 -0700
commit9cebb7d06fb10405c4422a606ca1e32dace0edbb (patch)
treea9ca8626042621579a43bc24e035dbdafb222fa2 /Source/Utils/WarpXAlgorithmSelection.cpp
parentde6b3be2f01f4879eaa49e50ccb87f93f521e272 (diff)
downloadWarpX-9cebb7d06fb10405c4422a606ca1e32dace0edbb.tar.gz
WarpX-9cebb7d06fb10405c4422a606ca1e32dace0edbb.tar.zst
WarpX-9cebb7d06fb10405c4422a606ca1e32dace0edbb.zip
Boundary input - Periodic (#1730)
* Read boundary and set periodicity, enumerate BC types, added support for periodic * eol * separate particle and field boudnary structs * Update comment for particle struct * the valid values are for field/particle * adding docs * eol * remove warning * add doc only for periodic * typo
Diffstat (limited to 'Source/Utils/WarpXAlgorithmSelection.cpp')
-rw-r--r--Source/Utils/WarpXAlgorithmSelection.cpp39
1 files changed, 38 insertions, 1 deletions
diff --git a/Source/Utils/WarpXAlgorithmSelection.cpp b/Source/Utils/WarpXAlgorithmSelection.cpp
index 76cdb4653..302060b1a 100644
--- a/Source/Utils/WarpXAlgorithmSelection.cpp
+++ b/Source/Utils/WarpXAlgorithmSelection.cpp
@@ -72,7 +72,23 @@ const std::map<std::string, int> MaxwellSolver_medium_algo_to_int = {
const std::map<std::string, int> MacroscopicSolver_algo_to_int = {
{"backwardeuler", MacroscopicSolverAlgo::BackwardEuler},
{"laxwendroff", MacroscopicSolverAlgo::LaxWendroff},
- {"default", MacroscopicSolverAlgo::BackwardEuler},
+ {"default", MacroscopicSolverAlgo::BackwardEuler}
+};
+
+const std::map<std::string, int> FieldBCType_algo_to_int = {
+ {"pec", FieldBoundaryType::PEC},
+ {"periodic", FieldBoundaryType::Periodic},
+ {"pml", FieldBoundaryType::PML},
+ {"pmc", FieldBoundaryType::PMC},
+ {"default", FieldBoundaryType::PEC}
+};
+
+const std::map<std::string, int> ParticleBCType_algo_to_int = {
+ {"absorbing", ParticleBoundaryType::Absorbing},
+ {"open", ParticleBoundaryType::Open},
+ {"reflecting", ParticleBoundaryType::Reflecting},
+ {"periodic", ParticleBoundaryType::Periodic},
+ {"default", ParticleBoundaryType::Absorbing}
};
int
@@ -128,3 +144,24 @@ GetAlgorithmInteger( amrex::ParmParse& pp, const char* pp_search_key ){
// If the input is a valid key, return the value
return algo_to_int[algo];
}
+
+int
+GetBCTypeInteger( std::string BCType, bool field ){
+ std::transform(BCType.begin(), BCType.end(), BCType.begin(), ::tolower);
+
+ std::map<std::string, int> BCType_to_int;
+
+ if (field) BCType_to_int = FieldBCType_algo_to_int; // set field boundary
+ else BCType_to_int = ParticleBCType_algo_to_int; // set particle boundary
+
+ 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 (valid_pair.first != "default"){
+ error_message += " - " + valid_pair.first + "\n";
+ }
+ }
+ amrex::Abort(error_message);
+ }
+ return BCType_to_int[BCType];
+}