Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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 
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 boost::shared_ptr<Extrapolate> ExtrapolateSharedPtr;
62  typedef LibUtilities::NekFactory< std::string, Extrapolate,
66  const Array<OneD, int>& ,
68 
70  typedef boost::shared_ptr<HighOrderOutflow> HighOrderOutflowSharedPtr;
71 
72 
73  ExtrapolateFactory& GetExtrapolateFactory();
74 
75  class Extrapolate
76  {
77  public:
78  Extrapolate(
79  const LibUtilities::SessionReaderSharedPtr pSession,
80  Array<OneD, MultiRegions::ExpListSharedPtr> pFields,
81  MultiRegions::ExpListSharedPtr pPressure,
82  const Array<OneD, int> pVel,
83  const SolverUtils::AdvectionSharedPtr advObject);
84 
85  virtual ~Extrapolate();
86 
87  void GenerateHOPBCMap(const LibUtilities::SessionReaderSharedPtr& pSsession);
88 
89  void UpdateRobinPrimCoeff(void);
90 
91  inline void SubSteppingTimeIntegration(
92  const int intMethod,
93  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme);
94 
95  inline void SubStepSaveFields(
96  const int nstep);
97 
98  inline void SubStepSetPressureBCs(
99  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
100  const NekDouble Aii_DT,
101  NekDouble kinvis);
102 
103  inline void SubStepAdvance(
104  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
105  const int nstep,
106  NekDouble time);
107 
108  inline void MountHOPBCs(
109  int HBCdata,
110  NekDouble kinvis,
113 
114  inline void EvaluatePressureBCs(
115  const Array<OneD, const Array<OneD, NekDouble> > &fields,
116  const Array<OneD, const Array<OneD, NekDouble> > &N,
117  NekDouble kinvis);
118 
119 
120  void AddDuDt(void);
121 
122  void AddVelBC(void);
123 
124  void ExtrapolatePressureHBCs(void);
125  void CopyPressureHBCsToPbndExp(void);
126 
128  const Array<OneD, Array<OneD,NekDouble> > inarray);
129 
130 
131  void CorrectPressureBCs( const Array<OneD, NekDouble> &pressure);
132 
134  Array<OneD, NekDouble> &IprodVn);
135 
137 
139 
141 
143 
145 
146  void ExtrapolateArray(
147  Array<OneD, Array<OneD, NekDouble> > &oldarrays,
148  Array<OneD, NekDouble> &newarray,
149  Array<OneD, NekDouble> &outarray);
150 
151  void AddNormVelOnOBC(const int nbcoeffs, const int nreg,
153 
154  void AddPressureToOutflowBCs(NekDouble kinvis);
155 
156  protected:
157  virtual void v_EvaluatePressureBCs(
158  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
159  const Array<OneD, const Array<OneD, NekDouble> > &N,
160  NekDouble kinvis)=0;
161 
162  virtual void v_SubSteppingTimeIntegration(
163  int intMethod,
164  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)=0;
165 
166  virtual void v_SubStepSaveFields(
167  int nstep)=0;
168 
169  virtual void v_SubStepSetPressureBCs(
170  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
171  NekDouble Aii_DT,
172  NekDouble kinvis)=0;
173 
174  virtual void v_SubStepAdvance(
175  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
176  int nstep,
177  NekDouble time)=0;
178 
179  virtual void v_MountHOPBCs(
180  int HBCdata,
181  NekDouble kinvis,
183  Array<OneD, const NekDouble> &Advection)=0;
184 
187 
189  const Array<OneD, const Array<OneD, NekDouble> > &fields,
190  const Array<OneD, const Array<OneD, NekDouble> > &N,
191  NekDouble kinvis)
192  {
193  v_CalcNeumannPressureBCs( fields, N, kinvis);
194  }
195 
196  virtual void v_CalcNeumannPressureBCs(
197  const Array<OneD, const Array<OneD, NekDouble> > &fields,
198  const Array<OneD, const Array<OneD, NekDouble> > &N,
199  NekDouble kinvis);
200 
201  virtual void v_CorrectPressureBCs( const Array<OneD, NekDouble> &pressure);
202 
203  virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg,
205  void CalcOutflowBCs(
206  const Array<OneD, const Array<OneD, NekDouble> > &fields,
207  NekDouble kinvis);
208 
209  void RollOver(Array<OneD, Array<OneD, NekDouble> > &input);
210 
211  LibUtilities::SessionReaderSharedPtr m_session;
212 
214 
215  /// Array of type of high order BCs for splitting shemes
217 
218  /// Velocity fields
219  Array<OneD, MultiRegions::ExpListSharedPtr> m_fields;
220 
221  /// Pointer to field holding pressure field
222  MultiRegions::ExpListSharedPtr m_pressure;
223 
224  /// int which identifies which components of m_fields contains the
225  /// velocity (u,v,w);
226  Array<OneD, int> m_velocity;
227 
229 
231 
232  /// Curl-curl dimensionality
234 
235  /// bounday dimensionality
237 
238  /// pressure boundary conditions container
240 
241  /// pressure boundary conditions expansion container
242  Array<OneD, MultiRegions::ExpListSharedPtr> m_PBndExp;
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.
272  HighOrderOutflowSharedPtr m_houtflow;
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 
289  m_outflowVelBnd = Array<OneD,
290  Array<OneD, Array<OneD,
291  Array<OneD, NekDouble> > > > (outHBCnumber);
292 
293  m_UBndExp = Array<OneD,
294  Array<OneD, MultiRegions::ExpListSharedPtr> >(curldim);
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
308  int m_numOutHBCPts;
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  int intMethod,
353  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
354  {
355  v_SubSteppingTimeIntegration(intMethod, IntegrationScheme);
356  }
357 
358  /**
359  *
360  */
362  int nstep)
363  {
364  v_SubStepSaveFields(nstep);
365  }
366 
367  /**
368  *
369  */
371  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
372  NekDouble Aii_DT,
373  NekDouble kinvis)
374  {
375  v_SubStepSetPressureBCs(inarray,Aii_DT,kinvis);
376  }
377 
378  /**
379  *
380  */
382  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
383  int nstep,
384  NekDouble time)
385  {
386  v_SubStepAdvance(integrationSoln,nstep, time);
387  }
388 
389  /**
390  *
391  */
393  int HBCdata,
394  NekDouble kinvis,
397  {
398  v_MountHOPBCs(HBCdata,kinvis,Q,Advection);
399  }
400 
401  /**
402  *
403  */
406  {
408  }
409 
410  /**
411  *
412  */
414  const Array<OneD, NekDouble> &pressure)
415  {
416  v_CorrectPressureBCs(pressure);
417  }
418 
419 
420  /**
421  *
422  */
423  inline void Extrapolate::AddNormVelOnOBC(const int nbcoeffs, const int nreg,
425  {
426  v_AddNormVelOnOBC(nbcoeffs,nreg,u);
427  }
428 
429 }
430 
431 #endif
432 
boost::shared_ptr< HighOrderOutflow > HighOrderOutflowSharedPtr
Definition: Extrapolate.h:69
void UpdateRobinPrimCoeff(void)
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Definition: Extrapolate.h:222
void IProductNormVelocityOnHBC(const Array< OneD, const Array< OneD, NekDouble > > &Vel, Array< OneD, NekDouble > &IprodVn)
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:211
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &array)
virtual void v_SubSteppingTimeIntegration(int intMethod, const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)=0
virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:226
NekDouble m_obcTheta
Parameters for outflow boundary condition.
Definition: Extrapolate.h:314
void SubStepAdvance(const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln, const int nstep, NekDouble time)
Definition: Extrapolate.h:381
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:242
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
void SubSteppingTimeIntegration(const int intMethod, const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
Definition: Extrapolate.h:351
void SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, const NekDouble Aii_DT, NekDouble kinvis)
Definition: Extrapolate.h:370
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:50
void AccelerationBDF(Array< OneD, Array< OneD, NekDouble > > &array)
boost::shared_ptr< TimeIntegrationWrapper > TimeIntegrationWrapperSharedPtr
boost::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:165
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
void RollOver(Array< OneD, Array< OneD, NekDouble > > &input)
HighOrderOutflow(const int numHOpts, const int outHBCnumber, const int curldim, const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: Extrapolate.h:281
HighOrderOutflowSharedPtr m_houtflow
Definition: Extrapolate.h:272
void CopyPressureHBCsToPbndExp(void)
virtual void v_SubStepAdvance(const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln, int nstep, NekDouble time)=0
void ExtrapolatePressureHBCs(void)
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:213
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
void AddPressureToOutflowBCs(NekDouble kinvis)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:219
static NekDouble StifflyStable_Gamma0_Coeffs[3]
Definition: Extrapolate.h:269
void EvaluateBDFArray(Array< OneD, Array< OneD, NekDouble > > &array)
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, NekDouble > > m_velocityPrimCoeff
primitive coefficient for velocities when using convetive like OBCs
Definition: Extrapolate.h:334
static std::string def
Definition: Extrapolate.h:275
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:236
void MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
Definition: Extrapolate.h:392
boost::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
void GenerateHOPBCMap(const LibUtilities::SessionReaderSharedPtr &pSsession)
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
Array< OneD, HBCType > m_hbcType
Array of type of high order BCs for splitting shemes.
Definition: Extrapolate.h:216
virtual LibUtilities::TimeIntegrationMethod v_GetSubStepIntegrationMethod(void)
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:254
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
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
boost::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:60
double NekDouble
Array< OneD, NekDouble > m_pressurePrimCoeff
primitive coefficient for pressure when using convetive like OBCs
Definition: Extrapolate.h:331
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:245
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
Array< OneD, Array< OneD, MultiRegions::ExpListSharedPtr > > m_UBndExp
Velocity boundary condition expansions on high order boundaries.
Definition: Extrapolate.h:328
void IProductNormVelocityBCOnHBC(Array< OneD, NekDouble > &IprodVn)
virtual void v_SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_DT, NekDouble kinvis)=0
void CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
Definition: Extrapolate.h:413
LibUtilities::TimeIntegrationMethod GetSubStepIntegrationMethod(void)
Definition: Extrapolate.h:405
virtual void v_SubStepSaveFields(int nstep)=0
virtual void v_CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
Definition: Extrapolate.h:230
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:259
boost::shared_ptr< TimeIntegrationSolution > TimeIntegrationSolutionSharedPtr
std::string m_defVelPrimCoeff[3]
Definition: Extrapolate.h:319
static NekDouble StifflyStable_Alpha_Coeffs[3][3]
Definition: Extrapolate.h:268
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:228
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: Extrapolate.h:264
int m_numOutHBCPts
Number of quadrature points for Outflow HOBC.
Definition: Extrapolate.h:305
int m_curl_dim
Curl-curl dimensionality.
Definition: Extrapolate.h:233
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 CalcOutflowBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
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, const SpatialDomains::BoundaryConditionShPtr > m_PBndConds
pressure boundary conditions container
Definition: Extrapolate.h:239
void SubStepSaveFields(const int nstep)
Definition: Extrapolate.h:361
NekDouble m_timestep
Definition: Extrapolate.h:256
virtual ~Extrapolate()
Definition: Extrapolate.cpp:75
int m_outHBCnumber
Number of Outflow HOBCs.
Definition: Extrapolate.h:311
Defines a callback function which evaluates the flux vector.
Definition: Advection.h:69
static NekDouble StifflyStable_Betaq_Coeffs[3][3]
Definition: Extrapolate.h:267
Provides a generic Factory class.
Definition: NekFactory.hpp:116
void AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
Definition: Extrapolate.h:423
void CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:188