LifeV
StabilizationSUPGALE.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.
29  @author Davide Forti <davide.forti@epfl.ch>
30  @maintainer Davide Forti <davide.forti@epfl.ch>
31  @date 03-02-2015
32 
33  This file contains an ETA implementation of SUPG, fully implicit for the moment.
34 
35  For reference, see Paper Y. Bazilevs, V.M. Calo, J.A. Cottrell, T.J.R. Hughes, A. Reali, and G. Scovazzi. <i>Variational multiscale
36  residual-based turbulence modeling for large eddy simulation of incompressible flows</i>. Comput. Methods Appl. Mech. Engr. 197(1):173–201, 2007.
37 
38 */
39 
40 #ifndef _STABILIZATIONSUPGALE_HPP_
41 #define _STABILIZATIONSUPGALE_HPP_ 1
42 
43 // Tell the compiler to ignore specific kind of warnings:
44 #pragma GCC diagnostic ignored "-Wunused-variable"
45 #pragma GCC diagnostic ignored "-Wunused-parameter"
46 
47 #include <Epetra_ConfigDefs.h>
48 #ifdef EPETRA_MPI
49  #include <mpi.h>
50  #include <Epetra_MpiComm.h>
51 #else
52  #include <Epetra_SerialComm.h>
53 #endif
54 
55 #include <Epetra_FECrsMatrix.h>
56 
57 //Tell the compiler to restore the warning previously silented
58 #pragma GCC diagnostic warning "-Wunused-variable"
59 #pragma GCC diagnostic warning "-Wunused-parameter"
60 
61 #include <lifev/navier_stokes_blocks/solver/Stabilization.hpp>
62 
63 #include <lifev/core/fem/FESpace.hpp>
64 #include <lifev/core/fem/ReferenceFE.hpp>
65 
66 #include <lifev/eta/fem/ETFESpace.hpp>
67 
68 // includes for building the matrix graph
69 #include <Epetra_FECrsGraph.h>
70 #include <lifev/eta/expression/Integrate.hpp>
71 #include <lifev/eta/expression/BuildGraph.hpp>
72 
73 namespace LifeV
74 {
75 
77 {
78 public:
79  typedef Real return_Type;
80 
81  inline return_Type operator() (const Real& a)
82  {
83  return std::sqrt(a);
84  }
85 
89 };
90 
92 {
93 public:
94 
95  //@name Public Types
96  //@{
99 
100  typedef VectorEpetra vector_Type;
102 
105 
108 
111 
114 
117 
118  //@}
119 
120  //! @name Constructor and Destructor
121  //@{
122  //! Default Constructor
124 
125  //! ~Destructor
126  virtual ~StabilizationSUPGALE() {}
127 
128  //@}
129 
130  //! Build the graphs of each single block
131  void buildGraphs();
132 
133  //! Updates the jacobian matrix
134  /*!
135  * @param convective_velocity_previous_newton_step convective velocity from the previous Newton step
136  * @param velocity_previous_newton_step velocity from the previous Newton step
137  * @param pressure_previous_newton_step pressure from the previous Newton step
138  * @param velocity_rhs velocity term from approximation time derivative
139  */
140  void apply_matrix( const vector_Type& convective_velocity_previous_newton_step,
141  const vector_Type& velocity_previous_newton_step,
142  const vector_Type& pressure_previous_newton_step,
143  const vector_Type& velocity_rhs );
144 
145  //! Adds to the residual the contribution coming from the SUPG stabilization
146  /*!
147  * @param residual_velocity velocity component of the residual
148  * @param residual_pressure pressure component of the residual
149  * @param convective_velocity_previous_newton_step convective velocity from the previous Newton step
150  * @param velocity_previous_newton_step velocity from the previous Newton step
151  * @param pressure_previous_newton_step pressure from the previous Newton step
152  * @param velocity_rhs velocity term from approximation time derivative
153  */
154  void apply_vector( vectorPtr_Type& residual_velocity,
155  vectorPtr_Type& residual_pressure,
156  const vector_Type& convective_velocity_previous_newton_step,
157  const vector_Type& velocity_previous_newton_step,
158  const vector_Type& pressure_previous_newton_step,
159  const vector_Type& velocity_rhs);
160 
161  void setVelocitySpace(fespacePtr_Type velocityFESpace){ M_uFESpace = velocityFESpace;}
162 
163  void setPressureSpace(fespacePtr_Type pressureFESpace){ M_pFESpace = pressureFESpace;}
164 
165  //! Set the constant C_I for the supg
166  void setConstant (const int & value);
167 
168  //! Set the fluid density
169  void setDensity (const Real & density) { M_density = density;}
170 
171  //! Set the bdf order
172  void setBDForder (const Real & bdfOrder) { M_bdfOrder = bdfOrder;}
173 
174  //! Set the bdf order
175  void setAlpha (const Real & alpha) { M_alpha = alpha;}
176 
177  //! Set the fluid dynamic viscosity
178  void setViscosity (const Real & viscosity) { M_viscosity = viscosity;}
179 
180  //! Set the Epetra communicator
181  void setCommunicator (std::shared_ptr<Epetra_Comm> comm) { M_comm = comm;}
182 
183  //! Set the time step size
184  void setTimeStep (const Real & timestep) { M_timestep = timestep;}
185 
186  void setETvelocitySpace(const ETFESpacePtr_velocity & velocityEta_fespace){ M_fespaceUETA = velocityEta_fespace;}
187 
188  void setETpressureSpace(const ETFESpacePtr_pressure & pressureEta_fespace){ M_fespacePETA = pressureEta_fespace;}
189 
190  //! @name Getters
191  //@{
192 
193  matrixPtr_Type const& block_00() const
194  {
195  return M_block_00;
196  }
197 
198  matrixPtr_Type const& block_01() const
199  {
200  return M_block_01;
201  }
202 
203  matrixPtr_Type const& block_10() const
204  {
205  return M_block_10;
206  }
207 
208  matrixPtr_Type const& block_11() const
209  {
210  return M_block_11;
211  }
212 
213  void setUseGraph (const bool& useGraph) { M_useGraph = useGraph; }
214 
215  std::string label () { return M_label; }
216 
217  //@}
218 
219 private:
220 
221  //! @name Private Attributes
222  //@{
223 
224  //! finite element spaces for velocity and pressure
227 
230 
231  //! Epetra communicator
233 
234  //! fluid dynamic viscosity @f$\nu@f$
236 
237  //! fluid density @f$\nu@f$
239 
240  //! stabilization parameters for the momentum and continuity equations
245 
247 
248  // Graphs
253 
254  // Matrices
259 
261 
263 
264  //@}
265 }; // class StabilizationSUPGALE
266 
267 //! Factory create function
269 {
270  return new StabilizationSUPGALE();
271 }
272 namespace
273 {
275 }
276 
277 } // namespace LifeV
278 
279 #endif /* _STABILIZATIONSUPGALE_HPP_ */
std::shared_ptr< vector_Type > vectorPtr_Type
std::shared_ptr< ETFESpace_velocity > ETFESpacePtr_velocity
std::shared_ptr< Epetra_FECrsGraph > graphPtr_Type
void setConstant(const int &value)
Set the constant C_I for the supg.
matrixPtr_Type const & block_11() const
Get block11 of the stabilization matrix.
ETFESpacePtr_pressure M_fespacePETA
FESpace - Short description here please!
Definition: FESpace.hpp:78
ETFESpacePtr_velocity M_fespaceUETA
void setETvelocitySpace(const ETFESpacePtr_velocity &velocityEta_fespace)
Set Expression Template FE space for velocity.
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
Real M_timestep
stabilization parameters for the momentum and continuity equations
void setTimeStep(const Real &timestep)
Set the time step size.
virtual ~StabilizationSUPGALE()
~Destructor
SquareRoot_SUPGALE(const SquareRoot_SUPGALE &)
void setBDForder(const Real &bdfOrder)
Set the bdf order.
void setUseGraph(const bool &useGraph)
Set if using the graph.
void setCommunicator(std::shared_ptr< Epetra_Comm > comm)
Set the Epetra communicator.
std::string label()
Get name of stabilization being used.
Real M_viscosity
fluid dynamic viscosity
return_Type operator()(const Real &a)
void setDensity(const Real &density)
Set the fluid density.
Epetra_Import const & importer()
Getter for the Epetra_Import.
Definition: MapEpetra.cpp:394
void setAlpha(const Real &alpha)
Set the bdf order.
FESpace< mesh_Type, map_Type > fespace_Type
matrixPtr_Type const & block_01() const
Get block01 of the stabilization matrix.
matrixPtr_Type const & block_10() const
Get block10 of the stabilization matrix.
StabilizationSUPGALE()
Default Constructor.
ETFESpace< mesh_Type, map_Type, 3, 3 > ETFESpace_velocity
std::shared_ptr< Epetra_Comm > M_comm
Epetra communicator.
StabilizationSUPGALE * createStabilizationSUPGALE()
Factory create function.
fespacePtr_Type M_uFESpace
finite element spaces for velocity and pressure
void apply_vector(vectorPtr_Type &residual_velocity, vectorPtr_Type &residual_pressure, const vector_Type &convective_velocity_previous_newton_step, const vector_Type &velocity_previous_newton_step, const vector_Type &pressure_previous_newton_step, const vector_Type &velocity_rhs)
Adds to the residual the contribution coming from the SUPG stabilization.
std::shared_ptr< matrix_Type > matrixPtr_Type
void apply_matrix(const vector_Type &convective_velocity_previous_newton_step, const vector_Type &velocity_previous_newton_step, const vector_Type &pressure_previous_newton_step, const vector_Type &velocity_rhs)
Updates the jacobian matrix.
matrixPtr_Type const & block_00() const
Get block00 of the stabilization matrix.
double Real
Generic real data.
Definition: LifeV.hpp:175
void setETpressureSpace(const ETFESpacePtr_pressure &pressureEta_fespace)
Set Expression Template FE space for velocity.
RegionMesh< LinearTetra > mesh_Type
void setViscosity(const Real &viscosity)
Set the fluid dynamic viscosity.
ETFESpace< mesh_Type, map_Type, 3, 1 > ETFESpace_pressure
void setVelocitySpace(fespacePtr_Type velocityFESpace)
Set FE space for velocity.
std::shared_ptr< fespace_Type > fespacePtr_Type
class ETFESpace A light, templated version of the FESpace
Definition: ETFESpace.hpp:93
void buildGraphs()
Build the graphs of each single block.
void setPressureSpace(fespacePtr_Type pressureFESpace)
Set Expression Template FE space for velocity.
std::shared_ptr< ETFESpace_pressure > ETFESpacePtr_pressure