Nektar++
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,
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,
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 
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,
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(
168  const int j);
169 
170  LibUtilities::SessionReaderSharedPtr m_session;
171 
173 
174  Array<OneD, MultiRegions::ExpListSharedPtr> m_fields;
175 
176  /// Pointer to field holding pressure field
177  MultiRegions::ExpListSharedPtr m_pressure;
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 
186 
187  /// Curl-curl dimensionality
189 
190  /// bounday dimensionality
192 
193  /// pressure boundary conditions container
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  /// Id of element to which pressure boundary condition belongs
227  Array<OneD, int> m_pressureBCtoElmtID;
228 
229  /// Id of edge (2D) or face (3D) to which pressure boundary condition belongs
230  Array<OneD, int> m_pressureBCtoTraceID;
231 
232  /// Storage for current and previous levels of high order pressure boundary conditions.
234 
235  /// Storage for current and previous levels of the acceleration term.
237 
238  /// data structure to old all the information regarding High order pressure BCs
240 
241  /// wave number 2 pi k /Lz
243 
244  /// minus Square of wavenumber
246 
247  /// Storage for current and previous velocity fields at the otuflow for high order outflow BCs
249 
250  /// Storage for current and previous velocity fields in physical space at the otuflow for high order outflow BCs
252 
253  /// Storage for nonlinear term in physical space at the outflow for high order outflow BCs
255 
256  /// Storage for nonlinear term in wave space at the outflow for high order outflow BCs
258 
259  /// expansion sizes of pressure boundary conditions in each plane
260  /// at the outflow for high order outflow BCs
262 
263  /// Storage for Fourier Coeffs of Dirichlet pressure condition from the input file
265 
266  /// Storage for Fourier Coeffs of Neumann velocity condition from the input file
268 
269  int m_totexps_per_plane; ///total number of expansion for each plane (if homogeneous)
270 
271  private:
272  static std::string def;
273 
274  // Velocity correction scheme coefficient required for extrapolation.
278  };
279 
280  /**
281  *
282  */
284  int intMethod,
285  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
286  {
287  v_SubSteppingTimeIntegration(intMethod, IntegrationScheme);
288  }
289 
290  /**
291  *
292  */
294  int nstep)
295  {
296  v_SubStepSaveFields(nstep);
297  }
298 
299  /**
300  *
301  */
303  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
304  NekDouble Aii_DT,
305  NekDouble kinvis)
306  {
307  v_SubStepSetPressureBCs(inarray,Aii_DT,kinvis);
308  }
309 
310  /**
311  *
312  */
314  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
315  int nstep,
316  NekDouble time)
317  {
318  v_SubStepAdvance(integrationSoln,nstep, time);
319  }
320 
321  /**
322  *
323  */
325  int HBCdata,
326  NekDouble kinvis,
328  Array<OneD, const NekDouble> &Advection)
329  {
330  v_MountHOPBCs(HBCdata,kinvis,Q,Advection);
331  }
332 }
333 
334 #endif
335 
Array< OneD, NekDouble > m_wavenumber
wave number 2 pi k /Lz
Definition: Extrapolate.h:242
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:177
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:170
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:181
int m_pressureBCsMaxPts
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:203
void SubStepAdvance(const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln, const int nstep, NekDouble time)
Definition: Extrapolate.h:313
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:197
void SubSteppingTimeIntegration(const int intMethod, const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
Definition: Extrapolate.h:283
void SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, const NekDouble Aii_DT, NekDouble kinvis)
Definition: Extrapolate.h:302
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:48
void CalcOutflowBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
bool m_SingleMode
Flag to determine if single homogeneous mode is used.
Definition: Extrapolate.h:214
int m_pressureBCsElmtMaxPts
Maximum points used in Element adjacent to pressure BC evaluation.
Definition: Extrapolate.h:206
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:264
Array< OneD, Array< OneD, NekDouble > > m_UBndCoeffs
(if homogeneous)
Definition: Extrapolate.h:267
Array< OneD, NekDouble > m_nonlinearterm_phys
(if homogeneous)
Definition: Extrapolate.h:254
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:223
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:172
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:50
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Definition: Extrapolate.h:174
static NekDouble StifflyStable_Gamma0_Coeffs[3]
Definition: Extrapolate.h:277
Array< OneD, NekDouble > m_negWavenumberSq
minus Square of wavenumber
Definition: Extrapolate.h:245
Array< OneD, NekDouble > m_nonlinearterm_coeffs
(if homogeneous)
Definition: Extrapolate.h:257
int m_totexps_per_plane
(if homogeneous)
Definition: Extrapolate.h:269
int m_physOffset
Physical offset of the element in the global list.
Definition: Extrapolate.h:56
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:248
static std::string def
total number of expansion for each plane (if homogeneous)
Definition: Extrapolate.h:272
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:57
int m_bnd_dim
bounday dimensionality
Definition: Extrapolate.h:191
Array< OneD, int > m_pressureBCtoElmtID
Id of element to which pressure boundary condition belongs.
Definition: Extrapolate.h:227
void MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
Definition: Extrapolate.h:324
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:236
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:209
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
Definition: ExpList.h:1340
NekDouble m_LhomZ
physical length in Z direction (if homogeneous)
Definition: Extrapolate.h:220
int m_bndryElmtID
Pressure boundary condition ID.
Definition: Extrapolate.h:62
bool m_MultipleModes
Flag to determine if use multiple homogenenous modes are used.
Definition: Extrapolate.h:218
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
Array< OneD, unsigned int > m_expsize_per_plane
(if homogeneous)
Definition: Extrapolate.h:261
int m_npointsX
number of points in X direction (if homogeneous)
Definition: Extrapolate.h:222
boost::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:72
double NekDouble
Array< OneD, int > m_pressureBCtoTraceID
Id of edge (2D) or face (3D) to which pressure boundary condition belongs.
Definition: Extrapolate.h:230
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:200
virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)=0
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
int m_assPhysOffset
Associated element physical offset ( and are the real and complex plane).
Definition: Extrapolate.h:65
virtual void v_SubStepSaveFields(int nstep)=0
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:251
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
Definition: Extrapolate.h:185
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:233
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:239
int m_ptsInElmt
Number of physical points in the element.
Definition: Extrapolate.h:54
static NekDouble StifflyStable_Alpha_Coeffs[3][3]
Definition: Extrapolate.h:276
int m_elmtTraceID
Trace ID of the element.
Definition: Extrapolate.h:60
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:183
int m_npointsZ
number of points in Z direction (if homogeneous)
Definition: Extrapolate.h:224
int m_bndElmtOffset
Physical offset of the element in the boundary expansion.
Definition: Extrapolate.h:58
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:188
bool m_HalfMode
Flag to determine if half homogeneous mode is used.
Definition: Extrapolate.h:216
void EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.cpp:90
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > m_PBndConds
pressure boundary conditions container
Definition: Extrapolate.h:194
void SubStepSaveFields(const int nstep)
Definition: Extrapolate.h:293
NekDouble m_timestep
Definition: Extrapolate.h:211
virtual ~Extrapolate()
Definition: Extrapolate.cpp:73
static NekDouble StifflyStable_Betaq_Coeffs[3][3]
Definition: Extrapolate.h:275
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)