Nektar++
DriverParallelInTime.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File DriverParallelInTime.h
4//
5// For more information, please see: http://www.nektar.info
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description: Driver class for the parallel-in-time solver
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERUTILS_DRIVERPARALLELINTIME_H
36#define NEKTAR_SOLVERUTILS_DRIVERPARALLELINTIME_H
37
38#include <SolverUtils/Driver.h>
40
41namespace Nektar::SolverUtils
42{
43
44/// Base class for the development of parallel-in-time solvers.
46{
47public:
48protected:
49 /// Constructor
53
54 /// Destructor
56
57 /// Virtual function for initialisation implementation.
59 std::ostream &out = std::cout) override;
60
61 /// Virtual function for solve implementation.
62 SOLVER_UTILS_EXPORT void v_Execute(std::ostream &out = std::cout) override;
63
64 void SetParallelInTimeEquationSystem(std::string AdvectiveType);
65
66 void GetParametersFromSession(void);
67
68 void InitialiseEqSystem(bool turnoff_output);
69
71
72 void PrintSolverInfo(std::ostream &out = std::cout);
73
74 void PrintHeader(const std::string &title, const char c);
75
77 int &convergence);
78
80
82 int &convergence);
83
85
88
89 void CopyFromPhysField(const size_t timeLevel,
91
92 void CopyToPhysField(const size_t timeLevel,
93 const Array<OneD, const Array<OneD, NekDouble>> &in);
94
95 void UpdateFieldCoeffs(const size_t timeLevel,
96 const Array<OneD, const Array<OneD, NekDouble>> &in =
98
99 void EvaluateExactSolution(const size_t timeLevel, const NekDouble &time);
100
101 void SolutionConvergenceMonitoring(const size_t timeLevel,
102 const size_t iter);
103
104 void SolutionConvergenceSummary(const size_t timeLevel);
105
106 void UpdateErrorNorm(const size_t timeLevel, const bool normalized);
107
108 void PrintErrorNorm(const size_t timeLevel, const bool normalized);
109
111
115
116 void Interpolate(
119 const Array<OneD, Array<OneD, NekDouble>> &inarray,
120 Array<OneD, Array<OneD, NekDouble>> &outarray);
121
122 /// Total time integration interval.
124
125 /// Time integration interval per chunk.
127
128 /// Local time.
130
131 /// Number of time chunks.
133
134 /// Rank in time.
136
137 /// Maximum number of parallel-in-time iteration.
139
140 // Number of windows for parallel-in-time time iteration.
142
143 /// Using exact solution to compute error norms.
145
146 /// ParallelInTime tolerance.
148
149 /// Number of variables.
150 size_t m_nVar;
151
152 /// Number of time levels.
154
155 /// Number of time steps for each time level.
157
158 /// Time step for each time level.
160
161 /// Number of dof for each time level.
163
164 /// Equation system to solve.
166
167 /// Storage for parallel-in-time iteration.
171};
172
173} // namespace Nektar::SolverUtils
174
175#endif // NEKTAR_SOLVERUTILS_DRIVERPARALLELINTIME_H
#define SOLVER_UTILS_EXPORT
Base class for the development of solvers.
Definition: Driver.h:65
Base class for the development of parallel-in-time solvers.
NekDouble m_totalTime
Total time integration interval.
SOLVER_UTILS_EXPORT ~DriverParallelInTime() override=default
Destructor.
Array< OneD, NekDouble > m_vL2Errors
Storage for parallel-in-time iteration.
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_iterMaxPIT
Maximum number of parallel-in-time iteration.
void PrintErrorNorm(const size_t timeLevel, const bool normalized)
void SetParallelInTimeEquationSystem(std::string AdvectiveType)
Array< OneD, size_t > m_nsteps
Number of time steps for each time level.
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 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.
void PrintSolverInfo(std::ostream &out=std::cout)
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)
SOLVER_UTILS_EXPORT void v_Execute(std::ostream &out=std::cout) override
Virtual function for solve implementation.
Array< OneD, size_t > m_npts
Number of dof for each time level.
Array< OneD, Array< OneD, NekDouble > > m_exactsoln
NekDouble EstimateCommunicationTime(Array< OneD, Array< OneD, NekDouble > > &buffer1, Array< OneD, Array< OneD, NekDouble > > &buffer2)
void SolutionConvergenceSummary(const size_t timeLevel)
Array< OneD, NekDouble > m_timestep
Time step for each time level.
void CopySolutionVector(const Array< OneD, const Array< OneD, NekDouble > > &in, Array< OneD, Array< OneD, NekDouble > > &out)
void UpdateErrorNorm(const size_t timeLevel, const bool normalized)
void SolutionConvergenceMonitoring(const size_t timeLevel, const size_t iter)
SOLVER_UTILS_EXPORT DriverParallelInTime(const LibUtilities::SessionReaderSharedPtr pSession, const SpatialDomains::MeshGraphSharedPtr pGraph)
Constructor.
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)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
double NekDouble