aboutsummaryrefslogtreecommitdiff
path: root/Source/Initialization/PlasmaInjector.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2019-12-20 06:17:22 -0800
committerGravatar GitHub <noreply@github.com> 2019-12-20 06:17:22 -0800
commit195dcd25bf09feea6769982c17d034a348195e3e (patch)
tree5508be8cc1bbdf226e978bfd39b25735a9e347e0 /Source/Initialization/PlasmaInjector.cpp
parent3bafba4f532c06df8eac1f896415aba9be47f98c (diff)
parentb5385a665eb1f683aea106b067970d675d137484 (diff)
downloadWarpX-195dcd25bf09feea6769982c17d034a348195e3e.tar.gz
WarpX-195dcd25bf09feea6769982c17d034a348195e3e.tar.zst
WarpX-195dcd25bf09feea6769982c17d034a348195e3e.zip
Merge pull request #524 from cameronjy/dist_directions
MJ and MB Drift Direction Parameters
Diffstat (limited to 'Source/Initialization/PlasmaInjector.cpp')
-rw-r--r--Source/Initialization/PlasmaInjector.cpp38
1 files changed, 28 insertions, 10 deletions
diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp
index 261a14fc5..f7c7e498f 100644
--- a/Source/Initialization/PlasmaInjector.cpp
+++ b/Source/Initialization/PlasmaInjector.cpp
@@ -276,17 +276,26 @@ void PlasmaInjector::parseMomentum (ParmParse& pp)
int dir = 0;
std::string direction = "x";
pp.query("beta", beta);
+ if(beta < 0){
+ amrex::Abort("Please enter a positive beta value. Drift direction is set with <s_name>.bulk_vel_dir = 'x' or '+x', '-x', 'y' or '+y', etc.");
+ }
pp.query("theta", theta);
- pp.query("direction", direction);
- if(direction == "x" || direction == "X"){
+ pp.query("bulk_vel_dir", direction);
+ if(direction[0] == '-'){
+ beta = -beta;
+ }
+ if((direction == "x" || direction[1] == 'x') ||
+ (direction == "X" || direction[1] == 'X')){
dir = 0;
- } else if (direction == "y" || direction == "Y"){
+ } else if ((direction == "y" || direction[1] == 'y') ||
+ (direction == "Y" || direction[1] == 'Y')){
dir = 1;
- } else if (direction == "z" || direction == "Z"){
+ } else if ((direction == "z" || direction[1] == 'z') ||
+ (direction == "Z" || direction[1] == 'Z')){
dir = 2;
} else{
std::stringstream stringstream;
- stringstream << "Direction " << direction << " is not recognzied. Please enter x, y, or z.";
+ stringstream << "Cannot interpret <s_name>.bulk_vel_dir input '" << direction << "'. Please enter +/- x, y, or z with no whitespace between the sign and other character.";
direction = stringstream.str();
amrex::Abort(direction.c_str());
}
@@ -298,17 +307,26 @@ void PlasmaInjector::parseMomentum (ParmParse& pp)
int dir = 0;
std::string direction = "x";
pp.query("beta", beta);
+ if(beta < 0){
+ amrex::Abort("Please enter a positive beta value. Drift direction is set with <s_name>.bulk_vel_dir = 'x' or '+x', '-x', 'y' or '+y', etc.");
+ }
pp.query("theta", theta);
- pp.query("direction", direction);
- if(direction == "x" || direction == "X"){
+ pp.query("bulk_vel_dir", direction);
+ if(direction[0] == '-'){
+ beta = -beta;
+ }
+ if((direction == "x" || direction[1] == 'x') ||
+ (direction == "X" || direction[1] == 'X')){
dir = 0;
- } else if (direction == "y" || direction == "Y"){
+ } else if ((direction == "y" || direction[1] == 'y') ||
+ (direction == "Y" || direction[1] == 'Y')){
dir = 1;
- } else if (direction == "z" || direction == "Z"){
+ } else if ((direction == "z" || direction[1] == 'z') ||
+ (direction == "Z" || direction[1] == 'Z')){
dir = 2;
} else{
std::stringstream stringstream;
- stringstream << "Direction " << direction << " is not recognzied. Please enter x, y, or z.";
+ stringstream << "Cannot interpret <s_name>.bulk_vel_dir input '" << direction << "'. Please enter +/- x, y, or z with no whitespace between the sign and other character.";
direction = stringstream.str();
amrex::Abort(direction.c_str());
}