Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
224 commits
Select commit Hold shift + click to select a range
56158d6
new prefactor for calculation of width_p for momentum in linear
EyaDammak Jan 17, 2025
9725208
Update PlasmaParticleContainer.cpp
EyaDammak Jan 17, 2025
089343f
style
EyaDammak Jan 17, 2025
a3ff984
Update PlasmaParticleContainer.cpp
EyaDammak Jan 17, 2025
8436c64
Update PlasmaParticleContainer.H
EyaDammak Jan 17, 2025
b523447
style
EyaDammak Jan 17, 2025
c50df2d
style
EyaDammak Jan 17, 2025
37b39af
Update PlasmaParticleContainer.cpp
EyaDammak Jan 17, 2025
af196e8
Update laser_ionization.1Rank.json
EyaDammak Jan 19, 2025
78cd9de
Update PlasmaParticleContainerInit.cpp
EyaDammak Jan 20, 2025
7a725a3
Update PlasmaParticleContainer.cpp
EyaDammak Jan 22, 2025
8dc706b
Update PlasmaParticleContainer.cpp
EyaDammak Jan 23, 2025
7f8b5b3
squelette
EyaDammak Jan 23, 2025
fb67cde
Merge branch 'injection' of https://github.com/EyaDammak/hipace into …
EyaDammak Jan 23, 2025
0e45cd7
fisrt kernel: counting + make invalid
EyaDammak Jan 23, 2025
000a659
simplification
EyaDammak Jan 24, 2025
8644ef7
update MultiPlasma.H
EyaDammak Jan 24, 2025
a9adc38
update Hipace.cpp
EyaDammak Jan 24, 2025
0e395a5
num_electrons was not defined
EyaDammak Jan 24, 2025
fd15bc9
return issue
EyaDammak Jan 24, 2025
14f2385
resizing the beam particle container
EyaDammak Jan 24, 2025
5199d62
syntax
EyaDammak Jan 24, 2025
189bc16
update resizing
EyaDammak Jan 24, 2025
92c9f2a
update
EyaDammak Jan 24, 2025
c25a23a
update
EyaDammak Jan 24, 2025
ddf3148
include more
EyaDammak Jan 24, 2025
acac290
adding beam defining
EyaDammak Jan 24, 2025
f55078f
includes missing
EyaDammak Jan 24, 2025
9205322
update hiapce.cpp
EyaDammak Jan 24, 2025
418d6f3
update hiapce.cpp for include
EyaDammak Jan 24, 2025
8089c15
update hipace.cpp
EyaDammak Jan 24, 2025
c6e0998
missing a variable for beams
EyaDammak Jan 24, 2025
259e62f
fixing small issue
EyaDammak Jan 24, 2025
9156aa6
update plasmaparticlecontainer
EyaDammak Jan 24, 2025
e1e2c1d
Update PlasmaParticleContainer.cpp
EyaDammak Jan 24, 2025
3dd3910
update ppc
EyaDammak Jan 29, 2025
dfc0e06
Merge branch 'injection' of https://github.com/EyaDammak/hipace into …
EyaDammak Jan 29, 2025
390b341
update ppc
EyaDammak Jan 29, 2025
1dfd87c
Update PlasmaParticleContainer.cpp
EyaDammak Jan 29, 2025
d75777f
update reduce function
EyaDammak Jan 29, 2025
0eba01f
Merge branch 'injection' of https://github.com/EyaDammak/hipace into …
EyaDammak Jan 29, 2025
694891c
update ppc
EyaDammak Jan 29, 2025
804645d
update
EyaDammak Jan 29, 2025
4cd31f2
update ppc
EyaDammak Jan 29, 2025
40e554c
update ppc
EyaDammak Jan 30, 2025
38ccfde
update ppc
EyaDammak Jan 30, 2025
a1e14e0
ppc
EyaDammak Jan 30, 2025
007d434
ppc, trying something
EyaDammak Jan 30, 2025
2e869da
update MultiPlasma
EyaDammak Jan 30, 2025
093677b
Update PlasmaParticleContainer.cpp
EyaDammak Jan 31, 2025
caae128
adding the beam.can_laser_injection
EyaDammak Jan 31, 2025
365ff2b
make public the m_product_name
EyaDammak Jan 31, 2025
96d9879
forgot to save
EyaDammak Jan 31, 2025
eea15e7
updates
EyaDammak Jan 31, 2025
042f8fb
adding islice variable
EyaDammak Jan 31, 2025
75421f0
ppc
EyaDammak Jan 31, 2025
068460e
m_can_laser_injection in plasmaparticlecontainer
EyaDammak Jan 31, 2025
52b4946
moving all the m_product and so on in the plasma container
EyaDammak Jan 31, 2025
748f345
modifications
EyaDammak Jan 31, 2025
b0083e8
update MultiBeam.cpp
EyaDammak Jan 31, 2025
60e5301
hello
EyaDammak Jan 31, 2025
2793b7c
style
EyaDammak Feb 2, 2025
67a172a
Update PlasmaParticleContainer.H
EyaDammak Feb 12, 2025
28eaad7
Update PlasmaParticleContainer.cpp
EyaDammak Feb 12, 2025
e2dbff3
Update MultiPlasma.cpp
EyaDammak Feb 14, 2025
eb5a235
Update parameters.rst
EyaDammak Feb 14, 2025
093a17b
Update BeamParticleContainer.cpp
EyaDammak Feb 14, 2025
d44c240
Update PlasmaParticleContainer.cpp
EyaDammak Feb 14, 2025
a07c5f9
Update MultiPlasma.cpp
EyaDammak Feb 14, 2025
cfb2436
Update PlasmaParticleContainer.cpp
EyaDammak Feb 14, 2025
5d0eeab
Merge branch 'development' into injection
EyaDammak Feb 14, 2025
a5285e5
Merge branch 'Hi-PACE:development' into injection
EyaDammak Feb 18, 2025
39a1eed
Update PlasmaParticleContainerInit.cpp
EyaDammak Feb 18, 2025
d638b06
Update PlasmaParticleContainer.cpp
EyaDammak Feb 19, 2025
db37f78
Update PlasmaParticleContainer.cpp
EyaDammak Feb 19, 2025
06d8bba
Update PlasmaParticleContainer.cpp
EyaDammak Feb 21, 2025
fd9c525
Update MultiPlasma.cpp
EyaDammak Feb 21, 2025
332ce5e
update ppc.cpp
EyaDammak Feb 21, 2025
a5435e8
update ppc.cpp
EyaDammak Feb 21, 2025
4a27702
Update PlasmaParticleContainer.cpp
EyaDammak Feb 21, 2025
f00732d
Update PlasmaParticleContainer.cpp
EyaDammak Feb 21, 2025
d8d966f
Merge branch 'Hi-PACE:development' into injection
EyaDammak Feb 24, 2025
c08636e
update pcc.cpp
EyaDammak Feb 24, 2025
3a78493
update pcc.cpp
EyaDammak Feb 24, 2025
0c693cd
update pcc.cpp
EyaDammak Feb 24, 2025
b412517
ppc.cpp
EyaDammak Feb 24, 2025
f7f5b21
MultiPlasma update
EyaDammak Feb 24, 2025
06473f3
update MultiPlasma.cpp
EyaDammak Feb 24, 2025
f243dca
multiplasma
EyaDammak Feb 24, 2025
d06b8b5
MultiPlasma.cpp
EyaDammak Feb 24, 2025
d3c7e19
multiplasma
EyaDammak Feb 24, 2025
94fd2e4
multiplasma
EyaDammak Feb 25, 2025
7a7e8e4
Update MultiPlasma.H
EyaDammak Feb 25, 2025
4de3834
style
EyaDammak Feb 25, 2025
966a640
Update PlasmaParticleContainer.H
EyaDammak Feb 25, 2025
503e04f
Update parameters.rst
EyaDammak Feb 25, 2025
d8bef27
Update PlasmaParticleContainerInit.cpp
EyaDammak Feb 25, 2025
98a926f
Merge branch 'Hi-PACE:development' into injection
EyaDammak Feb 25, 2025
e7534cd
Update PlasmaParticleContainer.cpp
EyaDammak Feb 25, 2025
677dc6f
style
EyaDammak Feb 25, 2025
e2ed4fa
Update MultiPlasma.cpp
EyaDammak Feb 25, 2025
c916dac
Update MultiPlasma.cpp
EyaDammak Feb 26, 2025
6e413ac
Update MultiPlasma.H
EyaDammak Feb 26, 2025
721a012
Update MultiPlasma.H
EyaDammak Feb 26, 2025
64d9299
Update Hipace.cpp
EyaDammak Feb 26, 2025
3815558
Update Hipace.cpp
EyaDammak Feb 26, 2025
c0085cb
Update MultiPlasma.cpp
EyaDammak Feb 26, 2025
8b003aa
Update PlasmaParticleContainer.cpp
EyaDammak Feb 26, 2025
e98ed63
Update PlasmaParticleContainer.cpp
EyaDammak Feb 26, 2025
fba8b27
Update MultiPlasma.cpp
EyaDammak Mar 3, 2025
b96107e
Update PlasmaParticleContainer.cpp
EyaDammak Mar 3, 2025
4f133ad
Update PlasmaParticleContainer.cpp
EyaDammak Mar 3, 2025
eda0de5
Update PlasmaParticleContainer.cpp
EyaDammak Mar 3, 2025
b7082ef
Update PlasmaParticleContainer.cpp
EyaDammak Mar 3, 2025
f2b265d
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
508bed3
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
8976610
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
72cece0
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
8fd4a5a
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
4db530d
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
5d194e6
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
6daf2aa
Update MultiPlasma.cpp
EyaDammak Mar 4, 2025
6407099
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
7c78b9c
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
95a5d6d
Update PlasmaParticleContainer.cpp
EyaDammak Mar 4, 2025
e319685
debugging
EyaDammak Mar 5, 2025
66db249
update of the conditions
EyaDammak Mar 5, 2025
d569f14
Update PlasmaParticleContainer.cpp
EyaDammak Mar 5, 2025
67d56b5
Update PlasmaParticleContainer.H
EyaDammak Mar 5, 2025
afd20b0
Update PlasmaParticleContainer.cpp
EyaDammak Mar 5, 2025
b093134
Update PlasmaParticleContainer.cpp
EyaDammak Mar 5, 2025
da547bc
Update PlasmaParticleContainer.cpp
EyaDammak Mar 5, 2025
5a03435
Update MultiPlasma.cpp
EyaDammak Mar 5, 2025
55deb11
style
EyaDammak Mar 5, 2025
4778ead
Update MultiPlasma.cpp
EyaDammak Mar 5, 2025
bdcca33
ppc.cpp
EyaDammak Mar 6, 2025
7d15e0b
little error in the MultiPlasma
EyaDammak Mar 6, 2025
ae75ab9
issue 2 in MultiPlasma.cpp
EyaDammak Mar 6, 2025
7435901
ppc.cpp
EyaDammak Mar 7, 2025
63443f6
condition to skip if no ionized electrons on a slice
EyaDammak Mar 7, 2025
74ffc83
error in the last laser ionization PR in the documentation
EyaDammak Mar 7, 2025
acc1a90
remove unnecessary variables
EyaDammak Mar 7, 2025
59cf6e2
same than prevously
EyaDammak Mar 7, 2025
b4956aa
same
EyaDammak Mar 7, 2025
99ed105
issue, was not copying
EyaDammak Mar 7, 2025
f5c2ebc
consistancy
EyaDammak Mar 7, 2025
66d4884
debug
EyaDammak Mar 7, 2025
a321540
update ppc.cpp
EyaDammak Mar 7, 2025
6e9376e
ppc
EyaDammak Mar 7, 2025
34d030c
ppc
EyaDammak Mar 7, 2025
93036f0
subcycling missing
EyaDammak Mar 7, 2025
a491d14
; missing
EyaDammak Mar 7, 2025
0ca72d5
taking into account the slipped particles
EyaDammak Mar 10, 2025
8f79079
debugging
EyaDammak Mar 25, 2025
b495817
Update OpenPMDWriter.cpp
EyaDammak Mar 25, 2025
f3651d6
Update OpenPMDWriter.cpp
EyaDammak Mar 25, 2025
03a9a8b
Merge branch 'Hi-PACE:development' into injection
EyaDammak Mar 25, 2025
96c1169
Update PlasmaParticleContainer.cpp
EyaDammak Mar 25, 2025
6245ebb
updating total number of particles missing
EyaDammak Mar 25, 2025
be290c2
updating the values of the beam particles
EyaDammak Mar 28, 2025
fec4cc6
Update BeamParticleAdvance.cpp
EyaDammak Mar 28, 2025
489d161
Update PlasmaParticleContainer.cpp
EyaDammak Mar 28, 2025
fa8b6db
style
EyaDammak Mar 28, 2025
cdddc90
Update PlasmaParticleContainer.cpp
EyaDammak Apr 3, 2025
eba7303
dt missing in the beam weight due to change of referentiels
EyaDammak Apr 3, 2025
235e19c
Merge branch 'Hi-PACE:development' into injection
EyaDammak Apr 3, 2025
cdc3a05
Update PlasmaParticleContainer.cpp
EyaDammak Apr 3, 2025
712cbc2
style
EyaDammak Apr 3, 2025
f9b6577
new function to detect particle injected
EyaDammak Apr 3, 2025
a32df60
style
EyaDammak Apr 3, 2025
309e1ed
ppc updated
EyaDammak Apr 3, 2025
42ab57f
laser variable missed
EyaDammak Apr 3, 2025
c3acc07
multiplasma update
EyaDammak Apr 3, 2025
c865dea
update
EyaDammak Apr 3, 2025
bb0e18e
ppc
EyaDammak Apr 3, 2025
f26dd5f
ppc
EyaDammak Apr 3, 2025
9dc15d5
ppc
EyaDammak Apr 3, 2025
d3915d3
ppc
EyaDammak Apr 3, 2025
4dd4945
ppc
EyaDammak Apr 3, 2025
65adfeb
resize Beam Diagnostic buffer
AlexanderSinn Apr 7, 2025
dcef4ef
fix namespace
AlexanderSinn Apr 7, 2025
3bb5f1a
Update PlasmaParticleContainer.cpp
EyaDammak Apr 7, 2025
fd3691a
Update PlasmaParticleContainer.cpp
EyaDammak Apr 9, 2025
a7333c7
style
EyaDammak Apr 9, 2025
4feb32d
Update PlasmaParticleContainer.cpp
EyaDammak Apr 9, 2025
da5921b
Update PlasmaParticleContainer.cpp
EyaDammak Apr 9, 2025
e0849cc
avoid overflow
AlexanderSinn Apr 9, 2025
3d25b22
Update PlasmaParticleContainer.cpp
EyaDammak Apr 9, 2025
c0ce7c9
Merge pull request #5 from AlexanderSinn/resize_Beam_Diagnostic_buffer
EyaDammak Apr 10, 2025
1511ffc
Update PlasmaParticleContainer.cpp
EyaDammak Apr 10, 2025
49c39c5
Update PlasmaParticleContainer.cpp
EyaDammak Apr 10, 2025
c9d21dc
new condition
EyaDammak Apr 10, 2025
5f0c75c
Update PlasmaParticleContainer.cpp
EyaDammak Apr 11, 2025
8e75cf4
Update PlasmaParticleContainer.cpp
EyaDammak Apr 11, 2025
a016d61
Update PlasmaParticleContainer.cpp
EyaDammak Apr 11, 2025
2aa28ee
Update PlasmaParticleContainer.cpp
EyaDammak Apr 11, 2025
2c2d417
Update PlasmaParticleContainer.cpp
EyaDammak Apr 11, 2025
fdded8b
Update OpenPMDWriter.cpp
EyaDammak Apr 11, 2025
d5b9ca6
Update PlasmaParticleContainer.cpp
EyaDammak Apr 11, 2025
57667ac
Update PlasmaParticleContainer.cpp
EyaDammak Apr 14, 2025
2c40713
Update MultiPlasma.cpp
EyaDammak Apr 15, 2025
24c71a4
Update MultiPlasma.cpp
EyaDammak Apr 15, 2025
e366566
Update PlasmaParticleContainer.cpp
EyaDammak Apr 16, 2025
c9a4e93
Update PlasmaParticleContainer.cpp
EyaDammak Apr 16, 2025
b39fa6d
expose capture threshold as input parameter
MaxThevenet Apr 16, 2025
d517aff
injection weight factor added as parameter
EyaDammak Apr 16, 2025
9834a13
unique ids for beam part injected
EyaDammak Apr 21, 2025
a394b93
Update PlasmaParticleContainer.cpp
EyaDammak Apr 21, 2025
f860ea9
little issue
EyaDammak Apr 21, 2025
97b720d
remove unecessary cout
EyaDammak Apr 25, 2025
5e43c94
fix push
EyaDammak May 7, 2025
90a6688
fixing issue of uz/psi in injection
EyaDammak May 7, 2025
36cff67
Update PlasmaParticleContainer.cpp
EyaDammak May 9, 2025
bbe51ef
new condition for injection
EyaDammak May 9, 2025
0c4e258
fix the fields parameter missing
EyaDammak May 9, 2025
43796f3
fix issue
EyaDammak May 9, 2025
45f3e60
laser_arr not defined
EyaDammak May 9, 2025
3f369b7
Update PlasmaParticleContainer.cpp
EyaDammak May 9, 2025
7371104
Update PlasmaParticleContainer.cpp
EyaDammak May 9, 2025
99e9f9a
Update PlasmaParticleContainer.cpp
EyaDammak May 14, 2025
32a2b42
Update PlasmaParticleContainer.cpp
EyaDammak May 14, 2025
68c3102
Update PlasmaParticleContainer.cpp
EyaDammak May 15, 2025
9bb6ce7
Merge dev (#8)
EyaDammak May 16, 2025
9259072
Merge pull request #9 from Hi-PACE/development
EyaDammak May 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion docs/source/run/parameters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ When both are specified, the per-species value is used.
* ``<plasma name>.can_ionize`` (`bool`) optional (default `0`)
Whether this plasma can ionize. Can also be set to 1 by specifying ``<plasma name>.ionization_product``.

* ``<plasma name>.can_laser_ionize`` (`bool`) optional (default `<plasma name>.can_ionize`)
* ``<plasma name>.can_laser_ionize`` (`bool`) optional (default `0`)
Whether this plasma can be ionized by a laser.

* ``<plasma name>.initial_ion_level`` (`int`) optional (default `-1`)
Expand Down Expand Up @@ -605,6 +605,13 @@ which are valid only for certain beam types, are introduced further below under
The ideal index type is different for beam push and beam deposition so some experimentation
may be required to find the overall fastest setting for a specific simulation.

* ``<plasma name>.can_laser_injection`` (`bool`) optional (default `0`)
Whether the laser injection is enabled. Can also be set to 1 by specifying ``<plasma name>.injection_product``.

* ``<plasma name>.injection_product`` (`string`) optional (default "")
Name of the beam species that contains the new electrons that are produced
when this plasma gets ionized. Only needed if this plasma is ionizable and the laser injection is unabled.

Option: ``fixed_weight_pdf``
^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Expand Down
8 changes: 7 additions & 1 deletion src/Hipace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "particles/pusher/GetAndSetPosition.H"
#include "mg_solver/HpMultiGrid.H"
#include "fields/fft_poisson_solver/fft/AnyFFT.H"
#include "particles/beam/MultiBeam.H"

#include <AMReX_ParmParse.H>
#include <AMReX_IntVect.H>
Expand Down Expand Up @@ -458,7 +459,7 @@ Hipace::Evolve ()
}

// Only reset plasma after receiving time step, to use proper density
m_multi_plasma.InitData(m_slice_ba, m_slice_dm, m_slice_geom, m_3D_geom);
m_multi_plasma.InitData(m_slice_ba, m_slice_dm, m_slice_geom, m_3D_geom, m_multi_beam);

m_multi_laser.SetInitialChi(m_multi_plasma);

Expand Down Expand Up @@ -714,6 +715,11 @@ Hipace::SolveOneSlice (int islice, int step)
// plasma laser ionization
m_multi_plasma.DoLaserIonization(islice, m_multi_laser.GetLaserGeom(), m_multi_laser);

// injection
for (int lev=0; lev<current_N_level; ++lev) {
m_multi_plasma.DoLaserInjection(lev, m_fields, m_multi_laser, m_3D_geom, islice);
}

// Push plasma particles
for (int lev=0; lev<current_N_level; ++lev) {
m_multi_plasma.AdvanceParticles(m_fields, m_3D_geom, false, lev, current_N_level);
Expand Down
6 changes: 5 additions & 1 deletion src/particles/beam/BeamParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,10 @@ public:
return m_total_num_particles;
}

void updateSize (int n) {
m_total_num_particles = n;
}

int numRealComponents () const {
return BeamIdx::real_nattribs + (m_do_spin_tracking ? 3 : 0);
}
Expand Down Expand Up @@ -259,7 +263,7 @@ private:
amrex::IntVect m_reorder_idx_type = {0, 0, 0};

// fixed_ppc:

private:
amrex::IntVect m_ppc {1, 1, 1}; /**< Number of particles per cell in each direction */
amrex::RealVect m_position_mean {0., 0., 0.}; /**< mean position of the beam */
amrex::Real m_min_density {0.}; /**< minimum density at which beam particles are generated */
Expand Down
2 changes: 1 addition & 1 deletion src/particles/deposition/PlasmaDepositCurrent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ DepositCurrent (PlasmaParticleContainer& plasma, Fields & fields,
+ 1._rt
);

if (gamma_psi < 0.0_rt || gamma_psi > max_qsa_weighting_factor || psi_inv < 0.0_rt)
if (gamma_psi < 0.0_rt || (gamma_psi > max_qsa_weighting_factor && ptd.id(ip)!=3) || psi_inv < 0.0_rt)
{
// This particle violates the QSA, discard it and do not deposit its current
amrex::Gpu::Atomic::Add(p_n_qsa_violation, 1);
Expand Down
15 changes: 14 additions & 1 deletion src/particles/plasma/MultiPlasma.H
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "PlasmaParticleContainer.H"
#include "fields/Fields.H"
#include "particles/collisions/CoulombCollision.H"
#include "particles/beam/MultiBeam.H"

class MultiPlasma
{
Expand All @@ -30,10 +31,12 @@ public:
* \param[in] slice_dm DistributionMapping of the transverse slice domain
* \param[in] slice_gm slice geometry
* \param[in] gm Geometry of the simulation, to get the cell size
* \param[in] beams MultiBeam object containing all beams
*/
void InitData (amrex::Vector<amrex::BoxArray> slice_ba,
amrex::Vector<amrex::DistributionMapping> slice_dm,
amrex::Vector<amrex::Geometry> slice_gm, amrex::Vector<amrex::Geometry> gm);
amrex::Vector<amrex::Geometry> slice_gm, amrex::Vector<amrex::Geometry> gm,
MultiBeam& beams);


/** Loop over plasma species and depose their currents into the current 2D slice in fields
Expand Down Expand Up @@ -109,6 +112,16 @@ public:
void DoLaserIonization (const int islice, const amrex::Geometry& laser_geom,
const MultiLaser& laser);

/** Do the transfer of ionized plasma particles to beam particles
*
* \param[in] lev MR level
* \param[in] fields the general field class
* \param[in] laser MultiLaser object containing the laser details
* \param[in] gm Geometry object for the whole domain
* \param[in] islice Slice index corresponding to the current simulation slice
*/
void DoLaserInjection (const int lev, const Fields& fields, const MultiLaser& laser, amrex::Vector<amrex::Geometry> const& gm, const int islice);

/** \brief whether any plasma species uses a neutralizing background, e.g. no ion motion */
bool AnySpeciesNeutralizeBackground () const;

Expand Down
25 changes: 24 additions & 1 deletion src/particles/plasma/MultiPlasma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
* License: BSD-3-Clause-LBNL
*/
#include "MultiPlasma.H"
#include "particles/beam/MultiBeam.H"
#include "particles/deposition/PlasmaDepositCurrent.H"
#include "particles/deposition/ExplicitDeposition.H"
#include "particles/pusher/PlasmaParticleAdvance.H"
Expand Down Expand Up @@ -38,7 +39,8 @@ MultiPlasma::MultiPlasma ()
void
MultiPlasma::InitData (amrex::Vector<amrex::BoxArray> slice_ba,
amrex::Vector<amrex::DistributionMapping> slice_dm,
amrex::Vector<amrex::Geometry> slice_gm, amrex::Vector<amrex::Geometry> gm)
amrex::Vector<amrex::Geometry> slice_gm, amrex::Vector<amrex::Geometry> gm,
MultiBeam& beams)
{
for (auto& plasma : m_all_plasmas) {
// make it think there is only level 0
Expand All @@ -57,7 +59,18 @@ MultiPlasma::InitData (amrex::Vector<amrex::BoxArray> slice_ba,
plasma.InitIonizationModule(gm[0],
Hipace::m_background_density_SI); // geometry only for dz
}

if(plasma.m_can_laser_injection) {
for (int i=0; i<beams.m_names.size(); ++i) {
if(beams.m_names[i] == plasma.m_product_beam_name) {
plasma.m_product_beam_pc = &beams.m_all_beams[i];
}
}
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(plasma.m_product_beam_pc != nullptr,
"Must specify a valid product beam for laser injection using ionization_product");
}
}

}

amrex::Real
Expand Down Expand Up @@ -138,6 +151,16 @@ MultiPlasma::DoLaserIonization (
}
}

void
MultiPlasma::DoLaserInjection (
const int lev, const Fields& fields, const MultiLaser& laser, amrex::Vector<amrex::Geometry> const& gm, const int islice)
{
for (auto& plasma : m_all_plasmas) {
plasma.InjectionCondition(lev, fields, laser, islice);
plasma.PlasmaToBeam(laser, gm, islice);
}
}

bool
MultiPlasma::AnySpeciesNeutralizeBackground () const
{
Expand Down
26 changes: 25 additions & 1 deletion src/particles/plasma/PlasmaParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <AMReX_AmrParticles.H>
#include <AMReX_Particles.H>
#include <AMReX_AmrCore.H>
#include "particles/beam/MultiBeam.H"
#include "particles/beam/BeamParticleContainer.H"
#include <map>

/** \brief Map names and indices for plasma particles attributes (SoA data) */
Expand Down Expand Up @@ -113,6 +115,23 @@ public:
const MultiLaser& laser,
const amrex::Real background_density_SI);

/** Mark the plasma particles that has been injected
*
* \param[in] lev MR level
* \param[in] fields the general field class
* \param[in] laser MultiLaser object containing the laser details
* \param[in] islice Slice index corresponding to the current simulation slice
*/
void InjectionCondition (const int lev, const Fields& fields, const MultiLaser& laser, const int islice);

/** Do the transfer of particles from the plasma container to the beam container
*
* \param[in] laser MultiLaser object containing the laser details
* \param[in] gm Geometry object for the whole domain
* \param[in] islice Slice index corresponding to the current simulation slice
*/
void PlasmaToBeam (const MultiLaser& laser, amrex::Vector<amrex::Geometry> const& gm, const int islice);

/** Reorder particles to speed-up current deposition
* \param[in] islice zeta slice index
*/
Expand Down Expand Up @@ -215,8 +234,13 @@ public:
amrex::Gpu::DeviceVector<amrex::Real> m_laser_adk_prefactor;
/** to calculate laser ionization momentum width for linear polarization */
amrex::Gpu::DeviceVector<amrex::Real> m_laser_dp_prefactor;
/** to calculate laser ionization momentum width at the second order for linear polarization */
amrex::Gpu::DeviceVector<amrex::Real> m_laser_dp_second_prefactor;
// laser injection:
bool m_can_laser_injection = false; /**< whether laser injection is enabled */
amrex::Real m_uz_threshold = 1.;
amrex::Real m_injection_weight_factor = 1.;
std::string m_product_beam_name = ""; /**< name of Injection product beam */
BeamParticleContainer* m_product_beam_pc = nullptr; /**< Injection product beam */

// plasma sorting/reordering:

Expand Down
Loading
Loading