LifeV
FSISolver.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  \include ../../doc/api/bibliography/newton
29  \include ../../doc/api/bibliography/fluidstructure
30 
31  @file
32  @brief solver class for FSI
33 
34  @author Christophe Prud'homme
35  @contributor Simone Deparis <simone.deparis@epfl.ch>
36  @contributor Gilles Fourestey <fourestey@cscs.ch>
37  @contributor Paolo Crosetto <paolo.crosetto@epfl.ch>
38  @maintainer Paolo Crosetto <paolo.crosetto@epfl.ch>
39 
40  @date 10-12-2010
41 
42  This class handles the FSI iterations, it is generalized in the context of geometric multiscale applications by the
43  class MS_ModelFSI, thus it will become obsolete.
44  */
45 
46 
47 
48 #ifndef __FSISolver_H
49 #define __FSISolver_H 1
50 
51 
52 #include <Epetra_ConfigDefs.h>
53 #ifdef EPETRA_MPI
54 #include <Epetra_MpiComm.h>
55 #else
56 #include <Epetra_SerialComm.h>
57 #endif
58 
59 
60 #include <lifev/core/LifeV.hpp>
61 
62 //#include <life/lifealg/newton.hpp>
63 
64 #include <lifev/fsi/solver/FSIOperator.hpp>
65 
66 namespace LifeV
67 {
68 
69 /*!
70  \class FSISolver
71  \brief solver for Fluid-Structure Interaction
72 
73  This class handles the FSI iterations, it is generalized in the context of geometric multiscale applications by the
74  class MS_ModelFSI, thus it will become obsolete.
75 
76  \c FSISolver uses the FSI operators whose base class is \c FSI to
77  solve the FSI problem. It behaves from an interface point of view
78  very much like a NS solver or solid solver.
79 
80  The temporal loop is externalized: the member function \c
81  iterate(time) must be called at each time steps. The time data is
82  the one associated with the fluid.
83 
84  \c FSISolver allows to change the FSI operator using the \c setFSI(name)
85  member function that needs the \c name of the new FSI operator to be used.
86 
87  \todo Generic fluid and Structure solvers
88  \todo Allow delayed initialization
89 
90  @see FSI
91 */
92 class FSISolver
93 {
94 public:
95 
96  /** @name Typedefs
97  */
98  //@{
99 
100  typedef FSIOperator FSIOper_Type;
101  typedef std::shared_ptr<FSIOper_Type> FSIOperPtr_Type;
102 
103  typedef FSIOperator::mesh_Type mesh_Type;
104 
105  typedef FSIOperator::fluid_Type fluid_Type;
106  typedef FSIOperator::solid_Type solid_Type;
107 
108  typedef fluid_Type::function_Type fluidFunction_Type;
109  typedef solid_Type::function solidFunction_Type;
110 
111  typedef fluid_Type::source_Type fluidSource_Type;
112  typedef solid_Type::source_Type solidSource_Type;
113 
114  typedef FSIOperator::fluidBchandlerPtr_Type fluidBchandlerPtr_Type;
115  typedef FSIOperator::solidBchandlerPtr_Type solidBchandlerPtr_Type;
116 
117  typedef FSIOperator::fluidBchandler_Type fluidBchandler_Type;
118  typedef FSIOperator::solidBchandler_Type solidBchandler_Type;
119 
120  typedef fluid_Type::data_Type fluidData_Type;
121  typedef solid_Type::data_Type solidData_Type;
122 
123  typedef FSIOperator::dataPtr_Type dataPtr_Type;
124 
125  typedef FSIOperator::vector_Type vector_Type;
126  typedef FSIOperator::vectorPtr_Type vectorPtr_Type;
127 
128  //@}
129 
130  /** @name Constructors, destructor
131  */
132  //@{
133 
134  //! default/only constructor for the FSI solver
135  /*! \attention the last argument of the constructor gives a
136  * possibility to override the operator that is given by the \c
137  * data_file. An empty string (default) means that it uses the
138  * operator defined in \c data_file
139  * \todo allow to change the FSI operator on the fly
140  */
141  FSISolver( );
142 
143  //! default/only destructor for the FSI solver
144  virtual ~FSISolver() {}
145 
146  //@}
147 
148 
149 
150  /** @name Get Functions
151  */
152  //@{
153 
154  //! get the FSI operator
155  FSIOperPtr_Type const& FSIOper() const
156  {
157  return M_oper;
158  }
159  //FSIOperPtr_Type FSIOper() const { return M_oper; }
160 
161  //! get the displacement, which will be on the solidInterfaceMap
162  LIFEV_DEPRECATED ( const vector_Type& displacement() const )
163  {
164  if ( M_epetraWorldComm->MyPID() == 0 )
165  {
166  std::cerr << std::endl << "Warning: FSISolver::displacement() is deprecated!" << std::endl
167  << " You should not access the solution inside FSISolver or FSIOperator!" << std::endl;
168  }
169 
170  return M_oper->solution();
171  }
172 
173  //! get access to the \c bchandler_type for the velocity
174  // fluidBchandlerPtr_Type& bcHandlerU() { return M_BCh_u; }
175 
176  //! get access to the \c bchandler_type for the velocity
177  // fluidBchandlerPtr_Type const& bcHandlerU() const { return M_BCh_u; }
178 
179  //! get access to the \c bchandler_type for the displacement
180  // solidBchandlerPtr_Type const& bcHandlerD() const { return M_BCh_d; }
181 
182  bool isFluid()
183  {
184  return M_oper->isFluid();
185  }
186  bool isSolid()
187  {
188  return M_oper->isSolid();
189  }
190 
191  //@}
192 
193 
194 
195  /** @name Set Functions
196  */
197  //@{
198 
199  void setSourceTerms ( const fluidSource_Type& fluidSource,
200  const solidSource_Type& solidSource );
201 
202  //! set the FSI operator to be used to couple the fluid and the structure
203  /*!
204  * \param __op FSI operator name
205  */
206  void setFSI ( );
207 
208  void setFluidBC ( const fluidBchandlerPtr_Type& bc_fluid );
209  void setLinFluidBC ( const fluidBchandlerPtr_Type& bc_dfluid );
210  void setInvLinFluidBC ( const fluidBchandlerPtr_Type& bc_dfluid_inv );
211  void setHarmonicExtensionBC ( const fluidBchandlerPtr_Type& bc_he );
212  void setSolidBC ( const solidBchandlerPtr_Type& bc_solid );
213  void setLinSolidBC ( const solidBchandlerPtr_Type& bc_dsolid );
214  void setInvLinSolidBC ( const solidBchandlerPtr_Type& bc_dsolid_inv );
215  //!\todo{kill this method}
216  void setFluxBC (const fluidBchandlerPtr_Type& bc_fluid);
217  //!\todo{kill this method}
218  void setRobinBC (const fluidBchandlerPtr_Type& bc_fluid);
219 
220  //@}
221 
222 
223 
224  /** @name Methods
225  */
226  //@{
227 
228  void setData ( const dataPtr_Type& data );
229 
230  void setup( );
231 
232 
233  virtual void initialize (std::vector<vectorPtr_Type> u0 = std::vector<vectorPtr_Type> (0), std::vector<vectorPtr_Type> ds0 = std::vector<vectorPtr_Type> (0), std::vector<vectorPtr_Type> df0 = std::vector<vectorPtr_Type> (0) );
234 
235  virtual void initializeMonolithicOperator (std::vector<vectorPtr_Type> u0 = std::vector<vectorPtr_Type> (0), std::vector<vectorPtr_Type> ds0 = std::vector<vectorPtr_Type> (0), std::vector<vectorPtr_Type> df0 = std::vector<vectorPtr_Type> (0) );
236 
237  LIFEV_DEPRECATED ( void iterate() );
238 
239  void iterate ( vectorPtr_Type& solution );
240 
241  void showMe() {}
242 
243 private:
244 
245  //! forbid copy constructor
246  FSISolver ( FSISolver const& );
247 
248  //! forbid copy operator
249  FSISolver& operator= ( FSISolver const& );
250 
251  //Private members
252  FSIOperPtr_Type M_oper;
253 
254  dataPtr_Type M_data;
255 
256  std::shared_ptr<MapEpetra> M_fluidInterfaceMap;
257  std::shared_ptr<MapEpetra> M_solidInterfaceMap;
258 
259  std::shared_ptr<Epetra_MpiComm> M_epetraComm;
260  std::shared_ptr<Epetra_MpiComm> M_epetraWorldComm;
261  std::shared_ptr<MPI_Comm> M_localComm;
262  std::shared_ptr<MPI_Comm> M_interComm;
263 
264  std::ofstream M_out_iter;
265  std::ofstream M_out_res;
266 
267  // data_fluid M_dataFluid;
268  // data_solid M_dataSolid;
269 
270  // be careful here: the BCs must be constructed before the solvers
271  // fluidBchandlerPtr_Type M_BCh_u;
272  // fluidBchandlerPtr_Type M_BCh_d;
273  // fluidBchandlerPtr_Type M_BCh_mesh;
274 
275  // fluidBchandlerPtr_Type M_BCh_du;
276  // fluidBchandlerPtr_Type M_BCh_dz;
277 
278 
279  // FESpace<mesh_Type, MapEpetra>* M_uFESpace;
280  // FESpace<mesh_Type, MapEpetra>* M_pFESpace;
281  // FESpace<mesh_Type, MapEpetra>* M_dFESpace;
282  // FESpace<mesh_Type, MapEpetra>* M_mmFESpace;
283 
284  // partitionMesh< FSI::mesh_Type >* M_fluidMeshPart;
285  // partitionMesh< FSI::mesh_Type >* M_solidMeshPart;
286 
287  // FSI::fluid_type M_fluid;
288  // FSI::solid_type M_solid;
289  // FSI::meshmotion_type M_meshMotion;
290 
291  // bool M_fluid;
292  // bool M_solid;
293 
294  // Epetra_MpiComm* M_epetraSolidComm;
295 };
296 
297 } // Namespace LifeV
298 #endif /* __FSISolver_H */
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
#define LIFEV_DEPRECATED(func)
Definition: LifeV.hpp:117