Optimize constraint refresh after regrid
This commit is contained in:
@@ -64,8 +64,9 @@ bssn_class::bssn_class(double Couranti, double StartTimei, double TotalTimei,
|
|||||||
#ifdef With_AHF
|
#ifdef With_AHF
|
||||||
xc(0), yc(0), zc(0), xr(0), yr(0), zr(0), trigger(0), dTT(0), dumpid(0),
|
xc(0), yc(0), zc(0), xr(0), yr(0), zr(0), trigger(0), dTT(0), dumpid(0),
|
||||||
#endif
|
#endif
|
||||||
a_lev(a_levi), maxl(maxli), decn(decni), maxrex(maxrexi), drex(drexi),
|
a_lev(a_levi), maxl(maxli), decn(decni), maxrex(maxrexi), drex(drexi),
|
||||||
CheckPoint(0)
|
ConstraintRefreshLevels(0),
|
||||||
|
CheckPoint(0)
|
||||||
// CheckPoint(0)
|
// CheckPoint(0)
|
||||||
{
|
{
|
||||||
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
|
||||||
@@ -701,9 +702,12 @@ void bssn_class::Initialize()
|
|||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GH = new cgh(0, ngfs, Symmetry, pname, checkrun, ErrorMonitor);
|
GH = new cgh(0, ngfs, Symmetry, pname, checkrun, ErrorMonitor);
|
||||||
if (checkrun)
|
ConstraintRefreshLevels = new int[GH->levels];
|
||||||
CheckPoint->readcheck_cgh(PhysTime, GH, myrank, nprocs, Symmetry);
|
for (int il = 0; il < GH->levels; il++)
|
||||||
|
ConstraintRefreshLevels[il] = 0;
|
||||||
|
if (checkrun)
|
||||||
|
CheckPoint->readcheck_cgh(PhysTime, GH, myrank, nprocs, Symmetry);
|
||||||
else
|
else
|
||||||
GH->compose_cgh(nprocs);
|
GH->compose_cgh(nprocs);
|
||||||
#ifdef WithShell
|
#ifdef WithShell
|
||||||
@@ -789,9 +793,11 @@ bssn_class::~bssn_class()
|
|||||||
SynchList_pre->clearList();
|
SynchList_pre->clearList();
|
||||||
SynchList_cor->clearList();
|
SynchList_cor->clearList();
|
||||||
DumpList->clearList();
|
DumpList->clearList();
|
||||||
ConstraintList->clearList();
|
ConstraintList->clearList();
|
||||||
|
|
||||||
delete phio;
|
delete[] ConstraintRefreshLevels;
|
||||||
|
|
||||||
|
delete phio;
|
||||||
delete trKo;
|
delete trKo;
|
||||||
delete gxxo;
|
delete gxxo;
|
||||||
delete gxyo;
|
delete gxyo;
|
||||||
@@ -2437,13 +2443,17 @@ void bssn_class::RecursiveStep(int lev)
|
|||||||
if(lev>0) Parallel::Restrict_after(GH->PatL[lev-1],GH->PatL[lev],StateList,StateList,Symmetry);
|
if(lev>0) Parallel::Restrict_after(GH->PatL[lev-1],GH->PatL[lev],StateList,StateList,Symmetry);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (REGLEV == 0)
|
#if (REGLEV == 0)
|
||||||
if (GH->Regrid_Onelevel(lev, Symmetry, BH_num, Porgbr, Porg0,
|
if (GH->Regrid_Onelevel(lev, Symmetry, BH_num, Porgbr, Porg0,
|
||||||
SynchList_cor, OldStateList, StateList, SynchList_pre,
|
SynchList_cor, OldStateList, StateList, SynchList_pre,
|
||||||
fgt(PhysTime - dT_lev, StartTime, dT_lev / 2), ErrorMonitor))
|
fgt(PhysTime - dT_lev, StartTime, dT_lev / 2), ErrorMonitor))
|
||||||
for (int il = 0; il < GH->levels; il++) { sync_cache_pre[il].invalidate(); sync_cache_cor[il].invalidate(); sync_cache_rp_coarse[il].invalidate(); sync_cache_rp_fine[il].invalidate(); sync_cache_restrict[il].invalidate(); sync_cache_outbd[il].invalidate(); }
|
{
|
||||||
#endif
|
if (ConstraintRefreshLevels)
|
||||||
}
|
ConstraintRefreshLevels[lev] = 1;
|
||||||
|
for (int il = 0; il < GH->levels; il++) { sync_cache_pre[il].invalidate(); sync_cache_cor[il].invalidate(); sync_cache_rp_coarse[il].invalidate(); sync_cache_rp_fine[il].invalidate(); sync_cache_restrict[il].invalidate(); sync_cache_outbd[il].invalidate(); }
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
|
|
||||||
@@ -7261,8 +7271,8 @@ void bssn_class::Constraint_Out()
|
|||||||
for (int lev = 0; lev < GH->levels; lev++)
|
for (int lev = 0; lev < GH->levels; lev++)
|
||||||
{
|
{
|
||||||
// make sure the data consistent for higher levels
|
// make sure the data consistent for higher levels
|
||||||
if (lev > 0) // if the constrait quantities can be reused from the step rhs calculation
|
if (lev > 0 && ConstraintRefreshLevels && ConstraintRefreshLevels[lev]) // only refresh levels whose grid layout changed after evolution
|
||||||
{
|
{
|
||||||
double TRK4 = PhysTime;
|
double TRK4 = PhysTime;
|
||||||
double ndeps = numepsb;
|
double ndeps = numepsb;
|
||||||
int pre = 0;
|
int pre = 0;
|
||||||
@@ -7471,11 +7481,14 @@ void bssn_class::Constraint_Out()
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
Interp_Constraint(false);
|
Interp_Constraint(false);
|
||||||
|
|
||||||
LastConsOut = 0;
|
LastConsOut = 0;
|
||||||
}
|
if (ConstraintRefreshLevels)
|
||||||
}
|
for (int lev = 0; lev < GH->levels; lev++)
|
||||||
|
ConstraintRefreshLevels[lev] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//================================================================================================
|
//================================================================================================
|
||||||
|
|
||||||
|
|||||||
@@ -45,10 +45,11 @@ public:
|
|||||||
int checkrun;
|
int checkrun;
|
||||||
char checkfilename[50];
|
char checkfilename[50];
|
||||||
int Steps;
|
int Steps;
|
||||||
double StartTime, TotalTime;
|
double StartTime, TotalTime;
|
||||||
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
double AnasTime, DumpTime, d2DumpTime, CheckTime;
|
||||||
double LastAnas, LastConsOut;
|
double LastAnas, LastConsOut;
|
||||||
double Courant;
|
int *ConstraintRefreshLevels;
|
||||||
|
double Courant;
|
||||||
double numepss, numepsb, numepsh;
|
double numepss, numepsb, numepsh;
|
||||||
int Symmetry;
|
int Symmetry;
|
||||||
int maxl, decn;
|
int maxl, decn;
|
||||||
|
|||||||
Reference in New Issue
Block a user