aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Source/WarpXElectrostatic.cpp10
-rw-r--r--Source/WarpXEvolve.cpp14
2 files changed, 24 insertions, 0 deletions
diff --git a/Source/WarpXElectrostatic.cpp b/Source/WarpXElectrostatic.cpp
index e57d67084..e1f599f8a 100644
--- a/Source/WarpXElectrostatic.cpp
+++ b/Source/WarpXElectrostatic.cpp
@@ -63,7 +63,9 @@ WarpX::EvolveES (int numsteps) {
// Start loop on time steps
amrex::Print() << "\nSTEP " << step+1 << " starts ...\n";
+#ifdef WARPX_USE_PY
if (warpx_py_beforestep) warpx_py_beforestep();
+#endif
// At initialization, particles have p^{n-1/2} and x^{n-1/2}.
// Beyond one step, particles have p^{n-1/2} and x^{n}.
@@ -87,16 +89,22 @@ WarpX::EvolveES (int numsteps) {
// Evolve particles to p^{n+1/2} and x^{n+1}
mypc->EvolveES(eFieldNodal, rhoNodal, cur_time, dt[lev]);
+#ifdef WARPX_USE_PY
if (warpx_py_particleinjection) warpx_py_particleinjection();
if (warpx_py_particlescraper) warpx_py_particlescraper();
if (warpx_py_beforedeposition) warpx_py_beforedeposition();
+#endif
mypc->DepositCharge(rhoNodal);
+#ifdef WARPX_USE_PY
if (warpx_py_afterdeposition) warpx_py_afterdeposition();
if (warpx_py_beforeEsolve) warpx_py_beforeEsolve();
+#endif
computePhi(rhoNodal, phiNodal);
computeE(eFieldNodal, phiNodal);
+#ifdef WARPX_USE_PY
if (warpx_py_afterEsolve) warpx_py_afterEsolve();
+#endif
if (cur_time + dt[0] >= stop_time - 1.e-3*dt[0] || step == numsteps_max-1) {
// on last step, push by only 0.5*dt to synchronize all at n+1/2
@@ -142,7 +150,9 @@ WarpX::EvolveES (int numsteps) {
break;
}
+#ifdef WARPX_USE_PY
if (warpx_py_afterstep) warpx_py_afterstep();
+#endif
// End loop on time steps
}
diff --git a/Source/WarpXEvolve.cpp b/Source/WarpXEvolve.cpp
index 3eaa929f9..b42a781d1 100644
--- a/Source/WarpXEvolve.cpp
+++ b/Source/WarpXEvolve.cpp
@@ -5,7 +5,9 @@
#include <WarpX.H>
#include <WarpXConst.H>
#include <WarpX_f.H>
+#ifdef WARPX_USE_PY
#include <WarpX_py.H>
+#endif
using namespace amrex;
@@ -48,7 +50,9 @@ WarpX::EvolveEM (int numsteps)
// Start loop on time steps
amrex::Print() << "\nSTEP " << step+1 << " starts ...\n";
+#ifdef WARPX_USE_PY
if (warpx_py_beforestep) warpx_py_beforestep();
+#endif
if (costs[0] != nullptr)
{
@@ -95,11 +99,15 @@ WarpX::EvolveEM (int numsteps)
// from p^{n-1/2} to p^{n+1/2}
// Deposit current j^{n+1/2}
// Deposit charge density rho^{n}
+#ifdef WARPX_USE_PY
if (warpx_py_particleinjection) warpx_py_particleinjection();
if (warpx_py_particlescraper) warpx_py_particlescraper();
if (warpx_py_beforedeposition) warpx_py_beforedeposition();
+#endif
PushParticlesandDepose(cur_time);
+#ifdef WARPX_USE_PY
if (warpx_py_afterdeposition) warpx_py_afterdeposition();
+#endif
SyncCurrent();
@@ -124,7 +132,9 @@ WarpX::EvolveEM (int numsteps)
FillBoundaryB();
#endif
+#ifdef WARPX_USE_PY
if (warpx_py_beforeEsolve) warpx_py_beforeEsolve();
+#endif
if (cur_time + dt[0] >= stop_time - 1.e-3*dt[0] || step == numsteps_max-1) {
// At the end of last step, push p by 0.5*dt to synchronize
UpdateAuxilaryData();
@@ -135,7 +145,9 @@ WarpX::EvolveEM (int numsteps)
}
is_synchronized = true;
}
+#ifdef WARPX_USE_PY
if (warpx_py_afterEsolve) warpx_py_afterEsolve();
+#endif
for (int lev = 0; lev <= max_level; ++lev) {
++istep[lev];
@@ -200,7 +212,9 @@ WarpX::EvolveEM (int numsteps)
break;
}
+#ifdef WARPX_USE_PY
if (warpx_py_afterstep) warpx_py_afterstep();
+#endif
// End loop on time steps
}