aboutsummaryrefslogtreecommitdiff
path: root/Source/WarpXEvolve.cpp
diff options
context:
space:
mode:
authorGravatar Remi Lehe <remi.lehe@normalesup.org> 2018-07-03 00:27:35 +0000
committerGravatar Weiqun Zhang <WeiqunZhang@lbl.gov> 2018-07-03 00:27:35 +0000
commit00da522a342650f5a0805ba1a8d49e481841b088 (patch)
tree010822e80b801c516a12c0e3dea7e429a38590c1 /Source/WarpXEvolve.cpp
parent08553b75fc5f99a944bac03daf06940be74c297d (diff)
parent6a1c8787e5814a24df1760f5247999e64359396a (diff)
downloadWarpX-00da522a342650f5a0805ba1a8d49e481841b088.tar.gz
WarpX-00da522a342650f5a0805ba1a8d49e481841b088.tar.zst
WarpX-00da522a342650f5a0805ba1a8d49e481841b088.zip
Merged in sfc (pull request #77)
Improve load-balancing
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) );
}
}