Nektar++
IncNavierStokes.h
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: IncNavierStokes.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: Basic Advection Diffusion Reaction Field definition in
32// two-dimensions
33//
34///////////////////////////////////////////////////////////////////////////////
35
36#ifndef NEKTAR_SOLVERS_INCNAVIERSTOKES_H
37#define NEKTAR_SOLVERS_INCNAVIERSTOKES_H
38
46#include <boost/numeric/ublas/matrix.hpp>
47#include <boost/numeric/ublas/vector.hpp>
48#include <complex>
49
50namespace Nektar
51{
52namespace bnu = boost::numeric::ublas;
53
55{
65};
66
68{
78};
79
80// Keep this consistent with the enums in EquationType.
81const std::string kEquationTypeStr[] = {
82 "NoType",
83 "SteadyStokes",
84 "SteadyOseen",
85 "SteadyLinearisedNS",
86 "UnsteadyStokes",
87 "UnsteadyLinearisedNS",
88 "UnsteadyNavierStokes",
89 "SteadyNavierStokes",
90};
91
93{
103
104// Keep this consistent with the enums in EquationType.
105const std::string kAdvectionFormStr[] = {"NoType",
106 "Convective",
107 "NonConservative",
108 "Linearised",
109 "Adjoint",
110 "SkewSymmetric"
111 "NoAdvection"};
112
113typedef std::complex<double> NekComplexDouble;
114
116{
118 {
121 };
122
123 virtual ~WomersleyParams(){};
124
125 // Real and imaginary velocity comp. of wom
126 std::vector<NekComplexDouble> m_wom_vel;
127
128 // Womersley BC constants
132 // currently this needs to be the point in the middle of the
133 // axis but should be generalised to be any point on the axis
135
136 // poiseuille flow and fourier coefficients
139};
140typedef std::shared_ptr<WomersleyParams> WomersleyParamsSharedPtr;
141
142/**
143 * \brief This class is the base class for Navier Stokes problems
144 *
145 */
148{
149public:
150 // Destructor
151 ~IncNavierStokes() override;
152
153 void v_InitObject(bool DeclareField = true) override;
154
156 {
157 return m_nConvectiveFields;
158 }
159
160 void AddForcing(const SolverUtils::ForcingSharedPtr &pForce);
161
162 void v_GetPressure(
163 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
165
166 void v_GetDensity(
167 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
168 Array<OneD, NekDouble> &density) override;
169
170 bool v_HasConstantDensity() override
171 {
172 return true;
173 }
174
175 void v_GetVelocity(
176 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
178
180 const Array<OneD, NekDouble> &vFrameVels) override;
182 Array<OneD, NekDouble> &vFrameVels) override;
184 const Array<OneD, NekDouble> &vFrameDisp) override;
185 void v_GetMovingFrameDisp(Array<OneD, NekDouble> &vFrameDisp) override;
187 const bnu::matrix<NekDouble> &vProjMat) override;
189 bnu::matrix<NekDouble> &vProjMat) override;
190 void v_SetAeroForce(Array<OneD, NekDouble> forces) override;
191 void v_GetAeroForce(Array<OneD, NekDouble> forces) override;
192
193 bool DefinedForcing(const std::string &sForce);
194
195protected:
196 // pointer to the extrapolation class for sub-stepping and HOPBS
197
199
200 /// modal energy file
201 std::ofstream m_mdlFile;
202
203 /// bool to identify if advection term smoothing is requested
205
206 /// Forcing terms
207 std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
208
209 /// Number of fields to be convected;
211
212 /// int which identifies which components of m_fields contains the
213 /// velocity (u,v,w);
215
216 /// Pointer to field holding pressure field
218 /// Kinematic viscosity
220 /// dump energy to file at steps time
222
223 /// equation type;
225
226 /// Mapping from BCs to Elmt IDs
228 /// Mapping from BCs to Elmt Edge IDs
230 /// RHS Factor for Radiation Condition
232
233 /// Number of time integration steps AND Order of extrapolation for
234 /// pressure boundary conditions.
236
237 // pivot point for moving reference frame
238 // TODO: relocate this variable
241
242 /// Constructor.
245
247 {
248 return m_equationType;
249 }
250 static std::string eqTypeLookupIds[];
251
253 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
254 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
255
257
258 /// time dependent boundary conditions updating
260
261 /// Set Radiation forcing term
262 void SetRadiationBoundaryForcing(int fieldid);
263
264 /// Set Normal Velocity Component to Zero
266
267 /// Set Womersley Profile if specified
268 void SetWomersleyBoundary(const int fldid, const int bndid);
269
270 /// Set Up Womersley details
271 void SetUpWomersley(const int fldid, const int bndid, std::string womstr);
272
273 /// Set the moving reference frame boundary conditions
274 void SetMovingReferenceFrameBCs(const NekDouble &time);
275 void SetMRFWallBCs(const NekDouble &time);
276 void SetMRFDomainVelBCs(const NekDouble &time);
277
278 /// Womersley parameters if required
279 std::map<int, std::map<int, WomersleyParamsSharedPtr>> m_womersleyParams;
280
282 {
283 return m_pressure;
284 }
285
286 void v_TransCoeffToPhys(void) override
287 {
288 ASSERTL0(false, "This method is not defined in this class");
289 }
290
291 void v_TransPhysToCoeff(void) override
292 {
293 ASSERTL0(false, "This method is not defined in this class");
294 }
295
296 virtual int v_GetForceDimension() = 0;
297
299 const NekDouble SpeedSoundFactor) override;
300
301 bool v_PreIntegrate(int step) override;
302
303private:
304};
305
306typedef std::shared_ptr<IncNavierStokes> IncNavierStokesSharedPtr;
307
308} // namespace Nektar
309
310#endif // NEKTAR_SOLVERS_INCNAVIERSTOKES_H
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:208
This class is the base class for Navier Stokes problems.
std::ofstream m_mdlFile
modal energy file
Array< OneD, Array< OneD, int > > m_fieldsBCToTraceID
Mapping from BCs to Elmt Edge IDs.
Array< OneD, NekDouble > m_pivotPoint
Array< OneD, NekDouble > v_GetMaxStdVelocity(const NekDouble SpeedSoundFactor) override
std::map< int, std::map< int, WomersleyParamsSharedPtr > > m_womersleyParams
Womersley parameters if required.
bool v_HasConstantDensity() override
void v_SetAeroForce(Array< OneD, NekDouble > forces) override
virtual int v_GetForceDimension()=0
void SetWomersleyBoundary(const int fldid, const int bndid)
Set Womersley Profile if specified.
void v_GetMovingFrameVelocities(Array< OneD, NekDouble > &vFrameVels) override
void v_GetAeroForce(Array< OneD, NekDouble > forces) override
void v_TransPhysToCoeff(void) override
Virtual function for transformation to coefficient space.
void SetZeroNormalVelocity()
Set Normal Velocity Component to Zero.
void v_GetMovingFrameDisp(Array< OneD, NekDouble > &vFrameDisp) override
MultiRegions::ExpListSharedPtr v_GetPressure() override
Array< OneD, NekDouble > m_aeroForces
void SetBoundaryConditions(NekDouble time)
time dependent boundary conditions updating
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
void SetMRFDomainVelBCs(const NekDouble &time)
NekDouble m_kinvis
Kinematic viscosity.
bool m_SmoothAdvection
bool to identify if advection term smoothing is requested
void v_GetDensity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density) override
void SetRadiationBoundaryForcing(int fieldid)
Set Radiation forcing term.
Array< OneD, Array< OneD, NekDouble > > m_fieldsRadiationFactor
RHS Factor for Radiation Condition.
bool DefinedForcing(const std::string &sForce)
void SetMRFWallBCs(const NekDouble &time)
void v_SetMovingFrameVelocities(const Array< OneD, NekDouble > &vFrameVels) override
bool v_PreIntegrate(int step) override
void SetUpWomersley(const int fldid, const int bndid, std::string womstr)
Set Up Womersley details.
void v_InitObject(bool DeclareField=true) override
Initialisation object for EquationSystem.
ExtrapolateSharedPtr m_extrapolation
Array< OneD, int > m_velocity
int which identifies which components of m_fields contains the velocity (u,v,w);
static std::string eqTypeLookupIds[]
void v_GetMovingFrameProjectionMat(bnu::matrix< NekDouble > &vProjMat) override
void v_TransCoeffToPhys(void) override
Virtual function for transformation to physical space.
Array< OneD, Array< OneD, int > > m_fieldsBCToElmtID
Mapping from BCs to Elmt IDs.
int m_energysteps
dump energy to file at steps time
void v_GetVelocity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, Array< OneD, NekDouble > > &velocity) override
EquationType m_equationType
equation type;
EquationType GetEquationType(void)
void v_SetMovingFrameProjectionMat(const bnu::matrix< NekDouble > &vProjMat) override
int m_intSteps
Number of time integration steps AND Order of extrapolation for pressure boundary conditions.
int m_nConvectiveFields
Number of fields to be convected;.
void AddForcing(const SolverUtils::ForcingSharedPtr &pForce)
std::vector< SolverUtils::ForcingSharedPtr > m_forcing
Forcing terms.
void v_SetMovingFrameDisp(const Array< OneD, NekDouble > &vFrameDisp) override
void EvaluateAdvectionTerms(const Array< OneD, const Array< OneD, NekDouble > > &inarray, Array< OneD, Array< OneD, NekDouble > > &outarray, const NekDouble time)
void SetMovingReferenceFrameBCs(const NekDouble &time)
Set the moving reference frame boundary conditions.
IncNavierStokes(const LibUtilities::SessionReaderSharedPtr &pSession, const SpatialDomains::MeshGraphSharedPtr &pGraph)
Constructor.
A base class for PDEs which include an advection component.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
const std::vector< NekDouble > velocity
std::shared_ptr< ExpList > ExpListSharedPtr
Shared pointer to an ExpList object.
SOLVER_UTILS_EXPORT typedef std::shared_ptr< Forcing > ForcingSharedPtr
A shared pointer to an EquationSystem object.
Definition: Forcing.h:53
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:174
const std::string kAdvectionFormStr[]
std::complex< double > NekComplexDouble
@ eSteadyNavierStokes
@ eUnsteadyStokes
@ eUnsteadyNavierStokes
@ eSteadyLinearisedNS
@ eUnsteadyLinearisedNS
@ eEquationTypeSize
@ eNoEquationType
@ eAdvectionFormSize
@ eSkewSymmetric
@ eNonConservative
@ eNoAdvectionForm
@ eCoupledLinearisedNS
@ eVelocityCorrectionScheme
@ eSmoothedProfileMethod
@ eVCSWeakPressure
std::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:60
std::shared_ptr< IncNavierStokes > IncNavierStokesSharedPtr
std::shared_ptr< WomersleyParams > WomersleyParamsSharedPtr
const std::string kEquationTypeStr[]
double NekDouble
Array< OneD, NekDouble > m_axisnormal
std::vector< NekComplexDouble > m_wom_vel
Array< OneD, Array< OneD, NekDouble > > m_poiseuille
Array< OneD, NekDouble > m_axispoint
Array< OneD, Array< OneD, Array< OneD, NekComplexDouble > > > m_zvel