Nektar++
VCSMapping.h
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File: VCSMapping.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: Velocity Correction Scheme with coordinate transformation header
32 //
33 ///////////////////////////////////////////////////////////////////////////////
34 
35 #ifndef NEKTAR_SOLVERS_VCSMAPPING_H
36 #define NEKTAR_SOLVERS_VCSMAPPING_H
37 
38 #include <GlobalMapping/Mapping.h>
40 
41 namespace Nektar
42 {
44 {
45 public:
46  /// Creates an instance of this class
50  {
53  p->InitObject();
54  return p;
55  }
56 
57  /// Name of class
58  static std::string className;
59 
60  /// Constructor.
63 
64  //
66  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
67  Array<OneD, Array<OneD, NekDouble>> &outarray);
68 
69  virtual ~VCSMapping();
70 
71  virtual void v_InitObject(bool DeclareField = true) override;
72 
73 protected:
74  // Mapping object
76 
77  bool m_verbose;
78 
79  // Flags defining how pressure and viscous mapping terms
80  // should be treated
84  // Tolerance and relaxation parameters for pressure and viscous
85  // systems (when solved iteratively)
90 
91  // Pressure gradient (to avoid duplicate calculations)
93 
94  // Virtual functions
95  virtual void v_DoInitialise(void) override;
96 
97  virtual void v_SetUpPressureForcing(
98  const Array<OneD, const Array<OneD, NekDouble>> &fields,
100  const NekDouble aii_Dt) override;
101 
102  virtual void v_SetUpViscousForcing(
103  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
105  const NekDouble aii_Dt) override;
106 
107  virtual void v_SolvePressure(
108  const Array<OneD, NekDouble> &Forcing) override;
109 
110  virtual void v_SolveViscous(
111  const Array<OneD, const Array<OneD, NekDouble>> &Forcing,
112  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
113  Array<OneD, Array<OneD, NekDouble>> &outarray,
114  const NekDouble aii_Dt) override;
115 
117  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
118  Array<OneD, Array<OneD, NekDouble>> &outarray,
119  const NekDouble time) override;
120 
121 private:
123 
124  // Correction needed for convective terms = N(u) - ( -(u \nabla) u)
125  // velPhys is the velocity field (transformed for physical space)
127  const Array<OneD, const Array<OneD, NekDouble>> &velPhys,
128  Array<OneD, Array<OneD, NekDouble>> &outarray);
129 
130  // Correction needed for time-derivative terms
131  // = U_coord^j u^i_,j - u^j U_coord^i_,j
132  // vel is the velocity field (can be in wavespace)
133  // velPhys is the velocity field (transformed for physical space)
135  const Array<OneD, const Array<OneD, NekDouble>> &vel,
136  const Array<OneD, const Array<OneD, NekDouble>> &velPhys,
137  Array<OneD, Array<OneD, NekDouble>> &outarray);
138 
139  // Correction needed for pressure terms
140  // = -g^(ij)p_j + (\nabla p)/J for variable Jacobian
141  // = -g^(ij)p_j + (\nabla p) for constant Jacobian
142  // the pressure field can be in wavespace
144  Array<OneD, Array<OneD, NekDouble>> &outarray);
145 
146  // Correction needed for viscous terms = g^jk u^i_{,jk}-(\nabla^2 u)
147  // vel is the velocity field (can be in wavespace)
148  // velPhys is the velocity field (transformed for physical space)
150  const Array<OneD, const Array<OneD, NekDouble>> &velPhys,
151  Array<OneD, Array<OneD, NekDouble>> &outarray);
152 };
153 
154 typedef std::shared_ptr<VCSMapping> VCSMappingSharedPtr;
155 
156 } // namespace Nektar
157 
158 #endif // VELOCITY_CORRECTION_SCHEME_H
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
Defines a forcing term to be explicitly applied.
Definition: Forcing.h:73
virtual void v_SolvePressure(const Array< OneD, NekDouble > &Forcing) override
Definition: VCSMapping.cpp:415
virtual void v_EvaluateAdvection_SetPressureBCs(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time) override
Definition: VCSMapping.cpp:170
virtual ~VCSMapping()
Definition: VCSMapping.cpp:127
void MappingAccelerationCorrection(const Array< OneD, const Array< OneD, NekDouble >> &vel, const Array< OneD, const Array< OneD, NekDouble >> &velPhys, Array< OneD, Array< OneD, NekDouble >> &outarray)
Definition: VCSMapping.cpp:827
virtual void v_SolveViscous(const Array< OneD, const Array< OneD, NekDouble >> &Forcing, const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble aii_Dt) override
Definition: VCSMapping.cpp:553
virtual void v_DoInitialise(void) override
Sets up initial conditions.
Definition: VCSMapping.cpp:131
void MappingViscousCorrection(const Array< OneD, const Array< OneD, NekDouble >> &velPhys, Array< OneD, Array< OneD, NekDouble >> &outarray)
Definition: VCSMapping.cpp:932
void ApplyIncNSMappingForcing(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray)
Definition: VCSMapping.cpp:719
NekDouble m_pressureTolerance
Definition: VCSMapping.h:86
NekDouble m_viscousRelaxation
Definition: VCSMapping.h:89
virtual void v_SetUpPressureForcing(const Array< OneD, const Array< OneD, NekDouble >> &fields, Array< OneD, Array< OneD, NekDouble >> &Forcing, const NekDouble aii_Dt) override
Definition: VCSMapping.cpp:213
static std::string className
Name of class.
Definition: VCSMapping.h:58
NekDouble m_pressureRelaxation
Definition: VCSMapping.h:88
static SolverUtils::EquationSystemSharedPtr create(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Creates an instance of this class.
Definition: VCSMapping.h:47
NekDouble m_viscousTolerance
Definition: VCSMapping.h:87
void MappingPressureCorrection(Array< OneD, Array< OneD, NekDouble >> &outarray)
Definition: VCSMapping.cpp:906
GlobalMapping::MappingSharedPtr m_mapping
Definition: VCSMapping.h:75
void MappingAdvectionCorrection(const Array< OneD, const Array< OneD, NekDouble >> &velPhys, Array< OneD, Array< OneD, NekDouble >> &outarray)
Definition: VCSMapping.cpp:802
Array< OneD, Array< OneD, NekDouble > > m_presForcingCorrection
Definition: VCSMapping.h:122
VCSMapping(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Constructor.
Definition: VCSMapping.cpp:55
virtual void v_InitObject(bool DeclareField=true) override
Init object for UnsteadySystem class.
Definition: VCSMapping.cpp:62
virtual void v_SetUpViscousForcing(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &Forcing, const NekDouble aii_Dt) override
Definition: VCSMapping.cpp:338
Array< OneD, Array< OneD, NekDouble > > m_gradP
Definition: VCSMapping.h:92
GLOBAL_MAPPING_EXPORT typedef std::shared_ptr< Mapping > MappingSharedPtr
A shared pointer to a Mapping object.
Definition: Mapping.h:50
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< EquationSystem > EquationSystemSharedPtr
A shared pointer to an EquationSystem object.
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:172
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
std::shared_ptr< VCSMapping > VCSMappingSharedPtr
Definition: VCSMapping.h:154
double NekDouble