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 // Permission is hereby granted, free of charge, to any person obtaining a
14 // copy of this software and associated documentation files (the "Software"),
15 // to deal in the Software without restriction, including without limitation
16 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
17 // and/or sell copies of the Software, and to permit persons to whom the
18 // Software is furnished to do so, subject to the following conditions:
19 //
20 // The above copyright notice and this permission notice shall be included
21 // in all copies or substantial portions of the Software.
22 //
23 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 // DEALINGS IN THE SOFTWARE.
30 //
31 // Description: Abstract base class for Extrapolate.
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_SOLVERS_EXTRAPOLATE_H
36 #define NEKTAR_SOLVERS_EXTRAPOLATE_H
37 
41 #include <MultiRegions/ExpList.h>
46 
47 
48 namespace Nektar
49 {
50 
51  enum HBCType
52  {
54  eHBCNeumann, // Standard High Order BC
55  eOBC, // High Order outflow BC (Neumann-Dirichlet) from Dong et al JCP 2014
56  eConvectiveOBC // Convective High Order (Robin type) BC from Dong JCP 2015
57  };
58 
59  // Forward declaration
60  class Extrapolate;
61  typedef std::shared_ptr<Extrapolate> ExtrapolateSharedPtr;
62  typedef LibUtilities::NekFactory< std::string, Extrapolate,
66  const Array<OneD, int>& ,
68 
69  struct HighOrderOutflow;
70  typedef std::shared_ptr<HighOrderOutflow> HighOrderOutflowSharedPtr;
71 
72 
74 
76  {
77  public:
78  Extrapolate(
82  const Array<OneD, int> pVel,
83  const SolverUtils::AdvectionSharedPtr advObject);
84 
85  virtual ~Extrapolate();
86 
88 
89  void UpdateRobinPrimCoeff(void);
90 
91  inline void SubSteppingTimeIntegration(
92  const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme);
93 
94  inline void SubStepSaveFields(
95  const int nstep);
96 
97  inline void SubStepSetPressureBCs(
98  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
99  const NekDouble Aii_DT,
100  NekDouble kinvis);
101 
102  inline void SubStepAdvance(
103  const int nstep,
104  NekDouble time);
105 
106  inline void MountHOPBCs(
107  int HBCdata,
108  NekDouble kinvis,
111 
112  inline void EvaluatePressureBCs(
113  const Array<OneD, const Array<OneD, NekDouble> > &fields,
114  const Array<OneD, const Array<OneD, NekDouble> > &N,
115  NekDouble kinvis);
116 
117  inline void SetForcing(
118  const std::vector<SolverUtils::ForcingSharedPtr> &forcing);
119 
120  void AddDuDt(void);
121 
122  void AddVelBC(void);
123 
125  void CopyPressureHBCsToPbndExp(void);
126 
128  const Array<OneD, Array<OneD,NekDouble> > inarray);
129 
130 
132 
134  Array<OneD, NekDouble> &IprodVn);
135 
137 
138  std::string GetSubStepName(void);
139 
141 
143 
145  Array<OneD, Array<OneD, NekDouble> > &oldarrays,
146  Array<OneD, NekDouble> &newarray,
147  Array<OneD, NekDouble> &outarray);
148 
149  void AddNormVelOnOBC(const int nbcoeffs, const int nreg,
151 
152  void AddPressureToOutflowBCs(NekDouble kinvis);
153 
154  protected:
155  virtual void v_EvaluatePressureBCs(
156  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
157  const Array<OneD, const Array<OneD, NekDouble> > &N,
158  NekDouble kinvis)=0;
159 
161  const LibUtilities::TimeIntegrationSchemeSharedPtr & IntegrationScheme ) = 0;
162 
163  virtual void v_SubStepSaveFields(
164  int nstep)=0;
165 
167  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
168  NekDouble Aii_DT,
169  NekDouble kinvis)=0;
170 
171  virtual void v_SubStepAdvance(
172  int nstep,
173  NekDouble time ) = 0;
174 
175  virtual void v_MountHOPBCs(
176  int HBCdata,
177  NekDouble kinvis,
180 
181  virtual std::string v_GetSubStepName(void);
182 
183  virtual void v_AccelerationBDF(
184  Array<OneD, Array<OneD, NekDouble> > &array);
185 
187  const Array<OneD, const Array<OneD, NekDouble> > &fields,
188  const Array<OneD, const Array<OneD, NekDouble> > &N,
189  NekDouble kinvis)
190  {
191  v_CalcNeumannPressureBCs( fields, N, kinvis);
192  }
193 
194  virtual void v_CalcNeumannPressureBCs(
195  const Array<OneD, const Array<OneD, NekDouble> > &fields,
196  const Array<OneD, const Array<OneD, NekDouble> > &N,
197  NekDouble kinvis);
198 
200 
201  virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg,
203  void CalcOutflowBCs(
204  const Array<OneD, const Array<OneD, NekDouble> > &fields,
205  NekDouble kinvis);
206 
207  void RollOver(Array<OneD, Array<OneD, NekDouble> > &input);
208 
210 
212 
213  /// Array of type of high order BCs for splitting shemes
215 
216  /// Velocity fields
218 
219  /// Pointer to field holding pressure field
221 
222  /// int which identifies which components of m_fields contains the
223  /// velocity (u,v,w);
225 
227 
228  std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
229 
231 
232  /// Curl-curl dimensionality
234 
235  /// bounday dimensionality
237 
238  /// pressure boundary conditions container
240 
241  /// pressure boundary conditions expansion container
243 
244  /// number of times the high-order pressure BCs have been called
246 
247  // Number of degrees of freedom (coefficients) for HOPbc
249 
250  // Number of HOPbcs
252 
253  /// Maximum points used in pressure BC evaluation
255 
257 
258  /// Storage for current and previous levels of high order pressure boundary conditions.
260 
261  /// Storage for current and previous levels of the inner product of normal velocity
263 
265 
266  // Velocity correction scheme coefficient required for extrapolation.
270 
271  // data related to high order outflow.
273 
274  private:
275  static std::string def;
276  };
277 
278 
280  {
281  HighOrderOutflow(const int numHOpts, const int outHBCnumber,const int curldim, const LibUtilities::SessionReaderSharedPtr &pSession):
282  m_numOutHBCPts(numHOpts),
283  m_outHBCnumber(outHBCnumber)
284  {
286  Array<OneD, Array<OneD,
287  Array<OneD, NekDouble> > > > (outHBCnumber);
288 
290  Array<OneD, Array<OneD,
291  Array<OneD, NekDouble> > > > (outHBCnumber);
292 
293  m_UBndExp = Array<OneD,
295 
296  pSession->LoadParameter("OutflowBC_theta", m_obcTheta, 1.0);
297  pSession->LoadParameter("OutflowBC_alpha1", m_obcAlpha1, 0.0);
298  pSession->LoadParameter("OutflowBC_alpha2", m_obcAlpha2, 0.0);
299 
300  pSession->LoadParameter("U0_HighOrderBC", m_U0,1.0);
301  pSession->LoadParameter("Delta_HighOrderBC", m_delta,1/20.0);
302  }
303 
305  {};
306 
307  /// Number of quadrature points for Outflow HOBC
309 
310  /// Number of Outflow HOBCs
312 
313  /// Parameters for outflow boundary condition
319  std::string m_defVelPrimCoeff[3];
320 
321  /// Storage for current and previous velocity fields along the outflow
323 
324  /// Storage for current and previous velocities along the outflow boundary
326 
327  /// Velocity boundary condition expansions on high order boundaries.
329 
330  /// primitive coefficient for pressure when using convetive like OBCs
332 
333  /// primitive coefficient for velocities when using convetive like OBCs
335  };
336 
337  /**
338  * Evaluate Pressure Boundary Conditions for Standard Extrapolation
339  */
341  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
342  const Array<OneD, const Array<OneD, NekDouble> > &N,
343  NekDouble kinvis)
344  {
345  v_EvaluatePressureBCs(inarray,N,kinvis);
346  }
347 
348  /**
349  *
350  */
352  const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
353  {
354  v_SubSteppingTimeIntegration(IntegrationScheme);
355  }
356 
357  /**
358  *
359  */
361  int nstep)
362  {
363  v_SubStepSaveFields(nstep);
364  }
365 
366  /**
367  *
368  */
370  const std::vector<SolverUtils::ForcingSharedPtr> &forcing)
371  {
372  m_forcing = forcing;
373  }
374 
375  /**
376  *
377  */
379  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
380  NekDouble Aii_DT,
381  NekDouble kinvis)
382  {
383  v_SubStepSetPressureBCs(inarray,Aii_DT,kinvis);
384  }
385 
386  /**
387  *
388  */
390  int nstep,
391  NekDouble time)
392  {
393  v_SubStepAdvance(nstep, time);
394  }
395 
396  /**
397  *
398  */
400  int HBCdata,
401  NekDouble kinvis,
404  {
405  v_MountHOPBCs(HBCdata,kinvis,Q,Advection);
406  }
407 
408  /**
409  *
410  */
411  inline std::string Extrapolate::GetSubStepName(void)
412  {
413  return v_GetSubStepName();
414  }
415 
416  /**
417  *
418  */
421  {
423  }
424 
425 
426  /**
427  *
428  */
429  inline void Extrapolate::AddNormVelOnOBC(const int nbcoeffs, const int nreg,
431  {
432  v_AddNormVelOnOBC(nbcoeffs,nreg,u);
433  }
434 
435 }
436 
437 #endif
438 
std::string GetSubStepName(void)
Definition: Extrapolate.h:411
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:259
virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
int m_bnd_dim
bounday dimensionality
Definition: Extrapolate.h:236
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
Definition: Extrapolate.h:230
void SubStepAdvance(const int nstep, NekDouble time)
Definition: Extrapolate.h:389
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:55
int m_curl_dim
Curl-curl dimensionality.
Definition: Extrapolate.h:233
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Definition: Extrapolate.h:220
static std::string def
Definition: Extrapolate.h:275
static NekDouble StifflyStable_Betaq_Coeffs[3][3]
Definition: Extrapolate.h:267
virtual void v_AccelerationBDF(Array< OneD, Array< OneD, NekDouble > > &array)
virtual void v_CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
void CopyPressureHBCsToPbndExp(void)
virtual void v_CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
virtual void v_SubStepSaveFields(int nstep)=0
void EvaluateBDFArray(Array< OneD, Array< OneD, NekDouble > > &array)
void SubStepSaveFields(const int nstep)
Definition: Extrapolate.h:360
void IProductNormVelocityBCOnHBC(Array< OneD, NekDouble > &IprodVn)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:217
void EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:340
void SubSteppingTimeIntegration(const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
Definition: Extrapolate.h:351
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
Storage for current and previous levels of the inner product of normal velocity.
Definition: Extrapolate.h:262
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:254
void CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:186
virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)=0
void ExtrapolatePressureHBCs(void)
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &oldarrays, Array< OneD, NekDouble > &newarray, Array< OneD, NekDouble > &outarray)
void GenerateHOPBCMap(const LibUtilities::SessionReaderSharedPtr &pSsession)
void IProductNormVelocityOnHBC(const Array< OneD, const Array< OneD, NekDouble > > &Vel, Array< OneD, NekDouble > &IprodVn)
virtual void v_SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_DT, NekDouble kinvis)=0
Array< OneD, HBCType > m_hbcType
Array of type of high order BCs for splitting shemes.
Definition: Extrapolate.h:214
HighOrderOutflowSharedPtr m_houtflow
Definition: Extrapolate.h:272
NekDouble m_timestep
Definition: Extrapolate.h:256
virtual void v_SubSteppingTimeIntegration(const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)=0
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:242
void SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, const NekDouble Aii_DT, NekDouble kinvis)
Definition: Extrapolate.h:378
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &array)
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Definition: Extrapolate.h:228
void MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
Definition: Extrapolate.h:399
void CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
Definition: Extrapolate.h:419
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:226
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:224
static NekDouble StifflyStable_Alpha_Coeffs[3][3]
Definition: Extrapolate.h:268
void AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
Definition: Extrapolate.h:429
void RollOver(Array< OneD, Array< OneD, NekDouble > > &input)
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > m_PBndConds
pressure boundary conditions container
Definition: Extrapolate.h:239
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: Extrapolate.h:264
virtual void v_SubStepAdvance(int nstep, NekDouble time)=0
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:245
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:209
void UpdateRobinPrimCoeff(void)
void CalcOutflowBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
void AddPressureToOutflowBCs(NekDouble kinvis)
virtual void v_EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)=0
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:211
void SetForcing(const std::vector< SolverUtils::ForcingSharedPtr > &forcing)
Definition: Extrapolate.h:369
static NekDouble StifflyStable_Gamma0_Coeffs[3]
Definition: Extrapolate.h:269
virtual ~Extrapolate()
Definition: Extrapolate.cpp:71
virtual std::string v_GetSubStepName(void)
Provides a generic Factory class.
Definition: NekFactory.hpp:105
An abstract base class encapsulating the concept of advection of a vector field.
Definition: Advection.h:73
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< TimeIntegrationScheme > TimeIntegrationSchemeSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:54
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
std::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:291
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
std::shared_ptr< HighOrderOutflow > HighOrderOutflowSharedPtr
Definition: Extrapolate.h:69
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:67
@ eNOHBC
Definition: Extrapolate.h:53
@ eConvectiveOBC
Definition: Extrapolate.h:56
@ eHBCNeumann
Definition: Extrapolate.h:54
std::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:60
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:49
double NekDouble
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_outflowVelBnd
Storage for current and previous velocities along the outflow boundary.
Definition: Extrapolate.h:325
Array< OneD, Array< OneD, NekDouble > > m_velocityPrimCoeff
primitive coefficient for velocities when using convetive like OBCs
Definition: Extrapolate.h:334
std::string m_defVelPrimCoeff[3]
Definition: Extrapolate.h:319
int m_outHBCnumber
Number of Outflow HOBCs.
Definition: Extrapolate.h:311
Array< OneD, NekDouble > m_pressurePrimCoeff
primitive coefficient for pressure when using convetive like OBCs
Definition: Extrapolate.h:331
NekDouble m_obcTheta
Parameters for outflow boundary condition.
Definition: Extrapolate.h:314
Array< OneD, Array< OneD, MultiRegions::ExpListSharedPtr > > m_UBndExp
Velocity boundary condition expansions on high order boundaries.
Definition: Extrapolate.h:328
HighOrderOutflow(const int numHOpts, const int outHBCnumber, const int curldim, const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: Extrapolate.h:281
int m_numOutHBCPts
Number of quadrature points for Outflow HOBC.
Definition: Extrapolate.h:305
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_outflowVel
Storage for current and previous velocity fields along the outflow.
Definition: Extrapolate.h:322