From d2340a2f2b52aef91230383cf210d8280e41f12c Mon Sep 17 00:00:00 2001 From: Hannah Klion Date: Wed, 27 Oct 2021 22:50:42 -0700 Subject: Spatially vary velocity (#2491) * initial add of GetVelocity and VelocityProperties * bug fixes and first test implementation * add documentation to parameters.rst * Add error if |beta|>=1 * Check for |beta|>=1 in Juttner as well * update comment on initial_distribution python script * Doxygenization and floats in python Co-authored-by: Axel Huebl * Address comments in review - Add units to analysis_distribution.py constants - Move a comment on VelocityProperties constructor from implementation to header file Co-authored-by: Hannah Klion Co-authored-by: Axel Huebl --- Source/Initialization/PlasmaInjector.cpp | 61 ++++---------------------------- 1 file changed, 7 insertions(+), 54 deletions(-) (limited to 'Source/Initialization/PlasmaInjector.cpp') diff --git a/Source/Initialization/PlasmaInjector.cpp b/Source/Initialization/PlasmaInjector.cpp index fab5d3d58..e6f33ccd5 100644 --- a/Source/Initialization/PlasmaInjector.cpp +++ b/Source/Initialization/PlasmaInjector.cpp @@ -10,6 +10,7 @@ #include "PlasmaInjector.H" #include "Initialization/GetTemperature.H" +#include "Initialization/GetVelocity.H" #include "Initialization/InjectorDensity.H" #include "Initialization/InjectorMomentum.H" #include "Initialization/InjectorPosition.H" @@ -555,67 +556,19 @@ void PlasmaInjector::parseMomentum (amrex::ParmParse& pp) ux_m, uy_m, uz_m, ux_th, uy_th, uz_th, flux_normal_axis, flux_direction)); } else if (mom_dist_s == "maxwell_boltzmann"){ - amrex::Real beta = 0._rt; - int dir = 0; - std::string direction = "x"; h_mom_temp = std::make_unique(pp); GetTemperature getTemp(*h_mom_temp.get()); - queryWithParser(pp, "beta", beta); - if(beta < 0){ - amrex::Abort("Please enter a positive beta value. Drift direction is set with .bulk_vel_dir = 'x' or '+x', '-x', 'y' or '+y', etc."); - } - 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[1] == 'y') || - (direction == "Y" || direction[1] == 'Y')){ - dir = 1; - } else if ((direction == "z" || direction[1] == 'z') || - (direction == "Z" || direction[1] == 'Z')){ - dir = 2; - } else{ - std::stringstream stringstream; - stringstream << "Cannot interpret .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()); - } + h_mom_vel = std::make_unique(pp); + GetVelocity getVel(*h_mom_vel.get()); // Construct InjectorMomentum with InjectorMomentumBoltzmann. - h_inj_mom.reset(new InjectorMomentum((InjectorMomentumBoltzmann*)nullptr, getTemp, beta, dir)); + h_inj_mom.reset(new InjectorMomentum((InjectorMomentumBoltzmann*)nullptr, getTemp, getVel)); } else if (mom_dist_s == "maxwell_juttner"){ - amrex::Real beta = 0._rt; - int dir = 0; h_mom_temp = std::make_unique(pp); GetTemperature getTemp(*h_mom_temp.get()); - std::string direction = "x"; - queryWithParser(pp, "beta", beta); - if(beta < 0){ - amrex::Abort("Please enter a positive beta value. Drift direction is set with .bulk_vel_dir = 'x' or '+x', '-x', 'y' or '+y', etc."); - } - 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[1] == 'y') || - (direction == "Y" || direction[1] == 'Y')){ - dir = 1; - } else if ((direction == "z" || direction[1] == 'z') || - (direction == "Z" || direction[1] == 'Z')){ - dir = 2; - } else{ - std::stringstream stringstream; - stringstream << "Cannot interpret .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()); - } + h_mom_vel = std::make_unique(pp); + GetVelocity getVel(*h_mom_vel.get()); // Construct InjectorMomentum with InjectorMomentumJuttner. - h_inj_mom.reset(new InjectorMomentum((InjectorMomentumJuttner*)nullptr, getTemp, beta, dir)); + h_inj_mom.reset(new InjectorMomentum((InjectorMomentumJuttner*)nullptr, getTemp, getVel)); } else if (mom_dist_s == "radial_expansion") { amrex::Real u_over_r = 0._rt; queryWithParser(pp, "u_over_r", u_over_r); -- cgit v1.2.3