LifeV
NavierStokesPreconditionerOperator.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 NavierStokesPreconditionerOperator - Abstract interface for preconditioners for Navier-Stokes
30 
31  @author Davide Forti <davide.forti@epfl.ch>
32  @date 08-12-2014
33 
34  @maintainer Davide Forti <davide.Forti@epfl.ch>
35  */
36 
37 #ifndef NSPRECONDITIONEROPERATOR_HPP
38 #define NSPRECONDITIONEROPERATOR_HPP 1
39 
40 #include <lifev/core/linear_algebra/LinearOperatorAlgebra.hpp>
41 #include <lifev/core/util/Factory.hpp>
42 #include <lifev/core/util/FactorySingleton.hpp>
43 #include <Teuchos_ParameterList.hpp>
44 #include <Teuchos_XMLParameterListHelpers.hpp>
45 #include <lifev/core/array/MatrixEpetra.hpp>
46 #include <lifev/core/linear_algebra/BlockEpetra_Map.hpp>
47 
48 #include <Teuchos_ParameterList.hpp>
49 #include <Teuchos_XMLParameterListHelpers.hpp>
50 #include <lifev/core/array/VectorEpetra.hpp>
51 
52 namespace LifeV
53 {
54 namespace Operators
55 {
56 
57 class NavierStokesPreconditionerOperator : public LinearOperatorAlgebra
58 {
59 public:
60 
61  typedef MatrixEpetra<Real> matrixEpetra_Type;
62 
63  typedef std::shared_ptr<matrixEpetra_Type> matrixEpetraPtr_Type;
64 
65  typedef Epetra_Comm comm_Type;
66 
67  typedef std::shared_ptr<comm_Type> commPtr_Type;
68 
69  typedef Epetra_Map map_Type;
70 
71  typedef std::shared_ptr<map_Type> mapPtr_Type;
72 
73  typedef std::shared_ptr<const map_Type> constMapPtr_Type;
74 
75  typedef Epetra_Operator operator_Type;
76 
77  typedef std::shared_ptr<operator_Type> operatorPtr_Type;
78 
79  typedef std::shared_ptr<Teuchos::ParameterList> parameterListPtr_Type;
80 
81  NavierStokesPreconditionerOperator();
82 
83  ~NavierStokesPreconditionerOperator();
84 
85  //! If set true, transpose of this operator will be applied.
86  /*! This flag allows the transpose of the given operator to be used implicitly. Setting this flag
87  affects only the Apply() and ApplyInverse() methods. If the implementation of this interface
88  does not support transpose use, this method should return a value of -1.
89 
90  \param In
91  UseTranspose -If true, multiply by the transpose of operator, otherwise just use operator.
92 
93  \return Integer error code, set to 0 if successful. Set to -1 if this implementation does not support transpose.
94  */
95  virtual int SetUseTranspose(bool UseTranspose){};
96 
97  //! @name Mathematical functions
98  //@{
99 
100  //! Returns the result of a raw_operator applied to a raw_vector X in Y.
101  /*!
102  \param In
103  X - A raw_vector of dimension NumVectors to multiply with matrix.
104  \param Out
105  Y -A raw_vector of dimension NumVectors containing result.
106 
107  \return Integer error code, set to 0 if successful.
108  */
109  virtual int Apply(const vector_Type& X, vector_Type& Y) const {};
110 
111  //! Returns the result of a raw_operator inverse applied to an raw_vector X in Y.
112  /*!
113  \param In
114  X - A raw_vector of dimension NumVectors to solve for.
115  \param Out
116  Y -A raw_vector of dimension NumVectors containing result.
117 
118  \return Integer error code, set to 0 if successful.
119 
120  \warning In order to work with AztecOO, any implementation of this method must
121  support the case where X and Y are the same object.
122  */
123  virtual int ApplyInverse(const vector_Type& X, vector_Type& Y) const {};
124 
125  //! Returns the infinity norm of the global matrix.
126  /* Returns the quantity \f$ \| A \|_\infty\f$ such that
127  \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f].
128 
129  \warning This method must not be called unless HasNormInf() returns true.
130  */
131  virtual double NormInf() const {};
132 
133  //! Returns a character string describing the operator
134  virtual const char * Label() const {};
135 
136  //! Returns the current UseTranspose setting.
137  virtual bool UseTranspose() const {};
138 
139  //! Returns true if the \e this object can provide an approximate Inf-norm, false otherwise.
140  virtual bool HasNormInf() const {};
141 
142  //! Returns a pointer to the Epetra_Comm communicator associated with this operator.
143  virtual const comm_Type & Comm() const {};
144 
145  //! Returns the raw_map object associated with the domain of this operator.
146  virtual const map_Type & OperatorDomainMap() const {};
147 
148  //! Returns the raw_map object associated with the range of this operator.
149  virtual const map_Type & OperatorRangeMap() const {};
150  //@}
151 
152  //! @name Methods used by the preconditioners that derive from here
153  //@{
154 
155  virtual void setUp ( const matrixEpetraPtr_Type & F,
156  const matrixEpetraPtr_Type & B,
157  const matrixEpetraPtr_Type & Btranspose ){};
158 
159  virtual void setUp ( const matrixEpetraPtr_Type & F,
160  const matrixEpetraPtr_Type & B,
161  const matrixEpetraPtr_Type & Btranspose,
162  const matrixEpetraPtr_Type & D ){};
163 
164  virtual void setOptions ( const Teuchos::ParameterList& solversOptions){};
165 
166  virtual void setDomainMap ( const std::shared_ptr<BlockEpetra_Map> & domainMap){};
167 
168  virtual void setRangeMap ( const std::shared_ptr<BlockEpetra_Map> & rangeMap){};
169 
170  virtual void updateApproximatedMomentumOperator ( ){};
171 
172  virtual void updateApproximatedSchurComplementOperator ( ){};
173 
174  virtual void updateApproximatedPressureMassOperator ( ){};
175 
176  virtual void setUp ( const matrixEpetraPtr_Type & F, const matrixEpetraPtr_Type & B, const matrixEpetraPtr_Type & Btranspose,
177  const matrixEpetraPtr_Type & Fp, const matrixEpetraPtr_Type & Mp, const matrixEpetraPtr_Type & Mu){};
178 
179  virtual void setMomentumOptions(const parameterListPtr_Type & _oList) {};
180 
181  virtual void setSchurOptions(const parameterListPtr_Type & _oList) {};
182 
183  virtual void setPressureMassOptions(const parameterListPtr_Type & _oList) {};
184 
185  virtual matrixEpetraPtr_Type const& F() const {};
186 
187  virtual matrixEpetraPtr_Type const& B() const {};
188 
189  virtual matrixEpetraPtr_Type const& Btranspose() const {};
190 
191  //! Returns the High Order Yosida approximation of the inverse pressure Schur Complement applied to \c (Xu, Xp).
192  virtual int ApplyInverse( VectorEpetra const& X_velocity,
193  VectorEpetra const& X_pressure,
194  VectorEpetra & Y_velocity,
195  VectorEpetra & Y_pressure) const {};
196 
197 
198 private:
199 
200 };
201 
202 inline NavierStokesPreconditionerOperator::NavierStokesPreconditionerOperator()
203 {
204 }
205 
206 inline NavierStokesPreconditionerOperator::~NavierStokesPreconditionerOperator()
207 {
208 }
209 
210 typedef FactorySingleton<Factory<NavierStokesPreconditionerOperator, std::string> > NSPreconditionerFactory;
211 
212 } // namespace Operators
213 
214 } // namespace LifeV
215 
216 
217 #endif // NSPRECONDITIONEROPERATOR_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.
Abstract class which defines the interface of a Linear Operator.
void updateInverseJacobian(const UInt &iQuadPt)
double Real
Generic real data.
Definition: LifeV.hpp:175