Skip to content

Commit

Permalink
Merge branch 'GPU_acceleration' of github.com:Pierre-Bartoli/WarpX in…
Browse files Browse the repository at this point in the history
…to GPU_acceleration
  • Loading branch information
Pierre Bartoli committed Mar 18, 2024
2 parents 4d46fc7 + d81f328 commit 0c67026
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
4 changes: 3 additions & 1 deletion Source/Particles/Radiation/RadiationHandler.H
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public:

void dump_radiation (amrex::Real dt, int timestep, const std::string& filename);
void Integral_overtime (const amrex::Real dt);

enum struct Type
{
cartesian,
Expand Down Expand Up @@ -78,9 +78,11 @@ private:

bool m_has_start;
bool m_has_stop;
bool m_has_step_skip;

int m_step_start;
int m_step_stop;
int m_step_skip;

};
#endif // WARPX_PARTICLES_RADIATION_H
23 changes: 16 additions & 7 deletions Source/Particles/Radiation/RadiationHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,11 @@ RadiationHandler::RadiationHandler(const amrex::Array<amrex::Real,3>& center)
amrex::Gpu::Device::streamSynchronize();


m_has_start = queryWithParser(pp_radiation, "step_start", m_step_start);
m_has_stop = queryWithParser(pp_radiation, "step_stop", m_step_stop);
m_has_start = queryWithParser(pp_radiation, "step_start", m_step_start);
m_has_stop = queryWithParser(pp_radiation, "step_stop", m_step_stop);
m_has_step_skip = queryWithParser(pp_radiation, "step_skip", m_step_skip);
if (!m_has_step_skip) m_step_skip = 1;


if (m_has_start || m_has_stop){
ablastr::warn_manager::WMRecordWarning(
Expand All @@ -265,14 +268,17 @@ RadiationHandler::RadiationHandler(const amrex::Array<amrex::Real,3>& center)


void RadiationHandler::add_radiation_contribution(
const amrex::Real dt, std::unique_ptr<WarpXParticleContainer>& pc,
const amrex::Real t_dt, std::unique_ptr<WarpXParticleContainer>& pc,
const amrex::Real current_time, const int timestep)
{
if (((m_has_start) && (timestep < m_step_start)) ||
((m_has_stop) && (timestep > m_step_stop))) {
((m_has_stop) && (timestep > m_step_stop)) ||
((m_has_step_skip) && (timestep % m_step_skip != 0))) {
return;
}

const amrex::Real dt = t_dt * m_step_skip;

for (int lev = 0; lev <= pc->finestLevel(); ++lev)
{
#ifdef AMREX_USE_OMP
Expand Down Expand Up @@ -434,10 +440,10 @@ void RadiationHandler::add_radiation_contribution(
}

void RadiationHandler::dump_radiation (
amrex::Real dt, int timestep, const std::string& filename)
const amrex::Real t_dt, const int timestep, const std::string& filename)
{
if (!m_output_intervals_parser.contains(timestep+1)){ return; }
Integral_overtime(dt);
Integral_overtime(t_dt);
gather_and_write_radiation(filename, timestep);
}

Expand Down Expand Up @@ -564,8 +570,11 @@ void RadiationHandler::gather_and_write_radiation(const std::string& filename, [

}

void RadiationHandler::Integral_overtime(const amrex::Real dt)
void RadiationHandler::Integral_overtime(const amrex::Real t_dt)
{

const amrex::Real dt = t_dt * m_step_skip;

const auto factor = dt*dt/16/std::pow(ablastr::constant::math::pi,3)/PhysConst::ep0/(PhysConst::c);

const auto how_many = m_det_pts[0]*m_det_pts[1];
Expand Down

0 comments on commit 0c67026

Please sign in to comment.