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
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,
177 Array<OneD, Array<OneD, NekDouble>> &velocity) override;
178
180 const int step) override;
182 const int step) override;
183 void v_SetMovingFrameDisp(const Array<OneD, NekDouble> &vFrameDisp,
184 const int step) override;
186 const Array<OneD, NekDouble> &vFramePivot) override;
188 const int step) override;
189 void v_SetAeroForce(Array<OneD, NekDouble> forces) override;
190 void v_GetAeroForce(Array<OneD, NekDouble> forces) override;
191
192 bool DefinedForcing(const std::string &sForce);
193
194protected:
195 // pointer to the extrapolation class for sub-stepping and HOPBS
196
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
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 /// Womersley parameters if required
273 std::map<int, std::map<int, WomersleyParamsSharedPtr>> m_womersleyParams;
274
276 {
277 return m_pressure;
278 }
279
280 void v_TransCoeffToPhys(void) override
281 {
282 ASSERTL0(false, "This method is not defined in this class");
283 }
284
285 void v_TransPhysToCoeff(void) override
286 {
287 ASSERTL0(false, "This method is not defined in this class");
288 }
289
290 virtual int v_GetForceDimension() = 0;
291
293 const NekDouble SpeedSoundFactor) override;
294
295 bool v_PreIntegrate(int step) override;
296
297private:
298};
299
300typedef std::shared_ptr<IncNavierStokes> IncNavierStokesSharedPtr;
301
302} // namespace Nektar
303
304#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
pivot point for moving reference frame
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
bool v_GetMovingFrameVelocities(Array< OneD, NekDouble > &vFrameVels, const int step) override
virtual int v_GetForceDimension()=0
void SetWomersleyBoundary(const int fldid, const int bndid)
Set Womersley Profile if specified.
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_SetMovingFrameDisp(const Array< OneD, NekDouble > &vFrameDisp, const int step) 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.
bool v_GetMovingFrameDisp(Array< OneD, NekDouble > &vFrameDisp, const int step) override
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
IncBoundaryConditionsSharedPtr m_IncNavierStokesBCs
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)
bool v_PreIntegrate(int step) override
void v_SetMovingFrameVelocities(const Array< OneD, NekDouble > &vFrameVels, const 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_SetMovingFramePivot(const Array< OneD, NekDouble > &vFramePivot) 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)
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)
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: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[]
std::shared_ptr< IncBoundaryConditions > IncBoundaryConditionsSharedPtr
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