Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Extrapolate.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: Extrapolate.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: Abstract base class for Extrapolate.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
36 #ifndef NEKTAR_SOLVERS_EXTRAPOLATE_H
37 #define NEKTAR_SOLVERS_EXTRAPOLATE_H
38 
42 #include <MultiRegions/ExpList.h>
46 
47 namespace Nektar
48 {
49  struct HBCInfo
50  {
51  /// Global element ID.
53  /// Number of physical points in the element.
55  /// Physical offset of the element in the global list.
57  /// Physical offset of the element in the boundary expansion.
59  /// Trace ID of the element
61  /// Pressure boundary condition ID.
63  /// Associated element physical offset (\f$ k\f$ and \f$ k_c\f$ are the
64  /// real and complex plane).
66  /// Coefficient offset used to locate the acceleration term in the
67  /// general m_pressureHBC.
69  };
70 
71  // Forward declaration
72  class Extrapolate;
73  typedef boost::shared_ptr<Extrapolate> ExtrapolateSharedPtr;
74  typedef LibUtilities::NekFactory< std::string, Extrapolate,
76  Array<OneD, MultiRegions::ExpListSharedPtr>& ,
78  const Array<OneD, int>& ,
80 
82 
84  {
85  public:
86  Extrapolate(
88  Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
90  const Array<OneD, int> pVel,
91  const SolverUtils::AdvectionSharedPtr advObject);
92 
93  virtual ~Extrapolate();
94 
95  void GenerateHOPBCMap();
96 
97  inline void SubSteppingTimeIntegration(
98  const int intMethod,
99  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme);
100 
101  inline void SubStepSaveFields(
102  const int nstep);
103 
104  inline void SubStepSetPressureBCs(
105  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
106  const NekDouble Aii_DT,
107  NekDouble kinvis);
108 
109  inline void SubStepAdvance(
110  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
111  const int nstep,
112  NekDouble time);
113 
114  inline void MountHOPBCs(
115  int HBCdata,
116  NekDouble kinvis,
117  Array<OneD, NekDouble> &Q,
118  Array<OneD, const NekDouble> &Advection);
119 
120  void EvaluatePressureBCs(
121  const Array<OneD, const Array<OneD, NekDouble> > &fields,
122  const Array<OneD, const Array<OneD, NekDouble> > &N,
123  NekDouble kinvis);
124 
125  Array<OneD,NekDouble> GetMaxStdVelocity(
126  const Array<OneD, Array<OneD,NekDouble> > inarray);
127 
128  protected:
129  virtual void v_SubSteppingTimeIntegration(
130  int intMethod,
131  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)=0;
132 
133  virtual void v_SubStepSaveFields(
134  int nstep)=0;
135 
136  virtual void v_SubStepSetPressureBCs(
137  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
138  NekDouble Aii_DT,
139  NekDouble kinvis)=0;
140 
141  virtual void v_SubStepAdvance(
142  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
143  int nstep,
144  NekDouble time)=0;
145 
146  virtual void v_MountHOPBCs(
147  int HBCdata,
148  NekDouble kinvis,
149  Array<OneD, NekDouble> &Q,
150  Array<OneD, const NekDouble> &Advection)=0;
151 
153  const Array<OneD, const Array<OneD, NekDouble> > &fields,
154  const Array<OneD, const Array<OneD, NekDouble> > &N,
155  NekDouble kinvis);
156 
157  void CalcOutflowBCs(
158  const Array<OneD, const Array<OneD, NekDouble> > &fields,
159  const Array<OneD, const Array<OneD, NekDouble> > &N,
160  NekDouble kinvis);
161 
162  void RollOver(
163  Array<OneD, Array<OneD, NekDouble> > &input);
164 
165  void CurlCurl(
166  Array<OneD, Array<OneD, const NekDouble> > &Vel,
167  Array<OneD, Array<OneD, NekDouble> > &Q,
168  const int j);
169 
171 
173 
174  Array<OneD, MultiRegions::ExpListSharedPtr> m_fields;
175 
176  /// Pointer to field holding pressure field
178 
179  /// int which identifies which components of m_fields contains the
180  /// velocity (u,v,w);
181  Array<OneD, int> m_velocity;
182 
184 
185  Array<OneD, Array<OneD, NekDouble> > m_previousVelFields;
186 
187  /// Curl-curl dimensionality
189 
190  /// bounday dimensionality
192 
193  /// pressure boundary conditions container
194  Array<OneD, const SpatialDomains::BoundaryConditionShPtr> m_PBndConds;
195 
196  /// pressure boundary conditions expansion container
197  Array<OneD, MultiRegions::ExpListSharedPtr> m_PBndExp;
198 
199  /// number of times the high-order pressure BCs have been called
201 
202  /// Maximum points used in pressure BC evaluation
204 
205  /// Maximum points used in Element adjacent to pressure BC evaluation
207 
208  /// Maximum points used in pressure BC evaluation
210 
212 
213  /// Flag to determine if single homogeneous mode is used.
215  /// Flag to determine if half homogeneous mode is used.
217  /// Flag to determine if use multiple homogenenous modes are used.
219 
220  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
221 
222  int m_npointsX; ///< number of points in X direction (if homogeneous)
223  int m_npointsY; ///< number of points in Y direction (if homogeneous)
224  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
225 
226 
227 
228  /// Id of element to which pressure boundary condition belongs
229  Array<OneD, int> m_pressureBCtoElmtID;
230 
231  /// Id of edge (2D) or face (3D) to which pressure boundary condition belongs
232  Array<OneD, int> m_pressureBCtoTraceID;
233 
234  /// Storage for current and previous levels of high order pressure boundary conditions.
235  Array<OneD, Array<OneD, NekDouble> > m_pressureHBCs;
236 
237  /// Storage for current and previous levels of the acceleration term.
238  Array<OneD, Array<OneD, NekDouble> > m_acceleration;
239 
240  /// data structure to old all the information regarding High order pressure BCs
241  Array<OneD, HBCInfo > m_HBCdata;
242 
243  /// wave number 2 pi k /Lz
244  Array<OneD, NekDouble> m_wavenumber;
245 
246  /// minus Square of wavenumber
247  Array<OneD, NekDouble> m_negWavenumberSq;
248 
249  /// Storage for current and previous velocity fields at the otuflow for high order outflow BCs
250  Array<OneD, Array<OneD, Array<OneD, NekDouble > > > m_outflowVel;
251 
252 
253  private:
254  static std::string def;
255 
256  // Velocity correction scheme coefficient required for extrapolation.
260  };
261 
262  /**
263  *
264  */
266  int intMethod,
267  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
268  {
269  v_SubSteppingTimeIntegration(intMethod, IntegrationScheme);
270  }
271 
272  /**
273  *
274  */
276  int nstep)
277  {
278  v_SubStepSaveFields(nstep);
279  }
280 
281  /**
282  *
283  */
285  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
286  NekDouble Aii_DT,
287  NekDouble kinvis)
288  {
289  v_SubStepSetPressureBCs(inarray,Aii_DT,kinvis);
290  }
291 
292  /**
293  *
294  */
296  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
297  int nstep,
298  NekDouble time)
299  {
300  v_SubStepAdvance(integrationSoln,nstep, time);
301  }
302 
303  /**
304  *
305  */
307  int HBCdata,
308  NekDouble kinvis,
309  Array<OneD, NekDouble> &Q,
310  Array<OneD, const NekDouble> &Advection)
311  {
312  v_MountHOPBCs(HBCdata,kinvis,Q,Advection);
313  }
314 }
315 
316 #endif
317