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 
50 namespace Nektar
51 {
52 namespace bnu = boost::numeric::ublas;
53 
55 {
65 };
66 
67 // Keep this consistent with the enums in EquationType.
68 const std::string kEquationTypeStr[] = {
69  "NoType",
70  "SteadyStokes",
71  "SteadyOseen",
72  "SteadyLinearisedNS",
73  "UnsteadyStokes",
74  "UnsteadyLinearisedNS",
75  "UnsteadyNavierStokes",
76  "SteadyNavierStokes",
77 };
78 
80 {
89 };
90 
91 // Keep this consistent with the enums in EquationType.
92 const std::string kAdvectionFormStr[] = {"NoType",
93  "Convective",
94  "NonConservative",
95  "Linearised",
96  "Adjoint",
97  "SkewSymmetric"
98  "NoAdvection"};
99 
100 typedef std::complex<double> NekComplexDouble;
101 
103 {
105  {
108  };
109 
110  virtual ~WomersleyParams(){};
111 
112  // Real and imaginary velocity comp. of wom
113  std::vector<NekComplexDouble> m_wom_vel;
114 
115  // Womersley BC constants
119  // currently this needs to be the point in the middle of the
120  // axis but should be generalised to be any point on the axis
122 
123  // poiseuille flow and fourier coefficients
126 };
127 typedef std::shared_ptr<WomersleyParams> WomersleyParamsSharedPtr;
128 
129 /**
130  * \brief This class is the base class for Navier Stokes problems
131  *
132  */
135 {
136 public:
137  // Destructor
138  virtual ~IncNavierStokes();
139 
140  virtual void v_InitObject(bool DeclareField = true) override;
141 
143  {
144  return m_nConvectiveFields;
145  }
146 
148  {
149  return m_velocity;
150  }
151 
152  void AddForcing(const SolverUtils::ForcingSharedPtr &pForce);
153 
154  virtual void GetPressure(
155  const Array<OneD, const Array<OneD, NekDouble>> &physfield,
156  Array<OneD, NekDouble> &pressure) override;
157 
158  virtual void GetDensity(
159  const Array<OneD, const Array<OneD, NekDouble>> &physfield,
160  Array<OneD, NekDouble> &density) override;
161 
162  virtual bool HasConstantDensity() override
163  {
164  return true;
165  }
166 
167  virtual void GetVelocity(
168  const Array<OneD, const Array<OneD, NekDouble>> &physfield,
169  Array<OneD, Array<OneD, NekDouble>> &velocity) override;
170 
171  virtual void SetMovingFrameVelocities(
172  const Array<OneD, NekDouble> &vFrameVels) override;
173  virtual void GetMovingFrameVelocities(
174  Array<OneD, NekDouble> &vFrameVels) override;
175  virtual void SetMovingFrameAngles(
176  const Array<OneD, NekDouble> &vFrameTheta) override;
177  virtual void GetMovingFrameAngles(
178  Array<OneD, NekDouble> &vFrameTheta) override;
179  virtual void SetMovingFrameProjectionMat(
180  const bnu::matrix<NekDouble> &vProjMat) override;
181  virtual void GetMovingFrameProjectionMat(
182  bnu::matrix<NekDouble> &vProjMat) override;
183 
184  virtual bool DefinedForcing(const std::string &sForce);
185  virtual void GetPivotPoint(Array<OneD, NekDouble> &vPivotPoint);
186 
187 protected:
188  // pointer to the extrapolation class for sub-stepping and HOPBS
189 
191 
192  /// modal energy file
193  std::ofstream m_mdlFile;
194 
195  /// bool to identify if advection term smoothing is requested
197 
198  /// Forcing terms
199  std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
200 
201  /// Number of fields to be convected;
203 
204  /// int which identifies which components of m_fields contains the
205  /// velocity (u,v,w);
207 
208  /// Pointer to field holding pressure field
210  /// Kinematic viscosity
212  /// dump energy to file at steps time
214 
215  /// equation type;
217 
218  /// Mapping from BCs to Elmt IDs
220  /// Mapping from BCs to Elmt Edge IDs
222  /// RHS Factor for Radiation Condition
224 
225  /// Number of time integration steps AND Order of extrapolation for
226  /// pressure boundary conditions.
228 
229  // pivot point for moving reference frame
230  // TODO: relocate this variable
232 
233  /// Constructor.
235  const SpatialDomains::MeshGraphSharedPtr &pGraph);
236 
238  {
239  return m_equationType;
240  }
241  static std::string eqTypeLookupIds[];
242 
244  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
245  Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
246 
247  void WriteModalEnergy(void);
248 
249  /// time dependent boundary conditions updating
250  void SetBoundaryConditions(NekDouble time);
251 
252  /// Set Radiation forcing term
253  void SetRadiationBoundaryForcing(int fieldid);
254 
255  /// Set Normal Velocity Component to Zero
256  void SetZeroNormalVelocity();
257 
258  /// Set Womersley Profile if specified
259  void SetWomersleyBoundary(const int fldid, const int bndid);
260 
261  /// Set Up Womersley details
262  void SetUpWomersley(const int fldid, const int bndid, std::string womstr);
263 
264  /// Set the moving reference frame boundary conditions
265  void SetMovingReferenceFrameBCs(const NekDouble &time);
266  void SetMRFWallBCs(const NekDouble &time);
267  void SetMRFDomainVelBCs(const NekDouble &time);
268 
269  /// Womersley parameters if required
270  std::map<int, std::map<int, WomersleyParamsSharedPtr>> m_womersleyParams;
271 
273  {
274  return m_pressure;
275  }
276 
277  virtual void v_TransCoeffToPhys(void) override
278  {
279  ASSERTL0(false, "This method is not defined in this class");
280  }
281 
282  virtual void v_TransPhysToCoeff(void) override
283  {
284  ASSERTL0(false, "This method is not defined in this class");
285  }
286 
287  virtual int v_GetForceDimension() = 0;
288 
290  const NekDouble SpeedSoundFactor) override;
291 
292  virtual bool v_PreIntegrate(int step) override;
293 
294 private:
295 };
296 
297 typedef std::shared_ptr<IncNavierStokes> IncNavierStokesSharedPtr;
298 
299 } // namespace Nektar
300 
301 #endif // NEKTAR_SOLVERS_INCNAVIERSTOKES_H
#define ASSERTL0(condition, msg)
Definition: ErrorUtil.hpp:215
This class is the base class for Navier Stokes problems.
Array< OneD, int > & GetVelocity(void)
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
virtual void SetMovingFrameAngles(const Array< OneD, NekDouble > &vFrameTheta) override
std::map< int, std::map< int, WomersleyParamsSharedPtr > > m_womersleyParams
Womersley parameters if required.
virtual MultiRegions::ExpListSharedPtr v_GetPressure() override
virtual void GetMovingFrameAngles(Array< OneD, NekDouble > &vFrameTheta) override
virtual int v_GetForceDimension()=0
void SetWomersleyBoundary(const int fldid, const int bndid)
Set Womersley Profile if specified.
void SetZeroNormalVelocity()
Set Normal Velocity Component to Zero.
virtual void SetMovingFrameVelocities(const Array< OneD, NekDouble > &vFrameVels) override
void SetBoundaryConditions(NekDouble time)
time dependent boundary conditions updating
MultiRegions::ExpListSharedPtr m_pressure
Pointer to field holding pressure field.
virtual void GetMovingFrameVelocities(Array< OneD, NekDouble > &vFrameVels) override
virtual void GetMovingFrameProjectionMat(bnu::matrix< NekDouble > &vProjMat) override
void SetMRFDomainVelBCs(const NekDouble &time)
NekDouble m_kinvis
Kinematic viscosity.
bool m_SmoothAdvection
bool to identify if advection term smoothing is requested
virtual bool HasConstantDensity() 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.
virtual bool DefinedForcing(const std::string &sForce)
void SetMRFWallBCs(const NekDouble &time)
virtual void v_TransCoeffToPhys(void) override
Virtual function for transformation to physical space.
virtual 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 GetDensity(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &density) override
Extract array with density from physfield.
void EvaluateAdvectionTerms(const Array< OneD, const Array< OneD, NekDouble >> &inarray, Array< OneD, Array< OneD, NekDouble >> &outarray, const NekDouble time)
Array< OneD, Array< OneD, int > > m_fieldsBCToElmtID
Mapping from BCs to Elmt IDs.
int m_energysteps
dump energy to file at steps time
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.
virtual void SetMovingFrameProjectionMat(const bnu::matrix< NekDouble > &vProjMat) override
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.
SOLVER_UTILS_EXPORT MultiRegions::ExpListSharedPtr GetPressure()
Get pressure field if available.
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:52
std::shared_ptr< MeshGraph > MeshGraphSharedPtr
Definition: MeshGraph.h:172
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
const std::string kAdvectionFormStr[]
std::complex< double > NekComplexDouble
@ eSteadyNavierStokes
@ eUnsteadyStokes
@ eUnsteadyNavierStokes
@ eSteadyLinearisedNS
@ eUnsteadyLinearisedNS
@ eEquationTypeSize
@ eNoEquationType
@ eAdvectionFormSize
@ eSkewSymmetric
@ eNonConservative
@ eNoAdvectionForm
std::shared_ptr< Extrapolate > ExtrapolateSharedPtr
Definition: Extrapolate.h:59
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