LifeV
NavierStokesProblem.hpp
Go to the documentation of this file.
1 //@HEADER
2 /*
3 *******************************************************************************
4 
5  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
6  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
7 
8  This file is part of LifeV.
9 
10  LifeV is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as published by
12  the Free Software Foundation, either version 3 of the License, or
13  (at your option) any later version.
14 
15  LifeV is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
22 
23 *******************************************************************************
24 */
25 //@HEADER
26 
27 /*!
28  @file NavierStokesProblem abstract class
29  @brief This class contains all the informations necessary to generate a Navier-Stokes problem
30 
31  @author Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
32  @date 23-10-2011
33  */
34 
35 #ifndef NAVIERSTOKESPROBLEM_HPP
36 #define NAVIERSTOKESPROBLEM_HPP
37 
38 #include <string>
39 #include <iostream>
40 #include <lifev/core/LifeV.hpp>
41 #include <lifev/core/fem/BCHandler.hpp>
42 #include <lifev/core/mesh/MeshPartitioner.hpp>
43 #include <lifev/core/fem/BCBase.hpp>
44 
45 namespace LifeV
46 {
47 
48 template< class mesh_Type >
50 {
51 public:
52 
53  typedef Real (*function_Type) ( const Real&, const Real&, const Real&,
54  const Real&, const ID& );
55 
56  static Real nullFunction ( const Real&, const Real&, const Real&,
57  const Real&, const ID& );
58 
59  //! @name Constructors, destructor
60  //@{
61 
63 
64  virtual ~NavierStokesProblem();
65 
66  //@}
67 
68  //! @name Methods
69  //@{
70 
71  //! Returns true if the problem has an exact solution
72  virtual bool hasExactSolution() const;
73 
74  //! Returns the value of the exact solution
75  virtual function_Type xexact();
76 
77  //! Returns the value of the exact solution (velocity components only)
78  virtual function_Type uexact();
79 
80  //! Returns the value of the derivative of the exact solution with respect to the time (velocity components only)
81  virtual function_Type uderexact();
82 
83  //! Returns the value of the exact solution (pressure component only)
84  virtual function_Type pexact();
85 
86  //! Display general information about the problem
87  /*!
88  @param output specify the output stream (std::cout by default)
89  */
90  virtual void showMe ( std::ostream& output = std::cout ) const = 0;
91 
92  //@}
93 
94  //! @name Set Methods
95  //@{
96 
97  //! Setup the problem mesh
98  void setMesh ( const UInt& refinement,
99  const std::string& ressourcesPath = "./Ressources/" );
100 
101  //! Set the viscosity of the fluid
102  /*!
103  @param viscosity viscosity of the fluid
104  */
105  virtual void setViscosity ( const Real& viscosity );
106 
107  //! Set the density of the fluid
108  /*!
109  @param density density of the fluid
110  */
111  virtual void setDensity ( const Real& density );
112 
113  //@}
114 
115  //! @name Get Methods
116  //@{
117 
118  //! Getter for the problem mesh
119  virtual void mesh ( std::shared_ptr< mesh_Type >& mesh ) const = 0;
120 
121  //! Getter for the boundary conditions in the provided BCHandler
122  /*!
123  @param bcHandler shared pointer on a BCHandler object
124  */
125  virtual void boundaryConditions ( std::shared_ptr<BCHandler> bcHandler ) const = 0;
126 
127  //! Returns the name of the problem
128  virtual std::string name() const = 0;
129 
130  //! Returns the viscosity
131  Real viscosity() const;
132 
133  //! Returns the density
134  Real density() const;
135 
136  //! Returns the value of the forces
137  virtual function_Type force();
138 
139  //@}
140 
141 protected:
142 
144  std::string M_resourcesPath;
147 
148 };
149 
150 template< class mesh_Type >
151 Real
152 NavierStokesProblem< mesh_Type >::nullFunction ( const Real&, const Real&, const Real&,
153  const Real&, const ID& )
154 {
155  return 0.0;
156 }
157 
158 template< class mesh_Type >
160  : M_refinement ( 0 ), M_resourcesPath ( "" ), M_viscosity ( 1.0 ), M_density ( 1.0 )
161 {
162 
163 }
164 
165 template< class mesh_Type >
167 {
168 
169 }
170 
171 template< class mesh_Type >
172 bool
174 {
175  return false;
176 }
177 
178 template< class mesh_Type >
179 typename NavierStokesProblem< mesh_Type >::function_Type
181 {
182  return 0;
183 }
184 
185 template< class mesh_Type >
186 typename NavierStokesProblem< mesh_Type >::function_Type
188 {
189  return 0;
190 }
191 
192 template< class mesh_Type >
193 typename NavierStokesProblem< mesh_Type >::function_Type
195 {
196  return 0;
197 }
198 
199 template< class mesh_Type >
200 typename NavierStokesProblem< mesh_Type >::function_Type
202 {
203  return 0;
204 }
205 
206 template< class mesh_Type >
207 void
208 NavierStokesProblem< mesh_Type >::setMesh ( const UInt& refinement,
209  const std::string& resourcesPath )
210 {
211  M_refinement = refinement;
212  M_resourcesPath = resourcesPath;
213 }
214 
215 template< class mesh_Type >
216 void
217 NavierStokesProblem< mesh_Type >::setViscosity ( const Real& viscosity )
218 {
219  M_viscosity = viscosity;
220 }
221 
222 template< class mesh_Type >
223 void
224 NavierStokesProblem< mesh_Type >::setDensity ( const Real& density )
225 {
226  M_density = density;
227 }
228 
229 template< class mesh_Type >
230 Real
231 NavierStokesProblem< mesh_Type >::viscosity() const
232 {
233  return M_viscosity;
234 }
235 
236 template< class mesh_Type >
237 Real
238 NavierStokesProblem< mesh_Type >::density() const
239 {
240  return M_density;
241 }
242 
243 template< class mesh_Type >
244 typename NavierStokesProblem< mesh_Type >::function_Type
245 NavierStokesProblem< mesh_Type >::force()
246 {
247  return nullFunction;
248 }
249 
250 } // namespace LifeV
251 
252 #endif /* NAVIERSTOKESPROBLEM_HPP */
virtual function_Type pexact()
Returns the value of the exact solution (pressure component only)
static Real nullFunction(const Real &, const Real &, const Real &, const Real &, const ID &)
virtual function_Type xexact()
Returns the value of the exact solution.
virtual function_Type uderexact()
Returns the value of the derivative of the exact solution with respect to the time (velocity componen...
virtual void mesh(std::shared_ptr< mesh_Type > &mesh) const =0
Getter for the problem mesh.
virtual std::string name() const =0
Returns the name of the problem.
virtual void boundaryConditions(std::shared_ptr< BCHandler > bcHandler) const =0
Getter for the boundary conditions in the provided BCHandler.
void setMesh(const UInt &refinement, const std::string &ressourcesPath="./Ressources/")
Setup the problem mesh.
virtual void setDensity(const Real &density)
Set the density of the fluid.
void updateInverseJacobian(const UInt &iQuadPt)
virtual function_Type force()
Returns the value of the forces.
uint32_type ID
IDs.
Definition: LifeV.hpp:194
virtual void showMe(std::ostream &output=std::cout) const =0
Display general information about the problem.
Real density() const
Returns the density.
double Real
Generic real data.
Definition: LifeV.hpp:175
virtual void setViscosity(const Real &viscosity)
Set the viscosity of the fluid.
virtual function_Type uexact()
Returns the value of the exact solution (velocity components only)
Real viscosity() const
Returns the viscosity.
virtual bool hasExactSolution() const
Returns true if the problem has an exact solution.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191