39#include <boost/format.hpp>
78 NekDouble totalTime = 0.0, predictorTime = 0.0, coarseSolveTime = 0.0,
79 fineSolveTime = 0.0, correctionTime = 0.0;
94 m_comm->GetTimeComm()->Block();
109 for (
size_t i = 0; i <
m_nVar; ++i)
118 for (
size_t i = 0; i <
m_nVar; ++i)
132 predictorTime += timer.
Elapsed().count();
133 totalTime += timer.
Elapsed().count();
140 totalTime += timer.
Elapsed().count();
142 m_comm->GetSpaceComm()->GetRank() == 0)
144 std::cout <<
"Total Computation Time : " << totalTime <<
"s"
151 int convergenceCurr =
false;
162 totalTime += timer.
Elapsed().count();
169 fineSolveTime += timer.
Elapsed().count();
170 totalTime += timer.
Elapsed().count();
176 correctionTime += timer.
Elapsed().count();
177 totalTime += timer.
Elapsed().count();
183 totalTime += timer.
Elapsed().count();
191 coarseSolveTime += timer.
Elapsed().count();
192 totalTime += timer.
Elapsed().count();
198 correctionTime += timer.
Elapsed().count();
199 totalTime += timer.
Elapsed().count();
205 m_comm->GetSpaceComm()->GetRank() == 0)
207 std::cout <<
"Total Computation Time : " << totalTime <<
"s"
210 std::cout <<
" - Predictor Time : " << predictorTime <<
"s"
213 std::cout <<
" - Coarse Solve Time : " << coarseSolveTime <<
"s"
216 std::cout <<
" - Fine Solve Time : " << fineSolveTime <<
"s"
219 std::cout <<
" - Correction Time : " << correctionTime <<
"s"
232 totalTime += timer.
Elapsed().count();
248 totalTime += timer.
Elapsed().count();
251 m_comm->GetTimeComm()->Block();
256 m_comm->GetSpaceComm()->GetRank() == 0)
258 std::cout <<
"Total Computation Time : " << totalTime <<
"s"
261 std::cout <<
" - Predictor Time : " << predictorTime <<
"s" << std::endl
263 std::cout <<
" - Coarse Solve Time : " << coarseSolveTime <<
"s"
266 std::cout <<
" - Fine Solve Time : " << fineSolveTime <<
"s"
269 std::cout <<
" - Correction Time : " << correctionTime <<
"s"
284 for (
size_t i = 0; i <
m_nVar; ++i)
304 "Total number of fine step should be divisible by number of chunks.");
308 "Total number of coarse step should be divisible by number of chunks.");
311 "Total number of fine step should be divisible by number of "
312 "windows times number of chunks.");
315 "Total number of coarse step should be divisible by number of "
316 "windows times number of chunks.");
320 "Fine and coarse total computational times do not match");
323 ->GetTimeIntegrationScheme()
324 ->GetNumIntegrationPhases() == 1,
325 "Only single step time-integration schemes currently supported "
329 ->GetTimeIntegrationScheme()
330 ->GetNumIntegrationPhases() == 1,
331 "Only single step time-integration schemes currently supported "
340 "number of IO_InfoSteps should divide number of fine steps "
350 "number of IO_InfoSteps should divide number of coarse steps "
360 "number of IO_CheckSteps should divide number of fine steps "
370 "number of IO_CheckSteps should divide number of coarse steps "
401 const NekDouble time,
const size_t nstep,
402 const size_t wd,
const size_t iter)
406 m_EqSys[timeLevel]->GetCheckpointSteps()
415 m_EqSys[timeLevel]->SetCheckpointNumber(iChkPts);
418 m_EqSys[timeLevel]->SetIterationNumberPIT(iter);
421 m_EqSys[timeLevel]->SetWindowNumberPIT(wd);
423 m_EqSys[timeLevel]->SetTime(time);
424 m_EqSys[timeLevel]->SetSteps(nstep);
434 for (
size_t i = 0; i <
m_nVar; ++i)
450 for (
size_t i = 0; i <
m_nVar; ++i)
486 for (
size_t i = 0; i <
m_nVar; ++i)
495 for (
size_t i = 0; i <
m_nVar; ++i)
510 if (
m_comm->GetSpaceComm()->GetRank() == 0)
512 for (
size_t j = k; j < kmax; j++)
521 sessionName +
"_" + std::to_string(j - 1) +
".pit";
524 std::string outdir = sessionName +
"_" + std::to_string(j) +
".pit";
526 for (
size_t timeLevel = 0; timeLevel <
m_nTimeLevel; timeLevel++)
530 m_EqSys[timeLevel]->GetCheckpointSteps()
532 m_EqSys[timeLevel]->GetCheckpointSteps()
538 for (
size_t i = 1; i <= nChkPts; i++)
541 std::string filename = sessionName +
"_timeLevel" +
542 std::to_string(timeLevel) +
"_" +
543 std::to_string(iChkPts + i) +
".chk";
546 std::string infullname = indir +
"/" + filename;
549 std::string outfullname = outdir +
"/" + filename;
552 fs::remove_all(outfullname);
#define ASSERTL0(condition, msg)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
static std::string RegisterEnumValue(std::string pEnum, std::string pString, int pEnumValue)
Registers an enumeration value.
LibUtilities::CommSharedPtr m_comm
Communication object.
Base class for the development of parallel-in-time solvers.
size_t m_numChunks
Number of time chunks.
NekDouble m_totalTime
Total time integration interval.
NekDouble vL2ErrorMax(void)
void UpdateFieldCoeffs(const size_t timeLevel, const Array< OneD, const Array< OneD, NekDouble > > &in=NullNekDoubleArrayOfArray)
NekDouble m_chunkTime
Time integration interval per chunk.
void SendToNextProc(Array< OneD, Array< OneD, NekDouble > > &array, int &convergence)
size_t m_nTimeLevel
Number of time levels.
size_t m_iterMaxPIT
Maximum number of parallel-in-time iteration.
Array< OneD, size_t > m_nsteps
Number of time steps for each time level.
void InitialiseEqSystem(bool turnoff_output)
SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout) override
Virtual function for initialisation implementation.
void EvaluateExactSolution(const size_t timeLevel, const NekDouble &time)
void GetParametersFromSession(void)
void RecvFromPreviousProc(Array< OneD, Array< OneD, NekDouble > > &array, int &convergence)
Array< OneD, std::shared_ptr< UnsteadySystem > > m_EqSys
Equation system to solve.
void PrintHeader(const std::string &title, const char c)
NekDouble m_tolerPIT
ParallelInTime tolerance.
size_t m_chunkRank
Rank in time.
void PrintSolverInfo(std::ostream &out=std::cout)
size_t m_nVar
Number of variables.
bool m_exactSolution
Using exact solution to compute error norms.
void CopyFromPhysField(const size_t timeLevel, Array< OneD, Array< OneD, NekDouble > > &out)
void CopyToPhysField(const size_t timeLevel, const Array< OneD, const Array< OneD, NekDouble > > &in)
Array< OneD, size_t > m_npts
Number of dof for each time level.
Array< OneD, Array< OneD, NekDouble > > m_exactsoln
void SolutionConvergenceSummary(const size_t timeLevel)
NekDouble m_time
Local time.
Array< OneD, NekDouble > m_timestep
Time step for each time level.
void SolutionConvergenceMonitoring(const size_t timeLevel, const size_t iter)
void Interpolate(const Array< OneD, MultiRegions::ExpListSharedPtr > &infield, const Array< OneD, MultiRegions::ExpListSharedPtr > &outfield, const Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray)
void ApplyWindowing(const size_t w)
SOLVER_UTILS_EXPORT void v_Execute(std::ostream &out=std::cout) override
Virtual function for solve implementation.
static constexpr size_t m_fineLevel
void UpdateInitialConditionFromSolver(const size_t timeLevel)
static std::string driverLookupId
void InterpolateCoarseSolution(void)
static constexpr size_t m_coarseLevel
static std::string className
Name of the class.
void CorrectionWithOldCoarseSolution(void)
void CopyConvergedCheckPoints(const size_t w, const size_t k)
SOLVER_UTILS_EXPORT void v_InitObject(std::ostream &out=std::cout) override
Virtual function for initialisation implementation.
void UpdateSolution(const size_t timeLevel, const NekDouble time, const size_t nstep, const size_t wd, const size_t iter)
Array< OneD, Array< OneD, NekDouble > > m_coarseSolution
void CorrectionWithNewCoarseSolution(void)
static DriverSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
SOLVER_UTILS_EXPORT DriverParareal(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Constructor.
void WriteTimeChunkOuput(void)
void AllocateMemory(void)
void AssertParameters(void)
void UpdateSolverInitialCondition(const size_t timeLevel)
Array< OneD, Array< OneD, NekDouble > > m_fineSolution
Array< OneD, Array< OneD, NekDouble > > m_initialCondition
std::shared_ptr< SessionReader > SessionReaderSharedPtr
DriverFactory & GetDriverFactory()
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
std::vector< double > w(NPUPPER)
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
void Vadd(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Add vector z = x+y.
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
void Vsub(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Subtract vector z = x-y.