Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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,
111  const Array< OneD, Array<OneD, NekDouble> > &Advfield = NullNekDoubleArrayofArray,
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,
127  Array<OneD, MultiRegions::ExpListSharedPtr> &fields,
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 
148  void EvaluateNewtonRHS(Array<OneD, Array<OneD, NekDouble> > &Velocity,
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);
158  Array<OneD, Array<OneD, NekDouble> > m_ForcingTerm;
159  Array<OneD, Array<OneD, NekDouble> > m_ForcingTerm_Coeffs;
160 
161  Array<OneD, CoupledLocalToGlobalC0ContMapSharedPtr> m_locToGloMap;
162 
163  protected:
165 
166  virtual void v_InitObject();
167 
168  private:
169  /// Identify if a single mode is required for stability analysis.
171  /// Id to identify when single mode is mean mode (i.e. beta=0);
173 
176  NekDouble m_tol; // Tolerence
177  int m_maxIt; // Max number of iteration
178  int m_Restart; // 0=Stokes solution as init guess; 1=Restart.cont as init guess
183 
184 
185 
186 
187  Array<OneD, CoupledSolverMatrices> m_mat;
188 
189 
190  /**
191  * Generate the linearised Navier Stokes solver based on the
192  * static condensation of the interior velocity space and
193  * pressure modes. This call also allows for a Fourier mode
194  * to be specified, however if HomogeneneousMode= 0 then can
195  * be used for a standared 2D and hopefully 3D (in the
196  * future).
197  */
198  void SetUpCoupledMatrix(const NekDouble lambda,
199  const Array< OneD, Array<OneD, NekDouble> > &Advfield,
200  bool IsLinearNSEquation,
201  const int HomogeneousMode,
204  const NekDouble lambda_imag = NekConstants::kNekUnsetDouble);
205 
207 
208  virtual void v_DoInitialise(void);
209 
210  virtual void v_DoSolve(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