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. --- Source/Particles/MultiParticleContainer.cpp | 79 +++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) (limited to 'Source/Particles/MultiParticleContainer.cpp') 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); -- cgit v1.2.3 From 314155c64214c4b37d66e6fe4b668143920dd6cf Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Mon, 13 Jan 2020 11:16:07 -0800 Subject: EOL whitespace --- Source/Particles/MultiParticleContainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Particles/MultiParticleContainer.cpp') diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 78b976209..0fd81e698 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -124,7 +124,7 @@ MultiParticleContainer::ReadParameters () 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 @@ -147,7 +147,7 @@ MultiParticleContainer::ReadParameters () makeParser(m_str_Ez_ext_particle_function))); } - + -- cgit v1.2.3 From eb6089d8ad31c0fa34acc9592f4fc0f9fe7099fb Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Tue, 14 Jan 2020 11:37:49 -0800 Subject: adding time as an independent variable for parser function (x,y,z,t) --- Source/Initialization/InjectorDensity.cpp | 4 ++-- Source/Initialization/InjectorMomentum.cpp | 4 ++-- Source/Initialization/WarpXInitData.cpp | 4 ++-- Source/Parser/GpuParser.H | 14 ++++++++++---- Source/Parser/GpuParser.cpp | 4 ++++ Source/Parser/WarpXParserWrapper.H | 2 +- Source/Parser/wp_parser_c.h | 2 +- Source/Particles/MultiParticleContainer.cpp | 12 ++++++------ Source/Particles/PhysicalParticleContainer.H | 2 +- Source/Particles/PhysicalParticleContainer.cpp | 26 ++++++++++++++------------ Source/Utils/WarpXMovingWindow.cpp | 2 +- Source/Utils/WarpXUtil.cpp | 3 ++- 12 files changed, 46 insertions(+), 33 deletions(-) (limited to 'Source/Particles/MultiParticleContainer.cpp') diff --git a/Source/Initialization/InjectorDensity.cpp b/Source/Initialization/InjectorDensity.cpp index 9f711a7af..fa54b342c 100644 --- a/Source/Initialization/InjectorDensity.cpp +++ b/Source/Initialization/InjectorDensity.cpp @@ -36,8 +36,8 @@ InjectorDensity::sharedMemoryNeeded () const noexcept case Type::parser: { // For parser injector, the 3D position of each particle - // is stored in shared memory. - return amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 3; + // and time, t, is stored in shared memory. + return amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 4; } default: return 0; diff --git a/Source/Initialization/InjectorMomentum.cpp b/Source/Initialization/InjectorMomentum.cpp index 8fadf0c4b..255883a34 100644 --- a/Source/Initialization/InjectorMomentum.cpp +++ b/Source/Initialization/InjectorMomentum.cpp @@ -30,9 +30,9 @@ InjectorMomentum::sharedMemoryNeeded () const noexcept { case Type::parser: { - // For parser injector, the 3D position of each particle + // For parser injector, the 3D position of each particle and time, t, // is stored in shared memory. - return amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 3; + return amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 4; } default: return 0; diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index be29a1cbc..48c30ae93 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -535,8 +535,8 @@ WarpX::InitializeExternalFieldsOnGridUsingParser ( mfzfab(i,j,k) = zfield_parser->getField(x,y,z); }, /* To allocate shared memory for the GPU threads. */ - /* But, for now only 3 doubles (x,y,z) are allocated. */ - amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 3 + /* But, for now only 4 doubles (x,y,z,t) are allocated. */ + amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 4 ); } diff --git a/Source/Parser/GpuParser.H b/Source/Parser/GpuParser.H index c158ee314..ff855d275 100644 --- a/Source/Parser/GpuParser.H +++ b/Source/Parser/GpuParser.H @@ -17,7 +17,7 @@ public: AMREX_GPU_HOST_DEVICE amrex::Real - operator() (amrex::Real x, amrex::Real y, amrex::Real z) const noexcept + operator() (amrex::Real x, amrex::Real y, amrex::Real z, amrex::Real t=0.0) const noexcept { #ifdef AMREX_USE_GPU @@ -27,15 +27,17 @@ public: amrex::Gpu::SharedMemory gsm; amrex::Real* p = gsm.dataPtr(); int tid = threadIdx.x + threadIdx.y*blockDim.x + threadIdx.z*(blockDim.x*blockDim.y); - p[tid*3] = x; - p[tid*3+1] = y; - p[tid*3+2] = z; + p[tid*4] = x; + p[tid*4+1] = y; + p[tid*4+2] = z; + p[tid*4+3] = t; return wp_ast_eval(m_gpu_parser.ast); #else // WarpX compiled for GPU, function compiled for __host__ m_var.x = x; m_var.y = y; m_var.z = z; + m_t = t; return wp_ast_eval(m_cpu_parser.ast); #endif @@ -49,10 +51,12 @@ public: m_var[tid].x = x; m_var[tid].y = y; m_var[tid].z = z; + m_t[tid] = t; return wp_ast_eval(m_parser[tid]->ast); #endif } + private: #ifdef AMREX_USE_GPU @@ -61,10 +65,12 @@ private: // Copy of the parser running on __host__ struct wp_parser m_cpu_parser; mutable amrex::XDim3 m_var; + mutable amrex::Real m_t; #else // Only one parser struct wp_parser** m_parser; mutable amrex::XDim3* m_var; + mutable amrex::Real* m_t; int nthreads; #endif }; diff --git a/Source/Parser/GpuParser.cpp b/Source/Parser/GpuParser.cpp index 5078b498b..ba904666b 100644 --- a/Source/Parser/GpuParser.cpp +++ b/Source/Parser/GpuParser.cpp @@ -16,6 +16,7 @@ GpuParser::GpuParser (WarpXParser const& wp) wp_parser_regvar_gpu(&m_gpu_parser, "x", 0); wp_parser_regvar_gpu(&m_gpu_parser, "y", 1); wp_parser_regvar_gpu(&m_gpu_parser, "z", 2); + wp_parser_regvar_gpu(&m_gpu_parser, "t", 3); // Initialize CPU parser: allocate memory in CUDA managed memory, // copy all data needed on CPU to m_cpu_parser @@ -28,6 +29,7 @@ GpuParser::GpuParser (WarpXParser const& wp) wp_parser_regvar(&m_cpu_parser, "x", &(m_var.x)); wp_parser_regvar(&m_cpu_parser, "y", &(m_var.y)); wp_parser_regvar(&m_cpu_parser, "z", &(m_var.z)); + wp_parser_regvar(&m_cpu_parser, "t", &(m_t)); #else // not defined AMREX_USE_GPU @@ -39,6 +41,7 @@ GpuParser::GpuParser (WarpXParser const& wp) m_parser = ::new struct wp_parser*[nthreads]; m_var = ::new amrex::XDim3[nthreads]; + m_t = ::new amrex::Real[nthreads]; for (int tid = 0; tid < nthreads; ++tid) { @@ -50,6 +53,7 @@ GpuParser::GpuParser (WarpXParser const& wp) wp_parser_regvar(m_parser[tid], "x", &(m_var[tid].x)); wp_parser_regvar(m_parser[tid], "y", &(m_var[tid].y)); wp_parser_regvar(m_parser[tid], "z", &(m_var[tid].z)); + wp_parser_regvar(m_parser[tid], "t", &(m_t[tid])); } #endif // AMREX_USE_GPU diff --git a/Source/Parser/WarpXParserWrapper.H b/Source/Parser/WarpXParserWrapper.H index 2dd7f72c7..2a355e749 100644 --- a/Source/Parser/WarpXParserWrapper.H +++ b/Source/Parser/WarpXParserWrapper.H @@ -24,7 +24,7 @@ struct ParserWrapper AMREX_GPU_HOST_DEVICE amrex::Real - getField (amrex::Real x, amrex::Real y, amrex::Real z) const noexcept + getField (amrex::Real x, amrex::Real y, amrex::Real z, amrex::Real t=0.0) const noexcept { return m_parser(x,y,z); } diff --git a/Source/Parser/wp_parser_c.h b/Source/Parser/wp_parser_c.h index 970d6b355..2cf0e2c00 100644 --- a/Source/Parser/wp_parser_c.h +++ b/Source/Parser/wp_parser_c.h @@ -30,7 +30,7 @@ wp_ast_eval (struct wp_node* node) #ifdef AMREX_DEVICE_COMPILE extern __shared__ amrex_real extern_xyz[]; int tid = threadIdx.x + threadIdx.y*blockDim.x + threadIdx.z*(blockDim.x*blockDim.y); - amrex_real* x = extern_xyz + tid*3; + amrex_real* x = extern_xyz + tid*4; // parser assumes 4 independent variables (x,y,z,t) #endif switch (node->type) diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 0fd81e698..c99bd3c5b 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -111,11 +111,11 @@ MultiParticleContainer::ReadParameters () // 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)", + Store_parserString(pp, "Bx_external_particle_function(x,y,z,t)", m_str_Bx_ext_particle_function); - Store_parserString(pp, "By_external_particle_function(x,y,z)", + Store_parserString(pp, "By_external_particle_function(x,y,z,t)", m_str_By_ext_particle_function); - Store_parserString(pp, "Bz_external_particle_function(x,y,z)", + Store_parserString(pp, "Bz_external_particle_function(x,y,z,t)", m_str_Bz_ext_particle_function); m_Bx_particle_parser.reset(new ParserWrapper( @@ -133,11 +133,11 @@ MultiParticleContainer::ReadParameters () // 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)", + Store_parserString(pp, "Ex_external_particle_function(x,y,z,t)", m_str_Ex_ext_particle_function); - Store_parserString(pp, "Ey_external_particle_function(x,y,z)", + Store_parserString(pp, "Ey_external_particle_function(x,y,z,t)", m_str_Ey_ext_particle_function); - Store_parserString(pp, "Ez_external_particle_function(x,y,z)", + Store_parserString(pp, "Ez_external_particle_function(x,y,z,t)", m_str_Ez_ext_particle_function); m_Ex_particle_parser.reset(new ParserWrapper( makeParser(m_str_Ex_ext_particle_function))); diff --git a/Source/Particles/PhysicalParticleContainer.H b/Source/Particles/PhysicalParticleContainer.H index 147b632eb..8867778f7 100644 --- a/Source/Particles/PhysicalParticleContainer.H +++ b/Source/Particles/PhysicalParticleContainer.H @@ -64,7 +64,7 @@ public: RealVector& Byp, RealVector& Bzp, amrex::Gpu::ManagedDeviceVector xp, amrex::Gpu::ManagedDeviceVector yp, - amrex::Gpu::ManagedDeviceVector zp); + amrex::Gpu::ManagedDeviceVector zp, int lev); virtual void FieldGather (int lev, const amrex::MultiFab& Ex, diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index d4de7bb53..5b80ed2d9 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -969,7 +969,7 @@ PhysicalParticleContainer::AssignExternalFieldOnParticles(WarpXParIter& pti, RealVector& Bxp, RealVector& Byp, RealVector& Bzp, Gpu::ManagedDeviceVector xp, Gpu::ManagedDeviceVector yp, - Gpu::ManagedDeviceVector zp) + Gpu::ManagedDeviceVector zp, int lev) { const long np = pti.numParticles(); /// get WarpX class object @@ -998,15 +998,16 @@ PhysicalParticleContainer::AssignExternalFieldOnParticles(WarpXParIter& pti, 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(); + Real time = warpx.gett_new(lev); amrex::ParallelFor(pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { - Exp_data[i] = xfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); - Eyp_data[i] = yfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); - Ezp_data[i] = zfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); + Exp_data[i] = xfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i],time); + Eyp_data[i] = yfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i],time); + Ezp_data[i] = zfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i],time); }, /* To allocate shared memory for the GPU threads. */ - /* But, for now only 3 doubles (x,y,z) are allocated. */ - amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 3 + /* But, for now only 3 doubles (x,y,z,t) are allocated. */ + amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 4 ); } if (mypc.m_B_ext_particle_s=="parse_b_ext_particle_function") { @@ -1019,15 +1020,16 @@ PhysicalParticleContainer::AssignExternalFieldOnParticles(WarpXParIter& pti, 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(); + Real time = warpx.gett_new(lev); amrex::ParallelFor(pti.numParticles(), [=] AMREX_GPU_DEVICE (long i) { - Bxp_data[i] = xfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); - Byp_data[i] = yfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); - Bzp_data[i] = zfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i]); + Bxp_data[i] = xfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i],time); + Byp_data[i] = yfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i],time); + Bzp_data[i] = zfield_partparser->getField(xp_data[i],yp_data[i],zp_data[i],time); }, /* To allocate shared memory for the GPU threads. */ - /* But, for now only 3 doubles (x,y,z) are allocated. */ - amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 3 + /* But, for now only 4 doubles (x,y,z,t) are allocated. */ + amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double) * 4 ); } @@ -2234,7 +2236,7 @@ PhysicalParticleContainer::FieldGather (WarpXParIter& pti, // gathering fields from the grid to the particles. AssignExternalFieldOnParticles(pti, Exp, Eyp, Ezp, Bxp, Byp, Bzp, m_xp[thread_num], m_yp[thread_num], - m_zp[thread_num]); + m_zp[thread_num], lev); // Get cell size on gather_lev diff --git a/Source/Utils/WarpXMovingWindow.cpp b/Source/Utils/WarpXMovingWindow.cpp index e05a64bfe..91dd4e2ca 100644 --- a/Source/Utils/WarpXMovingWindow.cpp +++ b/Source/Utils/WarpXMovingWindow.cpp @@ -309,7 +309,7 @@ WarpX::shiftMF (MultiFab& mf, const Geometry& geom, int num_shift, int dir, #endif srcfab(i,j,k,n) = field_parser->getField(x,y,z); } - , amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double)*3 + , amrex::Gpu::numThreadsPerBlockParallelFor() * sizeof(double)*4 ); } diff --git a/Source/Utils/WarpXUtil.cpp b/Source/Utils/WarpXUtil.cpp index e9fb958fd..a154e93df 100644 --- a/Source/Utils/WarpXUtil.cpp +++ b/Source/Utils/WarpXUtil.cpp @@ -185,12 +185,13 @@ void Store_parserString(amrex::ParmParse& pp, std::string query_string, WarpXParser makeParser (std::string const& parse_function) { WarpXParser parser(parse_function); - parser.registerVariables({"x","y","z"}); + parser.registerVariables({"x","y","z","t"}); ParmParse pp("my_constants"); std::set symbols = parser.symbols(); symbols.erase("x"); symbols.erase("y"); symbols.erase("z"); + symbols.erase("t"); for (auto it = symbols.begin(); it != symbols.end(); ) { Real v; if (pp.query(it->c_str(), v)) { -- cgit v1.2.3 From 262de3a369647eac5820c79b010e94865b280db8 Mon Sep 17 00:00:00 2001 From: RevathiJambunathan Date: Wed, 15 Jan 2020 12:15:34 -0800 Subject: changes as suggested in review. --- Source/Particles/MultiParticleContainer.H | 8 ------- Source/Particles/MultiParticleContainer.cpp | 32 ++++++++++++++++---------- Source/Particles/PhysicalParticleContainer.H | 5 ++-- Source/Particles/PhysicalParticleContainer.cpp | 5 ---- Source/Particles/WarpXParticleContainer.H | 10 -------- Source/WarpX.H | 2 +- 6 files changed, 24 insertions(+), 38 deletions(-) (limited to 'Source/Particles/MultiParticleContainer.cpp') diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H index f3ea1825c..ed1c2f371 100644 --- a/Source/Particles/MultiParticleContainer.H +++ b/Source/Particles/MultiParticleContainer.H @@ -221,14 +221,6 @@ public: // 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; diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index c99bd3c5b..ab836ce9d 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -111,19 +111,23 @@ MultiParticleContainer::ReadParameters () // must be provided in the input file. if (m_B_ext_particle_s == "parse_b_ext_particle_function") { // store the mathematical expression as string + std::string str_Bx_ext_particle_function; + std::string str_By_ext_particle_function; + std::string str_Bz_ext_particle_function; Store_parserString(pp, "Bx_external_particle_function(x,y,z,t)", - m_str_Bx_ext_particle_function); + str_Bx_ext_particle_function); Store_parserString(pp, "By_external_particle_function(x,y,z,t)", - m_str_By_ext_particle_function); + str_By_ext_particle_function); Store_parserString(pp, "Bz_external_particle_function(x,y,z,t)", - m_str_Bz_ext_particle_function); + str_Bz_ext_particle_function); + // Parser for B_external on the particle m_Bx_particle_parser.reset(new ParserWrapper( - makeParser(m_str_Bx_ext_particle_function))); + makeParser(str_Bx_ext_particle_function))); m_By_particle_parser.reset(new ParserWrapper( - makeParser(m_str_By_ext_particle_function))); + makeParser(str_By_ext_particle_function))); m_Bz_particle_parser.reset(new ParserWrapper( - makeParser(m_str_Bz_ext_particle_function))); + makeParser(str_Bz_ext_particle_function))); } @@ -133,18 +137,22 @@ MultiParticleContainer::ReadParameters () // must be provided in the input file. if (m_E_ext_particle_s == "parse_e_ext_particle_function") { // store the mathematical expression as string + std::string str_Ex_ext_particle_function; + std::string str_Ey_ext_particle_function; + std::string str_Ez_ext_particle_function; Store_parserString(pp, "Ex_external_particle_function(x,y,z,t)", - m_str_Ex_ext_particle_function); + str_Ex_ext_particle_function); Store_parserString(pp, "Ey_external_particle_function(x,y,z,t)", - m_str_Ey_ext_particle_function); + str_Ey_ext_particle_function); Store_parserString(pp, "Ez_external_particle_function(x,y,z,t)", - m_str_Ez_ext_particle_function); + str_Ez_ext_particle_function); + // Parser for E_external on the particle m_Ex_particle_parser.reset(new ParserWrapper( - makeParser(m_str_Ex_ext_particle_function))); + makeParser(str_Ex_ext_particle_function))); m_Ey_particle_parser.reset(new ParserWrapper( - makeParser(m_str_Ey_ext_particle_function))); + makeParser(str_Ey_ext_particle_function))); m_Ez_particle_parser.reset(new ParserWrapper( - makeParser(m_str_Ez_ext_particle_function))); + makeParser(str_Ez_ext_particle_function))); } diff --git a/Source/Particles/PhysicalParticleContainer.H b/Source/Particles/PhysicalParticleContainer.H index 8867778f7..74d1a0f62 100644 --- a/Source/Particles/PhysicalParticleContainer.H +++ b/Source/Particles/PhysicalParticleContainer.H @@ -53,8 +53,9 @@ public: * in a mathematical expression. The default value for the E- and B-fields * is (0.0,0.0,0.0). * - * \param Exp-Bzp: fields on particles modified based on external E and B - * \param xp,yp,zp: arrays of particle positions required to compute + * \param[in,out] Exp-Bzp pointer to fields on particles modified based + * on external E and B + * \param[in] xp,yp,zp arrays of particle positions required to compute * mathematical expression for the external fields * using parser. */ diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index c04b3d32a..91cc5fb12 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1218,11 +1218,6 @@ PhysicalParticleContainer::Evolve (int lev, exfab, eyfab, ezfab, bxfab, byfab, bzfab); } - // - // copy data from particle container to temp arrays - // - pti.GetPosition(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 long nfine_current = np; diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H index 39ce1dcda..398334d93 100644 --- a/Source/Particles/WarpXParticleContainer.H +++ b/Source/Particles/WarpXParticleContainer.H @@ -323,16 +323,6 @@ 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; - - protected: std::map particle_comps; diff --git a/Source/WarpX.H b/Source/WarpX.H index ad4fa29b1..ed6233743 100644 --- a/Source/WarpX.H +++ b/Source/WarpX.H @@ -87,7 +87,7 @@ public: static amrex::Vector E_external_grid; static amrex::Vector B_external_grid; - // Initialization Type for External E and B on grid and particles + // Initialization Type for External E and B on grid static std::string B_ext_grid_s; static std::string E_ext_grid_s; -- cgit v1.2.3