Nektar++
StandardExtrapolate.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: StandardExtrapolate.cpp
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 StandardExtrapolate.
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
37 
38 namespace Nektar
39 {
41  { 1.0, -1., 0.0, 0.0},
42  { 2.5, -4.0, 1.5, 0.0},
43  { 13./3., -9.5, 7.0, -11.0/6.0}};
44 
45  /**
46  * Registers the class with the Factory.
47  */
49  "Standard",
51  "Standard");
52 
57  const Array<OneD, int> pVel,
58  const SolverUtils::AdvectionSharedPtr advObject)
59  : Extrapolate(pSession,pFields,pPressure,pVel,advObject)
60  {
61  }
62 
64  {
65  }
66 
67 
68 
69  /**
70  * Function to extrapolate the new pressure boundary condition.
71  * Based on the velocity field and on the advection term.
72  * Acceleration term is also computed.
73  * This routine is a general one for 2d and 3D application and it can be called
74  * directly from velocity correction scheme. Specialisation on dimensionality is
75  * redirected to the CalcNeumannPressureBCs method.
76  */
78  const Array<OneD, const Array<OneD, NekDouble> > &fields,
79  const Array<OneD, const Array<OneD, NekDouble> > &N,
80  NekDouble kinvis)
81  {
83  if(m_HBCnumber>0)
84  {
85  // Calculate non-linear and viscous BCs at current level
86  // and put in m_pressureHBCs[0]
87  CalcNeumannPressureBCs(fields,N,kinvis);
88 
89  // Extrapolate to n+1
91 
92  // Add (phi,Du/Dt) term to m_presureHBC
93  AddDuDt();
94 
95  // Copy m_pressureHBCs to m_PbndExp
97  }
98 
99  CalcOutflowBCs(fields, kinvis);
100  }
101 
102 
103  /**
104  *
105  */
107  int intMethod,
108  const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
109  {
110  switch(intMethod)
111  {
113  {
114  m_intSteps = 1;
115  }
116  break;
119  {
120  m_intSteps = 2;
121  }
122  break;
124  {
125  m_intSteps = 3;
126  }
127  break;
129  {
130  m_intSteps = 4;
131  }
132  break;
133  }
134  }
135 
136  /**
137  *
138  */
140  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
141  NekDouble Aii_DT,
142  NekDouble kinvis)
143  {
144  }
145 
146 
147  /**
148  *
149  */
151  const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln,
152  int nstep,
153  NekDouble time)
154  {
155  }
156 
157 
158  /**
159  *
160  */
162  int nstep)
163  {
164  }
165 
166  /**
167  *
168  */
170  int HBCdata,
171  NekDouble kinvis,
174  {
175  Vmath::Svtvp(HBCdata,-kinvis,Q,1,Advection,1,Q,1);
176  }
177 
178  /**
179  * At the start, the newest value is stored in array[nlevels-1]
180  * and the previous values in the first positions
181  * At the end, the acceleration from BDF is stored in array[nlevels-1]
182  * and the storage has been updated to included the new value
183  */
186  {
187  int nlevels = array.num_elements();
188  int nPts = array[0].num_elements();
189 
190 
191  if(nPts)
192  {
193  // Update array
194  RollOver(array);
195 
196  // Calculate acceleration using Backward Differentiation Formula
197  Array<OneD, NekDouble> accelerationTerm (nPts, 0.0);
198  if (m_pressureCalls > 2)
199  {
200  int acc_order = std::min(m_pressureCalls-2,m_intSteps);
201  Vmath::Smul(nPts,
202  DuDt_Coeffs[acc_order-1][0],
203  array[0], 1,
204  accelerationTerm, 1);
205 
206  for(int i = 0; i < acc_order; i++)
207  {
208  Vmath::Svtvp(nPts,
209  DuDt_Coeffs[acc_order-1][i+1],
210  array[i+1], 1,
211  accelerationTerm, 1,
212  accelerationTerm, 1);
213  }
214  }
215  array[nlevels-1] = accelerationTerm;
216  }
217  }
218 }
219 
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:259
void CopyPressureHBCsToPbndExp(void)
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:188
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &array)
void RollOver(Array< OneD, Array< OneD, NekDouble > > &input)
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:245
void CalcOutflowBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:199
An abstract base class encapsulating the concept of advection of a vector field.
Definition: Advection.h:70
virtual void v_EvaluatePressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
static std::string className
Name of class.
static ExtrapolateSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, MultiRegions::ExpListSharedPtr &pPressure, const Array< OneD, int > &pVel, const SolverUtils::AdvectionSharedPtr &advObject)
Creates an instance of this class.
static NekDouble DuDt_Coeffs[3][4]
virtual void v_SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_DT, NekDouble kinvis)
virtual void v_SubSteppingTimeIntegration(int intMethod, const LibUtilities::TimeIntegrationWrapperSharedPtr &IntegrationScheme)
virtual void v_SubStepSaveFields(int nstep)
StandardExtrapolate(const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
virtual void v_AccelerationBDF(Array< OneD, Array< OneD, NekDouble > > &array)
virtual void v_SubStepAdvance(const LibUtilities::TimeIntegrationSolutionSharedPtr &integrationSoln, int nstep, NekDouble time)
virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
@ eIMEXGear
IMEX Gear Order 2.
@ eIMEXOrder4
IMEX 4th order scheme using Backward Different Formula & Extrapolation.
@ eIMEXOrder1
IMEX 1st order scheme using Euler Backwards/Euler Forwards.
@ eIMEXOrder3
IMEX 3rd order scheme using Backward Different Formula & Extrapolation.
@ eIMEXOrder2
IMEX 2nd order scheme using Backward Different Formula & Extrapolation.
std::shared_ptr< TimeIntegrationWrapper > TimeIntegrationWrapperSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< TimeIntegrationSolution > TimeIntegrationSolutionSharedPtr
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:170
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:49
double NekDouble
void Svtvp(int n, const T alpha, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
svtvp (scalar times vector plus vector): z = alpha*x + y
Definition: Vmath.cpp:488
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
Definition: Vmath.cpp:216