Skip to content

Commit

Permalink
WarpX class: fuse together doFieldIonization with doFieldIonization(l…
Browse files Browse the repository at this point in the history
…ev) and doQEDEvents with doQEDEvents(lev) (#5671)

`doFieldIonization(lev) ` is called only once, inside
`doFieldIonization` , which is simply a loop over the levels calling for
each level `doFieldIonization(lev) `. The same happens for
`doQEDEvents`.

In order to simplify the interface of the WarpX class, I would like to
propose to drop `doFieldIonization(lev) ` and `doQEDEvents(lev) `, and
to integrate their code respectively in `doFieldIonization` and
`doQEDEvents`.
  • Loading branch information
lucafedeli88 authored Feb 19, 2025
1 parent e627b9c commit 8d285a8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 42 deletions.
56 changes: 22 additions & 34 deletions Source/Evolve/WarpXEvolve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1076,53 +1076,41 @@ WarpX::OneStep_sub1 (Real cur_time)

void
WarpX::doFieldIonization ()
{
for (int lev = 0; lev <= finest_level; ++lev) {
doFieldIonization(lev);
}
}

void
WarpX::doFieldIonization (int lev)
{
using ablastr::fields::Direction;
using warpx::fields::FieldType;

mypc->doFieldIonization(
lev,
*m_fields.get(FieldType::Efield_aux, Direction{0}, lev),
*m_fields.get(FieldType::Efield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Efield_aux, Direction{2}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{0}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{2}, lev)
);
}

#ifdef WARPX_QED
void
WarpX::doQEDEvents ()
{
for (int lev = 0; lev <= finest_level; ++lev) {
doQEDEvents(lev);
mypc->doFieldIonization(
lev,
*m_fields.get(FieldType::Efield_aux, Direction{0}, lev),
*m_fields.get(FieldType::Efield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Efield_aux, Direction{2}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{0}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{2}, lev)
);
}
}

#ifdef WARPX_QED
void
WarpX::doQEDEvents (int lev)
WarpX::doQEDEvents ()
{
using ablastr::fields::Direction;
using warpx::fields::FieldType;

mypc->doQedEvents(
lev,
*m_fields.get(FieldType::Efield_aux, Direction{0}, lev),
*m_fields.get(FieldType::Efield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Efield_aux, Direction{2}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{0}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{2}, lev)
);
for (int lev = 0; lev <= finest_level; ++lev) {
mypc->doQedEvents(
lev,
*m_fields.get(FieldType::Efield_aux, Direction{0}, lev),
*m_fields.get(FieldType::Efield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Efield_aux, Direction{2}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{0}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{1}, lev),
*m_fields.get(FieldType::Bfield_aux, Direction{2}, lev)
);
}
}
#endif

Expand Down
8 changes: 0 additions & 8 deletions Source/WarpX.H
Original file line number Diff line number Diff line change
Expand Up @@ -663,18 +663,10 @@ public:

/** Run the ionization module on all species */
void doFieldIonization ();
/** Run the ionization module on all species at level lev
* \param lev level
*/
void doFieldIonization (int lev);

#ifdef WARPX_QED
/** Run the QED module on all species */
void doQEDEvents ();
/** Run the QED module on all species at level lev
* \param lev level
*/
void doQEDEvents (int lev);
#endif

void PushParticlesandDeposit (int lev, amrex::Real cur_time, DtType a_dt_type=DtType::Full, bool skip_current=false,
Expand Down

0 comments on commit 8d285a8

Please sign in to comment.