Skip to content

Commit

Permalink
communicate lambda0 with laser from file (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSinn authored Aug 4, 2023
1 parent 21f5aeb commit 9f174cf
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
2 changes: 0 additions & 2 deletions src/laser/MultiLaser.H
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ private:

/** if the lasers are initialized from openPMD file */
bool m_laser_from_file = false;
/** if the input file was already read */
bool m_input_file_is_read = false;
/** full 3D laser data stored on the host */
amrex::FArrayBox m_F_input_file;
/** path to input openPMD file */
Expand Down
20 changes: 15 additions & 5 deletions src/laser/MultiLaser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ MultiLaser::InitData (const amrex::BoxArray& slice_ba,
reinterpret_cast<LaserFFT::FFTWComplex*>(m_rhs_fourier.dataPtr()),
reinterpret_cast<LaserFFT::FFTWComplex*>(m_sol.dataPtr()),
FFTW_BACKWARD, FFTW_ESTIMATE);
#endif
}

if (m_laser_from_file) {
if (Hipace::HeadRank()) {
m_F_input_file.resize(m_laser_geom_3D.Domain(), 2, amrex::The_Pinned_Arena());
GetEnvelopeFromFileHelper(m_laser_geom_3D);
}
#ifdef AMREX_USE_MPI
// need to communicate m_lambda0 as it is read in from the input file only by the head rank
MPI_Bcast(&m_lambda0,
1,
amrex::ParallelDescriptor::Mpi_typemap<decltype(m_lambda0)>::type(),
amrex::ParallelDescriptor::NProcs() - 1, // HeadRank
amrex::ParallelDescriptor::Communicator());
#endif
}
}
Expand All @@ -148,11 +163,6 @@ MultiLaser::InitSliceEnvelope (const int islice, const int comp)
HIPACE_PROFILE("MultiLaser::InitSliceEnvelope()");

if (m_laser_from_file) {
if (!m_input_file_is_read) {
m_F_input_file.resize(m_laser_geom_3D.Domain(), 2, amrex::The_Pinned_Arena());
GetEnvelopeFromFileHelper(m_laser_geom_3D);
m_input_file_is_read = true;
}
amrex::Box src_box = m_slice_box;
src_box.setSmall(2, islice);
src_box.setBig(2, islice);
Expand Down

0 comments on commit 9f174cf

Please sign in to comment.