LifeV
StabilizationSUPG_semi_implicit.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  @file
28  @brief SUPG stabilization, semi-implicit case.
29  @author Davide Forti <davide.forti@epfl.ch>
30  @contributor Luca Dede <luca.dede@epfl.ch>
31  @maintainer Davide Forti <davide.forti@epfl.ch>
32  @date 15-04-2015
33 
34  This file contains an ETA implementation of SUPG, for semi-implicit treatment of the convective term.
35 
36  For reference, see Paper
37 
38  * D. Forti, L. Dede, Semi–implicit BDF time discretization of the Navier–Stokes equations with VMS–LES modeling in
39  a High Performance Computing framework. Submitted, available as MATHICSE report, 2015.
40 
41  * Y. Bazilevs, V.M. Calo, J.A. Cottrell, T.J.R. Hughes, A. Reali, and G. Scovazzi. <i>Variational multiscale
42  residual-based turbulence modeling for large eddy simulation of incompressible flows</i>. Comput. Methods Appl. Mech. Engr. 197(1):173–201, 2007.
43 
44 */
45 
46 #ifndef _STABILIZATIONSUPG_SEMI_IMPLICIT_HPP_
47 #define _STABILIZATIONSUPG_SEMI_IMPLICIT_HPP_ 1
48 
49 // Tell the compiler to ignore specific kind of warnings:
50 #pragma GCC diagnostic ignored "-Wunused-variable"
51 #pragma GCC diagnostic ignored "-Wunused-parameter"
52 
53 #include <Epetra_ConfigDefs.h>
54 #ifdef EPETRA_MPI
55  #include <mpi.h>
56  #include <Epetra_MpiComm.h>
57 #else
58  #include <Epetra_SerialComm.h>
59 #endif
60 
61 #include <Epetra_FECrsMatrix.h>
62 
63 //Tell the compiler to restore the warning previously silented
64 #pragma GCC diagnostic warning "-Wunused-variable"
65 #pragma GCC diagnostic warning "-Wunused-parameter"
66 
67 #include <lifev/navier_stokes_blocks/solver/Stabilization.hpp>
68 
69 #include <lifev/core/fem/FESpace.hpp>
70 #include <lifev/core/fem/ReferenceFE.hpp>
71 
72 #include <lifev/eta/fem/ETFESpace.hpp>
73 
74 // includes for building the matrix graph
75 #include <Epetra_FECrsGraph.h>
76 #include <lifev/eta/expression/Integrate.hpp>
77 #include <lifev/eta/expression/BuildGraph.hpp>
78 
79 #include <lifev/core/fem/TimeAndExtrapolationHandlerQuadPts.hpp>
80 
81 namespace LifeV
82 {
83 
85 {
86 public:
87 
88  //@name Public Types
89  //@{
92 
93  typedef VectorEpetra vector_Type;
95 
98 
101 
104 
107 
110 
111  //@}
112 
113  //! @name Constructor and Destructor
114  //@{
115  //! Default Constructor
117 
118  //! ~Destructor
120 
121  //@}
122 
123  //! Updates the system matrix in Navier-Stokes simulations in fixed coordinates
124  // with semi-implicit treatment of the convective term.
125  /*!
126  @param velocityExtrapolated extrapolation of the fluid velocity
127  */
128  void apply_matrix( const vector_Type& velocityExtrapolated );
129 
130  //! Adds to the right hand side the contribution coming from the SUPG stabilization
131  // in Navier-Stokes simulations in fixed coordinates. Used for NS semi-implicit
132  /*!
133  @param rhs_velocity velocity component of the right hand side
134  @param rhs_pressure pressure component of the right hand side
135  @param velocity_extrapolated velocity extrapolated
136  @param velocity_rhs velocity term from approximation time derivative
137  */
138  void apply_vector( vectorPtr_Type& rhs_velocity,
139  vectorPtr_Type& rhs_pressure,
140  const vector_Type& velocityExtrapolated,
141  const vector_Type& velocity_rhs);
142 
143  void setVelocitySpace(fespacePtr_Type velocityFESpace){ M_uFESpace = velocityFESpace;}
144 
145  void setPressureSpace(fespacePtr_Type pressureFESpace){ M_pFESpace = pressureFESpace;}
146 
147  //! Set the constant C_I for the supg
148  void setConstant (const int & value);
149 
150  //! Set the fluid density
151  void setDensity (const Real & density) { M_density = density;}
152 
153  //! Set the bdf order
154  void setBDForder (const Real & bdfOrder) { M_bdfOrder = bdfOrder;}
155 
156  //! Set the bdf order
157  void setAlpha (const Real & alpha) { M_alpha = alpha;}
158 
159  //! Set the fluid dynamic viscosity
160  void setViscosity (const Real & viscosity) { M_viscosity = viscosity;}
161 
162  //! Set the Epetra communicator
163  void setCommunicator (std::shared_ptr<Epetra_Comm> comm) { M_comm = comm;}
164 
165  //! Set the time step size
166  void setTimeStep (const Real & timestep) { M_timestep = timestep;}
167 
168  void setETvelocitySpace(const ETFESpacePtr_velocity & velocityEta_fespace){ M_fespaceUETA = velocityEta_fespace;}
169 
170  void setETpressureSpace(const ETFESpacePtr_pressure & pressureEta_fespace){ M_fespacePETA = pressureEta_fespace;}
171 
172  void setUseGraph (const bool& useGraph) { M_useGraph = useGraph; }
173 
174  //! @name Getters
175  //@{
176 
177  matrixPtr_Type const& block_00() const
178  {
179  return M_block_00;
180  }
181 
182  matrixPtr_Type const& block_01() const
183  {
184  return M_block_01;
185  }
186 
187  matrixPtr_Type const& block_10() const
188  {
189  return M_block_10;
190  }
191 
192  matrixPtr_Type const& block_11() const
193  {
194  return M_block_11;
195  }
196 
197  std::string label () { return M_label; }
198 
199  //@}
200 
201 private:
202 
203  //! @name Private Attributes
204  //@{
205 
206  //! finite element spaces for velocity and pressure
209 
212 
213  //! Epetra communicator
215 
216  //! fluid dynamic viscosity @f$\nu@f$
218 
219  //! fluid density @f$\nu@f$
221 
222  //! stabilization parameters for the momentum and continuity equations
227 
229 
230  // Graphs
235 
236  // Matrices
241 
243 
245 
247 
249 
253 
257 
258  //@}
259 }; // class StabilizationSUPG_semi_implicit
260 
261 //! Factory create function
263 {
265 }
266 namespace
267 {
270 }
271 
273 {
274 public:
275  typedef Real return_Type;
276 
277  inline return_Type operator() (const Real& a)
278  {
279  return std::sqrt(a);
280  }
281 
285 };
286 
287 } // namespace LifeV
288 
289 #endif /* _STABILIZATIONSUPG_SEMI_IMPLICIT_HPP_ */
StabilizationSUPG_semi_implicit * createStabilizationSUPG_semi_implicit()
Factory create function.
matrixPtr_Type const & block_11() const
Get block11 of the stabilization matrix.
ETFESpace< mesh_Type, map_Type, 3, 1 > ETFESpace_pressure
FESpace - Short description here please!
Definition: FESpace.hpp:78
void setBDForder(const Real &bdfOrder)
Set the bdf order.
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
matrixPtr_Type const & block_00() const
Get block00 of the stabilization matrix.
fespacePtr_Type M_uFESpace
finite element spaces for velocity and pressure
void setViscosity(const Real &viscosity)
Set the fluid dynamic viscosity.
void apply_vector(vectorPtr_Type &rhs_velocity, vectorPtr_Type &rhs_pressure, const vector_Type &velocityExtrapolated, const vector_Type &velocity_rhs)
Adds to the right hand side the contribution coming from the SUPG stabilization.
matrixPtr_Type const & block_10() const
Get block10 of the stabilization matrix.
void setETvelocitySpace(const ETFESpacePtr_velocity &velocityEta_fespace)
Set Expression Template FE space for velocity.
void setVelocitySpace(fespacePtr_Type velocityFESpace)
Set FE space for velocity.
void setAlpha(const Real &alpha)
Set the bdf order.
Epetra_Import const & importer()
Getter for the Epetra_Import.
Definition: MapEpetra.cpp:394
void setTimeStep(const Real &timestep)
Set the time step size.
std::shared_ptr< Epetra_FECrsGraph > graphPtr_Type
Real M_timestep
stabilization parameters for the momentum and continuity equations
matrixPtr_Type const & block_01() const
Get block01 of the stabilization matrix.
std::shared_ptr< ETFESpace_velocity > ETFESpacePtr_velocity
void setUseGraph(const bool &useGraph)
Set if using the graph.
std::string label()
Get name of stabilization being used.
ETFESpace< mesh_Type, map_Type, 3, 3 > ETFESpace_velocity
void setPressureSpace(fespacePtr_Type pressureFESpace)
Set Expression Template FE space for velocity.
double Real
Generic real data.
Definition: LifeV.hpp:175
std::shared_ptr< ETFESpace_pressure > ETFESpacePtr_pressure
void setETpressureSpace(const ETFESpacePtr_pressure &pressureEta_fespace)
Set Expression Template FE space for velocity.
void setConstant(const int &value)
Set the constant C_I for the supg.
void setCommunicator(std::shared_ptr< Epetra_Comm > comm)
Set the Epetra communicator.
std::vector< std::vector< VectorSmall< 1 > > > M_fineScalePressure
void apply_matrix(const vector_Type &velocityExtrapolated)
Updates the system matrix in Navier-Stokes simulations in fixed coordinates.
void setDensity(const Real &density)
Set the fluid density.
std::shared_ptr< Epetra_Comm > M_comm
Epetra communicator.
class ETFESpace A light, templated version of the FESpace
Definition: ETFESpace.hpp:93
SquareRoot_supg_semi_implicit(const SquareRoot_supg_semi_implicit &)