From 679156e73e537284b97e642ef13f9d784b44f264 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 10:45:35 +0200 Subject: Added dedicated pusher to photons --- Source/Particles/PhotonParticleContainer.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index b4070a773..0e1adc13b 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -22,7 +22,7 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecie // where is the name of your species ParmParse pp(species_name); - // read .size_in_inches in the input file, and + // read .size_in_inches in the input file, and // store it into member data. pp.query("size_in_inches", size_in_inches); @@ -56,13 +56,20 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, auto& Byp = attribs[PIdx::By]; auto& Bzp = attribs[PIdx::Bz]; const long np = pti.numParticles(); - - // Probably want to push photons in some way here. - // PhysicalParticleContainer::PushPX is probably - // a good start. Let's start by writing CPU code. - for (WarpXParIter pti(*this, 0); pti.isValid(); ++pti) - { - } + + // Using new pusher for positions + const amrex_real zero_mass = 0.0; + const amrex_real zero_charge = 0.0; + warpx_particle_pusher_positions(&np, + xp.dataPtr(), + yp.dataPtr(), + zp.dataPtr(), + uxp.dataPtr(), uyp.dataPtr(), uzp.dataPtr(), + giv.dataPtr(), + Exp.dataPtr(), Eyp.dataPtr(), Ezp.dataPtr(), + Bxp.dataPtr(), Byp.dataPtr(), Bzp.dataPtr(), + &zero_charge, &zero_mass, &dt, + &WarpX::particle_pusher_algo); } void @@ -77,7 +84,7 @@ PhotonParticleContainer::Evolve (int lev, Real t, Real dt) { // This does gather, push and depose. - // Push and depose have been re-written for photon, + // Push and depose have been re-written for photon, // so they do not do anything. // Currently, I guess photons do gather fields from the mesh. PhysicalParticleContainer::Evolve (lev, -- cgit v1.2.3 From 81b53da1c52294a642f0d7919a25fa704a6172b7 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 11:20:26 +0200 Subject: now WARPX_QED is defined via makefile --- GNUmakefile | 2 ++ Source/Make.WarpX | 17 ++++++++++++----- Source/Particles/MultiParticleContainer.H | 2 -- Source/Particles/MultiParticleContainer.cpp | 4 ++-- Source/Particles/PhotonParticleContainer.cpp | 7 ++++++- 5 files changed, 22 insertions(+), 10 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/GNUmakefile b/GNUmakefile index 9d7b1c65f..5e4c46628 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -8,6 +8,8 @@ DEBUG = FALSE DIM = 2 #DIM = 3 +QED = TRUE + COMP = gcc #COMP = intel #COMP = pgi diff --git a/Source/Make.WarpX b/Source/Make.WarpX index c1ef54c33..280955665 100644 --- a/Source/Make.WarpX +++ b/Source/Make.WarpX @@ -45,6 +45,13 @@ endif DEFINES += -DWARPX_USE_PY endif +ifeq ($(QED),TRUE) + CXXFLAGS += -DWARPX_QED + CFLAGS += -DWARPX_QED + FFLAGS += -DWARPX_QED + F90FLAGS += -DWARPX_QED +endif + -include Make.package include $(WARPX_HOME)/Source/Make.package include $(WARPX_HOME)/Source/BoundaryConditions/Make.package @@ -98,7 +105,7 @@ ifeq ($(USE_OPENPMD), TRUE) DEFINES += -DWARPX_USE_OPENPMD -DopenPMD_HAVE_MPI=1 LIBRARIES += -lopenPMD -lhdf5 endif - + ifeq ($(USE_PSATD),TRUE) FFTW_HOME ?= NOT_SET @@ -139,7 +146,7 @@ ifeq ($(USE_HDF5),TRUE) endif DEFINES += -DWARPX_USE_HDF5 LIBRARIES += -lhdf5 -lz -endif +endif # job_info support CEXE_sources += AMReX_buildInfo.cpp @@ -186,7 +193,7 @@ else ifdef WarpxBinDir -all: $(executable) +all: $(executable) $(SILENT) $(RM) AMReX_buildInfo.cpp @if [ ! -d $(WarpxBinDir) ]; then mkdir -p $(WarpxBinDir); fi $(SILENT) mv -f $(executable) $(WarpxBinDir)/ @@ -195,7 +202,7 @@ all: $(executable) else -all: $(executable) +all: $(executable) $(SILENT) $(RM) AMReX_buildInfo.cpp @echo SUCCESS @@ -203,7 +210,7 @@ endif endif -AMReX_buildInfo.cpp: +AMReX_buildInfo.cpp: $(AMREX_HOME)/Tools/C_scripts/makebuildinfo_C.py \ --amrex_home "$(AMREX_HOME)" \ --COMP "$(COMP)" --COMP_VERSION "$(COMP_VERSION)" \ diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H index 2754607fd..44e325b84 100644 --- a/Source/Particles/MultiParticleContainer.H +++ b/Source/Particles/MultiParticleContainer.H @@ -22,8 +22,6 @@ // concrete class dervied from WarpXParticlContainer. // -//Enable QED effects -#define WARPX_QED #ifdef WARPX_QED //BW ENGINE diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index c53ddceac..c22e87345 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -75,8 +75,8 @@ MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core) #ifdef WARPX_QED //Add a tau field (optical depth) for all photon species - //for (int i = 0; i < nspecies; ++i) - //allcontainers[i]->AddRealComp("tau"); + for (int i = 0; i < nspecies; ++i) + allcontainers[i]->AddRealComp("tau"); #endif } diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 0e1adc13b..8c8008627 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -26,6 +26,11 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecie // store it into member data. pp.query("size_in_inches", size_in_inches); +#define WARPX_QED +#ifdef WARPX_QED + plot_flags.resize(PIdx::nattribs + 6, 1); +#endif + } void PhotonParticleContainer::InitData() @@ -57,7 +62,7 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, auto& Bzp = attribs[PIdx::Bz]; const long np = pti.numParticles(); - // Using new pusher for positions + // Using new pusher for positions const amrex_real zero_mass = 0.0; const amrex_real zero_charge = 0.0; warpx_particle_pusher_positions(&np, -- cgit v1.2.3 From cf3b3e52e484eca8c5640f65863186ba47137cad Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 11:39:26 +0200 Subject: Moved addition of tau component into PhotonParticleContainer --- Source/Particles/MultiParticleContainer.cpp | 7 ------- Source/Particles/PhotonParticleContainer.cpp | 2 +- 2 files changed, 1 insertion(+), 8 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index c22e87345..d8ccb36c6 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -72,13 +72,6 @@ MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core) pc_tmp->AddRealComp("uyold"); pc_tmp->AddRealComp("uzold"); } - -#ifdef WARPX_QED - //Add a tau field (optical depth) for all photon species - for (int i = 0; i < nspecies; ++i) - allcontainers[i]->AddRealComp("tau"); -#endif - } void diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 8c8008627..b0bbf406a 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -26,8 +26,8 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecie // store it into member data. pp.query("size_in_inches", size_in_inches); -#define WARPX_QED #ifdef WARPX_QED + AddRealComp("tau"); plot_flags.resize(PIdx::nattribs + 6, 1); #endif -- cgit v1.2.3 From eb61eabea96c7fe4dfdbc890053f52f0548d3ed4 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 12:01:13 +0200 Subject: initial work for a function to initialize optical depth --- Source/Particles/PhotonParticleContainer.H | 5 +++++ Source/Particles/PhotonParticleContainer.cpp | 8 ++++++++ 2 files changed, 13 insertions(+) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.H b/Source/Particles/PhotonParticleContainer.H index fbc68f0b0..4c72fe47e 100644 --- a/Source/Particles/PhotonParticleContainer.H +++ b/Source/Particles/PhotonParticleContainer.H @@ -63,6 +63,11 @@ public: int lev, amrex::Real dt ) override {}; + +#ifdef WARPX_QED + virtual void InitOpticalDepth(); +#endif + private: amrex::Real size_in_inches = 1.; diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index b0bbf406a..b440b7990 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -36,6 +36,7 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecie void PhotonParticleContainer::InitData() { AddParticles(0); // Note - add on level 0 + if (maxLevel() > 0) { Redistribute(); // We then redistribute } @@ -102,3 +103,10 @@ PhotonParticleContainer::Evolve (int lev, cBx, cBy, cBz, t, dt); } + + +#ifdef WARPX_QED + void InitOpticalDepth(){ + + } +#endif -- cgit v1.2.3 From c0eb69ccbd7a2523ed82220cacb1b4bbcd83bbcf Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 12:03:02 +0200 Subject: coorected bug --- Source/Particles/PhotonParticleContainer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index b440b7990..b80e597c3 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -106,7 +106,7 @@ PhotonParticleContainer::Evolve (int lev, #ifdef WARPX_QED - void InitOpticalDepth(){ - + void PhysicalParticleContainer::InitOpticalDepth(){ + } #endif -- cgit v1.2.3 From 16a345b0e522f6fdf1bffeb5196b356b0957e326 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 12:27:50 +0200 Subject: corrected bug --- Source/Particles/PhotonParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index b80e597c3..41ad13fc2 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -106,7 +106,7 @@ PhotonParticleContainer::Evolve (int lev, #ifdef WARPX_QED - void PhysicalParticleContainer::InitOpticalDepth(){ + void PhotonParticleContainer::InitOpticalDepth(){ } #endif -- cgit v1.2.3 From e1067378f5d43c11850f4e6518cbfe3a96250889 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 14:37:08 +0200 Subject: Added a wrapper for BW engine --- Source/Particles/MultiParticleContainer.H | 30 +++------------------------- Source/Particles/MultiParticleContainer.cpp | 12 ++++++----- Source/Particles/PhotonParticleContainer.cpp | 4 ++++ Source/QED/Make.package | 5 +++-- Source/QED/amrex_rng_wrapper.cpp | 18 +++++++++++++++++ Source/QED/amrex_rng_wrapper.h | 20 +++++++++++++++++++ Source/QED/amrex_rng_wrapper.hpp | 27 ------------------------- Source/QED/breit_wheeler_engine_wrapper.h | 7 +++---- 8 files changed, 58 insertions(+), 65 deletions(-) create mode 100644 Source/QED/amrex_rng_wrapper.cpp create mode 100644 Source/QED/amrex_rng_wrapper.h delete mode 100644 Source/QED/amrex_rng_wrapper.hpp (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/MultiParticleContainer.H b/Source/Particles/MultiParticleContainer.H index 44e325b84..eb1d2ba75 100644 --- a/Source/Particles/MultiParticleContainer.H +++ b/Source/Particles/MultiParticleContainer.H @@ -22,33 +22,9 @@ // concrete class dervied from WarpXParticlContainer. // - +// #ifdef WARPX_QED -//BW ENGINE -//#define PXRMP_GPU __host__ __device__ -#define PXRMP_WITH_SI_UNITS -#include "breit_wheeler_engine.hpp" -//Alias for the picsar::multi_physics namespace -namespace pxrmp = picsar::multi_physics; - -//RNG wrapper BW engine -class amrex_rng_wrapper -{ -public: - //Get rnd number uniformly distributed in [a,b) - amrex::Real unf(amrex::Real a, amrex::Real b) - { - return (b-a)*amrex::Random() + a; - } - - //Get rnd number with exponential distribution - amrex::Real exp(amrex::Real l) - { - amrex::Real zero_plus_to_one = 1.0 - unf(0.0, 1.0); - return -log(zero_plus_to_one)/l; - } -}; -//___________________________________________ + #include "breit_wheeler_engine_wrapper.h" #endif class MultiParticleContainer @@ -228,7 +204,7 @@ public: //bw_engine is a public member of the MultiParticleContainer object #ifdef WARPX_QED - pxrmp::breit_wheeler_engine bw_engine; + warpx_breit_wheeler_engine bw_engine; #endif protected: diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index d8ccb36c6..92f66c705 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -10,13 +10,15 @@ using namespace amrex; constexpr int MultiParticleContainer::nstencilz_fdtd_nci_corr; -#ifdef WARPX_QED + MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core): - bw_engine{std::move(amrex_rng_wrapper{})}//, default_lambda};//, bw_ctrl}; -#else -MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core) -#endif + bw_engine{std::move(init_warpx_breit_wheeler_engine())} { + +#ifdef WARPX_QED + +#endif + ReadParameters(); allcontainers.resize(nspecies + nlasers); diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 41ad13fc2..9ea448ec8 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -37,6 +37,10 @@ void PhotonParticleContainer::InitData() { AddParticles(0); // Note - add on level 0 +#ifdef WARPX_QED + InitOpticalDepth(); +#endif + if (maxLevel() > 0) { Redistribute(); // We then redistribute } diff --git a/Source/QED/Make.package b/Source/QED/Make.package index 12b007e73..6e38efb9e 100644 --- a/Source/QED/Make.package +++ b/Source/QED/Make.package @@ -1,5 +1,6 @@ -CEXE_headers += WarpXConst.H -CEXE_headers += WarpXUtil.H +CEXE_headers += amrex_rng_wrapper.h +CEXE_headers += breit_wheeler_engine_wrapper.h +CEXE_sources += amrex_rng_wrapper.cpp INCLUDE_LOCATIONS += $(WARPX_HOME)/Source/QED VPATH_LOCATIONS += $(WARPX_HOME)/Source/QED diff --git a/Source/QED/amrex_rng_wrapper.cpp b/Source/QED/amrex_rng_wrapper.cpp new file mode 100644 index 000000000..955144c4c --- /dev/null +++ b/Source/QED/amrex_rng_wrapper.cpp @@ -0,0 +1,18 @@ +//This file provides a wrapper aroud the RNG +//provided by the amrex library + +#include "amrex_rng_wrapper.h" + +//RNG wrapper BW engine +//Get rnd number uniformly distributed in [a,b) +amrex::Real amrex_rng_wrapper::unf(amrex::Real a, amrex::Real b) +{ + return (b-a)*amrex::Random() + a; +} + +//Get rnd number with exponential distribution +amrex::Real amrex_rng_wrapper::exp(amrex::Real l) +{ + amrex::Real zero_plus_to_one = 1.0 - unf(0.0, 1.0); + return -log(zero_plus_to_one)/l; +} diff --git a/Source/QED/amrex_rng_wrapper.h b/Source/QED/amrex_rng_wrapper.h new file mode 100644 index 000000000..f9818c589 --- /dev/null +++ b/Source/QED/amrex_rng_wrapper.h @@ -0,0 +1,20 @@ +#ifndef WARPX_amrex_rng_wrapper_h_ +#define WARPX_rng_wrapper_h_ + +//This file provides a wrapper aroud the RNG +//provided by the amrex library + +#include + +//RNG wrapper BW engine +class amrex_rng_wrapper +{ +public: + //Get rnd number uniformly distributed in [a,b) + amrex::Real unf(amrex::Real a, amrex::Real b); + + //Get rnd number with exponential distribution + amrex::Real exp(amrex::Real l); +}; + +#endif //amrex_rng_wrapper_hpp_ diff --git a/Source/QED/amrex_rng_wrapper.hpp b/Source/QED/amrex_rng_wrapper.hpp deleted file mode 100644 index 25d667df7..000000000 --- a/Source/QED/amrex_rng_wrapper.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef WARPX_amrex_rng_wrapper_hpp_ -#define WARPX_rng_wrapper_hpp_ - -//This file provides a wrapper aroud the RNG -//provided by the amrex library - -#include - -//RNG wrapper BW engine -inline class amrex_rng_wrapper -{ -public: - //Get rnd number uniformly distributed in [a,b) - amrex::Real unf(amrex::Real a, amrex::Real b) - { - return (b-a)*amrex::Random() + a; - } - - //Get rnd number with exponential distribution - amrex::Real exp(amrex::Real l) - { - amrex::Real zero_plus_to_one = 1.0 - unf(0.0, 1.0); - return -log(zero_plus_to_one)/l; - } -}; - -#endif //amrex_rng_wrapper_hpp_ diff --git a/Source/QED/breit_wheeler_engine_wrapper.h b/Source/QED/breit_wheeler_engine_wrapper.h index 17bf4ef69..3bb3ea740 100644 --- a/Source/QED/breit_wheeler_engine_wrapper.h +++ b/Source/QED/breit_wheeler_engine_wrapper.h @@ -9,17 +9,16 @@ #define PXRMP_WITH_SI_UNITS #include "breit_wheeler_engine.hpp" -#include "amrex_rng_wrapper.hpp" +#include "amrex_rng_wrapper.h" using warpx_breit_wheeler_engine = picsar::multi_physics::breit_wheeler_engine; //Helper function to initialize the engine -inline warpx_breit_wheeler_engine&& init_warpx_breit_wheeler_engine(){ - return std::move(warpx_breit_wheeler_engine{std::move{amrex_rng_wrapper{}}}); +inline warpx_breit_wheeler_engine init_warpx_breit_wheeler_engine(){ + return warpx_breit_wheeler_engine{std::move(amrex_rng_wrapper{})}; } //___________________________________________ -#endif #endif //WARPX_breit_wheeler_engine_wrapper_H_ -- cgit v1.2.3 From ffb2c6a10bcfcf8c2b7a617f0d1ddb9fd8666aec Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 15:24:54 +0200 Subject: Added function to initialize the optical depth (still crashing) --- Source/Particles/MultiParticleContainer.cpp | 9 +++++---- Source/Particles/PhotonParticleContainer.H | 8 ++++++-- Source/Particles/PhotonParticleContainer.cpp | 17 ++++++++++------- 3 files changed, 21 insertions(+), 13 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/MultiParticleContainer.cpp b/Source/Particles/MultiParticleContainer.cpp index 92f66c705..a56651f50 100644 --- a/Source/Particles/MultiParticleContainer.cpp +++ b/Source/Particles/MultiParticleContainer.cpp @@ -10,14 +10,15 @@ using namespace amrex; constexpr int MultiParticleContainer::nstencilz_fdtd_nci_corr; - +#ifdef WARPX_QED MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core): bw_engine{std::move(init_warpx_breit_wheeler_engine())} +#else +MultiParticleContainer::MultiParticleContainer (AmrCore* amr_core) +#endif { -#ifdef WARPX_QED - -#endif + ReadParameters(); diff --git a/Source/Particles/PhotonParticleContainer.H b/Source/Particles/PhotonParticleContainer.H index 4c72fe47e..616231ef6 100644 --- a/Source/Particles/PhotonParticleContainer.H +++ b/Source/Particles/PhotonParticleContainer.H @@ -4,6 +4,8 @@ #include #include +#include "breit_wheeler_engine_wrapper.h" + class PhotonParticleContainer : public PhysicalParticleContainer { @@ -63,9 +65,11 @@ public: int lev, amrex::Real dt ) override {}; - +//This function initialises the optical depth of the photons #ifdef WARPX_QED - virtual void InitOpticalDepth(); + virtual void InitOpticalDepth( + WarpXParIter& pti, + warpx_breit_wheeler_engine& engine); #endif private: diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 9ea448ec8..6e6300bd1 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -11,6 +11,8 @@ #include #include +#include "breit_wheeler_engine_wrapper.h" + using namespace amrex; PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecies, @@ -37,10 +39,6 @@ void PhotonParticleContainer::InitData() { AddParticles(0); // Note - add on level 0 -#ifdef WARPX_QED - InitOpticalDepth(); -#endif - if (maxLevel() > 0) { Redistribute(); // We then redistribute } @@ -110,7 +108,12 @@ PhotonParticleContainer::Evolve (int lev, #ifdef WARPX_QED - void PhotonParticleContainer::InitOpticalDepth(){ - - } +void PhotonParticleContainer::InitOpticalDepth( + WarpXParIter& pti, + warpx_breit_wheeler_engine& engine) +{ + auto& taus = pti.GetAttribs(particle_comps["tau"]); + for(auto& tau: taus) + tau = engine.get_optical_depth(); +} #endif -- cgit v1.2.3 From 17f2c26f30c2e2dbffcf5f3becb7dd6ae454b41a Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 15:55:48 +0200 Subject: Corrected bug --- Source/Particles/PhotonParticleContainer.H | 4 +++- Source/Particles/PhotonParticleContainer.cpp | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.H b/Source/Particles/PhotonParticleContainer.H index 616231ef6..966fc1e2d 100644 --- a/Source/Particles/PhotonParticleContainer.H +++ b/Source/Particles/PhotonParticleContainer.H @@ -4,7 +4,9 @@ #include #include -#include "breit_wheeler_engine_wrapper.h" +#ifdef WARPX_QED + #include "breit_wheeler_engine_wrapper.h" +#endif class PhotonParticleContainer : public PhysicalParticleContainer diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 6e6300bd1..daf196014 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -11,8 +11,6 @@ #include #include -#include "breit_wheeler_engine_wrapper.h" - using namespace amrex; PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecies, -- cgit v1.2.3 From 1259a63a21ea6b072481ed285c888bcd6b417e51 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 16:17:17 +0200 Subject: modified the pusher of the photon particle container --- Source/FortranInterface/WarpX_f.H | 4 +--- Source/FortranInterface/WarpX_picsar.F90 | 6 ++---- Source/Particles/PhotonParticleContainer.cpp | 6 ++---- 3 files changed, 5 insertions(+), 11 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/FortranInterface/WarpX_f.H b/Source/FortranInterface/WarpX_f.H index 20781a8ee..0fca39d2f 100644 --- a/Source/FortranInterface/WarpX_f.H +++ b/Source/FortranInterface/WarpX_f.H @@ -172,9 +172,7 @@ extern "C" void warpx_particle_pusher_positions(const long* np, amrex::Real* xp, amrex::Real* yp, amrex::Real* zp, amrex::Real* uxp, amrex::Real* uyp, amrex::Real* uzp, amrex::Real* gaminv, - const amrex::Real* exp, const amrex::Real* eyp,const amrex::Real* ezp, - const amrex::Real* bxp, const amrex::Real* byp,const amrex::Real* bzp, - const amrex::Real* charge, const amrex::Real* mass, const amrex::Real* dt, + const amrex::Real* mass, const amrex::Real* dt, const long* particle_pusher_algo); diff --git a/Source/FortranInterface/WarpX_picsar.F90 b/Source/FortranInterface/WarpX_picsar.F90 index 42d7a904e..c70d20564 100644 --- a/Source/FortranInterface/WarpX_picsar.F90 +++ b/Source/FortranInterface/WarpX_picsar.F90 @@ -605,7 +605,7 @@ subroutine warpx_charge_deposition(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,n !> @param[in] particle_pusher_algo Particle pusher algorithm [UNUSED] subroutine warpx_particle_pusher_positions(np,xp,yp,zp,uxp,uyp,uzp, & gaminv,& - ex,ey,ez,bx,by,bz,q,m,dt, & + m,dt, & particle_pusher_algo) & bind(C, name="warpx_particle_pusher_positions") @@ -613,9 +613,7 @@ subroutine warpx_charge_deposition(rho,np,xp,yp,zp,w,q,xmin,ymin,zmin,dx,dy,dz,n REAL(amrex_real),INTENT(INOUT) :: gaminv(np) REAL(amrex_real),INTENT(IN) :: xp(np),yp(np),zp(np) REAL(amrex_real),INTENT(INOUT) :: uxp(np),uyp(np),uzp(np) - REAL(amrex_real),INTENT(IN) :: ex(np),ey(np),ez(np) - REAL(amrex_real),INTENT(IN) :: bx(np),by(np),bz(np) - REAL(amrex_real),INTENT(IN) :: q,m,dt + REAL(amrex_real),INTENT(IN) :: m,dt INTEGER(c_long), INTENT(IN) :: particle_pusher_algo INTEGER(c_long) :: ip diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index daf196014..9900bd1ad 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -65,16 +65,13 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, // Using new pusher for positions const amrex_real zero_mass = 0.0; - const amrex_real zero_charge = 0.0; warpx_particle_pusher_positions(&np, xp.dataPtr(), yp.dataPtr(), zp.dataPtr(), uxp.dataPtr(), uyp.dataPtr(), uzp.dataPtr(), giv.dataPtr(), - Exp.dataPtr(), Eyp.dataPtr(), Ezp.dataPtr(), - Bxp.dataPtr(), Byp.dataPtr(), Bzp.dataPtr(), - &zero_charge, &zero_mass, &dt, + &zero_mass, &dt, &WarpX::particle_pusher_algo); } @@ -102,6 +99,7 @@ PhotonParticleContainer::Evolve (int lev, cEx, cEy, cEz, cBx, cBy, cBz, t, dt); + } -- cgit v1.2.3 From 9822611b0e0b883bfa81a73c40ac8440f0ee21c2 Mon Sep 17 00:00:00 2001 From: Luca Fedeli Date: Mon, 3 Jun 2019 16:28:08 +0200 Subject: corrected bug --- Source/Particles/PhotonParticleContainer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 9900bd1ad..2bcf87d6a 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -28,7 +28,7 @@ PhotonParticleContainer::PhotonParticleContainer (AmrCore* amr_core, int ispecie #ifdef WARPX_QED AddRealComp("tau"); - plot_flags.resize(PIdx::nattribs + 6, 1); + plot_flags.resize(PIdx::nattribs + 1, 1); #endif } -- cgit v1.2.3 From d55fd6f190470cb56cfcbf3435d8b14a3ef597b8 Mon Sep 17 00:00:00 2001 From: MaxThevenet Date: Mon, 2 Sep 2019 07:10:11 -0700 Subject: fix compilation errors --- Source/Particles/PhotonParticleContainer.H | 32 ++++++++++++++-------------- Source/Particles/PhotonParticleContainer.cpp | 23 -------------------- 2 files changed, 16 insertions(+), 39 deletions(-) (limited to 'Source/Particles/PhotonParticleContainer.cpp') diff --git a/Source/Particles/PhotonParticleContainer.H b/Source/Particles/PhotonParticleContainer.H index 966fc1e2d..a4b8ca84c 100644 --- a/Source/Particles/PhotonParticleContainer.H +++ b/Source/Particles/PhotonParticleContainer.H @@ -50,22 +50,22 @@ public: amrex::Cuda::ManagedDeviceVector& giv, amrex::Real dt) override; - virtual void DepositCurrent(WarpXParIter& pti, - RealVector& wp, - RealVector& uxp, - RealVector& uyp, - RealVector& uzp, - amrex::MultiFab& jx, - amrex::MultiFab& jy, - amrex::MultiFab& jz, - amrex::MultiFab* cjx, - amrex::MultiFab* cjy, - amrex::MultiFab* cjz, - const long np_current, - const long np, - int thread_num, - int lev, - amrex::Real dt ) override {}; + + virtual void DepositCurrent(WarpXParIter& pti, + RealVector& wp, + RealVector& uxp, + RealVector& uyp, + RealVector& uzp, + const int * const ion_lev, + amrex::MultiFab* jx, + amrex::MultiFab* jy, + amrex::MultiFab* jz, + const long offset, + const long np_to_depose, + int thread_num, + int lev, + int depos_lev, + amrex::Real dt) override {}; //This function initialises the optical depth of the photons #ifdef WARPX_QED diff --git a/Source/Particles/PhotonParticleContainer.cpp b/Source/Particles/PhotonParticleContainer.cpp index 2bcf87d6a..31a62b739 100644 --- a/Source/Particles/PhotonParticleContainer.cpp +++ b/Source/Particles/PhotonParticleContainer.cpp @@ -50,29 +50,6 @@ PhotonParticleContainer::PushPX(WarpXParIter& pti, Cuda::ManagedDeviceVector& giv, Real dt) { - // This wraps the call to warpx_particle_pusher so that inheritors can modify the call. - auto& attribs = pti.GetAttribs(); - auto& uxp = attribs[PIdx::ux]; - auto& uyp = attribs[PIdx::uy]; - auto& uzp = attribs[PIdx::uz]; - auto& Exp = attribs[PIdx::Ex]; - auto& Eyp = attribs[PIdx::Ey]; - auto& Ezp = attribs[PIdx::Ez]; - auto& Bxp = attribs[PIdx::Bx]; - auto& Byp = attribs[PIdx::By]; - auto& Bzp = attribs[PIdx::Bz]; - const long np = pti.numParticles(); - - // Using new pusher for positions - const amrex_real zero_mass = 0.0; - warpx_particle_pusher_positions(&np, - xp.dataPtr(), - yp.dataPtr(), - zp.dataPtr(), - uxp.dataPtr(), uyp.dataPtr(), uzp.dataPtr(), - giv.dataPtr(), - &zero_mass, &dt, - &WarpX::particle_pusher_algo); } void -- cgit v1.2.3