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 
147  void AddForcing(const SolverUtils::ForcingSharedPtr &pForce);
148 
149  virtual void v_GetPressure(
150  const Array<OneD, const Array<OneD, NekDouble>> &physfield,
151  Array<OneD, NekDouble> &pressure) override;
152 
153  virtual void v_GetDensity(
154  const Array<OneD, const Array<OneD, NekDouble>> &physfield,
155  Array<OneD, NekDouble> &density) override;
156 
157  virtual bool v_HasConstantDensity() override
158  {
159  return true;
160  }
161 
162  virtual void v_GetVelocity(
163  const Array<OneD, const Array<OneD, NekDouble>> &physfield,
164  Array<OneD, Array<OneD, NekDouble>> &velocity) override;
165 
166  virtual void v_SetMovingFrameVelocities(
167  const Array<OneD, NekDouble> &vFrameVels) override;
168  virtual void v_GetMovingFrameVelocities(
169  Array<OneD, NekDouble> &vFrameVels) override;
170  virtual void v_SetMovingFrameAngles(
171  const Array<OneD, NekDouble> &vFrameTheta) override;
172  virtual void v_GetMovingFrameAngles(
173  Array<OneD, NekDouble> &vFrameTheta) override;
174  virtual void v_SetMovingFrameProjectionMat(
175  const bnu::matrix<NekDouble> &vProjMat) override;
176  virtual void v_GetMovingFrameProjectionMat(
177  bnu::matrix<NekDouble> &vProjMat) override;
178 
179  bool DefinedForcing(const std::string &sForce);
180  void GetPivotPoint(Array<OneD, NekDouble> &vPivotPoint);
181 
182 protected:
183  // pointer to the extrapolation class for sub-stepping and HOPBS
184 
186 
187  /// modal energy file
188  std::ofstream m_mdlFile;
189 
190  /// bool to identify if advection term smoothing is requested
192 
193  /// Forcing terms
194  std::vector<SolverUtils::ForcingSharedPtr> m_forcing;
195 
196  /// Number of fields to be convected;
198 
199  /// int which identifies which components of m_fields contains the
200  /// velocity (u,v,w);
202 
203  /// Pointer to field holding pressure field
205  /// Kinematic viscosity
207  /// dump energy to file at steps time
209 
210  /// equation type;
212 
213  /// Mapping from BCs to Elmt IDs
215  /// Mapping from BCs to Elmt Edge IDs
217  /// RHS Factor for Radiation Condition
219 
220  /// Number of time integration steps AND Order of extrapolation for
221  /// pressure boundary conditions.
223 
224  // pivot point for moving reference frame
225  // TODO: relocate this variable
227 
228  /// Constructor.
230  const SpatialDomains::MeshGraphSharedPtr &pGraph);
231 
233  {
234  return m_equationType;
235  }
236  static std::string eqTypeLookupIds[];
237 
239  const Array<OneD, const Array<OneD, NekDouble>> &inarray,
240  Array<OneD, Array<OneD, NekDouble>> &outarray, const NekDouble time);
241 
242  void WriteModalEnergy(void);
243 
244  /// time dependent boundary conditions updating
245  void SetBoundaryConditions(NekDouble time);
246 
247  /// Set Radiation forcing term
248  void SetRadiationBoundaryForcing(int fieldid);
249 
250  /// Set Normal Velocity Component to Zero
251  void SetZeroNormalVelocity();
252 
253  /// Set Womersley Profile if specified
254  void SetWomersleyBoundary(const int fldid, const int bndid);
255 
256  /// Set Up Womersley details
257  void SetUpWomersley(const int fldid, const int bndid, std::string womstr);
258 
259  /// Set the moving reference frame boundary conditions
260  void SetMovingReferenceFrameBCs(const NekDouble &time);
261  void SetMRFWallBCs(const NekDouble &time);
262  void SetMRFDomainVelBCs(const NekDouble &time);
263 
264  /// Womersley parameters if required
265  std::map<int, std::map<int, WomersleyParamsSharedPtr>> m_womersleyParams;
266 
268  {
269  return m_pressure;
270  }
271 
272  virtual void v_TransCoeffToPhys(void) override
273  {
274  ASSERTL0(false, "This method is not defined in this class");
275  }
276 
277  virtual void v_TransPhysToCoeff(void) override
278  {
279  ASSERTL0(false, "This method is not defined in this class");
280  }
281 
282  virtual int v_GetForceDimension() = 0;
283 
285  const NekDouble SpeedSoundFactor) override;
286 
287  virtual bool v_PreIntegrate(int step) override;
288 
289 private:
290 };
291 
292 typedef std::shared_ptr<IncNavierStokes> IncNavierStokesSharedPtr;
293 
294 } // namespace Nektar
295 
296 #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)
virtual void v_GetDensity(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, NekDouble > &density) override
NekDouble m_kinvis
Kinematic viscosity.
bool m_SmoothAdvection
bool to identify if advection term smoothing is requested
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
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)
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.
virtual void v_GetVelocity(const Array< OneD, const Array< OneD, NekDouble >> &physfield, Array< OneD, Array< OneD, NekDouble >> &velocity) 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.
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:2
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