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