LifeV
FSIApplyOperatorNonConforming.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 Classes to hold algorithms for the mesh motion, for instance, involved in a ALE formulation.
29  @author D. Forti
30  @date 01-10-2007
31 
32  A class which implements the application of the FSI Jacobian matrix to a given vector
33  when nonconforming meshes are used. This class inherits from LifeV::LinearOperator.
34 
35  */
36 
37 
38 #include <boost/numeric/ublas/matrix.hpp>
39 
40 #include <Epetra_CrsMatrix.h>
41 #include <Epetra_Vector.h>
42 
43 #include <lifev/core/linear_algebra/BlockEpetra_Map.hpp>
44 #include <lifev/core/linear_algebra/LinearOperatorAlgebra.hpp>
45 
46 #include <lifev/navier_stokes_blocks/solver/NavierStokesPreconditionerOperator.hpp>
47 #include <lifev/navier_stokes_blocks/solver/aSIMPLEOperator.hpp>
48 
49 #include <lifev/navier_stokes_blocks/solver/NavierStokesOperator.hpp>
50 
51 #include <lifev/core/array/MatrixEpetra.hpp>
52 #include <lifev/core/linear_algebra/ApproximatedInvertibleRowMatrix.hpp>
53 #include <Teuchos_ParameterList.hpp>
54 #include <Teuchos_XMLParameterListHelpers.hpp>
55 
56 #include <lifev/core/interpolation/Interpolation.hpp>
57 #include <Teuchos_ParameterList.hpp>
58 #include <Teuchos_XMLParameterListHelpers.hpp>
59 #include <Teuchos_RCP.hpp>
60 #include <lifev/core/algorithm/LinearSolver.hpp>
61 
62 #ifndef _FSIAPPLYOPERATORNONCONFORMING_H_
63 #define _FSIAPPLYOPERATORNONCONFORMING_H_
64 
65 namespace LifeV
66 {
67 namespace Operators
68 {
69 
70 //! @class FSIApplyOperatorNonConforming
71 /*! @brief A class which implements the application of the FSI Jacobian matrix
72  * to a given vector when nonconforming meshes are used. This class inherits from LifeV::LinearOperator.
73  *
74  * The Transpose is not supported yet.
75  */
76 
78 {
79 public:
80  //! @name Public Types
81  //@{
82 
90  typedef super::comm_Type comm_Type;
91  typedef super::commPtr_Type commPtr_Type;
98 
104 
106 
107  //@}
108 
109  //! @name Constructors
110  //@{
111  //! Empty constructor
113  //@}
115 
116  //! @name SetUp
117  //@{
118  //! SetUp
119  /*!
120  */
121 
122  //! @name Set Methods
123  //@{
124 
125  //! set the communicator
126  void setComm ( const commPtr_Type & comm ) { M_comm = comm; };
127  //! \warning Transpose of this operator is not supported
128  int SetUseTranspose(bool UseTranspose){M_useTranspose = UseTranspose; return 0;}
129  //! set the domain map
130  void setDomainMap(const std::shared_ptr<BlockEpetra_Map> & domainMap){M_operatorDomainMap = domainMap;}
131  //! set the range map
132  void setRangeMap(const std::shared_ptr<BlockEpetra_Map> & rangeMap){M_operatorRangeMap = rangeMap;}
133  //@}
134 
135 
136  //! @name
137  //@{
138  //! Returns the Application of the Jacobian applied to \c X.
139  int Apply(const vector_Type &X, vector_Type &Y) const;
140  //! \warning No method \c Apply defined for this operator. It return an error code.
141  int ApplyInverse(const vector_Type &/*X*/, vector_Type &/*Y*/) const {return -1;};
142  //! \warning Infinity norm not defined for this operator
143  double NormInf() const {return -1.0;}
144  //@}
145 
146  // @name Attribute access functions
147  //@{
148  //! Return a character string describing the operator
149  const char * Label() const {return M_label.c_str();}
150  //! Return the current UseTranspose setting \warning Not Supported Yet.
151  bool UseTranspose() const {return M_useTranspose;}
152  //! Return false.
153  bool HasNormInf() const {return false;}
154  //! return a reference to the Epetra_Comm communicator associated with this operator
155  const comm_Type & Comm() const {return *M_comm;}
156  //! Returns the Epetra_Map object associated with the domain of this operator
157  const map_Type & OperatorDomainMap() const {return *(M_monolithicMap->map(Unique));}
158  //! Returns the Epetra_Map object associated with the range of this operator
159  const map_Type & OperatorRangeMap() const {return *(M_monolithicMap->map(Unique));}
160  //@}
161 
162  // @name Set
163  //@{
164 
165  //! Set the monolithic map
166  void setMonolithicMap(const mapEpetraPtr_Type& monolithicMap);
167 
168  //! Set the map of each component of the residual
169  void setMaps( const mapEpetraPtr_Type& fluid_velocity_map,
170  const mapEpetraPtr_Type& fluid_pressure_map,
171  const mapEpetraPtr_Type& structure_displacement_map,
172  const mapEpetraPtr_Type& lagrange_multipliers_map,
173  const mapEpetraPtr_Type& ALE_map);
174 
175  //! Set the shape derivatives
176  void setUseShapeDerivatives( bool use ) { M_useShapeDerivatives = use; };
177 
178  //! Set the shape derivatives
179  void setShapeDerivativesBlocks( const matrixEpetraPtr_Type & ShapeVelocity,
180  const matrixEpetraPtr_Type & ShapePressure);
181 
182  //! Copy the pointer of the interpolation objects
183  void setInterpolants( interpolationPtr_Type fluidToStructure,
184  interpolationPtr_Type structureToFluid,
185  bool useMasses);
186 
187  //! Set the blocks of the fluid Jacobian when stabilization is used
188  void setFluidBlocks ( const matrixEpetraPtr_Type & block00,
189  const matrixEpetraPtr_Type & block01,
190  const matrixEpetraPtr_Type & block10,
191  const matrixEpetraPtr_Type & block11);
192 
193  //! Set the blocks of the fluid Jacobian when stabilization is not used
194  void setFluidBlocks ( const matrixEpetraPtr_Type & block00,
195  const matrixEpetraPtr_Type & block01,
196  const matrixEpetraPtr_Type & block10);
197 
198  //! Set the block of the Jacobian of the structure
199  void setStructureBlock ( const matrixEpetraPtr_Type & structure ) { M_S = structure;};
200 
201  //! Set the block of the Jacobian of the ALE
202  void setALEBlock ( const matrixEpetraPtr_Type & ale ) { M_G = ale;};
203 
204  //! Set the datafile needed by the solver of the interface mass
205  void setDatafile( const GetPot& dataFile) { M_datafile = dataFile;};
206 
207  //! Set the timestep
208  void setTimeStep( Real timeStep ) { M_timeStep = timeStep;};
209 
210  //! Set the blocks of the fluid Jacobian when stabilization is used
211  void setInterfaceMassMatrices ( const matrixEpetraPtr_Type & fluid_interface_mass,
212  const matrixEpetraPtr_Type & structure_interface_mass);
213 
214  void setGamma (Real gamma){ M_gamma = gamma;};
215 
216  void setBeta (Real beta){ M_beta = beta;};
217 
218  void setBDFcoeff (Real bdf_coef){ M_coefficientBDF = bdf_coef; M_useBDFStructure = true; };
219 
220  //@}
221 
222  // @name Others
223  //@{
224 
225  //! Apply the inverse of the fluid interface mass to a vector
226  // defined on the fluid interface
228 
229  //@}
230 
231  //! Show information about the class
232  void showMe();
233 
234  // @name Set the parameters
235  //@{
236 
237  //@}
238 
239 private:
240 
241  // @name Set the parameters
242  //@{
243 
244 
245  //@}
246 
247  //! Create the domain and the range maps
248  void setMaps();
249 
251  //! Range Map
253 
254  //! Communicator
255  commPtr_Type M_comm;
256 
258 
259  // @name Maps
260  //@{
261 
268 
269  //@}
270 
271  // @name Offsets
272  //@{
273 
278 
279  //@}
280 
281  // @name Parameter list of each block
282  //@{
283 
284  //! Fluid blocks
285 
290 
291  //! Interface masses
292 
295 
296  //! Shape derivatives
297 
300 
301  //! Structure block
302 
304 
305  //! ALE block
306 
308 
309  //! Interpolants
310 
313 
314  //@}
315 
317 
318  //! datafile
320 
321  //! Label
322  const std::string M_label;
323 
324  //! Vectors needed for the Apply - input vectors associated to each part of the residual
330 
331  //! Vectors needed for the Apply - output vectors associated to the application of the
332  // Jacobian to each part of the residual
338 
339  //! If using the stabilization for the fluid
341 
342  //! If using the shape derivatives for the Jacobian
344 
346 
349 
351 
354 
355 };
356 
357 } /* end namespace Operators */
358 } //end namespace
359 #endif
VectorEpetra - The Epetra Vector format Wrapper.
void applyInverseInterfaceFluidMass(const VectorEpetraPtr_Type &X, VectorEpetraPtr_Type &Y) const
Apply the inverse of the fluid interface mass to a vector.
const map_Type & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this operator.
const comm_Type & Comm() const
return a reference to the Epetra_Comm communicator associated with this operator
int ApplyInverse(const vector_Type &, vector_Type &) const
bool M_useShapeDerivatives
If using the shape derivatives for the Jacobian.
void importFromHDF5(std::string const &fileName, std::string const &matrixName="matrix")
Read a matrix from a HDF5 (.h5) file.
void setDomainMap(const std::shared_ptr< BlockEpetra_Map > &domainMap)
set the domain map
void setInterfaceMassMatrices(const matrixEpetraPtr_Type &fluid_interface_mass, const matrixEpetraPtr_Type &structure_interface_mass)
Set the blocks of the fluid Jacobian when stabilization is used.
void setRangeMap(const std::shared_ptr< BlockEpetra_Map > &rangeMap)
set the range map
void setInterpolants(interpolationPtr_Type fluidToStructure, interpolationPtr_Type structureToFluid, bool useMasses)
Copy the pointer of the interpolation objects.
void setMaps()
Create the domain and the range maps.
int Apply(const vector_Type &X, vector_Type &Y) const
Returns the Application of the Jacobian applied to X.
void setFluidBlocks(const matrixEpetraPtr_Type &block00, const matrixEpetraPtr_Type &block01, const matrixEpetraPtr_Type &block10)
Set the blocks of the fluid Jacobian when stabilization is not used.
Abstract class which defines the interface of a Linear Operator.
interpolationPtr_Type M_FluidToStructureInterpolant
Interpolants.
const map_Type & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this operator.
void updateInverseJacobian(const UInt &iQuadPt)
PreconditionerIfpack(std::shared_ptr< Epetra_Comm > comm=std::shared_ptr< Epetra_Comm >(new Epetra_MpiComm(MPI_COMM_WORLD)))
Empty constructor.
std::shared_ptr< VectorEpetra_Type > M_Y_velocity
Vectors needed for the Apply - output vectors associated to the application of the.
Epetra_Import const & importer()
Getter for the Epetra_Import.
Definition: MapEpetra.cpp:394
const char * Label() const
Return a character string describing the operator.
void setStructureBlock(const matrixEpetraPtr_Type &structure)
Set the block of the Jacobian of the structure.
A class which implements the application of the FSI Jacobian matrix to a given vector when nonconform...
matrixEpetraPtr_Type M_fluid_interface_mass
Interface masses.
std::shared_ptr< VectorEpetra_Type > M_X_velocity
Vectors needed for the Apply - input vectors associated to each part of the residual.
void setMonolithicMap(const mapEpetraPtr_Type &monolithicMap)
Set the monolithic map.
void setFluidBlocks(const matrixEpetraPtr_Type &block00, const matrixEpetraPtr_Type &block01, const matrixEpetraPtr_Type &block10, const matrixEpetraPtr_Type &block11)
Set the blocks of the fluid Jacobian when stabilization is used.
void setUseShapeDerivatives(bool use)
Set the shape derivatives.
double Real
Generic real data.
Definition: LifeV.hpp:175
Teuchos::RCP< Teuchos::ParameterList > parameterListRCP_Type
bool UseTranspose() const
Return the current UseTranspose setting.
Preconditioner - Abstract preconditioner class.
void setDatafile(const GetPot &dataFile)
Set the datafile needed by the solver of the interface mass.
void setALEBlock(const matrixEpetraPtr_Type &ale)
Set the block of the Jacobian of the ALE.
void setComm(const commPtr_Type &comm)
set the communicator
void setShapeDerivativesBlocks(const matrixEpetraPtr_Type &ShapeVelocity, const matrixEpetraPtr_Type &ShapePressure)
Set the shape derivatives.
void setMaps(const mapEpetraPtr_Type &fluid_velocity_map, const mapEpetraPtr_Type &fluid_pressure_map, const mapEpetraPtr_Type &structure_displacement_map, const mapEpetraPtr_Type &lagrange_multipliers_map, const mapEpetraPtr_Type &ALE_map)
Set the map of each component of the residual.
std::shared_ptr< Teuchos::ParameterList > parameterListPtr_Type
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
std::shared_ptr< BlockEpetra_Map > M_operatorRangeMap
Range Map.
bool M_useStabilization
If using the stabilization for the fluid.