LifeV
MonolithicBlockMatrixRN.hpp
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 //@HEADER
3 /*
4 *******************************************************************************
5 
6  Copyright (C) 2004, 2005, 2007 EPFL, Politecnico di Milano, INRIA
7  Copyright (C) 2010 EPFL, Politecnico di Milano, Emory University
8 
9  This file is part of LifeV.
10 
11  LifeV is free software; you can redistribute it and/or modify
12  it under the terms of the GNU Lesser General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  LifeV is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  Lesser General Public License for more details.
20 
21  You should have received a copy of the GNU Lesser General Public License
22  along with LifeV. If not, see <http://www.gnu.org/licenses/>.
23 
24 *******************************************************************************
25 */
26 //@HEADER
27 
28 /*!
29  @file MonolithicBlockMatrixRN.hpp
30  @brief file containing a class for handling a 2-blocks matrix with Robin-Neumann coupling
31 
32  @author Paolo Crosetto <crosetto@iacspc70.epfl.ch>
33  @date 09 Jul 2010
34 
35  */
36 
37 #ifndef BLOCKMATRIXRN_H
38 #define BLOCKMATRIXRN_H 1
39 
40 #include <lifev/core/LifeV.hpp>
41 
42 #include <lifev/core/LifeV.hpp>
43 
44 #include <lifev/fsi/solver/MonolithicBlockMatrix.hpp>
45 #include <lifev/fsi/solver/MonolithicRobinInterface.hpp>
46 
47 namespace LifeV
48 {
49 
50 //! MonolithicBlockMatrixRN - class for handling a 2-blocks matrix with Robin-Neumann coupling
51 /*!
52  @author Paolo Crosetto
53 
54  This class derives both from MonolithicBlock, which is the base class for the block operators, and from MonolithicRobinInterface,
55  which is a class holding some general methods and attributes for the robin coupling.
56 
57  NOTE: this class has been tested for both the GE and GI time discretizations
58  (method = monolithicGE and method = monolithicGI).
59  NOTE: as the same block matrices are shared between the system matrix and the preconditioner, the preconditioner
60  choices available are in principle automatically adapted to the RN case. The preconditioners tested for this case
61  are the modular composedDN and the algebraic additive Schwarz AdditiveSchwarz.
62  */
63 class MonolithicBlockMatrixRN : public MonolithicBlockMatrix, private MonolithicRobinInterface
64 {
65 public:
66 
67  //! @name Public Types
68  //@{
69  typedef MonolithicBlockMatrix super_Type;
70  typedef MonolithicRobinInterface superRobin;
71  //@}
72 
73 
74  //! @name Constructor & Destructor
75  //@{
76 
77  //! Empty Constructor
78  MonolithicBlockMatrixRN (const std::vector<Int>& flags /*UInt flag*/) :
79  super_Type (flags),
80  superRobin()
81  {}
82 
83  //! Destructor
84  ~MonolithicBlockMatrixRN() {}
85  //@}
86 
87  //! @name Public methods
88  //@{
89 
90 
91  //! sets the data relative to Robin (e.g. the coefficients \f$\alpha_f\f$ and \f$\alpha_s\f$).
92  void setDataFromGetPot ( const GetPot& data, const std::string& section );
93 
94  //! Adds to the r.h.s. the part due to the Robin Coupling and runs MonolithicBlockMatrix::GlobalAssemble()
95  void GlobalAssemble();
96 
97 
98  //! Computes the specific coupling for a block
99  /*!
100  computes all the coupling blocks specific for the chosen preconditioner. The coupling is handled
101  through an augmented formulation, introducing new variables (multipliers). Needs as input: the global map of the problem,
102  the FESpaces of the subproblems to be coupled with their offsets, a std::map holding the two numerations of the
103  interface between the two subproblems (the numeration can be different but the nodes must be matching in each
104  subdomain), an EpetraVector defined on the multipliers map containing the corresponding dof at the interface (NB: the multipliers map should be constructed from the second numeration in the std::map).
105  Note that the FESpaces and the offsets have to be set before calling this method.
106  @param map the map of the global problem
107  @param locDofMap std::map with the correspondence between the interface dofs for the two different maps in
108  the subproblems
109  @param numerationInterface vector containing the correspondence of the Lagrange multipliers with the interface dofs
110  @param timeStep the time step
111  @param coefficient coefficient, usually is the term multiplying the mass in the time discretization
112  @param couplingFlag integer parameter identifying which block is coupled with which. See the method 'couplingMatrix' in @see MonolithicBlock class for a more detailed explanation.
113  */
114  void coupler (mapPtr_Type& map,
115  const std::map<ID, ID>& locDofMap,
116  const vectorPtr_Type& numerationInterface,
117  const Real& timeStep,
118  const Real& coefficient,
119  const Real& rescaleFactor,
120  UInt couplingFlag);
121 
122  //!Computes the coupling
123  void coupler (mapPtr_Type& map,
124  const std::map<ID, ID>& locDofMap,
125  const vectorPtr_Type& numerationInterface,
126  const Real& timeStep,
127  const Real& coefficient,
128  const Real& rescaleFactor);
129 
130  //! Sums all the blocks and the couplings into the system matrix, adds the robin coupling part
131  void blockAssembling();
132 
133  //! sets the matrix where the Robin contribution will be assembled (which have to passed from outside) and the
134  /*! right hand side vector of the linear system, which will be updated with the Robin part.
135  */
136  void setRobin ( matrixPtr_Type& matrix, vectorPtr_Type& vec )
137  {
138  setRobinMatrix ( matrix );
139  setRobinRhs ( vec );
140  }
141 
142  //! sets the matrix where the Robin contribution will be assembled
143  void setRobin ( matrixPtr_Type& matrix )
144  {
145  setRobinMatrix ( matrix );
146  }
147  //@}
148 
149 
150  //!@name Factory Method
151  //@{
152  static MonolithicBlockMatrix* createAdditiveSchwarzRN()
153  {
154  const Int couplings[] = { 15, 0, 16 };//to modify (15 to 7) to neglect the coupling (and solve Navier--Stokes)
155  const std::vector<Int> couplingVector (couplings, couplings + 3);
156  return new MonolithicBlockMatrixRN (couplingVector);
157  }
158  //@}
159 
160 private:
161 
162 };
163 
164 } // Namespace LifeV
165 
166 #endif /* BLOCKMATRIXRN_H */
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
int32_type Int
Generic integer data.
Definition: LifeV.hpp:188
double Real
Generic real data.
Definition: LifeV.hpp:175
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191