Nektar++
CoupledLinearNS.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: CoupledLinearNS.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: Coupled Stokes solver scheme header
32//
33///////////////////////////////////////////////////////////////////////////////
34
35#ifndef NEKTAR_SOLVERS_COUPLEDSTOKESSCHEME_H
36#define NEKTAR_SOLVERS_COUPLEDSTOKESSCHEME_H
37
43//#include <MultiRegions/GlobalLinSysDirectStaticCond.h>
44
45namespace Nektar
46{
47
49{
50 /** \brief Boundary-interior Laplacian plus linearised convective
51 * terms pre-multiplying Cinv:
52 * \f$ m\_BCinv[n,m] = (\nabla \phi^b_n, \nu \nabla
53 * \phi^i_j) + (\phi^b_n,{\bf U \cdot \nabla} \phi^i_j) +
54 * (\phi^b_n \nabla^T {\bf U} \phi^i_j) m_Cinv[j,m]\f$
55 */
57
58 /** \brief Interior-boundary Laplacian plus linearised convective terms
59 * \f$ m\_Btilde^T[n,m] = (\nabla \phi^i_n, \nu \nabla \phi^b_m) +
60 * (\phi^i_n,{\bf U \cdot \nabla} \phi^b_m) + (\phi^i_n \nabla^T
61 * {\bf U} \phi^b_m) \f$ */
63
64 /** \brief Interior-Interior Laplaican plus linearised convective
65 * terms inverted, i.e. the inverse of
66 * \f$ m\_C[n,m] = (\nabla \phi^i_n, \nu \nabla
67 * \phi^i_m) + (\phi^i_n,{\bf U \cdot \nabla} \phi^i_m) +
68 * (\phi^i_n \nabla^T {\bf U} \phi^i_m),\f$ */
70
71 /** \brief Inner product of pressure system with divergence of the
72 * boundary velocity space
73 * \f$ m\_D\_{bnd}[n,m] = (\psi_n,\nabla \phi^b_m),\f$
74 */
76
77 /** \brief Inner product of pressure system with divergence of the
78 * interior velocity space
79 * \f$ m\_D\_{int}[n,m] = (\psi_j,\nabla \phi^i_m) \f$
80 */
82
85
87{
88public:
89 friend class MemoryManager<CoupledLinearNS>;
90
91 /// Creates an instance of this class
95 {
98 p->InitObject();
99 return p;
100 }
101 /// Name of class
102 static std::string className;
103
104 /**
105 * Generate the linearised Navier Stokes solver based on the
106 * static condensation of the interior velocity space and
107 * pressure modes.
108 */
109 void SetUpCoupledMatrix(const NekDouble lambda = 0.0,
111 &Advfield = NullNekDoubleArrayOfArray,
112 bool IsLinearNSEquation = true);
113
116
117 void Solve(void);
118
119 /**
120 * Solve the coupled linear Navier-Stokes solve using matrix
121 * systems set up at construction. The solution is stored
122 * in #m_velocity and #m_pressure.
123 */
124 void SolveLinearNS(const Array<OneD, Array<OneD, NekDouble>> &forcing);
125
129 const int HomogeneousMode = 0);
130
132 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
133 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time,
134 const NekDouble a_iixDt);
135
137 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
138 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
139
140 void SolveSteadyNavierStokes(void);
141
142 void Continuation(void);
143
144 /*void EvaluateNewtonRHS(Array<OneD, Array<OneD, NekDouble> > &Velocity,
145 * Array<OneD,
146 *Array<OneD, NekDouble> > &PreviousForcing, Array<OneD, Array<OneD,
147 *NekDouble> > &outarray);*/
148
150 Array<OneD, Array<OneD, NekDouble>> &outarray);
151
153 Array<OneD, NekDouble> &outarray);
154
155 void L2Norm(Array<OneD, Array<OneD, NekDouble>> &inarray,
156 Array<OneD, NekDouble> &outarray);
157
158 void DefineForcingTerm(void);
161
163
164protected:
167
168 void v_InitObject(bool DeclareField = true) override;
169
170 static std::string solverTypeLookupId;
171
172private:
173 /// Id to identify when single mode is mean mode (i.e. beta=0);
175
178 NekDouble m_tol; // Tolerence
179 int m_maxIt; // Max number of iteration
180 int m_Restart; // 0=Stokes solution as init guess; 1=Restart.cont as init
181 // guess
186
188
189 /**
190 * Generate the linearised Navier Stokes solver based on the
191 * static condensation of the interior velocity space and
192 * pressure modes. This call also allows for a Fourier mode
193 * to be specified, however if HomogeneneousMode= 0 then can
194 * be used for a standared 2D and hopefully 3D (in the
195 * future).
196 */
198 const NekDouble lambda,
199 const Array<OneD, Array<OneD, NekDouble>> &Advfield,
200 bool IsLinearNSEquation, const int HomogeneousMode,
203 const NekDouble lambda_imag = NekConstants::kNekUnsetDouble);
204
206
207 void v_DoInitialise(bool dumpInitialConditions = true) override;
208
209 void v_DoSolve(void) override;
210
211 bool v_NegatedOp(void) override;
212
213 void v_TransCoeffToPhys(void) override;
214
215 void v_TransPhysToCoeff(void) override;
216
217 void v_Output(void) override;
218
219 int v_GetForceDimension(void) override;
220};
221
222} // namespace Nektar
223
224#endif // COUPLEDSTOKESSCHEME_H
void L2Norm(Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &outarray)
CoupledLinearNS(const LibUtilities::SessionReaderSharedPtr &pSesssion, const SpatialDomains::MeshGraphSharedPtr &pGraph)
void v_GenerateSummary(SolverUtils::SummaryList &s) override
Print a summary of time stepping parameters.
void EvaluateNewtonRHS(Array< OneD, Array< OneD, NekDouble > > &Velocity, Array< OneD, Array< OneD, NekDouble > > &outarray)
void v_DoSolve(void) override
Solves an unsteady problem.
Array< OneD, CoupledLocalToGlobalC0ContMapSharedPtr > m_locToGloMap
void SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble a_iixDt)
void SolveLinearNS(const Array< OneD, Array< OneD, NekDouble > > &forcing)
void v_Output(void) override
void v_DoInitialise(bool dumpInitialConditions=true) override
Sets up initial conditions.
const SpatialDomains::ExpansionInfoMap & GenPressureExp(const SpatialDomains::ExpansionInfoMap &VelExp)
bool v_NegatedOp(void) override
void EvaluateAdvection(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
void v_InitObject(bool DeclareField=true) override
Initialisation object for EquationSystem.
static std::string className
Name of class.
bool m_zeroMode
Id to identify when single mode is mean mode (i.e. beta=0);.
Array< OneD, Array< OneD, NekDouble > > m_ForcingTerm_Coeffs
Array< OneD, Array< OneD, NekDouble > > m_ForcingTerm
void v_TransPhysToCoeff(void) override
Virtual function for transformation to coefficient space.
void SetUpCoupledMatrix(const NekDouble lambda=0.0, const Array< OneD, Array< OneD, NekDouble > > &Advfield=NullNekDoubleArrayOfArray, bool IsLinearNSEquation=true)
int v_GetForceDimension(void) override
void InfNorm(Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &outarray)
void v_TransCoeffToPhys(void) override
Virtual function for transformation to physical space.
Array< OneD, CoupledSolverMatrices > m_mat
static std::string solverTypeLookupId
This class is the base class for Navier Stokes problems.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:51
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
static const NekDouble kNekUnsetDouble
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:46
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
std::map< int, ExpansionInfoShPtr > ExpansionInfoMap
Definition: MeshGraph.h:141
struct Nektar::coupledSolverMatrices CoupledSolverMatrices
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:79
std::shared_ptr< CoupledLocalToGlobalC0ContMap > CoupledLocalToGlobalC0ContMapSharedPtr
double NekDouble
DNekScalBlkMatSharedPtr m_D_int
Inner product of pressure system with divergence of the interior velocity space .
DNekScalBlkMatSharedPtr m_D_bnd
Inner product of pressure system with divergence of the boundary velocity space .
DNekScalBlkMatSharedPtr m_Cinv
Interior-Interior Laplaican plus linearised convective terms inverted, i.e. the inverse of .
DNekScalBlkMatSharedPtr m_Btilde
Interior-boundary Laplacian plus linearised convective terms .
DNekScalBlkMatSharedPtr m_BCinv
Boundary-interior Laplacian plus linearised convective terms pre-multiplying Cinv: .
MultiRegions::GlobalLinSysSharedPtr m_CoupledBndSys