aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/Diagnostics/ParticleIO.cpp3
-rw-r--r--Source/Laser/LaserParticleContainer.cpp2
-rw-r--r--Source/Particles/Deposition/CurrentDeposition.H4
-rw-r--r--Source/Particles/PhysicalParticleContainer.cpp29
-rw-r--r--Source/Particles/WarpXParticleContainer.H9
-rw-r--r--Source/Particles/WarpXParticleContainer.cpp2
6 files changed, 28 insertions, 21 deletions
diff --git a/Source/Diagnostics/ParticleIO.cpp b/Source/Diagnostics/ParticleIO.cpp
index 2b70c9379..618ecc6c5 100644
--- a/Source/Diagnostics/ParticleIO.cpp
+++ b/Source/Diagnostics/ParticleIO.cpp
@@ -114,7 +114,8 @@ MultiParticleContainer::WritePlotFile (const std::string& dir) const
}
if(pc->do_field_ionization){
- real_names.push_back("ionization_level");
+ int_names.push_back("ionization_level");
+ int_flags.resize(1, 1);
}
// Convert momentum to SI
diff --git a/Source/Laser/LaserParticleContainer.cpp b/Source/Laser/LaserParticleContainer.cpp
index 37e8f8bf2..e2aebdd5e 100644
--- a/Source/Laser/LaserParticleContainer.cpp
+++ b/Source/Laser/LaserParticleContainer.cpp
@@ -504,7 +504,7 @@ LaserParticleContainer::Evolve (int lev,
// Current Deposition
//
// Deposit inside domains
- Real* ion_lev = nullptr;
+ int* ion_lev = nullptr;
DepositCurrent(pti, wp, uxp, uyp, uzp, ion_lev, &jx, &jy, &jz,
0, np_current, thread_num,
lev, lev, dt);
diff --git a/Source/Particles/Deposition/CurrentDeposition.H b/Source/Particles/Deposition/CurrentDeposition.H
index deff65424..86cf89cd3 100644
--- a/Source/Particles/Deposition/CurrentDeposition.H
+++ b/Source/Particles/Deposition/CurrentDeposition.H
@@ -26,7 +26,7 @@ void doDepositionShapeN(const amrex::Real * const xp,
const amrex::Real * const uxp,
const amrex::Real * const uyp,
const amrex::Real * const uzp,
- const amrex::Real * const ion_lev,
+ const int * const ion_lev,
const amrex::Array4<amrex::Real>& jx_arr,
const amrex::Array4<amrex::Real>& jy_arr,
const amrex::Array4<amrex::Real>& jz_arr,
@@ -184,7 +184,7 @@ void doEsirkepovDepositionShapeN (const amrex::Real * const xp,
const amrex::Real * const uxp,
const amrex::Real * const uyp,
const amrex::Real * const uzp,
- const amrex::Real * ion_lev,
+ const int * ion_lev,
const amrex::Array4<amrex::Real>& Jx_arr,
const amrex::Array4<amrex::Real>& Jy_arr,
const amrex::Array4<amrex::Real>& Jz_arr,
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp
index 7fdb783b7..98d9e5d18 100644
--- a/Source/Particles/PhysicalParticleContainer.cpp
+++ b/Source/Particles/PhysicalParticleContainer.cpp
@@ -452,9 +452,9 @@ PhysicalParticleContainer::AddPlasma (int lev, RealBox part_realbox)
pb[4] = soa.GetRealData(particle_comps["uyold"]).data() + old_size;
pb[5] = soa.GetRealData(particle_comps["uzold"]).data() + old_size;
}
- Real* pi;
+ int* pi;
if (do_field_ionization) {
- pi = soa.GetRealData(particle_comps[ "ionization_level"]).data() + old_size;
+ pi = soa.GetIntData(particle_icomps["ionization_level"]).data() + old_size;
}
const GpuArray<Real,AMREX_SPACEDIM> overlap_corner
@@ -1293,9 +1293,9 @@ PhysicalParticleContainer::Evolve (int lev,
lev, lev-1, dt);
}
} else {
- Real* AMREX_RESTRICT ion_lev;
+ int* AMREX_RESTRICT ion_lev;
if (do_field_ionization){
- ion_lev = pti.GetAttribs(particle_comps["ionization_level"]).dataPtr();
+ ion_lev = pti.GetiAttribs(particle_icomps["ionization_level"]).dataPtr();
} else {
ion_lev = nullptr;
}
@@ -1523,9 +1523,9 @@ PhysicalParticleContainer::PushPX(WarpXParIter& pti,
copy_attribs(pti, x, y, z);
}
- Real* AMREX_RESTRICT ion_lev = nullptr;
+ int* AMREX_RESTRICT ion_lev = nullptr;
if (do_field_ionization){
- ion_lev = pti.GetAttribs(particle_comps["ionization_level"]).dataPtr();
+ ion_lev = pti.GetiAttribs(particle_icomps["ionization_level"]).dataPtr();
}
// Loop over the particles and update their momentum
@@ -1972,7 +1972,7 @@ void PhysicalParticleContainer::InitIonizationModule()
pp.get("ionization_product", ionization_product_name);
pp.get("physical_element", physical_element);
// Add Real component for ionization level
- AddRealComp("ionization_level");
+ AddIntComp("ionization_level");
plot_flags.resize(PIdx::nattribs + 1, 1);
// Get atomic number and ionization energies from file
int ion_element_id = ion_map_ids[physical_element];
@@ -2051,7 +2051,8 @@ PhysicalParticleContainer::buildIonizationMask(const amrex::MFIter& mfi, const i
const Real * const AMREX_RESTRICT bx = soa.GetRealData(PIdx::Bx).data();
const Real * const AMREX_RESTRICT by = soa.GetRealData(PIdx::By).data();
const Real * const AMREX_RESTRICT bz = soa.GetRealData(PIdx::Bz).data();
- Real* ilev_real = soa.GetRealData(particle_comps["ionization_level"]).data();
+ // Real* ilev_real = soa.GetIntData(particle_icomps["ionization_level"]).data();
+ int* ion_lev = soa.GetIntData(particle_icomps["ionization_level"]).data();
Real c = PhysConst::c;
Real c2_inv = 1./c/c;
@@ -2063,9 +2064,9 @@ PhysicalParticleContainer::buildIonizationMask(const amrex::MFIter& mfi, const i
np,
[=] AMREX_GPU_DEVICE (long i) {
// Get index of ionization_level
- int ilev = (int) round(ilev_real[i]);
+ // int ilev = (int) round(ilev_real[i]);
p_ionization_mask[i] = 0;
- if ( ilev<atomic_number ){
+ if ( ion_lev[i]<atomic_number ){
Real random_draw = amrex::Random();
// Compute electric field amplitude in the particle's frame of
// reference (particularly important when in boosted frame).
@@ -2078,14 +2079,14 @@ PhysicalParticleContainer::buildIonizationMask(const amrex::MFIter& mfi, const i
);
// Compute probability of ionization p
Real p;
- Real w_dtau = 1./ ga * p_adk_prefactor[ilev] *
- std::pow(E,p_adk_power[ilev]) *
- std::exp( p_adk_exp_prefactor[ilev]/E );
+ Real w_dtau = 1./ ga * p_adk_prefactor[ion_lev[i]] *
+ std::pow(E,p_adk_power[ion_lev[i]]) *
+ std::exp( p_adk_exp_prefactor[ion_lev[i]]/E );
p = 1. - std::exp( - w_dtau );
if (random_draw < p){
// increment particle's ionization level
- ilev_real[i] += 1.;
+ ion_lev[i] += 1;
// update mask
p_ionization_mask[i] = 1;
}
diff --git a/Source/Particles/WarpXParticleContainer.H b/Source/Particles/WarpXParticleContainer.H
index 204031497..2613be167 100644
--- a/Source/Particles/WarpXParticleContainer.H
+++ b/Source/Particles/WarpXParticleContainer.H
@@ -76,6 +76,10 @@ public:
RealVector& GetAttribs (int comp) {
return GetStructOfArrays().GetRealData(comp);
}
+
+ IntVector& GetiAttribs (int comp) {
+ return GetStructOfArrays().GetIntData(comp);
+ }
};
class MultiParticleContainer;
@@ -180,7 +184,7 @@ public:
RealVector& uxp,
RealVector& uyp,
RealVector& uzp,
- amrex::Real* ion_lev,
+ int* ion_lev,
amrex::MultiFab* jx,
amrex::MultiFab* jy,
amrex::MultiFab* jz,
@@ -268,7 +272,7 @@ public:
void AddIntComp (const std::string& name, bool comm=true)
{
- particle_comps[name] = NumIntComps();
+ particle_icomps[name] = NumIntComps();
AddIntComp(comm);
}
@@ -285,6 +289,7 @@ public:
protected:
std::map<std::string, int> particle_comps;
+ std::map<std::string, int> particle_icomps;
int species_id;
diff --git a/Source/Particles/WarpXParticleContainer.cpp b/Source/Particles/WarpXParticleContainer.cpp
index 2e418aae0..a7c30764d 100644
--- a/Source/Particles/WarpXParticleContainer.cpp
+++ b/Source/Particles/WarpXParticleContainer.cpp
@@ -428,7 +428,7 @@ void
WarpXParticleContainer::DepositCurrent(WarpXParIter& pti,
RealVector& wp, RealVector& uxp,
RealVector& uyp, RealVector& uzp,
- Real* ion_lev,
+ int* ion_lev,
MultiFab* jx, MultiFab* jy, MultiFab* jz,
const long offset, const long np_to_depose,
int thread_num, int lev, int depos_lev,