LifeV
OseenData.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
29  @brief File containing a class for handling Navier-Stokes data with GetPot
30 
31  @author M.A. Fernandez
32  Christiano Malossi <cristiano.malossi@epfl.ch>
33  Samuel Quinodoz <samuel.quinodoz@epfl.ch>
34  @contributor Alexis Aposporidis <aapospo@emory.edu>
35  @maintainer
36 
37  @date 01-09-2009
38 
39  */
40 
41 
42 #ifndef OSEENDATA_H
43 #define OSEENDATA_H
44 
45 #include <lifev/core/filter/GetPot.hpp>
46 #include <lifev/core/LifeV.hpp>
47 #include <lifev/core/util/StringData.hpp>
48 #include <lifev/core/util/StringUtility.hpp>
49 #include <lifev/core/fem/TimeData.hpp>
50 #include <lifev/core/fem/TimeAdvanceData.hpp>
51 #include <boost/shared_ptr.hpp>
52 #include <string>
53 #include <iostream>
54 
55 namespace LifeV
56 {
57 
58 enum NSStabilization
59 {
60  NO_STABILIZATION, //!< No stabilization
61  IP_STABILIZATION, //!< Interior penalty
62  SD_STABILIZATION //!< Stream-line diffusion
63 };
64 
65 
66 //! @class OseenData
67 //! OseenData - LifeV Base class which holds usual data for the NavierStokes equations solvers
68 /*!
69  * @author M.A. Fernandez, Cristiano Malossi, Samuel Quinodoz
70  *
71  * The data is now able to store multiple fluids, but the use of the old interface (for only one fluid) is still available and
72  * fully compatible.
73  * The old way is to declare one fluid with its density and viscosity in [fluid/physics/density] and [fluid/physics/viscosity].
74  * The set and get functions can then be used without specifying which fluid is concerned.
75  * Internally, the information is stored in vectors, but with only one value (the 0 value: density is stored in M_density[0]).
76  * In the new way, one has to declare first of all in [fluid/physics/fluid_number] the number of fluids that will be used.
77  * Then every fluid is specified in a section [fluid/physics/fluid_k] where k is the number of the fluid (k from 0 to fluid_number-1,
78  * the same enumeration is used internally). In this section, the density and the viscosity are declared.
79  *
80  * Example: To declare two fluids, one should use in the data file:
81  * [fluid]
82  * [./physics]
83  * fluid_number = 2
84  *
85  * [./fluid_0]
86  * density = 1;
87  * viscosity = 1;
88  *
89  * [../fluid_1]
90  * density = 10;
91  * viscosity = 100;
92  *
93  * Remark: in case both ways of declaring the fluids are used, the new one has priority.
94  * Remark: do not use "fluid_number = 1" with the old way, it will not work properly.
95  *
96  */
97 
98 class OseenData
99 {
100 
101 public:
102 
103  //! @name Public Types
104  //@{
105 
106  typedef TimeData time_Type;
107  typedef std::shared_ptr<time_Type> timePtr_Type;
108 
109  typedef TimeAdvanceData timeAdvance_Type;
110  typedef std::shared_ptr<timeAdvance_Type> timeAdvancePtr_Type;
111 
112  //@}
113 
114 
115  //! @name Constructors & Destructor
116  //@{
117 
118  //! Empty Constructor
119  OseenData();
120 
121  //! Copy constructor
122  /*!
123  * @param oseenData OseenData
124  */
125  OseenData ( const OseenData& oseenData );
126 
127  //! Virtual destructor
128  virtual ~OseenData() {}
129 
130  //@}
131 
132 
133  //! @name Operators
134  //@{
135 
136  //! Operator=
137  /*!
138  * @param oseenData OseenData
139  */
140  OseenData& operator= ( const OseenData& oseenData );
141 
142  //@}
143 
144 
145  //! @name Methods
146  //@{
147 
148  //! Read the dataFile and set all the quantities
149  /*!
150  * @param dataFile data file
151  * @param section section of the file
152  */
153  void setup ( const GetPot& dataFile, const std::string& section = "fluid" );
154 
155  //! Display the values
156  void showMe ( std::ostream& output = std::cout ) const;
157 
158  //@}
159 
160 
161 
162  //! @name Set methods
163  //@{
164 
165  //! Set data time container
166  /*!
167  * @param TimeData shared_ptr to TimeData container
168  */
169  void setTimeData ( const timePtr_Type timeData )
170  {
171  M_time = timeData;
172  }
173 
174  //! Set data time advance container
175  /*!
176  * @param timeAdvanceData shared_ptr to TimeAdvanceData container
177  */
178  void setTimeAdvanceData ( const timeAdvancePtr_Type timeAdvanceData )
179  {
180  M_timeAdvance = timeAdvanceData;
181  }
182 
183  //! Set the density for the specified fluid
184  /*!
185  * @param density
186  * @param nfluid the fluid number
187  */
188  void setDensity ( const Real& density, const UInt nfluid = 0 )
189  {
190  ASSERT (nfluid < M_fluidNumber, "Undeclared fluid");
191  M_density[nfluid] = density;
192  }
193 
194  //! Set the viscosity of the fluid
195  /*!
196  * @param viscosity
197  * @param nfluid the fluid number
198  */
199  void setViscosity ( const Real& viscosity, const UInt nfluid = 0 )
200  {
201  ASSERT (nfluid < M_fluidNumber, "Undeclared fluid");
202  M_viscosity[nfluid] = viscosity;
203  }
204 
205  //! Set this instance of OseenData to either a Stokes or a Navier-Stokes problem
206  /*!
207  * @param Stokes a boolean that is "true" for a Stokes problem and "false" for a Navier-Stokes
208  * problem
209  */
210  void setStokes ( const bool stokes )
211  {
212  M_stokes = stokes;
213  }
214 
215  //! Set the flag for the semi-implicit treatment of the shape derivatives in FSI simulations
216  /*!
217  * @param SI the flag for semi implicit treatment
218  */
219  void setSemiImplicit ( const bool SI )
220  {
221  M_semiImplicit = SI;
222  if ( M_semiImplicit )
223  {
224  setUseShapeDerivatives (false);
225  }
226  }
227 
228  //! Set the flag for using shape derivatives
229  /*!
230  * @param SD the flag for using shape derivatives
231  */
232  void setUseShapeDerivatives ( const bool SD )
233  {
234  M_shapeDerivatives = SD;
235  }
236 
237  //@}
238 
239 
240 
241  //! @name Get methods
242  //@{
243 
244  //! Get data time container
245  /*!
246  * @return shared_ptr to TimeData container
247  */
248  timePtr_Type dataTime() const
249  {
250  return M_time;
251  }
252 
253  //! Get data time advance container
254  /*!
255  * @return shared_ptr to TimeAdvanceData container
256  */
257  timeAdvancePtr_Type dataTimeAdvance() const
258  {
259  return M_timeAdvance;
260  }
261 
262  //! Get the number of the fluid
263  /*!
264  * @return M_fluidNumber the number of the current fluid
265  */
266  const UInt& fluidNumber() const
267  {
268  return M_fluidNumber;
269  };
270 
271  //! Get the density of the fluid
272  /*!
273  * @param n the fluid number
274  * @return M_density the density of fluid n
275  */
276  const Real& density (const UInt& n = 0) const
277  {
278  ASSERT (n < M_fluidNumber, "Undeclared fluid");
279  return M_density[n];
280  }
281 
282  //! Get the viscosity of the fluid
283  /*!
284  * @param n the fluid number
285  * @return M_viscosity the viscosity of the fluid n
286  */
287  const Real& viscosity (const UInt& n = 0) const
288  {
289  ASSERT (n < M_fluidNumber, "Undeclared fluid");
290  return M_viscosity[n];
291  }
292 
293  //! Get the order of the finite elements used for velocity
294  /*!
295  * @return M_uOrder a string specifying the order of finite elements for velocity
296  */
297  std::string uOrder() const
298  {
299  return M_uOrder;
300  }
301 
302  //! Get the order of the finite elements used for pressure
303  /*!
304  * @return M_pOrder a string specifying the order of finite elements for pressure
305  */
306  std::string pOrder() const
307  {
308  return M_pOrder;
309  }
310 
311  //! Temporal output verbose
312  /*!
313  * @return M_verbose
314  */
315  UInt verbose() const
316  {
317  return M_verbose;
318  }
319 
320  //! Dumping of the results
321  /*!
322  * @return M_dumpInit the time for dumping of the results
323  */
324  Real dumpInit() const
325  {
326  return M_dumpInit;
327  }
328 
329  //! Get the frequency of the dumping
330  /*!
331  * @return M_dumpPeriod number of time steps after which one dump is performed
332  */
333  UInt dumpPeriod() const
334  {
335  return M_dumpPeriod;
336  }
337 
338  //! Get the amplification factor
339  /*!
340  * @return M_factor The amplification factor
341  */
342  Real factor() const
343  {
344  return M_factor;
345  }
346 
347  //! Get the stabilization method
348  /*!
349  * @return M_stabMethod The method used for stabilizing
350  */
351  NSStabilization stabilization() const
352  {
353  return M_stabMethod;
354  }
355 
356  //!
357  /*! find out if this is a Stokes or Navier-Stokes problem
358  * @return M_stokes Boolean that is "true" for a Stokes and "false" for a Navier-Stokes
359  * problem
360  */
361  bool isStokes() const
362  {
363  return M_stokes;
364  }
365 
366  //! Find out if a semi-implicit scheme is used
367  /*!
368  * @return M_semiImplicit "true" if a semi-implicit scheme is used, "false" otherwise
369  */
370  bool isSemiImplicit() const
371  {
372  return M_semiImplicit;
373  }
374 
375  //!Get the flag for using shape derivatives
376  /*!
377  *@return M_shapeDerivatives Flag for shape derivatives
378  *
379  */
380  bool useShapeDerivatives() const
381  {
382  return M_shapeDerivatives;
383  }
384 
385 
386  //!Get the flag for considering implicitly the fluid domain (when it is moving, e.g. ALE)
387  /*!
388  *@return M_domainVelImplicit Flag for shape derivatives
389  *
390  */
391  bool domainVelImplicit() const
392  {
393  return M_domainVelImplicit;
394  }
395 
396 
397  //!Get the flag for considering implicitly the fluid convective term
398  /*!
399  *@return M_convectiveImplicit Flag for shape derivatives
400  *
401  */
402  bool convectiveImplicit() const
403  {
404  return M_convectiveImplicit;
405  }
406 
407  //! Get the number of mean valuNes per section
408  /*!
409  * @return M_computeMeanValuesPerSection number of mean values
410  */
411  UInt computeMeanValuesPerSection() const
412  {
413  return M_computeMeanValuesPerSection;
414  }
415 
416  //! Get the number of NBZ-sections
417  /*!
418  * @return M_NbZSections Number of NBZ-sections
419  */
420  UInt nbZSections() const
421  {
422  return M_NbZSections;
423  }
424 
425  //! Tolerance section
426  /*!
427  * @return M_ToleranceSection The tolerance section
428  */
429  Real toleranceSection() const
430  {
431  return M_ToleranceSection;
432  }
433 
434  //! X-Section frontier
435  /*!
436  * @return M_XSectionFrontier The x-section frontier
437  */
438  Real xSectionFrontier() const
439  {
440  return M_XSectionFrontier;
441  }
442 
443  //! Z section init
444  /*!
445  * @return M_ZSectionInit The initial z-section
446  */
447  Real zSectionInit() const
448  {
449  return M_ZSectionInit;
450  }
451 
452  //! Z section final
453  /*!
454  * @return M_ZSectionFinal The final z-section
455  */
456  Real zSectionFinal() const
457  {
458  return M_ZSectionFinal;
459  }
460 
461  //! Number of edges of the polygon (in the mesh) describing the circle
462  /*!
463  * @return M_NbPolygonEdges The number of polygon edges
464  */
465  UInt nbPolygonEdges() const
466  {
467  return M_NbPolygonEdges;
468  }
469 
470  //! Returns wether the formulation of the momentum conservation equation is written in conservative form or not.
471  /*!
472  * @return M_conservativeFormulation the output flag
473  */
474  bool conservativeFormulation() const
475  {
476  return M_conservativeFormulation;
477  }
478 
479  //@}
480 
481 protected:
482 
483  //! Data containers for time and mesh
484  timePtr_Type M_time;
485  timeAdvancePtr_Type M_timeAdvance;
486 
487  //! @name Physics
488  //@{
489 
490  //! number of this fluid
491  UInt M_fluidNumber;
492 
493  //! density of each fluid
494  std::vector<Real> M_density;
495 
496  //! viscosity of each fluid
497  std::vector<Real> M_viscosity;
498 
499  //@}
500 
501 
502  //! @name FE order
503  //@{
504 
505  //! order of finite elements for velocity
506  std::string M_uOrder;
507 
508  //! order of finite elements for pressure
509  std::string M_pOrder;
510 
511  //@}
512 
513 
514  //! @name Miscellaneous
515  //@{
516 
517  //! temporal output verbose
518  UInt M_verbose;
519 
520  //! time for starting the dumping of the results (Alex December 2003)
521  Real M_dumpInit;
522 
523  //! frequency of the dumping (one dump after _dump_period time steps) (Alex December 2003)
524  UInt M_dumpPeriod;
525 
526  //! amplification factor for moving domains
527  Real M_factor;
528 
529  //! true: Stokes problem; false: Navier-Stokes problem
530  bool M_stokes;
531 
532  //@}
533 
534  //! @name Discretization
535  //@{
536 
537  //! stabilization method
538  NSStabilization M_stabMethod;
539 
540  //@}
541 
542 private:
543 
544  //! To extract Mean Values at a given section z
545  bool M_semiImplicit;
546  bool M_shapeDerivatives;
547  bool M_domainVelImplicit;
548  bool M_convectiveImplicit;
549  UInt M_computeMeanValuesPerSection; // switch: 0 don't compute it, 1 compute
550  UInt M_NbZSections;
551  Real M_ToleranceSection;
552  Real M_XSectionFrontier;
553  Real M_ZSectionInit;
554  Real M_ZSectionFinal;
555  UInt M_NbPolygonEdges; // number of edges of the polygon (in mesh) describing the circle
556 
557  StringDataList M_stabilizationList;
558  bool M_conservativeFormulation;
559 };
560 
561 
562 
563 } // end namespace LifeV
564 
565 #endif /* OSEENDATA_H */
TimeAdvanceData - Class for handling temporal discretization.
void updateInverseJacobian(const UInt &iQuadPt)
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
double Real
Generic real data.
Definition: LifeV.hpp:175
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
TimeData - Class for handling temporal discretization.
Definition: TimeData.hpp:61