From d4406ac0dfd0e650bc85cbd8b3255f906d5452dd Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Thu, 9 Jan 2020 21:27:29 -0800 Subject: parser for particles in PhysicalParticleContainer --- Source/Particles/WarpXParticleContainer.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'Source/Particles/WarpXParticleContainer.cpp') diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 15a6cff9b..9d5f4bcf4 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -13,6 +13,7 @@ #include #include #include +#include using namespace amrex; @@ -113,6 +114,27 @@ WarpXParticleContainer::WarpXParticleContainer (AmrCore* amr_core, int ispecies) m_xp.resize(num_threads); m_yp.resize(num_threads); m_zp.resize(num_threads); + + + // to delete comment + if (WarpX::B_ext_particle_s == "parse_b_ext_particle_function") { + Bx_particle_parser.reset(new ParserWrapper( + makeParser(WarpX::str_Bx_ext_particle_function))); + By_particle_parser.reset(new ParserWrapper( + makeParser(WarpX::str_By_ext_particle_function))); + Bz_particle_parser.reset(new ParserWrapper( + makeParser(WarpX::str_Bz_ext_particle_function))); + } + + if (WarpX::E_ext_particle_s == "parse_e_ext_particle_function") { + Ex_particle_parser.reset(new ParserWrapper( + makeParser(WarpX::str_Ex_ext_particle_function))); + Ey_particle_parser.reset(new ParserWrapper( + makeParser(WarpX::str_Ey_ext_particle_function))); + Ez_particle_parser.reset(new ParserWrapper( + makeParser(WarpX::str_Ez_ext_particle_function))); + } + } void -- cgit v1.2.3 From acb42c129e67e716e6b0dd917105c5b3dc31da3f Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Thu, 9 Jan 2020 21:34:58 -0800 Subject: cleaning --- Source/Particles/PhysicalParticleContainer.cpp | 18 ++++++++---------- Source/Particles/WarpXParticleContainer.H | 3 +-- Source/Particles/WarpXParticleContainer.cpp | 2 -- Source/WarpX.H | 12 ------------ Source/WarpX.cpp | 3 --- 5 files changed, 9 insertions(+), 29 deletions(-) (limited to 'Source/Particles/WarpXParticleContainer.cpp') diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index b11a8e82b..34b8d6cb4 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1033,7 +1033,6 @@ PhysicalParticleContainer::FieldGather (int lev, // pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]); - // to delete comment if (WarpX::E_ext_particle_s=="parse_e_ext_particle_function") { // Points to particle position Real* const AMREX_RESTRICT xp_data = m_xp[thread_num].dataPtr(); @@ -1042,9 +1041,9 @@ PhysicalParticleContainer::FieldGather (int lev, Real* const AMREX_RESTRICT Exp_data = Exp.dataPtr(); Real* const AMREX_RESTRICT Eyp_data = Eyp.dataPtr(); Real* const AMREX_RESTRICT Ezp_data = Ezp.dataPtr(); - ParserWrapper *xfield_partparser = Ex_particle_parser.get(); - ParserWrapper *yfield_partparser = Ey_particle_parser.get(); - ParserWrapper *zfield_partparser = Ez_particle_parser.get(); + ParserWrapper *xfield_partparser = Ex_particle_parser.get(); + ParserWrapper *yfield_partparser = Ey_particle_parser.get(); + ParserWrapper *zfield_partparser = Ez_particle_parser.get(); amrex::ParallelFor(pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { Real x = xp_data[i]; @@ -1063,9 +1062,9 @@ PhysicalParticleContainer::FieldGather (int lev, Real* const AMREX_RESTRICT Bxp_data = Bxp.dataPtr(); Real* const AMREX_RESTRICT Byp_data = Byp.dataPtr(); Real* const AMREX_RESTRICT Bzp_data = Bzp.dataPtr(); - ParserWrapper *xfield_partparser = Bx_particle_parser.get(); - ParserWrapper *yfield_partparser = By_particle_parser.get(); - ParserWrapper *zfield_partparser = Bz_particle_parser.get(); + ParserWrapper *xfield_partparser = Bx_particle_parser.get(); + ParserWrapper *yfield_partparser = By_particle_parser.get(); + ParserWrapper *zfield_partparser = Bz_particle_parser.get(); amrex::ParallelFor(pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { Real x = xp_data[i]; @@ -1076,7 +1075,7 @@ PhysicalParticleContainer::FieldGather (int lev, Bzp_data[i] = zfield_partparser->getField(x,y,z); }); } - + // // Field Gather @@ -1225,7 +1224,7 @@ PhysicalParticleContainer::Evolve (int lev, // copy data from particle container to temp arrays // pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]); - // to delete comment + if (WarpX::E_ext_particle_s=="parse_e_ext_particle_function") { // Points to particle position Real* const AMREX_RESTRICT xp_data = m_xp[thread_num].dataPtr(); @@ -1933,7 +1932,6 @@ PhysicalParticleContainer::PushP (int lev, Real dt, // pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]); - // to delete comment if (WarpX::E_ext_particle_s=="parse_e_ext_particle_function") { // Points to particle position Real* const AMREX_RESTRICT xp_data = m_xp[thread_num].dataPtr(); diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index b80dfb056..14eb1a96f 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -323,7 +323,6 @@ public: //amrex::Real getMass () {return mass;} amrex::ParticleReal getMass () const {return mass;} - // to delete comment // ParserWrapper for B_external on the particle std::unique_ptr Bx_particle_parser; std::unique_ptr By_particle_parser; @@ -332,7 +331,7 @@ public: std::unique_ptr Ex_particle_parser; std::unique_ptr Ey_particle_parser; std::unique_ptr Ez_particle_parser; - + protected: diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 9d5f4bcf4..465539d1a 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -115,8 +115,6 @@ WarpXParticleContainer::WarpXParticleContainer (AmrCore* amr_core, int ispecies) m_yp.resize(num_threads); m_zp.resize(num_threads); - - // to delete comment if (WarpX::B_ext_particle_s == "parse_b_ext_particle_function") { Bx_particle_parser.reset(new ParserWrapper( makeParser(WarpX::str_Bx_ext_particle_function))); diff --git a/Source/WarpX.H b/Source/WarpX.H index 91a815f7c..5818df394 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -92,7 +92,6 @@ public: // Initialization Type for External E and B on grid and particles static std::string B_ext_grid_s; static std::string E_ext_grid_s; - // EB parser for particles -- to delete comment static std::string B_ext_particle_s; static std::string E_ext_particle_s; @@ -114,7 +113,6 @@ public: std::unique_ptr Eyfield_parser; std::unique_ptr Ezfield_parser; - // EV parser for particles -- to delete comment // Parser for B_external on the particle static std::string str_Bx_ext_particle_function; static std::string str_By_ext_particle_function; @@ -124,16 +122,6 @@ public: static std::string str_Ey_ext_particle_function; static std::string str_Ez_ext_particle_function; - // -- to delete comment - // ParserWrapper for B_external on the particle - static std::unique_ptr Bx_particle_parser; - static std::unique_ptr By_particle_parser; - static std::unique_ptr Bz_particle_parser; - // ParserWrapper for E_external on the particle - static std::unique_ptr Ex_particle_parser; - static std::unique_ptr Ey_particle_parser; - static std::unique_ptr Ez_particle_parser; - // Algorithms static long current_deposition_algo; static long charge_deposition_algo; diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index bc0edf979..d9be00df8 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -32,7 +32,6 @@ Vector WarpX::B_external_grid(3, 0.0); std::string WarpX::B_ext_grid_s = "default"; std::string WarpX::E_ext_grid_s = "default"; -//to delete comment std::string WarpX::B_ext_particle_s = "default"; std::string WarpX::E_ext_particle_s = "default"; @@ -45,7 +44,6 @@ std::string WarpX::str_Ex_ext_grid_function; std::string WarpX::str_Ey_ext_grid_function; std::string WarpX::str_Ez_ext_grid_function; -// EV parser for particles -- to delete comment // Parser for B_external on the particle std::string WarpX::str_Bx_ext_particle_function; std::string WarpX::str_By_ext_particle_function; @@ -331,7 +329,6 @@ WarpX::ReadParameters () pp.query("zmax_plasma_to_compute_max_step", zmax_plasma_to_compute_max_step); - // -- to delete comment // default values of E_external_particle and B_external_particle // are used to set the E and B field when "constant" or "parser" // is not explicitly used in the input -- cgit v1.2.3 From 5f9b4aa7d04ab3b945b180ba079b6482db2e9c24 Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Mon, 13 Jan 2020 11:14:17 -0800 Subject: moving E/B parser variables to MultiParticleContainer class. changing input files appropriately. --- .../inputs.3d_test_optical_depth_evolution | 8 +-- Examples/Tests/Larmor/inputs.mr | 4 +- Examples/Tests/particle_pusher/inputs | 8 +-- .../test_const_B_analytical/inputs | 4 +- Source/Particles/MultiParticleContainer.H | 24 +++++++ Source/Particles/MultiParticleContainer.cpp | 79 ++++++++++++++++++++++ Source/Particles/PhysicalParticleContainer.cpp | 53 +++++++-------- .../Particles/RigidInjectedParticleContainer.cpp | 7 -- Source/Particles/WarpXParticleContainer.H | 16 ++--- Source/Particles/WarpXParticleContainer.cpp | 18 ----- Source/WarpX.H | 15 ---- Source/WarpX.cpp | 67 ------------------ 12 files changed, 146 insertions(+), 157 deletions(-) (limited to 'Source/Particles/WarpXParticleContainer.cpp') diff --git a/Examples/Modules/qed/breit_wheeler/inputs.3d_test_optical_depth_evolution b/Examples/Modules/qed/breit_wheeler/inputs.3d_test_optical_depth_evolution index 8e4bcc3d7..0e1b37a00 100644 --- a/Examples/Modules/qed/breit_wheeler/inputs.3d_test_optical_depth_evolution +++ b/Examples/Modules/qed/breit_wheeler/inputs.3d_test_optical_depth_evolution @@ -158,11 +158,11 @@ qed_bw.lookup_table_mode = "dummy_builtin" ################################# ### EXTERNAL E FIELD ### (3e15 * [-0.811107105653813 0.324442842261525 0.486664263392288] ) -warpx.E_ext_particle_init_style = "constant" -warpx.E_external_particle = -2433321316961438 973328526784575 1459992790176863 +particles.E_ext_particle_init_style = "constant" +particles.E_external_particle = -2433321316961438 973328526784575 1459992790176863 #### ### EXTERNAL B FIELD ### (1e7 * [0.28571429 0.42857143 0.85714286] ) -warpx.B_ext_particle_init_style = "constant" -warpx.B_external_particle = 2857142.85714286 4285714.28571428 8571428.57142857 +particles.B_ext_particle_init_style = "constant" +particles.B_external_particle = 2857142.85714286 4285714.28571428 8571428.57142857 #### diff --git a/Examples/Tests/Larmor/inputs.mr b/Examples/Tests/Larmor/inputs.mr index cef5e0735..8b197543c 100644 --- a/Examples/Tests/Larmor/inputs.mr +++ b/Examples/Tests/Larmor/inputs.mr @@ -34,8 +34,8 @@ geometry.prob_hi = 2.0 2.0 warpx.do_pml = 1 warpx.pml_ncell = 10 -warpx.B_ext_particle_init_style = "constant" -warpx.B_external_particle = 0.0 0.00078110417851950768 0.0 +particles.B_ext_particle_init_style = "constant" +particles.B_external_particle = 0.0 0.00078110417851950768 0.0 # Verbosity warpx.verbose = 1 diff --git a/Examples/Tests/particle_pusher/inputs b/Examples/Tests/particle_pusher/inputs index 53376bb21..c61ac72c2 100755 --- a/Examples/Tests/particle_pusher/inputs +++ b/Examples/Tests/particle_pusher/inputs @@ -40,7 +40,7 @@ warpx.plot_raw_fields = 0 # External fields # Ex is set to be Ex = -vy*Bz -warpx.B_ext_particle_init_style = "constant" -warpx.B_external_particle = 0.0 0.0 1.0 -warpx.E_ext_particle_init_style = "constant" -warpx.E_external_particle = -2.994174829214179e+08 0.0 0.0 +particles.B_ext_particle_init_style = "constant" +particles.B_external_particle = 0.0 0.0 1.0 +particles.E_ext_particle_init_style = "constant" +particles.E_external_particle = -2.994174829214179e+08 0.0 0.0 diff --git a/Examples/Tests/radiation_reaction/test_const_B_analytical/inputs b/Examples/Tests/radiation_reaction/test_const_B_analytical/inputs index 03aa89b51..07ae2f17f 100644 --- a/Examples/Tests/radiation_reaction/test_const_B_analytical/inputs +++ b/Examples/Tests/radiation_reaction/test_const_B_analytical/inputs @@ -64,5 +64,5 @@ pos_perp2.single_particle_vel = -958.3148474999095 127.77531299998823 255.550625 pos_perp2.single_particle_weight = 1e-08 pos_perp2.do_classical_radiation_reaction = 1 -warpx.B_ext_particle_init_style = "constant" -warpx.B_external_particle = 917978.2333474257 1376967.350021139 2753934.700042278 +particles.B_ext_particle_init_style = "constant" +particles.B_external_particle = 917978.2333474257 1376967.350021139 2753934.700042278 diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H index 9db129b05..f3ea1825c 100644 --- a/Source/Particles/MultiParticleContainer.H +++ b/Source/Particles/MultiParticleContainer.H @@ -8,6 +8,7 @@ #include #include #include +#include #include #ifdef WARPX_QED @@ -215,6 +216,29 @@ public: IonizationProcess ionization_process; + std::string m_B_ext_particle_s = "default"; + std::string m_E_ext_particle_s = "default"; + // External fields added to particle fields. + amrex::Vector m_B_external_particle; + amrex::Vector m_E_external_particle; + // Parser for B_external on the particle + std::string m_str_Bx_ext_particle_function; + std::string m_str_By_ext_particle_function; + std::string m_str_Bz_ext_particle_function; + // Parser for E_external on the particle + std::string m_str_Ex_ext_particle_function; + std::string m_str_Ey_ext_particle_function; + std::string m_str_Ez_ext_particle_function; + // ParserWrapper for B_external on the particle + std::unique_ptr m_Bx_particle_parser; + std::unique_ptr m_By_particle_parser; + std::unique_ptr m_Bz_particle_parser; + // ParserWrapper for E_external on the particle + std::unique_ptr m_Ex_particle_parser; + std::unique_ptr m_Ey_particle_parser; + std::unique_ptr m_Ez_particle_parser; + + protected: // Particle container types diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index d84bc1afa..78b976209 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -72,6 +72,85 @@ MultiParticleContainer::ReadParameters () { ParmParse pp("particles"); + // allocating and initializing default values of external fields for particles + m_E_external_particle.resize(3); + m_B_external_particle.resize(3); + // initialize E and B fields to 0.0 + for (int idim = 0; idim < 3; ++idim) { + m_E_external_particle[idim] = 0.0; + m_B_external_particle[idim] = 0.0; + } + // default values of E_external_particle and B_external_particle + // are used to set the E and B field when "constant" or "parser" + // is not explicitly used in the input + pp.query("B_ext_particle_init_style", m_B_ext_particle_s); + std::transform(m_B_ext_particle_s.begin(), + m_B_ext_particle_s.end(), + m_B_ext_particle_s.begin(), + ::tolower); + pp.query("E_ext_particle_init_style", m_E_ext_particle_s); + std::transform(m_E_ext_particle_s.begin(), + m_E_ext_particle_s.end(), + m_E_ext_particle_s.begin(), + ::tolower); + // if the input string for B_external on particles is "constant" + // then the values for the external B on particles must + // be provided in the input file. + if (m_B_ext_particle_s == "constant") + pp.getarr("B_external_particle", m_B_external_particle); + + // if the input string for E_external on particles is "constant" + // then the values for the external E on particles must + // be provided in the input file. + if (m_E_ext_particle_s == "constant") + pp.getarr("E_external_particle", m_E_external_particle); + + // if the input string for B_ext_particle_s is + // "parse_b_ext_particle_function" then the mathematical expression + // for the Bx_, By_, Bz_external_particle_function(x,y,z) + // must be provided in the input file. + if (m_B_ext_particle_s == "parse_b_ext_particle_function") { + // store the mathematical expression as string + Store_parserString(pp, "Bx_external_particle_function(x,y,z)", + m_str_Bx_ext_particle_function); + Store_parserString(pp, "By_external_particle_function(x,y,z)", + m_str_By_ext_particle_function); + Store_parserString(pp, "Bz_external_particle_function(x,y,z)", + m_str_Bz_ext_particle_function); + + m_Bx_particle_parser.reset(new ParserWrapper( + makeParser(m_str_Bx_ext_particle_function))); + m_By_particle_parser.reset(new ParserWrapper( + makeParser(m_str_By_ext_particle_function))); + m_Bz_particle_parser.reset(new ParserWrapper( + makeParser(m_str_Bz_ext_particle_function))); + + } + + // if the input string for E_ext_particle_s is + // "parse_e_ext_particle_function" then the mathematical expression + // for the Ex_, Ey_, Ez_external_particle_function(x,y,z) + // must be provided in the input file. + if (m_E_ext_particle_s == "parse_e_ext_particle_function") { + // store the mathematical expression as string + Store_parserString(pp, "Ex_external_particle_function(x,y,z)", + m_str_Ex_ext_particle_function); + Store_parserString(pp, "Ey_external_particle_function(x,y,z)", + m_str_Ey_ext_particle_function); + Store_parserString(pp, "Ez_external_particle_function(x,y,z)", + m_str_Ez_ext_particle_function); + m_Ex_particle_parser.reset(new ParserWrapper( + makeParser(m_str_Ex_ext_particle_function))); + m_Ey_particle_parser.reset(new ParserWrapper( + makeParser(m_str_Ey_ext_particle_function))); + m_Ez_particle_parser.reset(new ParserWrapper( + makeParser(m_str_Ez_ext_particle_function))); + + } + + + + pp.query("nspecies", nspecies); BL_ASSERT(nspecies >= 0); diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index a4a9dbcfc..51448c747 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -972,29 +972,32 @@ PhysicalParticleContainer::AssignExternalFieldOnParticles(WarpXParIter& pti, Gpu::ManagedDeviceVector zp) { const long np = pti.numParticles(); - - if (WarpX::E_ext_particle_s=="constant" || - WarpX::E_ext_particle_s=="default") { - Exp.assign(np,WarpX::E_external_particle[0]); - Eyp.assign(np,WarpX::E_external_particle[1]); - Ezp.assign(np,WarpX::E_external_particle[2]); + /// get WarpX class object + auto & warpx = WarpX::GetInstance(); + /// get MultiParticleContainer class object + auto & mypc = warpx.GetPartContainer(); + if (mypc.m_E_ext_particle_s=="constant" || + mypc.m_E_ext_particle_s=="default") { + Exp.assign(np,mypc.m_E_external_particle[0]); + Eyp.assign(np,mypc.m_E_external_particle[1]); + Ezp.assign(np,mypc.m_E_external_particle[2]); } - if (WarpX::B_ext_particle_s=="constant" || - WarpX::B_ext_particle_s=="default") { - Bxp.assign(np,WarpX::B_external_particle[0]); - Byp.assign(np,WarpX::B_external_particle[1]); - Bzp.assign(np,WarpX::B_external_particle[2]); + if (mypc.m_B_ext_particle_s=="constant" || + mypc.m_B_ext_particle_s=="default") { + Bxp.assign(np,mypc.m_B_external_particle[0]); + Byp.assign(np,mypc.m_B_external_particle[1]); + Bzp.assign(np,mypc.m_B_external_particle[2]); } - if (WarpX::E_ext_particle_s=="parse_e_ext_particle_function") { + if (mypc.m_E_ext_particle_s=="parse_e_ext_particle_function") { Real* const AMREX_RESTRICT xp_data = xp.dataPtr(); Real* const AMREX_RESTRICT yp_data = yp.dataPtr(); Real* const AMREX_RESTRICT zp_data = zp.dataPtr(); Real* const AMREX_RESTRICT Exp_data = Exp.dataPtr(); Real* const AMREX_RESTRICT Eyp_data = Eyp.dataPtr(); Real* const AMREX_RESTRICT Ezp_data = Ezp.dataPtr(); - ParserWrapper *xfield_partparser = Ex_particle_parser.get(); - ParserWrapper *yfield_partparser = Ey_particle_parser.get(); - ParserWrapper *zfield_partparser = Ez_particle_parser.get(); + ParserWrapper *xfield_partparser = mypc.m_Ex_particle_parser.get(); + ParserWrapper *yfield_partparser = mypc.m_Ey_particle_parser.get(); + ParserWrapper *zfield_partparser = mypc.m_Ez_particle_parser.get(); amrex::ParallelFor(pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { Exp_data[i] = xfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); @@ -1002,16 +1005,16 @@ PhysicalParticleContainer::AssignExternalFieldOnParticles(WarpXParIter& pti, Ezp_data[i] = zfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); }); } - if (WarpX::B_ext_particle_s=="parse_b_ext_particle_function") { + if (mypc.m_B_ext_particle_s=="parse_b_ext_particle_function") { Real* const AMREX_RESTRICT xp_data = xp.dataPtr(); Real* const AMREX_RESTRICT yp_data = yp.dataPtr(); Real* const AMREX_RESTRICT zp_data = zp.dataPtr(); Real* const AMREX_RESTRICT Bxp_data = Bxp.dataPtr(); Real* const AMREX_RESTRICT Byp_data = Byp.dataPtr(); Real* const AMREX_RESTRICT Bzp_data = Bzp.dataPtr(); - ParserWrapper *xfield_partparser = Bx_particle_parser.get(); - ParserWrapper *yfield_partparser = By_particle_parser.get(); - ParserWrapper *zfield_partparser = Bz_particle_parser.get(); + ParserWrapper *xfield_partparser = mypc.m_Bx_particle_parser.get(); + ParserWrapper *yfield_partparser = mypc.m_By_particle_parser.get(); + ParserWrapper *zfield_partparser = mypc.m_Bz_particle_parser.get(); amrex::ParallelFor(pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { Bxp_data[i] = xfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); @@ -1077,9 +1080,6 @@ PhysicalParticleContainer::FieldGather (int lev, // copy data from particle container to temp arrays // pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]); - //ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp, - // m_xp[thread_num], m_yp[thread_num], - // m_zp[thread_num]); // // Field Gather @@ -1210,9 +1210,6 @@ PhysicalParticleContainer::Evolve (int lev, // copy data from particle container to temp arrays // pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]); - //ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp, - // m_xp[thread_num], m_yp[thread_num], - // m_zp[thread_num]); // Determine which particles deposit/gather in the buffer, and // which particles deposit/gather in the fine patch @@ -1858,10 +1855,6 @@ PhysicalParticleContainer::PushP (int lev, Real dt, // pti.GetPosition(m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]); - //ApplyExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp, - // m_xp[thread_num], m_yp[thread_num], - // m_zp[thread_num]); - int e_is_nodal = Ex.is_nodal() and Ey.is_nodal() and Ez.is_nodal(); FieldGather(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp, &exfab, &eyfab, &ezfab, &bxfab, &byfab, &bzfab, @@ -2226,7 +2219,6 @@ PhysicalParticleContainer::FieldGather (WarpXParIter& pti, AMREX_ALWAYS_ASSERT_WITH_MESSAGE((gather_lev==(lev-1)) || (gather_lev==(lev )), "Gather buffers only work for lev-1"); - // If no particles, do not do anything if (np_to_gather == 0) return; @@ -2236,6 +2228,7 @@ PhysicalParticleContainer::FieldGather (WarpXParIter& pti, m_xp[thread_num], m_yp[thread_num], m_zp[thread_num]); + // Get cell size on gather_lev const std::array& dx = WarpX::CellSize(std::max(gather_lev,0)); diff --git a/Source/Particles/RigidInjectedParticleContainer.cpp b/Source/Particles/RigidInjectedParticleContainer.cpp index bee71fba1..f3b502a0a 100644 --- a/Source/Particles/RigidInjectedParticleContainer.cpp +++ b/Source/Particles/RigidInjectedParticleContainer.cpp @@ -392,13 +392,6 @@ RigidInjectedParticleContainer::PushP (int lev, Real dt, const FArrayBox& byfab = By[pti]; const FArrayBox& bzfab = Bz[pti]; - Exp.assign(np,WarpX::E_external_particle[0]); - Eyp.assign(np,WarpX::E_external_particle[1]); - Ezp.assign(np,WarpX::E_external_particle[2]); - Bxp.assign(np,WarpX::B_external_particle[0]); - Byp.assign(np,WarpX::B_external_particle[1]); - Bzp.assign(np,WarpX::B_external_particle[2]); - // // copy data from particle container to temp arrays // diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index 14eb1a96f..39ce1dcda 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -323,14 +323,14 @@ public: //amrex::Real getMass () {return mass;} amrex::ParticleReal getMass () const {return mass;} - // ParserWrapper for B_external on the particle - std::unique_ptr Bx_particle_parser; - std::unique_ptr By_particle_parser; - std::unique_ptr Bz_particle_parser; - // ParserWrapper for E_external on the particle - std::unique_ptr Ex_particle_parser; - std::unique_ptr Ey_particle_parser; - std::unique_ptr Ez_particle_parser; +// // ParserWrapper for B_external on the particle +// std::unique_ptr Bx_particle_parser; +// std::unique_ptr By_particle_parser; +// std::unique_ptr Bz_particle_parser; +// // ParserWrapper for E_external on the particle +// std::unique_ptr Ex_particle_parser; +// std::unique_ptr Ey_particle_parser; +// std::unique_ptr Ez_particle_parser; protected: diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 465539d1a..9fe331f13 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -115,24 +115,6 @@ WarpXParticleContainer::WarpXParticleContainer (AmrCore* amr_core, int ispecies) m_yp.resize(num_threads); m_zp.resize(num_threads); - if (WarpX::B_ext_particle_s == "parse_b_ext_particle_function") { - Bx_particle_parser.reset(new ParserWrapper( - makeParser(WarpX::str_Bx_ext_particle_function))); - By_particle_parser.reset(new ParserWrapper( - makeParser(WarpX::str_By_ext_particle_function))); - Bz_particle_parser.reset(new ParserWrapper( - makeParser(WarpX::str_Bz_ext_particle_function))); - } - - if (WarpX::E_ext_particle_s == "parse_e_ext_particle_function") { - Ex_particle_parser.reset(new ParserWrapper( - makeParser(WarpX::str_Ex_ext_particle_function))); - Ey_particle_parser.reset(new ParserWrapper( - makeParser(WarpX::str_Ey_ext_particle_function))); - Ez_particle_parser.reset(new ParserWrapper( - makeParser(WarpX::str_Ez_ext_particle_function))); - } - } void diff --git a/Source/WarpX.H b/Source/WarpX.H index 5818df394..9b0110ea8 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -81,10 +81,6 @@ public: static void GotoNextLine (std::istream& is); - // External fields added to particle fields. - static amrex::Vector B_external_particle; - static amrex::Vector E_external_particle; - // Initial field on the grid. static amrex::Vector E_external_grid; static amrex::Vector B_external_grid; @@ -92,8 +88,6 @@ public: // Initialization Type for External E and B on grid and particles static std::string B_ext_grid_s; static std::string E_ext_grid_s; - static std::string B_ext_particle_s; - static std::string E_ext_particle_s; // Parser for B_external on the grid static std::string str_Bx_ext_grid_function; @@ -113,15 +107,6 @@ public: std::unique_ptr Eyfield_parser; std::unique_ptr Ezfield_parser; - // Parser for B_external on the particle - static std::string str_Bx_ext_particle_function; - static std::string str_By_ext_particle_function; - static std::string str_Bz_ext_particle_function; - // Parser for E_external on the particle - static std::string str_Ex_ext_particle_function; - static std::string str_Ey_ext_particle_function; - static std::string str_Ez_ext_particle_function; - // Algorithms static long current_deposition_algo; static long charge_deposition_algo; diff --git a/Source/WarpX.cpp b/Source/WarpX.cpp index 45ad16b58..07ea8c1af 100644 --- a/Source/WarpX.cpp +++ b/Source/WarpX.cpp @@ -24,16 +24,11 @@ using namespace amrex; -Vector WarpX::B_external_particle(3, 0.0); -Vector WarpX::E_external_particle(3, 0.0); - Vector WarpX::E_external_grid(3, 0.0); Vector WarpX::B_external_grid(3, 0.0); std::string WarpX::B_ext_grid_s = "default"; std::string WarpX::E_ext_grid_s = "default"; -std::string WarpX::B_ext_particle_s = "default"; -std::string WarpX::E_ext_particle_s = "default"; // Parser for B_external on the grid std::string WarpX::str_Bx_ext_grid_function; @@ -44,15 +39,6 @@ std::string WarpX::str_Ex_ext_grid_function; std::string WarpX::str_Ey_ext_grid_function; std::string WarpX::str_Ez_ext_grid_function; -// Parser for B_external on the particle -std::string WarpX::str_Bx_ext_particle_function; -std::string WarpX::str_By_ext_particle_function; -std::string WarpX::str_Bz_ext_particle_function; -// Parser for E_external on the particle -std::string WarpX::str_Ex_ext_particle_function; -std::string WarpX::str_Ey_ext_particle_function; -std::string WarpX::str_Ez_ext_particle_function; - int WarpX::do_moving_window = 0; int WarpX::moving_window_dir = -1; Real WarpX::moving_window_v = std::numeric_limits::max(); @@ -329,59 +315,6 @@ WarpX::ReadParameters () pp.query("zmax_plasma_to_compute_max_step", zmax_plasma_to_compute_max_step); - // default values of E_external_particle and B_external_particle - // are used to set the E and B field when "constant" or "parser" - // is not explicitly used in the input - pp.query("B_ext_particle_init_style", B_ext_particle_s); - std::transform(B_ext_particle_s.begin(), - B_ext_particle_s.end(), - B_ext_particle_s.begin(), - ::tolower); - pp.query("E_ext_particle_init_style", E_ext_particle_s); - std::transform(E_ext_particle_s.begin(), - E_ext_particle_s.end(), - E_ext_particle_s.begin(), - ::tolower); - // if the input string for B_external on particles is "constant" - // then the values for the external B on particles must - // be provided in the input file. - if (B_ext_particle_s == "constant") - pp.getarr("B_external_particle", B_external_particle); - - // if the input string for E_external on particles is "constant" - // then the values for the external E on particles must - // be provided in the input file. - if (E_ext_particle_s == "constant") - pp.getarr("E_external_particle", E_external_particle); - - // if the input string for B_ext_particle_s is - // "parse_b_ext_particle_function" then the mathematical expression - // for the Bx_, By_, Bz_external_particle_function(x,y,z) - // must be provided in the input file. - if (B_ext_particle_s == "parse_b_ext_particle_function") { - // store the mathematical expression as string - Store_parserString(pp, "Bx_external_particle_function(x,y,z)", - str_Bx_ext_particle_function); - Store_parserString(pp, "By_external_particle_function(x,y,z)", - str_By_ext_particle_function); - Store_parserString(pp, "Bz_external_particle_function(x,y,z)", - str_Bz_ext_particle_function); - } - - // if the input string for E_ext_particle_s is - // "parse_e_ext_particle_function" then the mathematical expression - // for the Ex_, Ey_, Ez_external_particle_function(x,y,z) - // must be provided in the input file. - if (E_ext_particle_s == "parse_e_ext_particle_function") { - // store the mathematical expression as string - Store_parserString(pp, "Ex_external_particle_function(x,y,z)", - str_Ex_ext_particle_function); - Store_parserString(pp, "Ey_external_particle_function(x,y,z)", - str_Ey_ext_particle_function); - Store_parserString(pp, "Ez_external_particle_function(x,y,z)", - str_Ez_ext_particle_function); - } - pp.query("do_moving_window", do_moving_window); if (do_moving_window) { -- cgit v1.2.3 From 3c8d481997a0a5063fd32b68d907cf1f70b10e8e Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Wed, 15 Jan 2020 12:25:58 -0800 Subject: removing unwanted headers --- Source/Particles/WarpXParticleContainer.H | 1 - Source/Particles/WarpXParticleContainer.cpp | 1 - 2 files changed, 2 deletions(-) (limited to 'Source/Particles/WarpXParticleContainer.cpp') diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index 155228d4e..fa5c586da 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -5,7 +5,6 @@ #include #include -#include #ifdef WARPX_QED #include diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp index 9fe331f13..03e83c5f3 100644 --- a/Source/Particles/WarpXParticleContainer.cpp +++ b/Source/Particles/WarpXParticleContainer.cpp @@ -13,7 +13,6 @@ #include #include #include -#include using namespace amrex; -- cgit v1.2.3