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 virtual ~IncNavierStokes();
152
153 virtual void v_InitObject(bool DeclareField = true) override;
154
156 {
157 return m_nConvectiveFields;
158 }
159
160 void AddForcing(const SolverUtils::ForcingSharedPtr &pForce);
161
162 virtual void v_GetPressure(
163 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
165
166 virtual void v_GetDensity(
167 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
168 Array<OneD, NekDouble> &density) override;
169
170 virtual bool v_HasConstantDensity() override
171 {
172 return true;
173 }
174
175 virtual void v_GetVelocity(
176 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
177 Array<OneD, Array<OneD, NekDouble>> &velocity) override;
178
179 virtual void v_SetMovingFrameVelocities(
180 const Array<OneD, NekDouble> &vFrameVels) override;
181 virtual void v_GetMovingFrameVelocities(
182 Array<OneD, NekDouble> &vFrameVels) override;
183 virtual void v_SetMovingFrameAngles(
184 const Array<OneD, NekDouble> &vFrameTheta) override;
185 virtual void v_GetMovingFrameAngles(
186 Array<OneD, NekDouble> &vFrameTheta) override;
188 const bnu::matrix<NekDouble> &vProjMat) override;
190 bnu::matrix<NekDouble> &vProjMat) override;
191
192 bool DefinedForcing(const std::string &sForce);
193 void GetPivotPoint(Array<OneD, NekDouble> &vPivotPoint);
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
240
241 /// Constructor.
244
246 {
247 return m_equationType;
248 }
249 static std::string eqTypeLookupIds[];
250
252 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
253 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
254
256
257 /// time dependent boundary conditions updating
259
260 /// Set Radiation forcing term
261 void SetRadiationBoundaryForcing(int fieldid);
262
263 /// Set Normal Velocity Component to Zero
265
266 /// Set Womersley Profile if specified
267 void SetWomersleyBoundary(const int fldid, const int bndid);
268
269 /// Set Up Womersley details
270 void SetUpWomersley(const int fldid, const int bndid, std::string womstr);
271
272 /// Set the moving reference frame boundary conditions
273 void SetMovingReferenceFrameBCs(const NekDouble &time);
274 void SetMRFWallBCs(const NekDouble &time);
275 void SetMRFDomainVelBCs(const NekDouble &time);
276
277 /// Womersley parameters if required
278 std::map<int, std::map<int, WomersleyParamsSharedPtr>> m_womersleyParams;
279
281 {
282 return m_pressure;
283 }
284
285 virtual void v_TransCoeffToPhys(void) override
286 {
287 ASSERTL0(false, "This method is not defined in this class");
288 }
289
290 virtual void v_TransPhysToCoeff(void) override
291 {
292 ASSERTL0(false, "This method is not defined in this class");
293 }
294
295 virtual int v_GetForceDimension() = 0;
296
298 const NekDouble SpeedSoundFactor) override;
299
300 virtual bool v_PreIntegrate(int step) override;
301
302private:
303};
304
305typedef std::shared_ptr<IncNavierStokes> IncNavierStokesSharedPtr;
306
307} // namespace Nektar
308
309#endif // NEKTAR_SOLVERS_INCNAVIERSTOKES_H
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
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
virtual Array< OneD, NekDouble > v_GetMaxStdVelocity(const NekDouble SpeedSoundFactor) override
std::map< int, std::map< int, WomersleyParamsSharedPtr > > m_womersleyParams
Womersley parameters if required.
virtual MultiRegions::ExpListSharedPtr v_GetPressure() override
virtual int v_GetForceDimension()=0
void SetWomersleyBoundary(const int fldid, const int bndid)
Set Womersley Profile if specified.
virtual void v_GetMovingFrameVelocities(Array< OneD, NekDouble > &vFrameVels) override
void SetZeroNormalVelocity()
Set Normal Velocity Component to Zero.
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
virtual void v_GetDensity(const Array< OneD, const Array< OneD, NekDouble > > &physfield, Array< OneD, NekDouble > &density) override
virtual void v_GetMovingFrameAngles(Array< OneD, NekDouble > &vFrameTheta) override
void SetRadiationBoundaryForcing(int fieldid)
Set Radiation forcing term.
Array< OneD, Array< OneD, NekDouble > > m_fieldsRadiationFactor
RHS Factor for Radiation Condition.
virtual void v_TransPhysToCoeff(void) override
Virtual function for transformation to coefficient space.
bool DefinedForcing(const std::string &sForce)
void SetMRFWallBCs(const NekDouble &time)
virtual void v_SetMovingFrameVelocities(const Array< OneD, NekDouble > &vFrameVels) override
virtual void v_TransCoeffToPhys(void) override
Virtual function for transformation to physical space.
void GetPivotPoint(Array< OneD, NekDouble > &vPivotPoint)
virtual bool v_PreIntegrate(int step) override
void SetUpWomersley(const int fldid, const int bndid, std::string womstr)
Set Up Womersley details.
virtual void v_InitObject(bool DeclareField=true) override
Init object for UnsteadySystem class.
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[]
virtual void v_SetMovingFrameAngles(const Array< OneD, NekDouble > &vFrameTheta) override
virtual bool v_HasConstantDensity() override
virtual void v_GetMovingFrameProjectionMat(bnu::matrix< NekDouble > &vProjMat) override
Array< OneD, Array< OneD, int > > m_fieldsBCToElmtID
Mapping from BCs to Elmt IDs.
int m_energysteps
dump energy to file at steps time
virtual 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)
virtual 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 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
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:55
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:176
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:2
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