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 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: Coupled Stokes solver scheme header
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERS_COUPLEDSTOKESSCHEME_H
37 #define NEKTAR_SOLVERS_COUPLEDSTOKESSCHEME_H
38 
43 #include <MultiRegions/ExpList2D.h>
44 #include <boost/shared_ptr.hpp>
46 //#include <MultiRegions/GlobalLinSysDirectStaticCond.h>
47 
48 namespace Nektar
49 {
50 
51  typedef struct coupledSolverMatrices
52  {
53  /** \brief Boundary-interior Laplacian plus linearised convective
54  * terms pre-multiplying Cinv:
55  * \f$ m\_BCinv[n,m] = (\nabla \phi^b_n, \nu \nabla
56  * \phi^i_j) + (\phi^b_n,{\bf U \cdot \nabla} \phi^i_j) +
57  * (\phi^b_n \nabla^T {\bf U} \phi^i_j) m_Cinv[j,m]\f$
58  */
60 
61  /** \brief Interior-boundary Laplacian plus linearised convective terms
62  * \f$ m\_Btilde^T[n,m] = (\nabla \phi^i_n, \nu \nabla \phi^b_m) +
63  * (\phi^i_n,{\bf U \cdot \nabla} \phi^b_m) + (\phi^i_n \nabla^T
64  * {\bf U} \phi^b_m) \f$ */
66 
67  /** \brief Interior-Interior Laplaican plus linearised convective
68  * terms inverted, i.e. the inverse of
69  * \f$ m\_C[n,m] = (\nabla \phi^i_n, \nu \nabla
70  * \phi^i_m) + (\phi^i_n,{\bf U \cdot \nabla} \phi^i_m) +
71  * (\phi^i_n \nabla^T {\bf U} \phi^i_m),\f$ */
73 
74  /** \brief Inner product of pressure system with divergence of the
75  * boundary velocity space
76  * \f$ m\_D\_{bnd}[n,m] = (\psi_n,\nabla \phi^b_m),\f$
77  */
79 
80  /** \brief Inner product of pressure system with divergence of the
81  * interior velocity space
82  * \f$ m\_D\_{int}[n,m] = (\psi_j,\nabla \phi^i_m) \f$
83  */
85 
88 
90  {
91  public:
93 
94  /// Creates an instance of this class
97  {
99  p->InitObject();
100  return p;
101  }
102  /// Name of class
103  static std::string className;
104 
105  /**
106  * Generate the linearised Navier Stokes solver based on the
107  * static condensation of the interior velocity space and
108  * pressure modes.
109  */
110  void SetUpCoupledMatrix(const NekDouble lambda = 0.0,
112  bool IsLinearNSEquation = true);
113 
114 
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 
126  void SolveLinearNS(const Array<OneD, Array<OneD, NekDouble> > &forcing,
129  const int HomogeneousMode = 0);
130 
131  void SolveUnsteadyStokesSystem(const Array<OneD, const Array<OneD, NekDouble> > &inarray,
132  Array<OneD, Array<OneD, NekDouble> > &outarray,
133  const NekDouble time,
134  const NekDouble a_iixDt);
135 
136  void EvaluateAdvection(const Array<OneD, const Array<OneD, NekDouble> > &inarray,
137  Array<OneD, Array<OneD, NekDouble> > &outarray,
138  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, Array<OneD, NekDouble> > &PreviousForcing,
146  * Array<OneD, Array<OneD, NekDouble> > &outarray);*/
147 
149  Array<OneD, Array<OneD, NekDouble> > &outarray);
150 
151  void InfNorm(Array<OneD, Array<OneD, NekDouble> > &inarray,
152  Array<OneD, NekDouble> &outarray);
153 
154  void L2Norm(Array<OneD, Array<OneD, NekDouble> > &inarray,
155  Array<OneD, NekDouble> &outarray);
156 
157  void DefineForcingTerm(void);
160 
162 
163  protected:
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
226 
227 /**
228  * $Log:$
229  *
230  **/
231 
struct Nektar::coupledSolverMatrices CoupledSolverMatrices
DNekScalBlkMatSharedPtr m_Btilde
Interior-boundary Laplacian plus linearised convective terms .
DNekScalBlkMatSharedPtr m_D_bnd
Inner product of pressure system with divergence of the boundary velocity space . ...
boost::shared_ptr< CoupledLocalToGlobalC0ContMap > CoupledLocalToGlobalC0ContMapSharedPtr
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::vector< std::pair< std::string, std::string > > SummaryList
Definition: Misc.h:47
virtual void v_Output(void)
const SpatialDomains::ExpansionMap & GenPressureExp(const SpatialDomains::ExpansionMap &VelExp)
Array< OneD, Array< OneD, NekDouble > > m_ForcingTerm
Array< OneD, CoupledSolverMatrices > m_mat
virtual bool v_NegatedOp(void)
void L2Norm(Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &outarray)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:50
virtual void v_TransCoeffToPhys(void)
Virtual function for transformation to physical space.
boost::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
void EvaluateNewtonRHS(Array< OneD, Array< OneD, NekDouble > > &Velocity, Array< OneD, Array< OneD, NekDouble > > &outarray)
DNekScalBlkMatSharedPtr m_D_int
Inner product of pressure system with divergence of the interior velocity space . ...
virtual void v_InitObject()
Init object for UnsteadySystem class.
void SolveLinearNS(const Array< OneD, Array< OneD, NekDouble > > &forcing)
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Definition: ExpList.h:1340
Array< OneD, Array< OneD, NekDouble > > m_ForcingTerm_Coeffs
virtual void v_DoInitialise(void)
Sets up initial conditions.
boost::shared_ptr< DNekScalBlkMat > DNekScalBlkMatSharedPtr
Definition: NekTypeDefs.hpp:74
virtual void v_GenerateSummary(SolverUtils::SummaryList &s)
Print a summary of time stepping parameters.
void InfNorm(Array< OneD, Array< OneD, NekDouble > > &inarray, Array< OneD, NekDouble > &outarray)
double NekDouble
void SetUpCoupledMatrix(const NekDouble lambda=0.0, const Array< OneD, Array< OneD, NekDouble > > &Advfield=NullNekDoubleArrayofArray, bool IsLinearNSEquation=true)
virtual int v_GetForceDimension(void)
static const NekDouble kNekUnsetDouble
static std::string className
Name of class.
DNekScalBlkMatSharedPtr m_Cinv
Interior-Interior Laplaican plus linearised convective terms inverted, i.e. the inverse of ...
Array< OneD, CoupledLocalToGlobalC0ContMapSharedPtr > m_locToGloMap
virtual void v_TransPhysToCoeff(void)
Virtual function for transformation to coefficient space.
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)
Creates an instance of this class.
bool m_zeroMode
Id to identify when single mode is mean mode (i.e. beta=0);.
This class is the base class for Navier Stokes problems.
boost::shared_ptr< GlobalLinSys > GlobalLinSysSharedPtr
Pointer to a GlobalLinSys object.
Definition: GlobalLinSys.h:51
virtual void v_DoSolve(void)
Solves an unsteady problem.
static Array< OneD, Array< OneD, NekDouble > > NullNekDoubleArrayofArray
void SolveUnsteadyStokesSystem(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time, const NekDouble a_iixDt)
std::map< int, ExpansionShPtr > ExpansionMap
Definition: MeshGraph.h:171
DNekScalBlkMatSharedPtr m_BCinv
Boundary-interior Laplacian plus linearised convective terms pre-multiplying Cinv: ...
CoupledLinearNS(const LibUtilities::SessionReaderSharedPtr &pSesssion)
MultiRegions::GlobalLinSysSharedPtr m_CoupledBndSys