Nektar++
Loading...
Searching...
No Matches
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
68
81
82// Keep this consistent with the enums in EquationType.
83const std::string kEquationTypeStr[] = {
84 "NoType",
85 "SteadyStokes",
86 "SteadyOseen",
87 "SteadyLinearisedNS",
88 "UnsteadyStokes",
89 "UnsteadyLinearisedNS",
90 "UnsteadyNavierStokes",
91 "SteadyNavierStokes",
92};
93
105
106// Keep this consistent with the enums in EquationType.
107const std::string kAdvectionFormStr[] = {"NoType",
108 "Convective",
109 "NonConservative",
110 "Linearised",
111 "Adjoint",
112 "SkewSymmetric"
113 "NoAdvection"};
114
115typedef std::complex<double> NekComplexDouble;
116
118{
120 {
123 };
124
125 virtual ~WomersleyParams() {};
126
127 // Real and imaginary velocity comp. of wom
128 std::vector<NekComplexDouble> m_wom_vel;
129
130 // Womersley BC constants
134 // currently this needs to be the point in the middle of the
135 // axis but should be generalised to be any point on the axis
137
138 // poiseuille flow and fourier coefficients
141};
142typedef std::shared_ptr<WomersleyParams> WomersleyParamsSharedPtr;
143
144/**
145 * \brief This class is the base class for Navier Stokes problems
146 *
147 */
150{
151public:
153 {
154 return m_nConvectiveFields;
155 }
156
157 void AddForcing(const SolverUtils::ForcingSharedPtr &pForce);
158
159 bool DefinedForcing(const std::string &sForce);
160
161protected:
162 // pointer to the extrapolation class for sub-stepping and HOPBS
165
166 /// modal energy file
167 std::ofstream m_mdlFile;
168
169 /// bool to identify if advection term smoothing is requested
171
172 /// Forcing terms
173 std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
174
175 /// Number of fields to be convected;
177
178 /// int which identifies which components of m_fields contains the
179 /// velocity (u,v,w);
181
182 /// Pointer to field holding pressure field
184 /// Kinematic viscosity
186 /// dump energy to file at steps time
188
189 /// equation type;
191
192 /// Mapping from BCs to Elmt IDs
194 /// Mapping from BCs to Elmt Edge IDs
196 /// RHS Factor for Radiation Condition
198
199 /// Number of time integration steps AND Order of extrapolation for
200 /// pressure boundary conditions.
202
203 /// pivot point for moving reference frame
206
207 static std::string eqTypeLookupIds[];
208
209 /// Constructor.
212
213 ~IncNavierStokes() override = default;
214
215 void v_InitObject(bool DeclareField = true) override;
216
217 void v_GetPressure(
218 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
219 Array<OneD, NekDouble> &pressure) override;
220
221 void v_GetDensity(
222 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
223 Array<OneD, NekDouble> &density) override;
224
225 bool v_HasConstantDensity() override
226 {
227 return true;
228 }
229
230 void v_GetVelocity(
231 const Array<OneD, const Array<OneD, NekDouble>> &physfield,
232 Array<OneD, Array<OneD, NekDouble>> &velocity) override;
233
235 const Array<OneD, NekDouble> &vFrameVels) override;
236
238 Array<OneD, NekDouble> &vFrameVels) override;
239
241 const Array<OneD, NekDouble> &vFrameDisp) override;
242
244 const Array<OneD, NekDouble> &vFramePivot) override;
245
246 void v_GetMovingFramePivot(Array<OneD, NekDouble> &vFramePivot) override;
247
248 bool v_GetMovingFrameDisp(Array<OneD, NekDouble> &vFrameDisp) override;
249
250 void v_SetAeroForce(Array<OneD, NekDouble> forces) override;
251
252 void v_GetAeroForce(Array<OneD, NekDouble> forces) override;
253
254 void v_SetMovableDoFs(const std::set<int> &dirDoFs) override;
255
256 void v_GetMovableDoFs(std::set<int> &dirDoFs) override;
257
259 const Array<OneD, const Array<OneD, NekDouble>> &inarray,
260 Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
261
263
264 /// time dependent boundary conditions updating
266
267 /// Set Radiation forcing term
268 void SetRadiationBoundaryForcing(int fieldid);
269
270 /// Set Normal Velocity Component to Zero
272
273 /// Set Womersley Profile if specified
274 void SetWomersleyBoundary(const int fldid, const int bndid);
275
276 /// Set Up Womersley details
277 void SetUpWomersley(const int fldid, const int bndid, std::string womstr);
278
279 /// Womersley parameters if required
280 std::map<int, std::map<int, WomersleyParamsSharedPtr>> m_womersleyParams;
281
283 {
284 return m_pressure;
285 }
286
287 void v_TransCoeffToPhys(void) override
288 {
289 ASSERTL0(false, "This method is not defined in this class");
290 }
291
292 void v_TransPhysToCoeff(void) override
293 {
294 ASSERTL0(false, "This method is not defined in this class");
295 }
296
297 virtual int v_GetForceDimension() = 0;
298
300 const NekDouble SpeedSoundFactor) override;
301
302 bool v_PreIntegrate(int step) override;
303
304private:
305};
306
307typedef std::shared_ptr<IncNavierStokes> IncNavierStokesSharedPtr;
308
309} // namespace Nektar
310
311#endif // NEKTAR_SOLVERS_INCNAVIERSTOKES_H
#define ASSERTL0(condition, msg)
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.
void v_GetMovingFramePivot(Array< OneD, NekDouble > &vFramePivot) override
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_GetMovingFrameDisp(Array< OneD, NekDouble > &vFrameDisp) override
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_GetMovableDoFs(std::set< int > &dirDoFs) 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.
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.
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)
void v_SetMovingFrameVelocities(const Array< OneD, NekDouble > &vFrameVels) override
bool v_GetMovingFrameVelocities(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_SetMovingFramePivot(const Array< OneD, NekDouble > &vFramePivot) override
void v_SetMovableDoFs(const std::set< int > &dirDoFs) 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;
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)
~IncNavierStokes() override=default
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)
A base class for PDEs which include an advection component.
std::shared_ptr< SessionReader > SessionReaderSharedPtr
@ eImplicit
Fully implicit scheme.
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:224
const std::string kAdvectionFormStr[]
std::complex< double > NekComplexDouble
@ eSteadyNavierStokes
@ eUnsteadyNavierStokes
@ eSteadyLinearisedNS
@ eUnsteadyLinearisedNS
@ eEquationTypeSize
@ eCoupledLinearisedNS
@ ePressDecompVCSFSI
@ eVelocityCorrectionScheme
@ eSmoothedProfileMethod
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
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