LifeV
OneDFSIBC.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 File containing a class for the boundary conditions of the 1D model.
30  *
31  * @version 1.0
32  * @date 01-28-2006
33  * @author Lucia Mirabella <lucia@mathcs.emory.edu>
34  * @author Tiziano Passerini <tiziano@mathcs.emory.edu>
35  *
36  * @version 2.0
37  * @date 20-04-2010
38  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
39  *
40  * @contributors Ricardo Ruiz-Baier <ricardo.ruiz@epfl.ch>
41  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
42  */
43 
44 #ifndef OneDFSIBC_H
45 #define OneDFSIBC_H
46 
47 #include <lifev/one_d_fsi/function/OneDFSIFunctionSolverDefined.hpp>
48 #include <lifev/one_d_fsi/solver/OneDFSIData.hpp>
49 
50 namespace LifeV
51 {
52 
53 //! OneDFSIBC - Class featuring methods to handle boundary conditions.
54 /*!
55  * @author Lucia Mirabella, Tiziano Passerini, Cristiano Malossi
56  * @see Equations and networks of 1-D models \cite FormaggiaLamponi2003
57  * @see Geometrical multiscale coupling of 1-D models \cite Malossi2011Algorithms \cite Malossi2011Algorithms1D
58  *
59  * We need to impose 2 boundary condition on each side of the 1D segment.
60  * These class stores the boundary conditions on one side.
61  *
62  * \cond \TODO Improve the description of this class. \endcond
63  */
64 class OneDFSIBC
65 {
66 public:
67 
68  //! @name Type definitions
69  //@{
70 
73 
75  typedef bcFunctionSolverDefined_Type::bcFunctionPtr_Type bcFunctionPtr_Type;
76 
81 
82  typedef bcFunctionSolverDefined_Type::container2D_Type container2D_Type;
83  typedef bcFunctionSolverDefined_Type::vectorPtrContainer_Type vectorPtrContainer_Type;
84 
87 
88  typedef bcFunctionSolverDefined_Type::bcLine_Type bcLine_Type;
89  typedef bcFunctionSolverDefined_Type::bcSide_Type bcSide_Type;
90  typedef bcFunctionSolverDefined_Type::bcType_Type bcType_Type;
91 
92  //@}
93 
94 
95  //! @name Constructors & Destructor
96  //@{
97 
98  //! Constructor
99  explicit OneDFSIBC ( const bcSide_Type& bcSide );
100 
101  //! Copy constructor
102  /*!
103  * @param bc OneDFSIBC
104  */
105  explicit OneDFSIBC ( const OneDFSIBC& bc );
106 
107  //! Destructor
108  virtual ~OneDFSIBC() {}
109 
110  //@}
111 
112 
113  //! @name Methods
114  //@{
115 
116  //! Apply boundary conditions to the rhs of the Taylor-Galerkin problem
117  /*!
118  * @param time the current time.
119  * @param timeStep the time step.
120  * @param solution the solution container.
121  * @param fluxPtr pointer to the flux class.
122  * @param rhs the rhs of the Taylor-Galerking problem.
123  */
124  void applyBC ( const Real& time, const Real& timeStep, const solution_Type& solution,
125  const fluxPtr_Type& fluxPtr, vectorPtrContainer_Type& rhs );
126 
127  //! Apply boundary conditions to the rhs of the viscoelastic problem
128  /*!
129  * @param fluxPtr pointer to the flux class.
130  * @param matrix the matrix of the viscoelastic problem.
131  * @param rhs the rhs of the viscoelastic problem.
132  */
133  void applyViscoelasticBC ( const fluxPtr_Type& fluxPtr, matrix_Type& matrix, vector_Type& rhs );
134 
135  //@}
136 
137 
138  //! @name Set Methods
139  //@{
140 
141  //! Set the type of boundary condition
142  /*!
143  * @param bcLine the line of the boundary condition (first or second).
144  * @param bcType the type of the boundary condition (\f$Q\f$, \f$A\f$, \f$P\f$, \f$S\f$, \f$W_1\f$, \f$W_2\f$).
145  */
146  void setType ( const bcLine_Type& bcLine, const bcType_Type& bcType )
147  {
148  M_bcType[bcLine] = bcType;
149  }
150 
151  //! Set the boundary condition function
152  /*!
153  * @param bcLine the line of the boundary condition (first or second).
154  * @param bcFunction the boundary condition function.
155  */
156  void setBCFunction ( const bcLine_Type& bcLine, const bcFunction_Type& rhs )
157  {
158  M_bcFunction[bcLine] = rhs;
159  }
160 
161  //@}
162 
163 
164  //! @name Get Methods
165  //@{
166 
167  //! Get the type of boundary condition
168  /*!
169  * @param bcLine the line of the boundary condition (first or second).
170  * @return the type of the boundary condition (\f$Q\f$, \f$A\f$, \f$P\f$, \f$S\f$, \f$W_1\f$, \f$W_2\f$).
171  */
172  const bcType_Type& type ( const bcLine_Type& bcLine ) const
173  {
174  return M_bcType.find ( bcLine )->second;
175  }
176 
177  //! Get the boundary condition function
178  /*!
179  * @param bcLine the line of the boundary condition (first or second).
180  * @return the boundary condition function.
181  */
182  const bcFunction_Type& bcFunction ( const bcLine_Type& bcLine ) const
183  {
184  return M_bcFunction.find ( bcLine )->second;
185  }
186 
187  //@}
188 
189 private:
190 
191  //! @name Unimplemented Methods
192  //@{
193 
194  OneDFSIBC& operator= ( const OneDFSIBC& bc );
195 
196  //@}
197 
198 
199  //! @name Private Methods
200  //@{
201 
202  //! Compute the matrix and the RHS for the BC 2x2 linear system
203  /*!
204  * @param time the current time.
205  * @param timeStep the time step.
206  * @param fluxPtr pointer to the flux class.
207  * @param bcLine the line of the boundary condition (first or second).
208  * @param leftEigenvector1 first line of the left eigenvector matrix.
209  * @param leftEigenvector2 second line of the left eigenvector matrix.
210  * @param dof degree of freedom of the boundary condition.
211  * @param bcMatrix the 2x2 matrix problem for the boundary condition computation.
212  * @param bcRHS the rhs of the 2x2 problem for the boundary condition computation.
213  */
214  void computeMatrixAndRHS ( const Real& time, const Real& timeStep, const fluxPtr_Type& fluxPtr, const bcLine_Type& bcLine,
215  const container2D_Type& leftEigenvector1, const container2D_Type& leftEigenvector2,
216  const UInt& dof, std::map<bcLine_Type, container2D_Type>& bcMatrix, Real& bcRHS );
217 
218  //! Solve a 2x2 linear system by the Cramer method (for the boundary conditions)
219  /*!
220  * Matrix A is given by two pairs corresponding to the 2 lines.
221  * @param line1 first line of the 2x2 matrix.
222  * @param line2 second line of the 2x2 matrix.
223  * @param rhs rhs of the 2x2 system.
224  * @return solution
225  */
226  container2D_Type solveLinearSystem ( const container2D_Type& line1,
227  const container2D_Type& line2, const container2D_Type& rhs ) const;
228 
229  //@}
230 
232 
233  bcSide_Type M_bcSide;
234 
236 };
237 
238 }
239 
240 #endif //OneDFSIBC_H
std::array< vectorPtr_Type, 2 > vectorPtrContainer_Type
bcSide_Type M_bcSide
Definition: OneDFSIBC.hpp:233
void setType(const bcLine_Type &bcLine, const bcType_Type &bcType)
Set the type of boundary condition.
Definition: OneDFSIBC.hpp:146
void applyBC(const Real &time, const Real &timeStep, const solution_Type &solution, const fluxPtr_Type &fluxPtr, vectorPtrContainer_Type &rhs)
Apply boundary conditions to the rhs of the Taylor-Galerkin problem.
Definition: OneDFSIBC.cpp:69
void setBCFunction(const bcLine_Type &bcLine, const bcFunction_Type &rhs)
Set the boundary condition function.
Definition: OneDFSIBC.hpp:156
std::map< bcLine_Type, bcFunction_Type > M_bcFunction
Definition: OneDFSIBC.hpp:235
OneDFSIBC(const OneDFSIBC &bc)
Copy constructor.
Definition: OneDFSIBC.cpp:59
void computeMatrixAndRHS(const Real &time, const Real &timeStep, const fluxPtr_Type &fluxPtr, const bcLine_Type &bcLine, const container2D_Type &leftEigenvector1, const container2D_Type &leftEigenvector2, const UInt &dof, std::map< bcLine_Type, container2D_Type > &bcMatrix, Real &bcRHS)
Compute the matrix and the RHS for the BC 2x2 linear system.
Definition: OneDFSIBC.cpp:149
void updateInverseJacobian(const UInt &iQuadPt)
OneDFSIBC - Class featuring methods to handle boundary conditions.
Definition: OneDFSIBC.hpp:64
OneDFSIFunctionSolverDefined bcFunctionSolverDefined_Type
Definition: OneDFSIBC.hpp:71
const bcFunction_Type & bcFunction(const bcLine_Type &bcLine) const
Get the boundary condition function.
Definition: OneDFSIBC.hpp:182
std::shared_ptr< bcFunction_Type > bcFunctionPtr_Type
void applyViscoelasticBC(const fluxPtr_Type &fluxPtr, matrix_Type &matrix, vector_Type &rhs)
Apply boundary conditions to the rhs of the viscoelastic problem.
Definition: OneDFSIBC.cpp:113
double Real
Generic real data.
Definition: LifeV.hpp:175
std::shared_ptr< solution_Type > solutionPtr_Type
const bcType_Type & type(const bcLine_Type &bcLine) const
Get the type of boundary condition.
Definition: OneDFSIBC.hpp:172
std::shared_ptr< bcFunctionSolverDefined_Type > bcFunctionSolverDefinedPtr_Type
Definition: OneDFSIBC.hpp:72
OneDFSIModelBCFunctionDefault - Base class for deriving specific 1D boundary functions.
container2D_Type solveLinearSystem(const container2D_Type &line1, const container2D_Type &line2, const container2D_Type &rhs) const
Solve a 2x2 linear system by the Cramer method (for the boundary conditions)
Definition: OneDFSIBC.cpp:204
std::map< std::string, vectorPtr_Type > solution_Type
virtual ~OneDFSIBC()
Destructor.
Definition: OneDFSIBC.hpp:108
std::map< bcLine_Type, bcType_Type > M_bcType
Definition: OneDFSIBC.hpp:231
OneDFSIBC(const bcSide_Type &bcSide)
Constructor.
Definition: OneDFSIBC.cpp:52
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191
OneDFSIBC & operator=(const OneDFSIBC &bc)