LifeV
PreconditionerSIMPLE.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 PreconditionerSIMPLE
30 
31  @author Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
32  @maintainer Gwenol Grandperrin <gwenol.grandperrin@epfl.ch>
33 
34  @date 24-01-2011
35  */
36 
37 #ifndef PRECONDITIONERSIMPLE_HPP
38 #define PRECONDITIONERSIMPLE_HPP 1
39 
40 #include <string>
41 
42 #include <boost/shared_ptr.hpp>
43 
44 #include <Teuchos_ParameterList.hpp>
45 
46 #include <lifev/core/filter/GetPot.hpp>
47 #include <lifev/core/array/MatrixEpetra.hpp>
48 #include <lifev/core/array/VectorEpetra.hpp>
49 #include <lifev/core/algorithm/PreconditionerComposition.hpp>
50 #include <lifev/core/array/MatrixEpetraStructured.hpp>
51 #include <lifev/core/solver/ADRAssembler.hpp>
52 #include <lifev/core/fem/FESpace.hpp>
53 #include <lifev/core/mesh/RegionMesh.hpp>
54 
55 namespace LifeV
56 {
57 
58 //! PreconditionerSIMPLE
59 /*!
60  * @author Gwenol Grandperrin
61  *
62  * The PreconditionerSIMPLE class provides the SIMPLE block preconditioner
63  */
66 {
67 public:
68 
69  /** @name Public Types
70  */
71  //@{
80 
83 
84  typedef ComposedOperator<Preconditioner> preconditioner_Type;
86 
88 
90  //@}
91 
92 
93  //! @name Constructors, destructor
94  //@{
95  //! default constructor
96 #ifdef HAVE_MPI
98 #else
99  PreconditionerSIMPLE ( std::shared_ptr<Epetra_Comm> comm = std::shared_ptr<Epetra_Comm> ( new Epetra_SerialComm ) );
100 #endif
101 
102  //! constructor from matrix A.
103  //! @param A EpetraMatrix<double> matrix upon which construct the preconditioner
104  // IfpackPreconditioner( matrixPtr_Type& A );
105 
106  //! default destructor
107  virtual ~PreconditionerSIMPLE();
108 
109  //@}
110 
111  //! @name Methods
112  //@{
113  void createParametersList ( list_Type& list,
114  const GetPot& dataFile,
115  const std::string& section,
116  const std::string& subsection = "SIMPLE" );
117 
118  //! Return an estimation of the conditionement number of the preconditioner
119  double condest ();
120 
121  //! Build the preconditioner
123 
124  //@}
125 
126  //! @name Get Methods
127  //@{
128  int numBlocksRows() const;
129  int numBlocksColumns() const;
130  //@}
131 
132  //! @name Set Methods
133  //@{
134  //! Setter using GetPot
135  /*!
136  This method use GetPot to load data from a file and then set
137  the preconditioner.
138  @param dataFile is a GetPot dataFile
139  @param section is the section containing the data
140  */
141  void setDataFromGetPot ( const GetPot& dataFile,
142  const std::string& section );
143 
144  //! Method to setup the solver using Teuchos::ParameterList
145  /*!
146  @param list Teuchos::ParameterList object
147  */
148  virtual void setParameters ( Teuchos::ParameterList& list );
149 
150  //! Setter for the FESpace
151  /*!
152  This method set the pointer for the FESpaces needed
153  for the construction of the operators Ap, Fp and Mp.
154  @param uFESpace std::shared_ptr on the FESpace for the velocity
155  @param pFESpace std::shared_ptr on the FESpace for the pressure
156  */
157  void setFESpace ( FESpacePtr_Type uFESpace, FESpacePtr_Type pFESpace );
158 
159  //! Setter for the damping factor
160  /*!
161  This method set damping factor used to build the preconditioner
162  @param dampingFactor Damping factor
163  */
164  void setDampingFactor ( const Real& dampingFactor );
165 
166  //@}
167 
168 protected:
169 
174 
176 
177  std::string M_SIMPLEType;
178 
179  // todo: Remove the member dataFile (bad programmation)
181  std::string M_fluidPrec;
182  std::string M_fluidDataSection;
183  std::string M_schurPrec;
184  std::string M_schurDataSection;
185 
186 private:
190 
191 };
192 
194 {
195  return new PreconditionerSIMPLE();
196 }
197 namespace
198 {
200 }
201 
202 } // namespace LifeV
203 
204 #endif /* PRECONDITIONERSIMPLE_HPP */
MatrixEpetraStructured< Real > matrixBlock_Type
VectorEpetra - The Epetra Vector format Wrapper.
std::shared_ptr< FESpace< mesh_Type, map_Type > > FESpacePtr_Type
std::shared_ptr< super_Type > superPtr_Type
PreconditionerSIMPLE(std::shared_ptr< Epetra_Comm > comm=std::shared_ptr< Epetra_Comm >(new Epetra_MpiComm(MPI_COMM_WORLD)))
default constructor
PreconditionerSIMPLE(const PreconditionerSIMPLE &P)
Teuchos::ParameterList list_Type
Preconditioner * createSIMPLE()
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
std::shared_ptr< vector_Type > vectorPtr_Type
void updateInverseJacobian(const UInt &iQuadPt)
std::shared_ptr< preconditioner_Type > preconditionerPtr_Type
RegionMesh< LinearTetra > mesh_Type
PreconditionerComposition(std::shared_ptr< Epetra_Comm > comm=std::shared_ptr< Epetra_Comm >(new Epetra_MpiComm(MPI_COMM_WORLD)))
Constructor.
MatrixEpetraStructuredView< Real > matrixBlockView_Type
double condest()
Return an estimation of the conditionement number of the preconditioner.
Epetra_Import const & importer()
Getter for the Epetra_Import.
Definition: MapEpetra.cpp:394
int buildPreconditioner(matrixPtr_Type &A)
Build the preconditioner.
MatrixEpetraStructuredView - class representing a block in a MatrixEpetraStructured.
double Real
Generic real data.
Definition: LifeV.hpp:175
Preconditioner - Abstract preconditioner class.
PreconditionerSIMPLE(const std::shared_ptr< PreconditionerSIMPLE > &)
void setFESpace(FESpacePtr_Type uFESpace, FESpacePtr_Type pFESpace)
Setter for the FESpace.
MatrixEpetraStructured - class of block matrix.
virtual void setParameters(Teuchos::ParameterList &list)
Method to setup the solver using Teuchos::ParameterList.
ComposedOperator< Preconditioner > preconditioner_Type
void setDampingFactor(const Real &dampingFactor)
Setter for the damping factor.
std::shared_ptr< matrix_Type > matrixPtr_Type
virtual ~PreconditionerSIMPLE()
constructor from matrix A.