aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpXEvolve.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WarpXEvolve.cpp')
-rw-r--r--Source/WarpXEvolve.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/Source/WarpXEvolve.cpp b/Source/WarpXEvolve.cpp
index 20919f333..89a73a978 100644
--- a/Source/WarpXEvolve.cpp
+++ b/Source/WarpXEvolve.cpp
@@ -39,7 +39,7 @@ WarpX::EvolveES (int numsteps) {
bool max_time_reached = false;
- // nodal storage for the electrostatic case
+ // nodal storage for thee electrostatic case
const int num_levels = max_level + 1;
Vector<std::unique_ptr<MultiFab> > rhoNodal(num_levels);
Vector<std::unique_ptr<MultiFab> > phiNodal(num_levels);
@@ -178,13 +178,19 @@ WarpX::EvolveEM (int numsteps)
#ifdef WARPX_USE_PSATD
amrex::Abort("LoadBalance for PSATD: TODO");
#endif
- if (step > 0 && (step-1) % load_balance_int == 0)
+ if (step > 0 && (step+1) % load_balance_int == 0)
{
LoadBalance();
+ // Reset the costs to 0
+ for (int lev = 0; lev <= finest_level; ++lev) {
+ costs[lev]->setVal(0.0);
+ }
}
for (int lev = 0; lev <= finest_level; ++lev) {
- costs[lev]->setVal(0.0);
+ // Perform running average of the costs
+ // (Giving more importance to most recent costs)
+ (*costs[lev].get()).mult( (1. - 2./load_balance_int) );
}
}