Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communicate lambda0 with laser from file #1004

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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