Nektar++
SubSteppingExtrapolateWeakPressure.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: SubSteppingExtrapolateWeakPressure.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 SubSteppingExtrapolate with Weak Pressure VCS
32 // mainly redefines SubStepSetPressureBCs
33 ///////////////////////////////////////////////////////////////////////////////
34 
37 
38 using namespace std;
39 
40 namespace Nektar
41 {
42  /**
43  * Registers the class with the Factory.
44  */
45  std::string SubSteppingExtrapolateWeakPressure::className = GetExtrapolateFactory().RegisterCreatorFunction(
46  "SubSteppingWeakPressure",
47  SubSteppingExtrapolateWeakPressure::create,
48  "SubSteppingWeakPressure");
49 
50  SubSteppingExtrapolateWeakPressure::SubSteppingExtrapolateWeakPressure(
54  const Array<OneD, int> pVel,
55  const SolverUtils::AdvectionSharedPtr advObject)
56  : SubSteppingExtrapolate(pSession,pFields,pPressure,pVel,advObject)
57  {
58  }
59 
61  {
62  }
63 
65  const Array<OneD, const Array<OneD, NekDouble> > &inarray,
66  const NekDouble Aii_Dt,
67  NekDouble kinvis)
68  {
69  Array<OneD, Array<OneD, NekDouble> > nullvelfields;
70 
72 
73  // Calculate non-linear and viscous BCs at current level and
74  // put in m_pressureHBCs[0]
75  CalcNeumannPressureBCs(inarray,nullvelfields,kinvis);
76 
77  // Extrapolate to m_pressureHBCs to n+1
79 
80  // Add (phi,gamma0 u^{n+1}/Dt) term to m_presureHBC
81  AddVelBC();
82 
83  // Copy m_pressureHBCs to m_PbndExp
85 
86  // Evaluate High order outflow conditiosn if required.
87  CalcOutflowBCs(inarray, kinvis);
88  }
89 
90 
91  // In weak pressure formulation we also require \int q u.n ds on outflow boundary
92  void SubSteppingExtrapolateWeakPressure::v_AddNormVelOnOBC(const int cnt, const int nreg,
94  {
95  if(!m_houtflow.get()) // no outflow on partition so just return
96  {
97  return;
98  }
99 
100  int nbcoeffs = m_PBndExp[nreg]->GetNcoeffs();
101  //int nqb = m_PBndExp[nreg]->GetTotPoints();
102 
103  Array<OneD, NekDouble> IProdVnTmp(nbcoeffs);
104 
106 
107 
108  for(int i = 0; i < m_curl_dim; ++i)
109  {
110  EvaluateBDFArray(m_houtflow->m_outflowVelBnd[cnt][i]);
111 
112  ubnd[i] = m_houtflow->m_outflowVelBnd[cnt][i][m_intSteps-1];
113 
114  // point input u to the first part of the array for later uee.
115  u[i] = m_houtflow->m_outflowVelBnd[cnt][i][0];
116  }
117 
118  m_PBndExp[nreg]->NormVectorIProductWRTBase(ubnd,IProdVnTmp);
119 
120  Vmath::Svtvp(nbcoeffs,-1.0/m_timestep,IProdVnTmp,1,m_PBndExp[nreg]->UpdateCoeffs(),1,
121  m_PBndExp[nreg]->UpdateCoeffs(),1);
122  }
123 }
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 CopyPressureHBCsToPbndExp(void)
void EvaluateBDFArray(Array< OneD, Array< OneD, NekDouble > > &array)
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:186
HighOrderOutflowSharedPtr m_houtflow
Definition: Extrapolate.h:272
NekDouble m_timestep
Definition: Extrapolate.h:256
Array< OneD, MultiRegions::ExpListSharedPtr > m_PBndExp
pressure boundary conditions expansion container
Definition: Extrapolate.h:242
void ExtrapolateArray(Array< OneD, Array< OneD, NekDouble > > &array)
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:200
virtual void v_AddNormVelOnOBC(const int nbcoeffs, const int nreg, Array< OneD, Array< OneD, NekDouble > > &u)
virtual void v_SubStepSetPressureBCs(const Array< OneD, const Array< OneD, NekDouble > > &inarray, NekDouble Aii_Dt, NekDouble kinvis)
std::shared_ptr< SessionReader > SessionReaderSharedPtr
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:291
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
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:565