Skip to content

Commit

Permalink
moving all the m_product and so on in the plasma container
Browse files Browse the repository at this point in the history
  • Loading branch information
EyaDammak committed Jan 31, 2025
1 parent 75421f0 commit 52b4946
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
6 changes: 0 additions & 6 deletions src/particles/beam/BeamParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -257,12 +257,6 @@ private:
/** 2D reordering index type. 0: cell, 1: node, 2: both */
amrex::IntVect m_reorder_idx_type = {0, 0, 0};

// laser injection:
public:
bool m_can_laser_injection = false; /**< whether laser injection is unabled */
std::string m_product_name = ""; /**< name of Injection product beam */
BeamParticleContainer* m_product_beam_pc = nullptr; /**< Injection product beam */

// fixed_ppc:
private:
amrex::IntVect m_ppc {1, 1, 1}; /**< Number of particles per cell in each direction */
Expand Down
2 changes: 0 additions & 2 deletions src/particles/beam/BeamParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,6 @@ BeamParticleContainer::ReadParameters ()
AMREX_ALWAYS_ASSERT_WITH_MESSAGE( m_duz_per_uz0_dzeta == 0.,
"Tilted beams and correlated energy spreads are only implemented for fixed weight beams");
}
m_can_laser_injection = pp.contains("injection_product");
queryWithParser(pp, "can_laser_injection", m_can_laser_injection);

queryWithParserAlt(pp, "initialize_on_cpu", m_initialize_on_cpu, pp_alt);
auto& soa = getBeamInitSlice().GetStructOfArrays();
Expand Down
9 changes: 0 additions & 9 deletions src/particles/beam/MultiBeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ MultiBeam::InitData (const amrex::Geometry& geom)
amrex::Real ptime {0.};
for (auto& beam : m_all_beams) {
ptime = beam.InitData(geom);
if(beam.m_can_laser_injection) {
for (int i=0; i<m_names.size(); ++i) {
if(m_names[i] == beam.m_product_name) {
beam.m_product_beam_pc = &m_all_beams[i];
}
}
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(beam.m_product_beam_pc != nullptr,
"Must specify a valid product beam for laser injection using ionization_product");
}
}
return ptime;
}
Expand Down
10 changes: 10 additions & 0 deletions src/particles/plasma/MultiPlasma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ MultiPlasma::InitData (amrex::Vector<amrex::BoxArray> slice_ba,
plasma.InitIonizationModule(gm[0],
Hipace::m_background_density_SI); // geometry only for dz
}
if(beam.m_can_laser_injection) {
for (int i=0; i<m_names.size(); ++i) {
if(m_names[i] == beam.m_product_name) {
beam.m_product_beam_pc = &m_all_beams[i];
}
}
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(beam.m_product_beam_pc != nullptr,
"Must specify a valid product beam for laser injection using ionization_product");
}

}
}

Expand Down
5 changes: 5 additions & 0 deletions src/particles/plasma/PlasmaParticleContainer.H
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@ public:
/** to calculate laser ionization momentum width for linear polarization */
amrex::Gpu::DeviceVector<amrex::Real> m_laser_dp_prefactor;

// laser injection:
bool m_can_laser_injection = false; /**< whether laser injection is unabled */
std::string m_product_beam_name = ""; /**< name of Injection product beam */
PlasmaParticleContainer* m_product_beam_pc = nullptr; /**< Injection product beam */

// plasma sorting/reordering:

/** After how many slices the particles are reordered. 0: off */
Expand Down
2 changes: 2 additions & 0 deletions src/particles/plasma/PlasmaParticleContainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ PlasmaParticleContainer::ReadParameters ()
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(m_init_ion_lev >= 0,
"The initial ion level must be specified");
}
m_can_laser_injection = pp.contains("injection_product");
queryWithParser(pp, "can_laser_injection", m_can_laser_injection);
queryWithParserAlt(pp, "neutralize_background", m_neutralize_background, pp_alt);
AMREX_ALWAYS_ASSERT_WITH_MESSAGE(!m_can_ionize || !m_neutralize_background,
"Cannot use neutralize_background when ionization is turned on");
Expand Down

0 comments on commit 52b4946

Please sign in to comment.