LifeV
ReferenceFEHybrid.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 Reference finite element for hybrid FEs.
30 
31  @author Alessio Fumagalli
32  Samuel Quinodoz <samuel.quinodoz@epfl.ch>
33  @date 10-05-2010
34 
35  @contributor
36  @mantainer Samuel Quinodoz <samuel.quinodoz@epfl.ch>
37  */
38 
39 #ifndef REFFEHYBRID_H
40 #define REFFEHYBRID_H 1
41 
42 #include <lifev/core/fem/CurrentFEManifold.hpp>
43 
44 namespace LifeV
45 {
46 
47 /*!
48  @class RefHybridFE
49  @brief Class for Hybrid functions, i.e. defined on the boundary of an element.
50  @author V. Martin
51  @date 08/2002
52 
53  This is an enrichment of ReferenceFE in order to implement mixed hybrid finite elements,
54  which are based on a (RT0 - Q0) like discretization of \f$ H(div, \Omega) - L^2(\Omega) \f$.
55 
56  This class contains a list of boundary elements; thanks to the Piola transform, the computations
57  are performed on the boundary of the reference element. But in general, the boundary of a 3D reference
58  element is not a 2D reference element.
59  <BR>
60  Example:
61  <BR>
62  REFERENCE TETRA -> 3 REFERENCE TRIA + 1 EQUILATERAL TRIANGLE...
63  <BR>
64  REFERENCE PRISM -> 2 TRIA + 3 QUAD...?
65  <BR>
66  REFERENCE HEXA -> 6 REFERENCE QUAD.
67 
68  @par How to add a new finite element ?
69 
70  @li In refFE.h: you add a new finite element flag in FE_TYPE enum with a command like:
71  \code
72 FE_PIPO = a_new_number
73  \endcode
74 
75  @li In refHybridFE.h: you declare the functions you need (fct1_Pipo_2D,
76  derfct1_1_Pipo_2D, etc...), the static arrays containing these functions
77  and the coordinates of the nodes on the reference element.
78 
79  @li In defQuadRuleFE.cc: you define these functions (fct1_Pipo_2D, etc...)
80 
81  @li In refFE.h you declare your finite element:
82  \code
83 extern const RefHybridFE fePipo;
84  \endcode
85 
86  @li In defQuadRuleFE.cc: you define a list of CurrentFEManifold with a command like:
87  \code
88  #define NB_BDFE_PIPO
89 static const CurrentFEManifold BdFE_PIPO_1( feTriaP0, geoLinearTria, quadRuleTria4pt, refcoor_PIPOstd::placeholders::_1, 0 );
90 ...
91  \endcode
92 
93  @li In defQuadRuleFE.cc: you define a static array containing all the CurrentFEManifold
94  with a command like
95  \code
96 static const CurrentFEManifold HybPIPOList[ NB_BDFE_PIPO ] =
97 {
98  BdFE_PIPOstd::placeholders::_1, BdFE_PIPOstd::placeholders::_2,
99  ...
100 };
101  \endcode
102 
103  @li In defQuadRuleFE.cc: you define your new element with a command like:
104  \code
105 const ReferenceFEHybrid feTriaPipo("Pipo elements on a tetrahedron", FE_PIPO, TETRA,
106  0, 0, 1, 0, 4, 3, NB_BDFE_PIPO, HybPIPOList, refcoor_PIPO, STANDARD_PATTERN );
107  \endcode
108  See documentation of ReferenceFEHybrid::ReferenceFEHybrid(...) for a precise description of all arguments.
109 */
111  public ReferenceFE
112 {
113 public:
114 
115  typedef ReferenceFE::function_Type function_Type;
116 
117  //! @name Constructor & Destructor
118  //@{
119 
120  /*!
121  Constructor of a reference hybrid finite element. The arguments are:
122  @param name Name of the finite element
123  @param type Type of the finite element (FE_P1_2D,... see the #define at the begining of refFE.h)
124  @param shape Geometry belongs to enum ReferenceShapes {NONE, POINT, LINE, TRIANGLE, QUAD, HEXA, PRISM, TETRA}; (see ElementShapes.h)
125  @param nbDofPerVertex Number of degrees of freedom per vertex
126  @param nbDofPerEdge Number of degrees of freedom per edge
127  @param nbDofPerFace Number of degrees of freedom per face
128  @param nbDofPerVolume Number of degrees of freedom per volume
129  @param nbDof Total number of degrees of freedom ( = nbDofPerVertex * nb vertex + nbDofPerEdge * nb edges + etc...)
130  @param nbLocalCoor Number of local coordinates
131  @param refCoor Static array containing the coordinates of the nodes on the reference element
132  @param numBoundaryFE Number of static boundary elements
133  @param boundaryFEList List of static boundary elements
134  @param refCoor Static array containing the coordinates of the nodes on
135  the reference element (defined in refEle.h)
136  @param patternType In most of cases is STANDARD_PATTERN, except for elements
137  like P1isoP2 (to define a new pattern, add a new #define in refFE.h and
138  code it in refFE.cc following the example of P1ISOP2_TRIA_PATTERN)
139  */
140  ReferenceFEHybrid ( std::string name,
141  FE_TYPE type,
142  ReferenceShapes shape,
143  UInt nbDofPerVertex,
144  UInt nbDofPerEdge,
145  UInt nbDofPerFace,
146  UInt nbDofPerVolume,
147  UInt nbDof,
148  UInt nbLocalCoor,
149  const UInt& numberBoundaryFE,
150  const CurrentFEManifold** boundaryFEList,
151  const Real* refCoor,
152  DofPatternType patternType = STANDARD_PATTERN );
153 
154  //! Destructor.
156 
157  //@}
158 
159 
160  //! @name Operators
161  //@{
162 
163  //! Extracting a CurrentFEManifold from the faces list.
164  const CurrentFEManifold& operator[] ( const ID& i ) const
165  {
166  ASSERT_BD ( i < static_cast<ID> ( M_numberBoundaryFE ) );
167  return * (M_boundaryFEList[ i ]);
168  }
169 
170  //@}
171 
172 
173  //! @name Get Methods
174  //@{
175 
176  //! Return the number of boundary elements of the reference element.
177  const UInt& numberBoundaryFE() const
178  {
179  return M_numberBoundaryFE;
180  }
181 
182  //@}
183 
184 
185 private:
186 
187  //! No empty constructor.
189 
190  //! No copy constructor.
192 
193  //! Number of boundary elements to be stored.
195 
196  /*! List holding the stored boundary elements that live on the boundary faces (3D),
197  or edges (2D), of the RefHybridFE element. The boundary elements of a reference
198  element are not in general reference elements themselves, that is why
199  we use here the CurrentFEManifold rather that ReferenceFE. */
201 };
202 
203 
204 
205 //======================================================================
206 // DECLARATION OF FINITE ELEMENTS (defined in defQuadRule.cc)
209 
212 
215 
216 //======================================================================
217 //
218 // RT0 TRIA HYBRID (2D)
219 // Element defined on SEGMENTS : P0 on each TRIA face.
220 //
221 //======================================================================
222 /*
223 
224 
225 */
226 
227 static const Real refcoor_RT0HYB_TRIA [ 9 ] =
228 {
229  1. / 2. , 0. , 0. ,
230  1. / 2. , 1. / 2. , 0. ,
231  0. , 1. / 2. , 0.
232 };
233 
234 
235 /* refcoor_HYB_TRIA_SEG_I
236  Coordinates of the vertices of the 4 segments. They are used for the definition of the POINT in the bdfe.
237  The same arrays can be used for all the Hybrid elements that have the same shape.
238  E.g. refcoor_HYB_TRIA_SEG_I are used for all the TRIA Hybrid elements. */
239 
240 static const Real refcoor_HYB_TRIA_SEG_1[ 6 ] =
241 {
242  0. , 0. , 0. ,
243  1. , 0. , 0.
244 };
245 
246 static const Real refcoor_HYB_TRIA_SEG_2[ 6 ] =
247 {
248  1. , 0. , 0. ,
249  0. , 1. , 0. ,
250 };
251 
252 static const Real refcoor_HYB_TRIA_SEG_3[ 6 ] =
253 {
254  0. , 1. , 0. ,
255  0. , 0. , 0.
256 };
257 
258 //======================================================================
259 //
260 // RT0 HEXA HYBRID (3D)
261 // Element defined on FACES : Q0 on each QUAD face.
262 //
263 //======================================================================
264 /*
265 
266  8-------7
267  /. /|
268  / . / |
269  5_______6 |
270  | . | |
271  | 4....|..3
272  | . | /
273  |. |/
274  1_______2
275 
276 SEE ElementShapes.cc for the ORIENTATION CONVENTIONS
277  point 1: 0, 0, 0
278  point 2: 1, 0, 0
279  point 3: 1, 1, 0
280  point 4: 1, 0, 0
281  point 5: 0, 0, 1
282  point 6: 1, 0, 1
283  point 7: 1, 1, 1
284  point 8: 1, 0, 1
285 
286  face 1: 1,4,3,2
287  face 2: 1,5,8,4
288  face 3: 1,2,6,5
289  face 4: 2,3,7,6
290  face 5: 3,4,8,7
291  face 6: 5,6,7,8
292 
293 */
294 
295 /* Not really useful(?). to be removed? in this case, remove also xi, eta, zeta, etc. in the class.
296  this info is included in Staticbdfe. */
297 static const Real refcoor_RT0HYB_HEXA[ 18 ] =
298 {
299  0.5 , 0.5 , 0. ,
300  0. , 0.5 , 0.5 ,
301  0.5 , 0. , 0.5 ,
302  1. , 0.5 , 0.5 ,
303  0.5 , 1. , 0.5 ,
304  0.5 , 0.5 , 1.
305 };
306 
307 
308 
309 /* refcoor_HYB_HEXA_FACE_I
310  Coordinates of the vertices of the 6 faces. They are used for the definition of the POINT in the bdfe.
311  The same arrays can be used for all the Hybrid elements that have the same shape.
312  E.g. refcoor_HYB_HEXA_FACE_I are used for all the HEXA Hybrid elements. */
313 
314 static const Real refcoor_HYB_HEXA_FACE_1[ 12 ] =
315 {
316  0. , 0. , 0. ,
317  0. , 1. , 0. ,
318  1. , 1. , 0. ,
319  1. , 0. , 0.
320 };
321 
322 static const Real refcoor_HYB_HEXA_FACE_2[ 12 ] =
323 {
324  0. , 0. , 0. ,
325  0. , 0. , 1. ,
326  0. , 1. , 1. ,
327  0. , 1. , 0.
328 };
329 
330 static const Real refcoor_HYB_HEXA_FACE_3[ 12 ] =
331 {
332  0. , 0. , 0. ,
333  1. , 0. , 0. ,
334  1. , 0. , 1. ,
335  0. , 0. , 1.
336 };
337 
338 static const Real refcoor_HYB_HEXA_FACE_4[ 12 ] =
339 {
340  1. , 0. , 0. ,
341  1. , 1. , 0. ,
342  1. , 1. , 1. ,
343  1. , 0. , 1.
344 };
345 
346 static const Real refcoor_HYB_HEXA_FACE_5[ 12 ] =
347 {
348  1. , 1. , 0. ,
349  0. , 1. , 0. ,
350  0. , 1. , 1. ,
351  1. , 1. , 1.
352 };
353 
354 static const Real refcoor_HYB_HEXA_FACE_6[ 12 ] =
355 {
356  0. , 0. , 1. ,
357  1. , 0. , 1. ,
358  1. , 1. , 1. ,
359  0. , 1. , 1.
360 };
361 
362 
363 //======================================================================
364 //
365 // RT0 TETRA HYBRID (3D)
366 // Element defined on FACES : Q0 on each QUAD face.
367 //
368 //======================================================================
369 /*
370 
371  4
372  / .
373  / \.3
374  / . \\
375  / . \\
376  /. \!
377  1 ----------2
378 
379 SEE ElementShapes.cc for the ORIENTATION CONVENTIONS
380  point 1: 0, 0, 0
381  point 2: 1, 0, 0
382  point 3: 0, 1, 0
383  point 4: 0, 0, 1
384 
385  face 1: 1, 3, 2
386  face 2: 1, 2, 4
387  face 3: 2, 3, 4
388  face 4: 1, 4, 3
389 
390 
391 */
392 
393 /* Not really useful(?). to be removed? in this case, remove also xi, eta, zeta, etc. in the class.
394  this info is included in Staticbdfe. */
395 static const Real refcoor_RT0HYB_TETRA[ 12 ] =
396 {
397  1. / 3 , 1. / 3. , 0. ,
398  1. / 3. , 0. , 1. / 3. ,
399  1. / 3. , 1. / 3. , 1. / 3. ,
400  0. , 1. / 3. , 1. / 3.
401 };
402 
403 
404 /* refcoor_HYB_TETRA_FACE_I
405  Coordinates of the vertices of the 6 faces. They are used for the definition of the POINT in the bdfe.
406  The same arrays can be used for all the Hybrid elements that have the same shape.
407  E.g. refcoor_HYB_TETRA_FACE_I are used for all the TETRA Hybrid elements. */
408 
409 static const Real refcoor_HYB_TETRA_FACE_1[ 9 ] =
410 {
411  0. , 0. , 0. ,
412  0. , 1. , 0. ,
413  1. , 0. , 0.
414 };
415 
416 static const Real refcoor_HYB_TETRA_FACE_2[ 9 ] =
417 {
418  0. , 0. , 0. ,
419  1. , 0. , 0. ,
420  0. , 0. , 1.
421 };
422 
423 static const Real refcoor_HYB_TETRA_FACE_3[ 9 ] =
424 {
425  1. , 0. , 0. ,
426  0. , 1. , 0. ,
427  0. , 0. , 1.
428 };
429 
430 static const Real refcoor_HYB_TETRA_FACE_4[ 9 ] =
431 {
432  0. , 0. , 0. ,
433  0. , 0. , 1. ,
434  0. , 1. , 0.
435 };
436 
437 
438 } // Namespace LifeV
439 
440 #endif /* REFFEHYBRID_H */
const UInt M_numberBoundaryFE
Number of boundary elements to be stored.
static const Real refcoor_HYB_TRIA_SEG_2[6]
static const Real refcoor_RT0HYB_TRIA[9]
#define ASSERT_BD(X)
Definition: LifeAssert.hpp:114
const CurrentFEManifold ** M_boundaryFEList
A class for a finite element on a manifold.
const ReferenceFEHybrid feHexaRT0VdotNHyb("Hybrid RT0 elements on a hexaedra", FE_RT0_HYB_HEXA_3D, HEXA, 0, 0, 1, 0, 6, 3, 6, HybRT0HexaVdotNList, refcoor_RT0HYB_HEXA, STANDARD_PATTERN)
static const Real refcoor_HYB_HEXA_FACE_5[12]
DofPatternType
Local pattern type.
static const Real refcoor_RT0HYB_TETRA[12]
static const Real refcoor_HYB_TRIA_SEG_3[6]
void updateInverseJacobian(const UInt &iQuadPt)
const ReferenceFEHybrid feTetraRT0VdotNHyb("Hybrid RT0 elements on a tetrahedron", FE_RT0_HYB_TETRA_3D, TETRA, 0, 0, 1, 0, 4, 3, 4, HybRT0TetraVdotNList, refcoor_RT0HYB_TETRA, STANDARD_PATTERN)
static const Real refcoor_HYB_HEXA_FACE_4[12]
static const Real refcoor_HYB_TETRA_FACE_1[9]
static const Real refcoor_HYB_TETRA_FACE_2[9]
uint32_type ID
IDs.
Definition: LifeV.hpp:194
static const Real refcoor_HYB_TRIA_SEG_1[6]
const ReferenceFEHybrid feTetraRT0Hyb("Hybrid RT0 elements on a tetrahedron", FE_RT0_HYB_TETRA_3D, TETRA, 0, 0, 1, 0, 4, 3, 4, HybRT0TetraList, refcoor_RT0HYB_TETRA, STANDARD_PATTERN)
const ReferenceFEHybrid feTriaRT0VdotNHyb("Hybrid RT0 elements on a triangle", FE_RT0_HYB_TRIA_2D, TRIANGLE, 0, 1, 0, 0, 3, 2, 3, HybRT0TriaVdotNList, refcoor_RT0HYB_TRIA, STANDARD_PATTERN)
static const Real refcoor_HYB_HEXA_FACE_1[12]
const ReferenceFEHybrid feHexaRT0Hyb("Hybrid RT0 elements on a hexaedra", FE_RT0_HYB_HEXA_3D, HEXA, 0, 0, 1, 0, 6, 3, 6, HybRT0HexaList, refcoor_RT0HYB_HEXA, STANDARD_PATTERN)
ReferenceFEHybrid(std::string name, FE_TYPE type, ReferenceShapes shape, UInt nbDofPerVertex, UInt nbDofPerEdge, UInt nbDofPerFace, UInt nbDofPerVolume, UInt nbDof, UInt nbLocalCoor, const UInt &numberBoundaryFE, const CurrentFEManifold **boundaryFEList, const Real *refCoor, DofPatternType patternType=STANDARD_PATTERN)
const ReferenceFEHybrid feTriaRT0Hyb("Hybrid RT0 elements on a triangle", FE_RT0_HYB_TRIA_2D, TRIANGLE, 0, 1, 0, 0, 3, 2, 3, HybRT0TriaList, refcoor_RT0HYB_TRIA, STANDARD_PATTERN)
double Real
Generic real data.
Definition: LifeV.hpp:175
const CurrentFEManifold & operator[](const ID &i) const
Extracting a CurrentFEManifold from the faces list.
The class for a reference Lagrangian finite element.
ReferenceFEHybrid()
No empty constructor.
static const Real refcoor_HYB_TETRA_FACE_3[9]
static const Real refcoor_RT0HYB_HEXA[18]
static const Real refcoor_HYB_HEXA_FACE_3[12]
ReferenceFEHybrid(const ReferenceFEHybrid &)
No copy constructor.
static const Real refcoor_HYB_TETRA_FACE_4[9]
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
const UInt & numberBoundaryFE() const
Return the number of boundary elements of the reference element.
static const Real refcoor_HYB_HEXA_FACE_6[12]
static const Real refcoor_HYB_HEXA_FACE_2[12]