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 
43 #include <MultiRegions/ExpList.h>
46 
47 namespace Nektar
48 {
49 
50 enum HBCType
51 {
53  eHBCNeumann, // Standard High Order BC
54  eOBC, // High Order outflow BC (Neumann-Dirichlet) from Dong et al JCP 2014
55  eConvectiveOBC // Convective High Order (Robin type) BC from Dong JCP 2015
56 };
57 
58 // Forward declaration
59 class Extrapolate;
60 typedef std::shared_ptr<Extrapolate> ExtrapolateSharedPtr;
67 
68 struct HighOrderOutflow;
69 typedef std::shared_ptr<HighOrderOutflow> HighOrderOutflowSharedPtr;
70 
72 
74 {
75 public:
79  const Array<OneD, int> pVel,
80  const SolverUtils::AdvectionSharedPtr advObject);
81 
82  virtual ~Extrapolate();
83 
84  void GenerateHOPBCMap(
85  const LibUtilities::SessionReaderSharedPtr &pSsession);
86 
87  void UpdateRobinPrimCoeff(void);
88 
89  inline void SubSteppingTimeIntegration(
90  const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme);
91 
92  inline void SubStepSaveFields(const int nstep);
93 
94  inline void SubStepSetPressureBCs(
95  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
96  const NekDouble Aii_DT, NekDouble kinvis);
97 
98  inline void SubStepAdvance(const int nstep, NekDouble time);
99 
100  inline void MountHOPBCs(int HBCdata, NekDouble kinvis,
103 
104  inline void EvaluatePressureBCs(
105  const Array<OneD, const Array<OneD, NekDouble>> &fields,
106  const Array<OneD, const Array<OneD, NekDouble>> &N, NekDouble kinvis);
107 
108  inline void SetForcing(
109  const std::vector<SolverUtils::ForcingSharedPtr> &forcing);
110 
111  void AddDuDt(void);
112 
113  void AddVelBC(void);
114 
116  void CopyPressureHBCsToPbndExp(void);
117 
119  const Array<OneD, Array<OneD, NekDouble>> inarray);
120 
122 
124  const Array<OneD, const Array<OneD, NekDouble>> &Vel,
125  Array<OneD, NekDouble> &IprodVn);
126 
128 
129  std::string GetSubStepName(void);
130 
132 
134 
136  Array<OneD, NekDouble> &newarray,
137  Array<OneD, NekDouble> &outarray);
138 
139  void AddNormVelOnOBC(const int nbcoeffs, const int nreg,
141 
142  void AddPressureToOutflowBCs(NekDouble kinvis);
143 
144 protected:
145  virtual void v_EvaluatePressureBCs(
146  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
147  const Array<OneD, const Array<OneD, NekDouble>> &N,
148  NekDouble kinvis) = 0;
149 
152  &IntegrationScheme) = 0;
153 
154  virtual void v_SubStepSaveFields(int nstep) = 0;
155 
157  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
158  NekDouble Aii_DT, NekDouble kinvis) = 0;
159 
160  virtual void v_SubStepAdvance(int nstep, NekDouble time) = 0;
161 
162  virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis,
165 
166  virtual std::string v_GetSubStepName(void);
167 
168  virtual void v_AccelerationBDF(Array<OneD, Array<OneD, NekDouble>> &array);
169 
171  const Array<OneD, const Array<OneD, NekDouble>> &fields,
172  const Array<OneD, const Array<OneD, NekDouble>> &N, NekDouble kinvis)
173  {
174  v_CalcNeumannPressureBCs(fields, N, kinvis);
175  }
176 
177  virtual void v_CalcNeumannPressureBCs(
178  const Array<OneD, const Array<OneD, NekDouble>> &fields,
179  const Array<OneD, const Array<OneD, NekDouble>> &N, NekDouble kinvis);
180 
182 
183  virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg,
185  void CalcOutflowBCs(const Array<OneD, const Array<OneD, NekDouble>> &fields,
186  NekDouble kinvis);
187 
188  void RollOver(Array<OneD, Array<OneD, NekDouble>> &input);
189 
191 
193 
194  /// Array of type of high order BCs for splitting shemes
196 
197  /// Velocity fields
199 
200  /// Pointer to field holding pressure field
202 
203  /// int which identifies which components of m_fields contains the
204  /// velocity (u,v,w);
206 
208 
209  std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
210 
212 
213  /// Curl-curl dimensionality
215 
216  /// bounday dimensionality
218 
219  /// pressure boundary conditions container
221 
222  /// pressure boundary conditions expansion container
224 
225  /// number of times the high-order pressure BCs have been called
227 
228  // Number of degrees of freedom (coefficients) for HOPbc
230 
231  // Number of HOPbcs
233 
234  /// Maximum points used in pressure BC evaluation
236 
238 
239  /// Storage for current and previous levels of high order pressure boundary
240  /// conditions.
242 
243  /// Storage for current and previous levels of the inner product of normal
244  /// velocity
246 
248 
249  // Velocity correction scheme coefficient required for extrapolation.
253 
254  // data related to high order outflow.
256 
257 private:
258  static std::string def;
259 };
260 
262 {
263  HighOrderOutflow(const int numHOpts, const int outHBCnumber,
264  const int curldim,
265  const LibUtilities::SessionReaderSharedPtr &pSession)
266  : m_numOutHBCPts(numHOpts), m_outHBCnumber(outHBCnumber)
267  {
268  m_outflowVel =
270  outHBCnumber);
271 
274  outHBCnumber);
275 
276  m_UBndExp =
278 
279  pSession->LoadParameter("OutflowBC_theta", m_obcTheta, 1.0);
280  pSession->LoadParameter("OutflowBC_alpha1", m_obcAlpha1, 0.0);
281  pSession->LoadParameter("OutflowBC_alpha2", m_obcAlpha2, 0.0);
282 
283  pSession->LoadParameter("U0_HighOrderBC", m_U0, 1.0);
284  pSession->LoadParameter("Delta_HighOrderBC", m_delta, 1 / 20.0);
285  }
286 
287  virtual ~HighOrderOutflow(){};
288 
289  /// Number of quadrature points for Outflow HOBC
291 
292  /// Number of Outflow HOBCs
294 
295  /// Parameters for outflow boundary condition
301  std::string m_defVelPrimCoeff[3];
302 
303  /// Storage for current and previous velocity fields along the outflow
305 
306  /// Storage for current and previous velocities along the outflow boundary
309 
310  /// Velocity boundary condition expansions on high order boundaries.
312 
313  /// primitive coefficient for pressure when using convetive like OBCs
315 
316  /// primitive coefficient for velocities when using convetive like OBCs
318 };
319 
320 /**
321  * Evaluate Pressure Boundary Conditions for Standard Extrapolation
322  */
324  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
325  const Array<OneD, const Array<OneD, NekDouble>> &N, NekDouble kinvis)
326 {
327  v_EvaluatePressureBCs(inarray, N, kinvis);
328 }
329 
330 /**
331  *
332  */
334  const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
335 {
336  v_SubSteppingTimeIntegration(IntegrationScheme);
337 }
338 
339 /**
340  *
341  */
342 inline void Extrapolate::SubStepSaveFields(int nstep)
343 {
344  v_SubStepSaveFields(nstep);
345 }
346 
347 /**
348  *
349  */
351  const std::vector<SolverUtils::ForcingSharedPtr> &forcing)
352 {
353  m_forcing = forcing;
354 }
355 
356 /**
357  *
358  */
360  const Array<OneD, const Array<OneD, NekDouble>> &inarray, NekDouble Aii_DT,
361  NekDouble kinvis)
362 {
363  v_SubStepSetPressureBCs(inarray, Aii_DT, kinvis);
364 }
365 
366 /**
367  *
368  */
369 inline void Extrapolate::SubStepAdvance(int nstep, NekDouble time)
370 {
371  v_SubStepAdvance(nstep, time);
372 }
373 
374 /**
375  *
376  */
377 inline void Extrapolate::MountHOPBCs(int HBCdata, NekDouble kinvis,
380 {
381  v_MountHOPBCs(HBCdata, kinvis, Q, Advection);
382 }
383 
384 /**
385  *
386  */
387 inline std::string Extrapolate::GetSubStepName(void)
388 {
389  return v_GetSubStepName();
390 }
391 
392 /**
393  *
394  */
397 {
399 }
400 
401 /**
402  *
403  */
404 inline void Extrapolate::AddNormVelOnOBC(const int nbcoeffs, const int nreg,
406 {
407  v_AddNormVelOnOBC(nbcoeffs, nreg, u);
408 }
409 
410 } // namespace Nektar
411 
412 #endif
void EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble >> &fields, const Array< OneD, const Array< OneD, NekDouble >> &N, NekDouble kinvis)
Definition: Extrapolate.h:323
virtual void v_AccelerationBDF(Array< OneD, Array< OneD, NekDouble >> &array)
virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble >> &u)
std::string GetSubStepName(void)
Definition: Extrapolate.h:387
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:241
int m_bnd_dim
bounday dimensionality
Definition: Extrapolate.h:217
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
Definition: Extrapolate.h:211
void SubStepAdvance(const int nstep, NekDouble time)
Definition: Extrapolate.h:369
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble >> inarray)
void CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble >> &fields, const Array< OneD, const Array< OneD, NekDouble >> &N, NekDouble kinvis)
Definition: Extrapolate.h:170
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:54
int m_curl_dim
Curl-curl dimensionality.
Definition: Extrapolate.h:214
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Definition: Extrapolate.h:201
void AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble >> &u)
Definition: Extrapolate.h:404
virtual void v_EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, const Array< OneD, const Array< OneD, NekDouble >> &N, NekDouble kinvis)=0
void EvaluateBDFArray(Array< OneD, Array< OneD, NekDouble >> &array)
static std::string def
Definition: Extrapolate.h:258
void RollOver(Array< OneD, Array< OneD, NekDouble >> &input)
static NekDouble StifflyStable_Betaq_Coeffs[3][3]
Definition: Extrapolate.h:250
void CopyPressureHBCsToPbndExp(void)
virtual void v_CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
virtual void v_SubStepSaveFields(int nstep)=0
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble >> &oldarrays, Array< OneD, NekDouble > &newarray, Array< OneD, NekDouble > &outarray)
void SubStepSaveFields(const int nstep)
Definition: Extrapolate.h:342
void IProductNormVelocityBCOnHBC(Array< OneD, NekDouble > &IprodVn)
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:198
void SubSteppingTimeIntegration(const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
Definition: Extrapolate.h:333
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
Storage for current and previous levels of the inner product of normal velocity.
Definition: Extrapolate.h:245
void ExtrapolateArray(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)
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:235
virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)=0
void ExtrapolatePressureHBCs(void)
void CalcOutflowBCs(const Array< OneD, const Array< OneD, NekDouble >> &fields, NekDouble kinvis)
void GenerateHOPBCMap(const LibUtilities::SessionReaderSharedPtr &pSsession)
Array< OneD, HBCType > m_hbcType
Array of type of high order BCs for splitting shemes.
Definition: Extrapolate.h:195
HighOrderOutflowSharedPtr m_houtflow
Definition: Extrapolate.h:255
NekDouble m_timestep
Definition: Extrapolate.h:237
virtual void v_SubSteppingTimeIntegration(const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)=0
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:223
void SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, const NekDouble Aii_DT, NekDouble kinvis)
Definition: Extrapolate.h:359
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Definition: Extrapolate.h:209
virtual void v_SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, NekDouble Aii_DT, NekDouble kinvis)=0
void MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
Definition: Extrapolate.h:377
void CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
Definition: Extrapolate.h:395
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:207
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:205
static NekDouble StifflyStable_Alpha_Coeffs[3][3]
Definition: Extrapolate.h:251
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > m_PBndConds
pressure boundary conditions container
Definition: Extrapolate.h:220
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: Extrapolate.h:247
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:226
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:190
void UpdateRobinPrimCoeff(void)
void IProductNormVelocityOnHBC(const Array< OneD, const Array< OneD, NekDouble >> &Vel, Array< OneD, NekDouble > &IprodVn)
void AddPressureToOutflowBCs(NekDouble kinvis)
LibUtilities::CommSharedPtr m_comm
Definition: Extrapolate.h:192
void SetForcing(const std::vector< SolverUtils::ForcingSharedPtr > &forcing)
Definition: Extrapolate.h:350
static NekDouble StifflyStable_Gamma0_Coeffs[3]
Definition: Extrapolate.h:252
virtual ~Extrapolate()
Definition: Extrapolate.cpp:66
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:70
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:278
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< HighOrderOutflow > HighOrderOutflowSharedPtr
Definition: Extrapolate.h:68
@ eNOHBC
Definition: Extrapolate.h:52
@ eConvectiveOBC
Definition: Extrapolate.h:55
@ eHBCNeumann
Definition: Extrapolate.h:53
std::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:59
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:66
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:48
double NekDouble
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_outflowVel
Storage for current and previous velocity fields along the outflow.
Definition: Extrapolate.h:304
Array< OneD, Array< OneD, NekDouble > > m_velocityPrimCoeff
primitive coefficient for velocities when using convetive like OBCs
Definition: Extrapolate.h:317
std::string m_defVelPrimCoeff[3]
Definition: Extrapolate.h:301
int m_outHBCnumber
Number of Outflow HOBCs.
Definition: Extrapolate.h:293
Array< OneD, NekDouble > m_pressurePrimCoeff
primitive coefficient for pressure when using convetive like OBCs
Definition: Extrapolate.h:314
NekDouble m_obcTheta
Parameters for outflow boundary condition.
Definition: Extrapolate.h:296
Array< OneD, Array< OneD, MultiRegions::ExpListSharedPtr > > m_UBndExp
Velocity boundary condition expansions on high order boundaries.
Definition: Extrapolate.h:311
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_outflowVelBnd
Storage for current and previous velocities along the outflow boundary.
Definition: Extrapolate.h:308
HighOrderOutflow(const int numHOpts, const int outHBCnumber, const int curldim, const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: Extrapolate.h:263
int m_numOutHBCPts
Number of quadrature points for Outflow HOBC.
Definition: Extrapolate.h:287