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 
45 namespace Nektar
46 {
47 
48  typedef struct coupledSolverMatrices
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  {
88  public:
89  friend class MemoryManager<CoupledLinearNS>;
90 
91  /// Creates an instance of this class
95  {
97  p->InitObject();
98  return p;
99  }
100  /// Name of class
101  static std::string className;
102 
103  /**
104  * Generate the linearised Navier Stokes solver based on the
105  * static condensation of the interior velocity space and
106  * pressure modes.
107  */
108  void SetUpCoupledMatrix(const NekDouble lambda = 0.0,
110  bool IsLinearNSEquation = true);
111 
112 
115 
116  void Solve(void);
117 
118  /**
119  * Solve the coupled linear Navier-Stokes solve using matrix
120  * systems set up at construction. The solution is stored
121  * in #m_velocity and #m_pressure.
122  */
123  void SolveLinearNS(const Array<OneD, Array<OneD, NekDouble> > &forcing);
124 
128  const int HomogeneousMode = 0);
129 
130  void SolveUnsteadyStokesSystem(const Array<OneD, const Array<OneD, NekDouble> > &inarray,
131  Array<OneD, Array<OneD, NekDouble> > &outarray,
132  const NekDouble time,
133  const NekDouble a_iixDt);
134 
135  void EvaluateAdvection(const Array<OneD, const Array<OneD, NekDouble> > &inarray,
136  Array<OneD, Array<OneD, NekDouble> > &outarray,
137  const NekDouble time);
138 
139  void SolveSteadyNavierStokes(void);
140 
141  void Continuation(void);
142 
143  /*void EvaluateNewtonRHS(Array<OneD, Array<OneD, NekDouble> > &Velocity,
144  * Array<OneD, Array<OneD, NekDouble> > &PreviousForcing,
145  * Array<OneD, Array<OneD, NekDouble> > &outarray);*/
146 
148  Array<OneD, Array<OneD, NekDouble> > &outarray);
149 
150  void InfNorm(Array<OneD, Array<OneD, NekDouble> > &inarray,
151  Array<OneD, NekDouble> &outarray);
152 
153  void L2Norm(Array<OneD, Array<OneD, NekDouble> > &inarray,
154  Array<OneD, NekDouble> &outarray);
155 
156  void DefineForcingTerm(void);
159 
161 
162  protected:
164  const SpatialDomains::MeshGraphSharedPtr &pGraph);
165 
166  virtual void v_InitObject();
167 
168  private:
169  /// Id to identify when single mode is mean mode (i.e. beta=0);
171 
174  NekDouble m_tol; // Tolerence
175  int m_maxIt; // Max number of iteration
176  int m_Restart; // 0=Stokes solution as init guess; 1=Restart.cont as init guess
181 
182 
183 
184 
186 
187 
188  /**
189  * Generate the linearised Navier Stokes solver based on the
190  * static condensation of the interior velocity space and
191  * pressure modes. This call also allows for a Fourier mode
192  * to be specified, however if HomogeneneousMode= 0 then can
193  * be used for a standared 2D and hopefully 3D (in the
194  * future).
195  */
196  void SetUpCoupledMatrix(const NekDouble lambda,
197  const Array< OneD, Array<OneD, NekDouble> > &Advfield,
198  bool IsLinearNSEquation,
199  const int HomogeneousMode,
202  const NekDouble lambda_imag = NekConstants::kNekUnsetDouble);
203 
205 
206  virtual void v_DoInitialise(void);
207 
208  virtual void v_DoSolve(void);
209 
210  virtual bool v_NegatedOp(void);
211 
212  virtual void v_TransCoeffToPhys(void);
213 
214  virtual void v_TransPhysToCoeff(void);
215 
216  virtual void v_Output(void);
217 
218  virtual int v_GetForceDimension(void);
219  };
220 
221 
222 
223 } //end of namespace
224 
225 #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 EvaluateNewtonRHS(Array< OneD, Array< OneD, NekDouble > > &Velocity, Array< OneD, Array< OneD, NekDouble > > &outarray)
virtual void v_TransPhysToCoeff(void)
Virtual function for transformation to coefficient space.
Array< OneD, CoupledLocalToGlobalC0ContMapSharedPtr > m_locToGloMap
virtual void v_Output(void)
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)
const SpatialDomains::ExpansionInfoMap & GenPressureExp(const SpatialDomains::ExpansionInfoMap &VelExp)
virtual void v_DoSolve(void)
Solves an unsteady problem.
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.
virtual bool v_NegatedOp(void)
static std::string className
Name of class.
virtual int v_GetForceDimension(void)
bool m_zeroMode
Id to identify when single mode is mean mode (i.e. beta=0);.
Array< OneD, Array< OneD, NekDouble > > m_ForcingTerm_Coeffs
virtual void v_InitObject()
Init object for UnsteadySystem class.
Array< OneD, Array< OneD, NekDouble > > m_ForcingTerm
void SetUpCoupledMatrix(const NekDouble lambda=0.0, const Array< OneD, Array< OneD, NekDouble > > &Advfield=NullNekDoubleArrayOfArray, bool IsLinearNSEquation=true)
virtual void v_DoInitialise(void)
Sets up initial conditions.
void InfNorm(Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &outarray)
Array< OneD, CoupledSolverMatrices > m_mat
virtual void v_TransCoeffToPhys(void)
Virtual function for transformation to physical space.
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
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:50
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:143
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
struct Nektar::coupledSolverMatrices CoupledSolverMatrices
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayOfArray
std::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:73
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