LifeV
StabilizationIP.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 Interior Penality Stabilization
30 
31  @author Christoph Winkelmann <christoph.winkelmann@epfl.ch>
32  @contributor Umberto Villa <uvilla@emory.edu>
33  @maintainer Umberto Villa <uvilla@emory.edu>
34 
35  @date 08-10-2004
36 
37  Implementation of I.P. stabilization for inf-sup incompatible finite elements for the Navier-Stokes equations.
38  */
39 
40 //TODO Change name to StabilizationIP
41 
42 #ifndef _NSIPTERMS_HPP
43 #define _NSIPTERMS_HPP
44 
45 #include <lifev/core/util/LifeChrono.hpp>
46 #include <lifev/core/array/MatrixElemental.hpp>
47 #include <lifev/core/array/VectorElemental.hpp>
48 #include <lifev/core/fem/AssemblyElemental.hpp>
49 #include <boost/shared_ptr.hpp>
50 
51 #define USE_OLD_PARAMETERS 0
52 #define WITH_DIVERGENCE 1
53 
54 namespace LifeV
55 {
56 
57 namespace details
58 {
59 //! StabilizationIP Class
60 /*!
61  * @brief Interior Penality Stabilization
62  * @author C. Winkelmann <christoph.winkelmann@epfl.ch>
63  *
64  * Implementation of I.P. stabilization for inf-sup incompatible finite elements
65  * for the Navier-Stokes equations. <br>
66  *
67  * This function adds the following stabilization terms to the Navier-Stokes monolithic matrix:
68  * <ol>
69  * <li> Block(1,1): @f$\Sigma_{f\in\mathcal{F}}\int_{f} c_\beta [\beta \cdot \nabla \mathbf{u}] [\beta \cdot \nabla \mathbf{v}] + \Sigma_{f\in\mathcal{F}}\int_{f} c_d [div \mathbf{u}] [div \mathbf{v}]@f$
70  * <li> Block(1,2): 0
71  * <li> Block(2,1): 0
72  * <li> Block(2,2): @f$\Sigma_{f\in\mathcal{F}}\int_{f} c_p [\nabla p] \cdot [\nabla q]@f$
73  * </ol>
74  *
75  * where
76  * <ol>
77  * <li> @f$\mathcal{F}@f$ is the set of all the internal facets in the mesh;
78  * <li> @f$[\cdot]@f$ is the jump operator: @f$[x] = x^+ - x^-@f$.
79  * </ol>
80  * and the parameter @f$ c_\beta@f$, @f$c_d@f$, @f$c_p@f$, are defined as follows:
81  * <ol>
82  * <li> @f$\displaystyle c_\beta = \frac{\gamma_\beta h} {\|\beta\|_\infty} @f$, being @f$h@f$ the facet measure;
83  * <li> @f$\displaystyle c_d = \gamma_d h \|\beta\|_\infty @f$;
84  * <li> @f$\displaystyle c_p = \frac{\gamma_p h}{\max(\|\beta\|_\infty, \nu/h^2)}@f$.
85  * </ol>
86  * Both high Pechlet numbers and inf-sup incompatible FEM are stabilized.
87  *
88  */
89 
90 template<typename MeshType, typename DofType>
91 class StabilizationIP
92 {
93 public:
94 
95  //! @name Public Types
96  //@{
97  typedef std::shared_ptr<MeshType> mesh_type; //deprecated
98  typedef MeshType mesh_Type;
99  typedef DofType dof_Type;
100  typedef std::shared_ptr<mesh_Type> meshPtr_Type;
101  typedef std::shared_ptr<dof_Type> dofPtr_Type;
102  //@}
103 
104  //! @name Constructor and Destructor
105  //@{
106 
107  //! Default Constructor
108  StabilizationIP();
109 
110  virtual ~StabilizationIP() {};
111  //@}
112 
113  //! @name Methods
114  //@{
115  //! compute IP stabilization terms and add them into matrix
116  /*!
117  * This function adds the following stabilization terms to the Navier-Stokes monolithic matrix:
118  * <ol>
119  * <li> Block(1,1): @f$\Sigma_{f\in\mathcal{F}}\int_{f} c_\beta [\beta \cdot \nabla \mathbf{u}] [\beta \cdot \nabla \mathbf{v}] + \Sigma_{f\in\mathcal{F}}\int_{f} c_d [div \mathbf{u}] [div \mathbf{v}]@f$
120  * <li> Block(1,2): 0
121  * <li> Block(2,1): 0
122  * <li> Block(2,2): @f$\Sigma_{f\in\mathcal{F}}\int_{f} c_p [\nabla p] \cdot [\nabla q]@f$
123  * </ol>
124  * where
125  * <ol>
126  * <li> @f$\displaystyle c_\beta = \frac{\gamma_\beta h} {\|\beta\|_\infty} @f$, being @f$h@f$ the facet measure;
127  * <li> @f$\displaystyle c_d = \gamma_\beta h \|\beta\|_\infty @f$;
128  * <li> @f$\displaystyle c_p = \frac{\gamma_p h}{\max(\|\beta\|_\infty, \nu/h^2)}@f$.
129  * </ol>
130  * Both high Pechlet numbers and inf-sup incompatible FEM are stabilized.
131  *
132  * PREREQUISITE: The velocity and the pressure field should belong to the same finite element space
133  *
134  * Parameters are the followings:
135  * @param dt Real timestep (INPUT)
136  * @param matrix MatrixType where the stabilization terms are added into. (OUTPUT)
137  * @param state VectorType velocity field for the linearization of the stabilization (INPUT)
138  * @param verbose bool whenever of not to print on screen
139  */
140  template<typename MatrixType, typename VectorType>
141  void apply ( MatrixType& matrix, const VectorType& state, bool verbose = true );
142 
143  //! Display class informations
144  /*!
145  * Write information relative to the class on output
146  * @param output ostream ostream were to write (Default cout)
147  */
148  void showMe (std::ostream& output = std::cout) const;
149  //@}
150 
151  //! @name Set Methods
152  //@{
153  //! Set the stabilization parameter @f$\gamma_\beta@f$ for @f$\Sigma_{f\in\mathcal{F}}\int_{f} [\beta \cdot \nabla \mathbf{u}] [\beta \cdot \nabla \mathbf{v}]@f$
154  void setGammaBeta (const Real& gammaBeta)
155  {
156  M_gammaBeta = gammaBeta;
157  }
158  //! Set the stabilization parameter @f$\gamma_d@f$ for @f$\Sigma_{f\in\mathcal{F}}\int_{f} [div \mathbf{u}] [div \mathbf{v}]@f$
159  void setGammaDiv (const Real& gammaDiv)
160  {
161  M_gammaDiv = gammaDiv;
162  }
163  //! Set the stabilization parameter @f$\gamma_p@f$ for @f$\Sigma_{f\in\mathcal{F}}\int_{f} [\nabla p] \cdot [\nabla q]@f$
164  void setGammaPress (const Real& gammaPress)
165  {
166  M_gammaPress = gammaPress;
167  }
168  //! Set the fluid viscosity @f$\nu@f$
169  void setViscosity (const Real& viscosity)
170  {
171  M_viscosity = viscosity;
172  }
173  //! Set the mesh file
174  void setMesh (const meshPtr_Type mesh)
175  {
176  M_mesh = mesh;
177  }
178  //! Set Discretization
179  void setDiscretization (const dofPtr_Type& dof, const ReferenceFE& refFE, CurrentFEManifold& feBd, const QuadratureRule& quadRule);
180  //! Set the fespace
181  template<typename MapType>
182  void setFeSpaceVelocity (FESpace<mesh_Type, MapType>& feSpaceVelocity);
183  //@}
184 private:
185 
186  //! @name Private Types
187  //@{
188  //! facetToPoint(i,j) = localId of jth point on ith local facet
189  typedef ID ( *FTOP ) ( ID const& localFacet, ID const& point );
190  //@}
191 
192  //! @name Private Constructor
193  //@{
194  //! Copy Constructor
195  StabilizationIP (const StabilizationIP<mesh_Type, dof_Type>& original);
196  //@}
197 
198  //! @name Private Attributes
199  //@{
200  //! Pointer to the mesh object
201  meshPtr_Type M_mesh;
202  //! reference to the DofType data structure
203  dofPtr_Type M_dof;
204  //! current Fe on side 1 of the current facet
205  std::shared_ptr<CurrentFE> M_feOnSide1;
206  //! current Fe on side 2 of the current facet
207  std::shared_ptr<CurrentFE> M_feOnSide2;
208  //! current boundary FE
210  //! Stabilization parameter @f$\gamma_\beta@f$ for @f$\int_{facet} [\beta \cdot \nabla \mathbf{u}] [\beta \cdot \nabla \mathbf{v}]@f$
211  Real M_gammaBeta;
212  //! Stabilization parameter @f$\gamma_d@f$ for @f$\int_{facet} [div \mathbf{u}] [div \mathbf{v}]@f$
213  Real M_gammaDiv;
214  //! Stabilization parameter @f$\gamma_p@f$ for @f$\int_{facet} [\nabla p] \cdot [\nabla q]@f$
215  Real M_gammaPress;
216  //! Fluid viscosity @f$\nu@f$
217  Real M_viscosity;
218  //! facetToPoint(i,j) = localId of jth point on ith local facet
219  FTOP M_facetToPoint;
220  //@}
221 }; // class StabilizationIP
222 
223 
224 //=============================================================================
225 // Constructor
226 //=============================================================================
227 
228 template<typename MeshType, typename DofType>
229 StabilizationIP<MeshType, DofType>::StabilizationIP() :
230  M_gammaBeta ( 0.0 ),
231  M_gammaDiv ( 0.0 ),
232  M_gammaPress ( 0.0 ),
233  M_viscosity ( 0.0 )
234 {}
235 
236 //=============================================================================
237 // Method
238 //=============================================================================
239 
240 template<typename MeshType, typename DofType>
241 template<typename MatrixType, typename VectorType>
242 void StabilizationIP<MeshType, DofType>::apply ( MatrixType& matrix, const VectorType& state, const bool verbose )
243 {
244  if ( M_gammaBeta == 0. && M_gammaDiv == 0. && M_gammaPress == 0. )
245  {
246  return;
247  }
248 
249  LifeChronoFake chronoUpdate;
250  LifeChronoFake chronoBeta;
251  LifeChronoFake chronoElemComp;
252  LifeChronoFake chronoAssembly1;
253  LifeChronoFake chronoAssembly2;
254  LifeChronoFake chronoAssembly3;
255  LifeChronoFake chronoAssembly4;
256  LifeChronoFake chronoAssembly5;
257  LifeChronoFake chronoAssembly6;
258  LifeChronoFake chronoAssembly7;
259  LifeChronoFake chronoAssembly8;
260  LifeChronoFake chronoAssembly9;
261  LifeChrono chronoAssembly;
262 
263  ID geoDimensions = MeshType::S_geoDimensions;
264  MatrixElemental elMatU ( M_feOnSide1->nbFEDof(), geoDimensions , geoDimensions );
265  MatrixElemental elMatP ( M_feOnSide1->nbFEDof(), geoDimensions + 1, geoDimensions + 1 );
266 
267 
268  const UInt nDof = M_dof->numTotalDof();
269 
270  Real normInf;
271  state.normInf (&normInf);
272 
273  // local trace of the velocity
274  VectorElemental beta ( M_feBd->nbFEDof(), geoDimensions );
275 
276  UInt myFacets (0);
277 
278  chronoAssembly.start();
279  // loop on interior facets
280  for ( UInt iFacet ( M_mesh->numBoundaryFacets() ); iFacet < M_mesh->numFacets();
281  ++iFacet )
282  {
283  const UInt iElAd1 ( M_mesh->facet ( iFacet ).firstAdjacentElementIdentity() );
284  const UInt iElAd2 ( M_mesh->facet ( iFacet ).secondAdjacentElementIdentity() );
285 
286  if ( Flag::testOneSet ( M_mesh->facet ( iFacet ).flag(),
287  EntityFlags::SUBDOMAIN_INTERFACE | EntityFlags::PHYSICAL_BOUNDARY ) )
288  {
289  //std::cout << "iElAd1 = " << iElAd1 << "; iElAd2 = " << iElAd2 << std::endl;
290  continue;
291  }
292  ++myFacets;
293 
294  chronoUpdate.start();
295  // update current finite elements
296 #if WITH_DIVERGENCE
297  M_feBd->update ( M_mesh->facet ( iFacet ), UPDATE_W_ROOT_DET_METRIC );
298 #else
299  M_feBd->updateMeasNormal ( M_mesh->facet ( iFacet ) );
300  KNM<Real>& normal = M_feBd->normal;
301 #endif
302  const Real hK2 = M_feBd->measure();
303 
304 
305  M_feOnSide1->updateFirstDeriv ( M_mesh->element ( iElAd1 ) );
306  M_feOnSide2->updateFirstDeriv ( M_mesh->element ( iElAd2 ) );
307  chronoUpdate.stop();
308 
309  Real bmax (0);
310  if (normInf != 0.)
311  {
312  chronoBeta.start();
313  // determine bmax = ||\beta||_{0,\infty,K}
314  // first, get the local trace of the velocity into beta
315 
316  // local id of the facet in its adjacent element
317  UInt iFaEl ( M_mesh->facet ( iFacet ).firstAdjacentElementPosition() );
318  for ( UInt iNode ( 0 ); iNode < M_feBd->nbFEDof(); ++iNode )
319  {
320  UInt iloc ( M_facetToPoint ( iFaEl, iNode ) );
321  for ( UInt iCoor ( 0 ); iCoor < M_feOnSide1->nbLocalCoor(); ++iCoor )
322  {
323  UInt ig ( M_dof->localToGlobalMap ( iElAd1, iloc ) + iCoor * nDof );
324 
325  if (state.blockMap().LID ( static_cast<EpetraInt_Type> (ig) ) >= 0)
326  {
327  beta.vec() [ iCoor * M_feBd->nbFEDof() + iNode ] = state ( ig);
328  }
329  }
330  }
331 
332  // second, calculate its max norm
333  for ( UInt l ( 0 ); l < static_cast<UInt> ( M_feOnSide1->nbLocalCoor() *M_feBd->nbFEDof() ); ++l )
334  {
335  if ( bmax < std::fabs ( beta.vec() [ l ] ) )
336  {
337  bmax = std::fabs ( beta.vec() [ l ] );
338  }
339  }
340 
341  chronoBeta.stop();
342  }
343 
344 
345  // pressure stabilization
346  if ( M_gammaPress != 0.0 )
347  {
349  Real coeffPress ( M_gammaPress * hK2 ); // P1, P2 (code)
350  //Real coeffPress = M_gammaPress * sqrt( hK2 ); // P1 p nonsmooth (code)
351 #else
352  Real coeffPress = M_gammaPress * hK2 / // Pk (paper)
353  std::max<Real> ( bmax, M_viscosity / std::sqrt ( hK2 ) );
354 #endif
355 
356  elMatP.zero();
357  chronoElemComp.start();
358  // coef*\int_{facet} grad u1 . grad v1
359  AssemblyElemental::ipstab_grad ( coeffPress, elMatP, *M_feOnSide1, *M_feOnSide1, *M_feBd,
360  geoDimensions, geoDimensions);
361  chronoElemComp.stop();
362  chronoAssembly1.start();
363 
364  assembleMatrix (matrix, elMatP, *M_feOnSide1, *M_dof,
365  geoDimensions, geoDimensions, geoDimensions * nDof, geoDimensions * nDof);
366  chronoAssembly1.stop();
367 
368  elMatP.zero();
369  chronoElemComp.start();
370  // coef*\int_{face} grad u2 . grad v2
371  AssemblyElemental::ipstab_grad ( coeffPress, elMatP, *M_feOnSide2, *M_feOnSide2, *M_feBd,
372  geoDimensions, geoDimensions);
373  chronoElemComp.stop();
374  chronoAssembly2.start();
375 
376  assembleMatrix (matrix, elMatP, *M_feOnSide2, *M_dof,
377  geoDimensions, geoDimensions, geoDimensions * nDof, geoDimensions * nDof);
378  chronoAssembly2.stop();
379 
380  elMatP.zero();
381  chronoElemComp.start();
382  // - coef*\int_{facet} grad u1 . grad v2
383  AssemblyElemental::ipstab_grad (- coeffPress, elMatP, *M_feOnSide1, *M_feOnSide2, *M_feBd,
384  geoDimensions, geoDimensions);
385  chronoElemComp.stop();
386  chronoAssembly3.start();
387 
388  assembleMatrix (matrix, elMatP, *M_feOnSide1, *M_feOnSide2, *M_dof, *M_dof,
389  geoDimensions, geoDimensions, geoDimensions * nDof, geoDimensions * nDof);
390  chronoAssembly3.stop();
391 
392  elMatP.zero();
393  chronoElemComp.start();
394  // - coef*\int_{facet} grad u2 . grad v1
395  AssemblyElemental::ipstab_grad (- coeffPress, elMatP, *M_feOnSide2, *M_feOnSide1, *M_feBd,
396  geoDimensions, geoDimensions);
397  chronoElemComp.stop();
398  chronoAssembly4.start();
399 
400  assembleMatrix (matrix, elMatP, *M_feOnSide2, *M_feOnSide1, *M_dof, *M_dof,
401  geoDimensions, geoDimensions, geoDimensions * nDof, geoDimensions * nDof);
402  chronoAssembly4.stop();
403  }
404 
405  // velocity stabilization
406  if ( ( M_gammaDiv != 0 || M_gammaBeta != 0 ) && bmax > 0 )
407  {
408 #if WITH_DIVERGENCE
410  Real coeffBeta ( M_gammaBeta * hK2 / std::max<Real> (bmax, hK2) ); // code
411 #else
412  Real coeffBeta ( M_gammaBeta * hK2 / bmax ); // paper
413 #endif
414 
415  Real coeffDiv ( M_gammaDiv * hK2 * bmax ); // (code and paper)
416  //Real coeffDiv ( M_gammaDiv * sqrt( hK2 ) * bmax ); // ? (code)
417 #else
418  // determine bnmax = ||\beta \cdot n||_{0,\infty,K}
419  // and bcmax = ||\beta \cross n||_{0,\infty,K}
420 
421  chronoBeta.start();
422  Real bnmax ( 0. );
423  Real bcmax ( 0. );
424  for ( UInt iNode (0); iNode < M_feBd->nbNode; ++iNode )
425  {
426  Real bn ( 0 );
427  for ( UInt iCoor (0); iCoor < M_feOnSide1->nbLocalCoor(); ++iCoor )
428  {
429  bn += normal (iNode, iCoor) *
430  beta.vec() [ iCoor * M_feBd->nbNode + iNode ];
431  bcmax = std::max<Real>
432  (bcmax, normal (iNode, (iCoor) % 3) *
433  beta.vec() [ (iCoor + 1) % 3 * M_feBd->nbNode + iNode ] -
434  normal (iNode, (iCoor + 1) % 3) *
435  beta.vec() [ (iCoor) % 3 * M_feBd->nbNode + iNode ]);
436  }
437  bnmax = std::max<Real> (bnmax, bn);
438  }
439  chronoBeta.stop();
440 
441  Real coeffGrad = hK2 * (M_gammaBeta * bnmax + M_gammaDiv * bcmax);
442 #endif
443  elMatU.zero();
444  chronoElemComp.start();
445 #if WITH_DIVERGENCE
446  // coef*\int_{facet} (\beta1 . grad u1) (\beta2 . grad v2)
447  AssemblyElemental::ipstab_bgrad ( coeffBeta, elMatU, *M_feOnSide1, *M_feOnSide1, beta,
448  *M_feBd, 0, 0, geoDimensions );
449  // coef*\int_{facet} div u1 . div v1
450  AssemblyElemental::ipstab_div ( coeffDiv, elMatU, *M_feOnSide1, *M_feOnSide1, *M_feBd );
451 #else
452  // coef*\int_{facet} grad u1 . grad v1
453  AssemblyElemental::ipstab_grad ( coeffGrad, elMatU, *M_feOnSide1, *M_feOnSide1, *M_feBd, 0, 0,
454  geoDimensions );
455 #endif
456  chronoElemComp.stop();
457  chronoAssembly5.start();
458  for ( UInt iComp ( 0 ); iComp < geoDimensions; ++iComp )
459  for ( UInt jComp ( 0 ); jComp < geoDimensions; ++jComp )
460  {
461  assembleMatrix ( matrix, elMatU, *M_feOnSide1, *M_dof,
462  iComp, jComp, iComp * nDof, jComp * nDof );
463  }
464  chronoAssembly5.stop();
465 
466  elMatU.zero();
467  chronoElemComp.start();
468 #if WITH_DIVERGENCE
469  // coef*\int_{facet} (\beta2 . grad u2) (\beta2 . grad v2)
470  AssemblyElemental::ipstab_bgrad ( coeffBeta, elMatU, *M_feOnSide2, *M_feOnSide2, beta,
471  *M_feBd, 0, 0, geoDimensions );
472  // coef*\int_{facet} div u2 . div v2
473  AssemblyElemental::ipstab_div ( coeffDiv, elMatU, *M_feOnSide2, *M_feOnSide2, *M_feBd );
474 #else
475  // coef*\int_{facet} grad u2 . grad v2
476  AssemblyElemental::ipstab_grad ( coeffGrad, elMatU, *M_feOnSide2, *M_feOnSide2, *M_feBd, 0, 0,
477  geoDimensions );
478 #endif
479  chronoElemComp.stop();
480  chronoAssembly6.start();
481  for ( UInt iComp ( 0 ); iComp < geoDimensions; ++iComp )
482  for ( UInt jComp ( 0 ); jComp < geoDimensions; ++jComp )
483  {
484  assembleMatrix ( matrix, elMatU, *M_feOnSide2, *M_dof,
485  iComp, jComp, iComp * nDof, jComp * nDof );
486  }
487  chronoAssembly6.stop();
488 
489  elMatU.zero();
490  chronoElemComp.start();
491 #if WITH_DIVERGENCE
492  // - coef*\int_{facet} (\beta1 . grad u1) (\beta2 . grad v2)
493  AssemblyElemental::ipstab_bgrad ( -coeffBeta, elMatU, *M_feOnSide1, *M_feOnSide2, beta,
494  *M_feBd, 0, 0, geoDimensions );
495  // - coef*\int_{facet} div u1 . div v2
496  AssemblyElemental::ipstab_div ( -coeffDiv, elMatU, *M_feOnSide1, *M_feOnSide2, *M_feBd );
497 #else
498  // - coef*\int_{facet} grad u1 . grad v2
499  AssemblyElemental::ipstab_grad ( -coeffGrad, elMatU, *M_feOnSide1, *M_feOnSide2, *M_feBd, 0, 0,
500  geoDimensions );
501 #endif
502  chronoElemComp.stop();
503  chronoAssembly7.start();
504  for ( UInt iComp = 0; iComp < geoDimensions; ++iComp )
505  for ( UInt jComp = 0; jComp < geoDimensions; ++jComp )
506  {
507  assembleMatrix ( matrix, elMatU, *M_feOnSide1, *M_feOnSide2, *M_dof, *M_dof,
508  iComp, jComp, iComp * nDof, jComp * nDof );
509  }
510  chronoAssembly7.stop();
511 
512  elMatU.zero();
513  chronoElemComp.start();
514 #if WITH_DIVERGENCE
515  // - coef*\int_{facet} (\beta2 . grad u2) (\beta1 . grad v1)
516  AssemblyElemental::ipstab_bgrad ( -coeffBeta, elMatU, *M_feOnSide2, *M_feOnSide1, beta,
517  *M_feBd, 0, 0, geoDimensions );
518  // - coef*\int_{facet} div u2 . div v1
519  AssemblyElemental::ipstab_div ( -coeffDiv, elMatU, *M_feOnSide2, *M_feOnSide1, *M_feBd );
520 #else
521  // - coef*\int_{facet} grad u2 . grad v1
522  AssemblyElemental::ipstab_grad ( -coeffGrad, elMatU, *M_feOnSide2, *M_feOnSide1, *M_feBd, 0, 0,
523  geoDimensions );
524 #endif
525  chronoElemComp.stop();
526  chronoAssembly8.start();
527  for ( UInt iComp ( 0 ); iComp < geoDimensions; ++iComp )
528  for ( UInt jComp ( 0 ); jComp < geoDimensions; ++jComp )
529  {
530  assembleMatrix ( matrix, elMatU, *M_feOnSide2, *M_feOnSide1, *M_dof, *M_dof,
531  iComp, jComp, iComp * nDof, jComp * nDof );
532  }
533  chronoAssembly8.stop();
534  }
535 
536  } // loop on interior facets
537  chronoAssembly.stop();
538  if (verbose)
539  {
540  debugStream (7101) << "\n";
541  debugStream (7101) << static_cast<UInt> (state.blockMap().Comm().MyPID() )
542  << " . Updating of element done in "
543  << chronoUpdate.diffCumul() << " s." << "\n";
544  debugStream (7101) << " . Determination of beta done in "
545  << chronoBeta.diffCumul() << " s." << "\n";
546  debugStream (7101) << " . Element computations done in "
547  << chronoElemComp.diffCumul() << " s." << "\n";
548  debugStream (7101) << " . chrono 1 done in "
549  << chronoAssembly1.diffCumul() << " s." << "\n";
550  debugStream (7101) << " . chrono 2 done in "
551  << chronoAssembly2.diffCumul() << " s." << "\n";
552  debugStream (7101) << " . chrono 3 done in "
553  << chronoAssembly3.diffCumul() << " s." << "\n";
554  debugStream (7101) << " . chrono 4 done in "
555  << chronoAssembly4.diffCumul() << " s." << "\n";
556  debugStream (7101) << " . chrono 5 done in "
557  << chronoAssembly5.diffCumul() << " s." << "\n";
558  debugStream (7101) << " . chrono 6 done in "
559  << chronoAssembly6.diffCumul() << " s." << "\n";
560  debugStream (7101) << " . chrono 7 done in "
561  << chronoAssembly7.diffCumul() << " s." << "\n";
562  debugStream (7101) << " . chrono 8 done in "
563  << chronoAssembly8.diffCumul() << " s." << "\n";
564  debugStream (7101) << " . total "
565  << chronoAssembly.diffCumul() << " s."
566  << " myFacets = " << myFacets << "\n";
567  }
568 
569 } // apply(...)
570 
571 template<typename MeshType, typename DofType>
572 void StabilizationIP<MeshType, DofType>::showMe (std::ostream& output) const
573 {
574  output << "StabilizationIP::showMe() " << std::endl;
575  output << "Fluid Viscosity: " << M_viscosity << std::endl;
576  output << "Stabilization coefficient velocity SD jumps: " << M_gammaBeta << std::endl;
577  output << "Stabilization coefficient velocity divergence jumps: " << M_gammaDiv << std::endl;
578  output << "Stabilization coefficient pressure gradient jumps: " << M_gammaPress << std::endl;
579  M_mesh->showMe (output);
580  M_dof->showMe (output);
581 }
582 
583 //=============================================================================
584 // Setters method
585 //=============================================================================
586 template<typename MeshType, typename DofType>
587 void StabilizationIP<MeshType, DofType>::setDiscretization (const dofPtr_Type& dof, const ReferenceFE& refFE, CurrentFEManifold& feBd, const QuadratureRule& quadRule)
588 {
589  M_dof = dof;
590  M_feOnSide1.reset ( new CurrentFE (refFE, getGeometricMap (*M_mesh), quadRule) );
591  M_feOnSide2.reset ( new CurrentFE (refFE, getGeometricMap (*M_mesh), quadRule) );
592  M_feBd = &feBd;
593 
594  M_facetToPoint = MeshType::elementShape_Type::facetToPoint;
595 }
596 
597 template<typename MeshType, typename DofType>
598 template<typename MapType>
599 void StabilizationIP<MeshType, DofType>::setFeSpaceVelocity (FESpace<mesh_Type, MapType>& feSpaceVelocity)
600 {
601  setMesh (feSpaceVelocity.mesh() );
602  setDiscretization (feSpaceVelocity.dofPtr(), feSpaceVelocity.refFE(),
603  feSpaceVelocity.feBd(), feSpaceVelocity.qr() );
604 }
605 
606 } // namespace details
607 
608 } // namespace LifeV
609 
610 #endif /* _NSIPTERMS_HPP */
#define WITH_DIVERGENCE
void start()
Start the timer.
Definition: LifeChrono.hpp:93
#define debugStream
Definition: LifeDebug.hpp:182
Real diffCumul()
Return a cumulative time difference.
Definition: LifeChrono.hpp:146
A class for a finite element on a manifold.
void updateInverseJacobian(const UInt &iQuadPt)
uint32_type ID
IDs.
Definition: LifeV.hpp:194
#define USE_OLD_PARAMETERS
double Real
Generic real data.
Definition: LifeV.hpp:175
The class for a reference Lagrangian finite element.
NdebugStream noDebugStream(int=0, NdebugStream::stprintf=&printf)
Definition: LifeDebug.hpp:183
void stop()
Stop the timer.
Definition: LifeChrono.hpp:100
QuadratureRule - The basis class for storing and accessing quadrature rules.
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191