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
46
47namespace Nektar
48{
49
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
59class Extrapolate;
60typedef std::shared_ptr<Extrapolate> ExtrapolateSharedPtr;
67
68struct HighOrderOutflow;
69typedef std::shared_ptr<HighOrderOutflow> HighOrderOutflowSharedPtr;
70
72
74{
75public:
79 const Array<OneD, int> pVel,
80 const SolverUtils::AdvectionSharedPtr advObject);
81
82 virtual ~Extrapolate() = default;
83
85 const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
86 {
87 v_SubSteppingTimeIntegration(IntegrationScheme);
88 }
89
90 inline void SubStepSaveFields(const int nstep)
91 {
93 }
94
96 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
97 const NekDouble Aii_DT, NekDouble kinvis)
98 {
99 v_SubStepSetPressureBCs(inarray, Aii_DT, kinvis);
100 }
101
102 inline void SubStepAdvance(const int nstep, NekDouble time)
103 {
104 v_SubStepAdvance(nstep, time);
105 }
106
107 inline void MountHOPBCs(int HBCdata, NekDouble kinvis,
110 {
111 v_MountHOPBCs(HBCdata, kinvis, Q, Advection);
112 }
113
115 const Array<OneD, const Array<OneD, NekDouble>> &fields,
116 const Array<OneD, const Array<OneD, NekDouble>> &N, NekDouble kinvis)
117 {
118 v_EvaluatePressureBCs(fields, N, kinvis);
119 }
120
121 inline void AddNormVelOnOBC(const int nbcoeffs, const int nreg,
123 {
124 v_AddNormVelOnOBC(nbcoeffs, nreg, u);
125 }
126
128 {
130 }
131
133 const Array<OneD, const Array<OneD, NekDouble>> &fields,
134 const Array<OneD, const Array<OneD, NekDouble>> &N, NekDouble kinvis)
135 {
136 v_CalcNeumannPressureBCs(fields, N, kinvis);
137 }
138
139 inline std::string GetSubStepName(void)
140 {
141 return v_GetSubStepName();
142 }
143
144 inline void SetForcing(
145 const std::vector<SolverUtils::ForcingSharedPtr> &forcing)
146 {
147 m_forcing = forcing;
148 }
149
150 void GenerateHOPBCMap(
151 const LibUtilities::SessionReaderSharedPtr &pSsession);
152
153 void UpdateRobinPrimCoeff(void);
154
155 void AddDuDt(void);
156
157 void AddVelBC(void);
158
160 void CopyPressureHBCsToPbndExp(void);
161
163 const Array<OneD, Array<OneD, NekDouble>> inarray);
164
166 const Array<OneD, const Array<OneD, NekDouble>> &Vel,
167 Array<OneD, NekDouble> &IprodVn);
168
170
172
174
176 Array<OneD, NekDouble> &newarray,
177 Array<OneD, NekDouble> &outarray);
178
180
181 void GenerateBndElmtExpansion(void);
182
183protected:
185 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
186 const Array<OneD, const Array<OneD, NekDouble>> &N,
187 NekDouble kinvis) = 0;
188
191 &IntegrationScheme) = 0;
192
193 virtual void v_SubStepSaveFields(int nstep) = 0;
194
196 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
197 NekDouble Aii_DT, NekDouble kinvis) = 0;
198
199 virtual void v_SubStepAdvance(int nstep, NekDouble time) = 0;
200
201 virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis,
204
205 virtual std::string v_GetSubStepName(void);
206
207 virtual void v_AccelerationBDF(Array<OneD, Array<OneD, NekDouble>> &array);
208
209 virtual void v_CalcNeumannPressureBCs(
210 const Array<OneD, const Array<OneD, NekDouble>> &fields,
211 const Array<OneD, const Array<OneD, NekDouble>> &N, NekDouble kinvis);
212
214
215 virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg,
217
218 void CalcOutflowBCs(const Array<OneD, const Array<OneD, NekDouble>> &fields,
219 NekDouble kinvis);
220
222
224
226
227 /// Array of type of high order BCs for splitting shemes
229
230 /// Velocity fields
232
233 /// Pointer to field holding pressure field
235
236 /// int which identifies which components of m_fields contains the
237 /// velocity (u,v,w);
239
241
242 std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
243
245
246 /// Curl-curl dimensionality
248
249 /// bounday dimensionality
251
252 /// pressure boundary conditions container
254
255 /// pressure boundary conditions expansion container
257
258 /// Boundary expansions on each domain boundary
260
261 /// number of times the high-order pressure BCs have been called
263
264 // Number of degrees of freedom (coefficients) for HOPbc
266
267 // Number of HOPbcs
269
270 /// Maximum points used in pressure BC evaluation
272
274
275 /// Storage for current and previous levels of high order pressure boundary
276 /// conditions.
278
279 /// Storage for current and previous levels of the inner product of normal
280 /// velocity
282
284
285 // Velocity correction scheme coefficient required for extrapolation.
289
290 // data related to high order outflow.
292
293private:
294 static std::string def;
295};
296
298{
299 HighOrderOutflow(const int numHOpts, const int outHBCnumber,
300 const int curldim,
302 : m_numOutHBCPts(numHOpts), m_outHBCnumber(outHBCnumber)
303 {
306 outHBCnumber);
307
310 outHBCnumber);
311
312 m_UBndExp =
314
315 pSession->LoadParameter("OutflowBC_theta", m_obcTheta, 1.0);
316 pSession->LoadParameter("OutflowBC_alpha1", m_obcAlpha1, 0.0);
317 pSession->LoadParameter("OutflowBC_alpha2", m_obcAlpha2, 0.0);
318
319 pSession->LoadParameter("U0_HighOrderBC", m_U0, 1.0);
320 pSession->LoadParameter("Delta_HighOrderBC", m_delta, 1 / 20.0);
321 }
322
323 virtual ~HighOrderOutflow(){};
324
325 /// Number of quadrature points for Outflow HOBC
327
328 /// Number of Outflow HOBCs
330
331 /// Parameters for outflow boundary condition
337 std::string m_defVelPrimCoeff[3];
338
339 /// Storage for current and previous velocity fields along the outflow
341
342 /// Storage for current and previous velocities along the outflow boundary
345
346 /// Velocity boundary condition expansions on high order boundaries.
348
349 /// primitive coefficient for pressure when using convetive like OBCs
351
352 /// primitive coefficient for velocities when using convetive like OBCs
354};
355
356} // namespace Nektar
357
358#endif
std::string GetSubStepName(void)
Definition: Extrapolate.h:139
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:277
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:250
Array< OneD, Array< OneD, NekDouble > > m_previousVelFields
Definition: Extrapolate.h:244
void SubStepAdvance(const int nstep, NekDouble time)
Definition: Extrapolate.h:102
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:53
int m_curl_dim
Curl-curl dimensionality.
Definition: Extrapolate.h:247
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
Definition: Extrapolate.h:234
static std::string def
Definition: Extrapolate.h:294
static NekDouble StifflyStable_Betaq_Coeffs[3][3]
Definition: Extrapolate.h:286
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:90
void IProductNormVelocityBCOnHBC(Array< OneD, NekDouble > &IprodVn)
virtual ~Extrapolate()=default
Array< OneD, MultiRegions::ExpListSharedPtr > m_fields
Velocity fields.
Definition: Extrapolate.h:231
void EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:114
void SubSteppingTimeIntegration(const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)
Definition: Extrapolate.h:84
Array< OneD, Array< OneD, NekDouble > > m_iprodnormvel
Storage for current and previous levels of the inner product of normal velocity.
Definition: Extrapolate.h:281
Array< OneD, NekDouble > GetMaxStdVelocity(const Array< OneD, Array< OneD, NekDouble > > inarray)
int m_intSteps
Maximum points used in pressure BC evaluation.
Definition: Extrapolate.h:271
void CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:132
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:228
HighOrderOutflowSharedPtr m_houtflow
Definition: Extrapolate.h:291
NekDouble m_timestep
Definition: Extrapolate.h:273
virtual void v_SubSteppingTimeIntegration(const LibUtilities::TimeIntegrationSchemeSharedPtr &IntegrationScheme)=0
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:256
void SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, const NekDouble Aii_DT, NekDouble kinvis)
Definition: Extrapolate.h:95
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &array)
void GenerateBndElmtExpansion(void)
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Definition: Extrapolate.h:242
void MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
Definition: Extrapolate.h:107
void CorrectPressureBCs(const Array< OneD, NekDouble > &pressure)
Definition: Extrapolate.h:127
SolverUtils::AdvectionSharedPtr m_advObject
Definition: Extrapolate.h:240
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
Definition: Extrapolate.h:238
static NekDouble StifflyStable_Alpha_Coeffs[3][3]
Definition: Extrapolate.h:287
void AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
Definition: Extrapolate.h:121
Array< OneD, MultiRegions::ExpListSharedPtr > m_bndElmtExps
Boundary expansions on each domain boundary.
Definition: Extrapolate.h:259
void RollOver(Array< OneD, Array< OneD, NekDouble > > &input)
Array< OneD, const SpatialDomains::BoundaryConditionShPtr > m_PBndConds
pressure boundary conditions container
Definition: Extrapolate.h:253
Array< OneD, Array< OneD, NekDouble > > m_traceNormals
Definition: Extrapolate.h:283
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:262
LibUtilities::SessionReaderSharedPtr m_session
Definition: Extrapolate.h:223
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:225
void SetForcing(const std::vector< SolverUtils::ForcingSharedPtr > &forcing)
Definition: Extrapolate.h:144
static NekDouble StifflyStable_Gamma0_Coeffs[3]
Definition: Extrapolate.h:288
virtual std::string v_GetSubStepName(void)
Provides a generic Factory class.
An abstract base class encapsulating the concept of advection of a vector field.
Definition: Advection.h:81
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< TimeIntegrationScheme > TimeIntegrationSchemeSharedPtr
std::shared_ptr< Comm > CommSharedPtr
Pointer to a Communicator object.
Definition: Comm.h:55
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:54
std::shared_ptr< HighOrderOutflow > HighOrderOutflowSharedPtr
Definition: Extrapolate.h:69
@ eNOHBC
Definition: Extrapolate.h:52
@ eConvectiveOBC
Definition: Extrapolate.h:55
@ eHBCNeumann
Definition: Extrapolate.h:53
std::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:60
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:47
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:340
Array< OneD, Array< OneD, NekDouble > > m_velocityPrimCoeff
primitive coefficient for velocities when using convetive like OBCs
Definition: Extrapolate.h:353
std::string m_defVelPrimCoeff[3]
Definition: Extrapolate.h:337
int m_outHBCnumber
Number of Outflow HOBCs.
Definition: Extrapolate.h:329
Array< OneD, NekDouble > m_pressurePrimCoeff
primitive coefficient for pressure when using convetive like OBCs
Definition: Extrapolate.h:350
NekDouble m_obcTheta
Parameters for outflow boundary condition.
Definition: Extrapolate.h:332
Array< OneD, Array< OneD, MultiRegions::ExpListSharedPtr > > m_UBndExp
Velocity boundary condition expansions on high order boundaries.
Definition: Extrapolate.h:347
Array< OneD, Array< OneD, Array< OneD, Array< OneD, NekDouble > > > > m_outflowVelBnd
Storage for current and previous velocities along the outflow boundary.
Definition: Extrapolate.h:344
HighOrderOutflow(const int numHOpts, const int outHBCnumber, const int curldim, const LibUtilities::SessionReaderSharedPtr &pSession)
Definition: Extrapolate.h:299
int m_numOutHBCPts
Number of quadrature points for Outflow HOBC.
Definition: Extrapolate.h:326