Nektar++
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
WeakPressureExtrapolate.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: WeakPressureExtrapolate.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 // 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 WeakPressureExtrapolate.
33 //
34 ///////////////////////////////////////////////////////////////////////////////
35 
38 
39 namespace Nektar
40 {
41  /**
42  * Registers the class with the Factory.
43  */
45  "WeakPressure",
47  "WeakPressure");
48 
53  const Array<OneD, int> pVel,
54  const SolverUtils::AdvectionSharedPtr advObject):
55  StandardExtrapolate(pSession,pFields,pPressure,pVel,advObject)
56  {
57  }
58 
60  {
61  }
62 
63  /**
64  * Function to extrapolate the new pressure boundary condition.
65  * Based on the velocity field and on the advection term.
66  * Acceleration term is also computed. This routine is a general
67  * one for 2d and 3D application and it can be called directly
68  * from velocity correction scheme. Specialisation on
69  * dimensionality is redirected to the CalcNeumannPressureBCs
70  * method.
71  */
73  const Array<OneD, const Array<OneD, NekDouble> > &fields,
74  const Array<OneD, const Array<OneD, NekDouble> > &N,
75  NekDouble kinvis)
76  {
78  if(m_HBCnumber > 0)
79  {
80  // Calculate just viscous BCs at current level and put in
81  // m_pressureHBCs[nlevels-1]
82  CalcNeumannPressureBCs(fields,N,kinvis);
83 
84  // Extrapolate to m_pressureHBCs to n+1
86 
87  // \int_bnd q n.u^{n} ds update current normal of field
88  // add m_pressureHBCs to gamma_0/Dt * m_acceleration[0]
89  AddVelBC();
90 
91  // Copy m_pressureHBCs to m_PbndExp
93  }
94 
95  // Evaluate High order outflow conditions if required.
96  CalcOutflowBCs(fields, kinvis);
97  }
98 
99  // In weak pressure formulation we also require \int q u.n ds on
100  // outflow boundary
102  const int nreg,
103  Array<OneD,
105  {
106  if(!m_houtflow.get()) // no outflow on partition so just return
107  {
108  return;
109  }
110 
111  int nbcoeffs = m_PBndExp[nreg]->GetNcoeffs();
112  //int nqb = m_PBndExp[nreg]->GetTotPoints();
113 
114  Array<OneD, NekDouble> IProdVnTmp(nbcoeffs);
115 
116 #if 0
118 
119  for(int i = 0; i < m_curl_dim; ++i)
120  {
121  EvaluateBDFArray(m_houtflow->m_outflowVelBnd[noutflow][i]);
122 
123  ubnd[i] = m_houtflow->m_outflowVelBnd[noutflow][i][m_intSteps-1];
124 
125  // point input u to the first part of the array for later uee.
126  // u[i] = m_houtflow->m_outflowVelBnd[noutflow][i][0];
127  u[i] = ubnd[i];
128  }
129 
130  m_PBndExp[nreg]->NormVectorIProductWRTBase(ubnd,IProdVnTmp);
131 #endif
132  m_PBndExp[nreg]->NormVectorIProductWRTBase(u,IProdVnTmp);
133 
134  Vmath::Svtvp(nbcoeffs,-1.0/m_timestep,IProdVnTmp,1,
135  m_PBndExp[nreg]->UpdateCoeffs(),1,
136  m_PBndExp[nreg]->UpdateCoeffs(),1);
137  }
138 
139 
140  /**
141  * vritual function which only puts in the curl operator into the bcs
142  */
144  NekDouble kinvis,
147  {
148  Vmath::Smul(HBCdata,-kinvis,Q,1,Q,1);
149  }
150 
151 
152 }
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &array)
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:242
ExtrapolateFactory & GetExtrapolateFactory()
Definition: Extrapolate.cpp:50
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.
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:485
boost::shared_ptr< Advection > AdvectionSharedPtr
A shared pointer to an Advection object.
Definition: Advection.h:165
HighOrderOutflowSharedPtr m_houtflow
Definition: Extrapolate.h:272
void CopyPressureHBCsToPbndExp(void)
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
Definition: MeshPartition.h:51
void EvaluateBDFArray(Array< OneD, Array< OneD, NekDouble > > &array)
virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
static std::string className
Name of class.
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:213
virtual void v_EvaluatePressureBCs(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:254
boost::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
double NekDouble
int m_pressureCalls
number of times the high-order pressure BCs have been called
Definition: Extrapolate.h:245
WeakPressureExtrapolate(const LibUtilities::SessionReaderSharedPtr pSession, Array< OneD, MultiRegions::ExpListSharedPtr > pFields, MultiRegions::ExpListSharedPtr pPressure, const Array< OneD, int > pVel, const SolverUtils::AdvectionSharedPtr advObject)
Array< OneD, Array< OneD, NekDouble > > m_pressureHBCs
Storage for current and previous levels of high order pressure boundary conditions.
Definition: Extrapolate.h:259
int m_curl_dim
Curl-curl dimensionality.
Definition: Extrapolate.h:233
void CalcOutflowBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, NekDouble kinvis)
virtual void v_MountHOPBCs(int HBCdata, NekDouble kinvis, Array< OneD, NekDouble > &Q, Array< OneD, const NekDouble > &Advection)
NekDouble m_timestep
Definition: Extrapolate.h:256
Defines a callback function which evaluates the flux vector.
Definition: Advection.h:69
void CalcNeumannPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &fields, const Array< OneD, const Array< OneD, NekDouble > > &N, NekDouble kinvis)
Definition: Extrapolate.h:188
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, tDescription pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:215