diff options
author | 2023-06-27 14:20:07 -0700 | |
---|---|---|
committer | 2023-06-27 14:20:07 -0700 | |
commit | efd450ecc31dc651315c6350dd0104cba8e46c31 (patch) | |
tree | 092121c084d5515d2cc94b9e95821d81f5270ce1 /Source/Particles/PhysicalParticleContainer.cpp | |
parent | 61d7dc8412eb78b05a42a854085004caa47c35df (diff) | |
download | WarpX-efd450ecc31dc651315c6350dd0104cba8e46c31.tar.gz WarpX-efd450ecc31dc651315c6350dd0104cba8e46c31.tar.zst WarpX-efd450ecc31dc651315c6350dd0104cba8e46c31.zip |
Define new `InjectorFlux` object, and use it in `AddPlasmaFlux` (#4040)
* Create flux injector object
* Call new flux injector in AddPlasmaFlux
* Update syntax in tests
* Also test the flux parser
* Remove the use of `density_min` and `density_max` for flux injection
* Update PICMI interface
* Update documentation
* Remove .cpp file
Diffstat (limited to 'Source/Particles/PhysicalParticleContainer.cpp')
-rw-r--r-- | Source/Particles/PhysicalParticleContainer.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Source/Particles/PhysicalParticleContainer.cpp b/Source/Particles/PhysicalParticleContainer.cpp index 685f000d7..0793094ff 100644 --- a/Source/Particles/PhysicalParticleContainer.cpp +++ b/Source/Particles/PhysicalParticleContainer.cpp @@ -1475,10 +1475,8 @@ PhysicalParticleContainer::AddPlasmaFlux (amrex::Real dt) } InjectorPosition* inj_pos = plasma_injector->getInjectorPosition(); - InjectorDensity* inj_rho = plasma_injector->getInjectorDensity(); + InjectorFlux* inj_flux = plasma_injector->getInjectorFlux(); InjectorMomentum* inj_mom = plasma_injector->getInjectorMomentum(); - const amrex::Real density_min = plasma_injector->density_min; - const amrex::Real density_max = plasma_injector->density_max; constexpr int level_zero = 0; const amrex::Real t = WarpX::GetInstance().gett_new(level_zero); @@ -1794,7 +1792,7 @@ PhysicalParticleContainer::AddPlasmaFlux (amrex::Real dt) #ifdef WARPX_DIM_RZ // Conversion from cylindrical to Cartesian coordinates // Replace the x and y, setting an angle theta. - // These x and y are used to get the momentum and density + // These x and y are used to get the momentum and flux Real theta; if (nmodes == 1 && rz_random_theta) { // With only 1 mode, the angle doesn't matter so @@ -1821,14 +1819,12 @@ PhysicalParticleContainer::AddPlasmaFlux (amrex::Real dt) pu.y = sin_theta*ur + cos_theta*ut; } #endif - Real dens = inj_rho->getDensity(ppos.x, ppos.y, ppos.z); - // Remove particle if density below threshold - if ( dens < density_min ){ + Real flux = inj_flux->getFlux(ppos.x, ppos.y, ppos.z, t); + // Remove particle if flux is negative or 0 + if ( flux <=0 ){ p.id() = -1; continue; } - // Cut density if above threshold - dens = amrex::min(dens, density_max); if (loc_do_field_ionization) { p_ion_level[ip] = loc_ionization_initial_level; @@ -1854,12 +1850,12 @@ PhysicalParticleContainer::AddPlasmaFlux (amrex::Real dt) #ifdef WARPX_DIM_RZ // The particle weight is proportional to the user-specified - // flux (denoted as `dens` here) and the emission surface within + // flux and the emission surface within // one cell (captured partially by `scale_fac`). // For cylindrical emission (flux_normal_axis==0 // or flux_normal_axis==2), the emission surface depends on // the radius ; thus, the calculation is finalized here - Real t_weight = dens * scale_fac * dt; + Real t_weight = flux * scale_fac * dt; if (loc_flux_normal_axis != 1) { if (radially_weighted) { t_weight *= 2._rt*MathConst::pi*radial_position; @@ -1872,7 +1868,7 @@ PhysicalParticleContainer::AddPlasmaFlux (amrex::Real dt) } const Real weight = t_weight; #else - const Real weight = dens * scale_fac * dt; + const Real weight = flux * scale_fac * dt; #endif pa[PIdx::w ][ip] = weight; pa[PIdx::ux][ip] = pu.x; |