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.
62  int m_bndryID;
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,
78  const Array<OneD, int>& ,
80 
81  ExtrapolateFactory& GetExtrapolateFactory();
82 
83  class Extrapolate
84  {
85  public:
86  Extrapolate(
87  const LibUtilities::SessionReaderSharedPtr pSession,
88  Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
89  MultiRegions::ExpListSharedPtr pPressure,
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,
119 
120  inline 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  void CalcExplicitDuDt(const Array<OneD, const Array<OneD, NekDouble> > &fields);
126  void ExtrapolatePressureHBCs(void);
127  void CopyPressureHBCsToPbndExp(void);
128 
130  const Array<OneD, Array<OneD,NekDouble> > inarray);
131 
132 
133  void CorrectPressureBCs( const Array<OneD, NekDouble> &pressure);
134 
136  Array<OneD, NekDouble> &IprodVn);
137 
139 
141 
142  void ExtrapolateArray(
143  Array<OneD, Array<OneD, NekDouble> > &oldarrays,
144  Array<OneD, NekDouble> &newarray,
145  Array<OneD, NekDouble> &outarray);
146 
147  protected:
148  virtual void v_EvaluatePressureBCs(
149  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
150  const Array<OneD, const Array<OneD, NekDouble> > &N,
151  NekDouble kinvis)=0;
152 
153  virtual void v_SubSteppingTimeIntegration(
154  int intMethod,
155  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)=0;
156 
157  virtual void v_SubStepSaveFields(
158  int nstep)=0;
159 
160  virtual void v_SubStepSetPressureBCs(
161  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
162  NekDouble Aii_DT,
163  NekDouble kinvis)=0;
164 
165  virtual void v_SubStepAdvance(
166  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
167  int nstep,
168  NekDouble time)=0;
169 
170  virtual void v_MountHOPBCs(
171  int HBCdata,
172  NekDouble kinvis,
174  Array<OneD, const NekDouble> &Advection)=0;
175 
178 
180  const Array<OneD, const Array<OneD, NekDouble> > &fields,
181  const Array<OneD, const Array<OneD, NekDouble> > &N,
182  NekDouble kinvis)
183  {
184  v_CalcNeumannPressureBCs( fields, N, kinvis);
185  }
186 
187  virtual void v_CalcNeumannPressureBCs(
188  const Array<OneD, const Array<OneD, NekDouble> > &fields,
189  const Array<OneD, const Array<OneD, NekDouble> > &N,
190  NekDouble kinvis);
191 
192  virtual void v_CorrectPressureBCs( const Array<OneD, NekDouble> &pressure);
193 
194  void CalcOutflowBCs(
195  const Array<OneD, const Array<OneD, NekDouble> > &fields,
196  NekDouble kinvis);
197 
198  void RollOver(
199  Array<OneD, Array<OneD, NekDouble> > &input);
200 
201  void CurlCurl(
204  const int j);
205 
206 
207 
208  LibUtilities::SessionReaderSharedPtr m_session;
209 
211 
212  Array<OneD, MultiRegions::ExpListSharedPtr> m_fields;
213 
214  /// Pointer to field holding pressure field
215  MultiRegions::ExpListSharedPtr m_pressure;
216 
217  /// int which identifies which components of m_fields contains the
218  /// velocity (u,v,w);
219  Array<OneD, int> m_velocity;
220 
222 
224 
225  /// Curl-curl dimensionality
227 
228  /// bounday dimensionality
230 
231  /// pressure boundary conditions container
233 
234  /// pressure boundary conditions expansion container
235  Array<OneD, MultiRegions::ExpListSharedPtr> m_PBndExp;
236 
237  /// number of times the high-order pressure BCs have been called
239 
240  /// Maximum points used in pressure BC evaluation
242 
243  /// Maximum points used in Element adjacent to pressure BC evaluation
245 
246  /// Maximum points used in pressure BC evaluation
248 
250 
251  /// Flag to determine if single homogeneous mode is used.
253  /// Flag to determine if half homogeneous mode is used.
255  /// Flag to determine if use multiple homogenenous modes are used.
257 
258  NekDouble m_LhomZ; ///< physical length in Z direction (if homogeneous)
259 
260  int m_npointsX; ///< number of points in X direction (if homogeneous)
261  int m_npointsY; ///< number of points in Y direction (if homogeneous)
262  int m_npointsZ; ///< number of points in Z direction (if homogeneous)
263 
264  /// Id of element to which pressure boundary condition belongs
265  Array<OneD, int> m_pressureBCtoElmtID;
266 
267  /// Id of edge (2D) or face (3D) to which pressure boundary condition belongs
268  Array<OneD, int> m_pressureBCtoTraceID;
269 
270  /// Storage for current and previous levels of high order pressure boundary conditions.
272 
273  /// Storage for current and previous levels of the acceleration term.
275 
276  /// data structure to old all the information regarding High order pressure BCs
278 
279  /// wave number 2 pi k /Lz
281 
282  /// minus Square of wavenumber
284 
285  /// Storage for current and previous velocity fields at the otuflow for high order outflow BCs
287 
289 
290  /// Storage for current and previous velocity fields in physical space at the otuflow for high order outflow BCs
292 
293  /// Storage for nonlinear term in physical space at the outflow for high order outflow BCs
295 
296  /// Storage for nonlinear term in wave space at the outflow for high order outflow BCs
298 
299  /// expansion sizes of pressure boundary conditions in each plane
300  /// at the outflow for high order outflow BCs
302 
303  /// Storage for Fourier Coeffs of Dirichlet pressure condition from the input file
305 
306  /// Storage for Fourier Coeffs of Neumann velocity condition from the input file
308 
309  int m_totexps_per_plane; ///total number of expansion for each plane (if homogeneous)
310 
311  // Velocity correction scheme coefficient required for extrapolation.
315 
316  private:
317  static std::string def;
318 
319  };
320 
321  /**
322  * Evaluate Pressure Boundary Conditions for Standard Extrapolation
323  */
325  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
326  const Array<OneD, const Array<OneD, NekDouble> > &N,
327  NekDouble kinvis)
328  {
329  v_EvaluatePressureBCs(inarray,N,kinvis);
330  }
331 
332  /**
333  *
334  */
336  int intMethod,
337  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
338  {
339  v_SubSteppingTimeIntegration(intMethod, IntegrationScheme);
340  }
341 
342  /**
343  *
344  */
346  int nstep)
347  {
348  v_SubStepSaveFields(nstep);
349  }
350 
351  /**
352  *
353  */
355  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
356  NekDouble Aii_DT,
357  NekDouble kinvis)
358  {
359  v_SubStepSetPressureBCs(inarray,Aii_DT,kinvis);
360  }
361 
362  /**
363  *
364  */
366  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
367  int nstep,
368  NekDouble time)
369  {
370  v_SubStepAdvance(integrationSoln,nstep, time);
371  }
372 
373  /**
374  *
375  */
377  int HBCdata,
378  NekDouble kinvis,
381  {
382  v_MountHOPBCs(HBCdata,kinvis,Q,Advection);
383  }
384 
385  /**
386  *
387  */
390  {
392  }
393 
394  /**
395  *
396  */
398  const Array<OneD, NekDouble> &pressure)
399  {
400  v_CorrectPressureBCs(pressure);
401  }
402 }
403 
404 #endif
405 
Array< OneD, NekDouble > m_wavenumber
wave number 2 pi k /Lz
Definition: Extrapolate.h:280
int m_coeffOffset
Coefficient offset used to locate the acceleration term in the general m_pressureHBC.
Definition: Extrapolate.h:68
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Definition: Extrapolate.h:215
void IProductNormVelocityOnHBC(const Array< OneD, const Array< OneD, NekDouble > > &Vel, Array< OneD, NekDouble > &IprodVn)
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:208
virtual void v_SubSteppingTimeIntegration(int intMethod, const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)=0
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:219
int m_pressureBCsMaxPts
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:241
void SubStepAdvance(const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln, const int nstep, NekDouble time)
Definition: Extrapolate.h:365
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:235
void SubSteppingTimeIntegration(const int intMethod, const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
Definition: Extrapolate.h:335
void SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, const NekDouble Aii_DT, NekDouble kinvis)
Definition: Extrapolate.h:354
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:50
bool m_SingleMode
Flag to determine if single homogeneous mode is used.
Definition: Extrapolate.h:252
int m_pressureBCsElmtMaxPts
Maximum points used in Element adjacent to pressure BC evaluation.
Definition: Extrapolate.h:244
boost::shared_ptr< TimeIntegrationWrapper > TimeIntegrationWrapperSharedPtr
boost::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:158
void RollOver(Array< OneD, Array< OneD, NekDouble > > &input)
Array< OneD, NekDouble > m_PBndCoeffs
(if homogeneous)
Definition: Extrapolate.h:304
Array< OneD, Array< OneD, NekDouble > > m_UBndCoeffs
(if homogeneous)
Definition: Extrapolate.h:307
void CopyPressureHBCsToPbndExp(void)
Array< OneD, NekDouble > m_nonlinearterm_phys
(if homogeneous)
Definition: Extrapolate.h:294
virtual void v_SubStepAdvance(const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln, int nstep, NekDouble time)=0
int m_npointsY
number of points in Y direction (if homogeneous)
Definition: Extrapolate.h:261
void ExtrapolatePressureHBCs(void)
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:210
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Definition: Extrapolate.h:212
static NekDouble StifflyStable_Gamma0_Coeffs[3]
Definition: Extrapolate.h:314
Array< OneD, NekDouble > m_negWavenumberSq
minus Square of wavenumber
Definition: Extrapolate.h:283
Array< OneD, NekDouble > m_nonlinearterm_coeffs
(if homogeneous)
Definition: Extrapolate.h:297
int m_totexps_per_plane
(if homogeneous)
Definition: Extrapolate.h:309
int m_physOffset
Physical offset of the element in the global list.
Definition: Extrapolate.h:56
virtual void v_EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)=0
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_outflowVel
Storage for current and previous velocity fields at the otuflow for high order outflow BCs...
Definition: Extrapolate.h:286
static std::string def
Definition: Extrapolate.h:317
Extrapolate(const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
Definition: Extrapolate.cpp:59
int m_bnd_dim
bounday dimensionality
Definition: Extrapolate.h:229
Array< OneD, int > m_pressureBCtoElmtID
Id of element to which pressure boundary condition belongs.
Definition: Extrapolate.h:265
void MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
Definition: Extrapolate.h:376
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:53
Array< OneD, Array< OneD, NekDouble > > m_acceleration
Storage for current and previous levels of the acceleration term.
Definition: Extrapolate.h:274
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
virtual LibUtilities::TimeIntegrationMethod v_GetSubStepIntegrationMethod(void)
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:247
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
Definition: Extrapolate.h:258
bool m_MultipleModes
Flag to determine if use multiple homogenenous modes are used.
Definition: Extrapolate.h:256
LibUtilities::NekFactory< std::string, Extrapolate, const LibUtilities::SessionReaderSharedPtr &, Array< OneD, MultiRegions::ExpListSharedPtr > &, MultiRegions::ExpListSharedPtr &, const Array< OneD, int > &, const SolverUtils::AdvectionSharedPtr & > ExtrapolateFactory
Definition: Extrapolate.h:79
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Array< OneD, unsigned int > m_expsize_per_plane
(if homogeneous)
Definition: Extrapolate.h:301
int m_npointsX
number of points in X direction (if homogeneous)
Definition: Extrapolate.h:260
boost::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:72
double NekDouble
void CalcExplicitDuDt(const Array< OneD, const Array< OneD, NekDouble > > &fields)
Definition: Extrapolate.cpp:83
Array< OneD, int > m_pressureBCtoTraceID
Id of edge (2D) or face (3D) to which pressure boundary condition belongs.
Definition: Extrapolate.h:268
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:238
virtual void v_CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)=0
void IProductNormVelocityBCOnHBC(Array< OneD, NekDouble > &IprodVn)
virtual void v_SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_DT, NekDouble kinvis)=0
int m_globalElmtID
Global element ID.
Definition: Extrapolate.h:52
void CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
Definition: Extrapolate.h:397
int m_assPhysOffset
Associated element physical offset ( and are the real and complex plane).
Definition: Extrapolate.h:65
int m_bndryID
Pressure boundary condition ID.
Definition: Extrapolate.h:62
LibUtilities::TimeIntegrationMethod GetSubStepIntegrationMethod(void)
Definition: Extrapolate.h:389
virtual void v_SubStepSaveFields(int nstep)=0
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &oldarrays, Array< OneD, NekDouble > &newarray, Array< OneD, NekDouble > &outarray)
Array< OneD, Array< OneD, Array< OneD, NekDouble > > > m_PhyoutfVel
Storage for current and previous velocity fields in physical space at the otuflow for high order outf...
Definition: Extrapolate.h:291
int m_bndElmtID
Physical offset of the element in the boundary expansion.
Definition: Extrapolate.h:58
virtual void v_CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
Definition: Extrapolate.h:223
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:271
boost::shared_ptr< TimeIntegrationSolution > TimeIntegrationSolutionSharedPtr
Array< OneD, HBCInfo > m_HBCdata
data structure to old all the information regarding High order pressure BCs
Definition: Extrapolate.h:277
int m_ptsInElmt
Number of physical points in the element.
Definition: Extrapolate.h:54
static NekDouble StifflyStable_Alpha_Coeffs[3][3]
Definition: Extrapolate.h:313
int m_elmtTraceID
Trace ID of the element.
Definition: Extrapolate.h:60
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:221
int m_npointsZ
number of points in Z direction (if homogeneous)
Definition: Extrapolate.h:262
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: Extrapolate.h:288
void CurlCurl(Array< OneD, Array< OneD, const NekDouble > > &Vel, Array< OneD, Array< OneD, NekDouble > > &Q, const int j)
int m_curl_dim
Curl-curl dimensionality.
Definition: Extrapolate.h:226
bool m_HalfMode
Flag to determine if half homogeneous mode is used.
Definition: Extrapolate.h:254
void EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:324
void CalcOutflowBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > m_PBndConds
pressure boundary conditions container
Definition: Extrapolate.h:232
void SubStepSaveFields(const int nstep)
Definition: Extrapolate.h:345
NekDouble m_timestep
Definition: Extrapolate.h:249
virtual ~Extrapolate()
Definition: Extrapolate.cpp:75
Defines a callback function which evaluates the flux vector.
Definition: Advection.h:69
static NekDouble StifflyStable_Betaq_Coeffs[3][3]
total number of expansion for each plane (if homogeneous)
Definition: Extrapolate.h:312
Provides a generic Factory class.
Definition: NekFactory.hpp:116
void CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:179