LifeV
OneDFSIBCHandler.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 handling 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  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
41  */
42 
43 #ifndef OneDFSIBCHandler_H
44 #define OneDFSIBCHandler_H
45 
46 #include <lifev/one_d_fsi/solver/OneDFSIDefinitions.hpp>
47 #include <lifev/one_d_fsi/fem/OneDFSIBC.hpp>
48 
49 namespace LifeV
50 {
51 
52 //! OneDFSIBCHandler - Class featuring methods to handle boundary conditions.
53 /*!
54  * @author Lucia Mirabella, Tiziano Passerini, Cristiano Malossi
55  * @see Equations and networks of 1-D models \cite FormaggiaLamponi2003
56  * @see Geometrical multiscale coupling of 1-D models \cite Malossi2011Algorithms \cite Malossi2011Algorithms1D
57  *
58  * We need to impose 2 boundary condition on each side of the 1D segment.
59  * These boundary conditions are stored in \c OneDFSIBC objects.
60  *
61  * \cond \TODO Improve the description of BC. \endcond
62  */
64 {
65 public:
66 
67  //! @name Type definitions
68  //@{
69 
70  typedef OneDFSIBC bc_Type;
72 
73  typedef bc_Type::bcFunction_Type bcFunction_Type;
74  typedef bc_Type::bcFunctionPtr_Type bcFunctionPtr_Type;
75  typedef bc_Type::bcFunctionSolverDefined_Type bcFunctionSolverDefined_Type;
76  typedef bc_Type::bcFunctionSolverDefinedPtr_Type bcFunctionSolverDefinedPtr_Type;
77 
78  typedef bc_Type::fluxPtr_Type fluxPtr_Type;
79  typedef bc_Type::sourcePtr_Type sourcePtr_Type;
80  typedef bc_Type::solution_Type solution_Type;
81  typedef bc_Type::solutionPtr_Type solutionPtr_Type;
82 
83  typedef bc_Type::vectorPtrContainer_Type vectorPtrContainer_Type;
84 
85  typedef bc_Type::vector_Type vector_Type;
86  typedef bc_Type::matrix_Type matrix_Type;
87 
88  typedef bc_Type::bcLine_Type bcLine_Type;
89  typedef bc_Type::bcSide_Type bcSide_Type;
90  typedef bc_Type::bcType_Type bcType_Type;
91 
92  //@}
93 
94 
95  //! @name Constructors & Destructor
96  //@{
97 
98  //! Empty Constructor
99  explicit OneDFSIBCHandler();
100 
101  //! Copy constructor
102  /*!
103  * @param bcHandler OneDFSIBCHandler
104  */
105  explicit OneDFSIBCHandler ( const OneDFSIBCHandler& bcHandler );
106 
107  //! Destructor
108  virtual ~OneDFSIBCHandler() {}
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 a boundary condition
142  /*!
143  * @param bcSide the side of the boundary condition (left or right).
144  * @param bcLine the line of the boundary condition (first or second).
145  * @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$).
146  * @param bcFunction the boundary condition function.
147  */
148  void setBC ( const bcSide_Type& bcSide, const bcLine_Type& bcLine, const bcType_Type& bcType, const bcFunction_Type& bcFunction );
149 
150  //! Set the default boundary conditions
151  /*!
152  * This is done only for the boundary conditions that have not been set yet.
153  */
154  void setDefaultBC();
155 
156  //! Set the flux and the source classes for the problem
157  /*!
158  * @param fluxPtr pointer to the flux term of the problem.
159  * @param source pointer to the source term of the problem.
160  */
161  void setFluxSource ( const fluxPtr_Type& fluxPtr, const sourcePtr_Type& sourcePtr );
162 
163  //! Set the solution of the problem
164  /*!
165  * @param solutionPtr pointer to the solution of the problem.
166  */
167  void setSolution ( const solutionPtr_Type& solutionPtr );
168 
169  //@}
170 
171 
172  //! @name Get Methods
173  //@{
174 
175  //! Get a specific boundary condition
176  /*!
177  * @param bcSide the side of the boundary condition (left or right).
178  * @return the pointer to the boundary conditions on a specific side
179  */
180  const bcPtr_Type& bc ( const bcSide_Type& bcSide ) const
181  {
182  return M_boundary.find ( bcSide )->second;
183  }
184 
185  //! Return true if the boundary condition has been set
186  /*!
187  * @param bcSide the side of the boundary condition (left or right).
188  * @param bcLine the line of the boundary condition (first or second).
189  * @return true if the boundary condition has been set, false otherwise.
190  */
191  const bool& bcReady ( const bcSide_Type& bcSide, const bcLine_Type& bcLine ) const
192  {
193  return M_boundarySet.find ( bcSide )->second.find ( bcLine )->second;
194  }
195 
196  //@}
197 
198 private:
199 
200  //! @name Unimplemented Methods
201  //@{
202 
203  OneDFSIBCHandler& operator= ( const OneDFSIBCHandler& bcHandler );
204 
205  //@}
206 
209 
211 };
212 
213 }
214 
215 #endif //OneDFSIBCHandler_H
const bool & bcReady(const bcSide_Type &bcSide, const bcLine_Type &bcLine) const
Return true if the boundary condition has been set.
OneDFSIBCHandler(const OneDFSIBCHandler &bcHandler)
Copy constructor.
void setBC(const bcSide_Type &bcSide, const bcLine_Type &bcLine, const bcType_Type &bcType, const bcFunction_Type &bcFunction)
Set a boundary condition.
void updateInverseJacobian(const UInt &iQuadPt)
void setFluxSource(const fluxPtr_Type &fluxPtr, const sourcePtr_Type &sourcePtr)
Set the flux and the source classes for the problem.
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.
OneDFSIBC - Class featuring methods to handle boundary conditions.
Definition: OneDFSIBC.hpp:64
OneDFSIBCHandler & operator=(const OneDFSIBCHandler &bcHandler)
OneDFSIFunctionSolverDefined bcFunctionSolverDefined_Type
Definition: OneDFSIBC.hpp:71
std::vector< bcFunctionSolverDefinedPtr_Type > M_defaultFunctions
virtual ~OneDFSIBCHandler()
Destructor.
OneDFSIBCHandler - Class featuring methods to handle boundary conditions.
std::map< bcSide_Type, bcPtr_Type > M_boundary
double Real
Generic real data.
Definition: LifeV.hpp:175
std::shared_ptr< bcFunctionSolverDefined_Type > bcFunctionSolverDefinedPtr_Type
Definition: OneDFSIBC.hpp:72
OneDFSIBCHandler()
Empty Constructor.
void setSolution(const solutionPtr_Type &solutionPtr)
Set the solution of the problem.
std::map< bcSide_Type, std::map< bcLine_Type, bool > > M_boundarySet
std::shared_ptr< bc_Type > bcPtr_Type
void setDefaultBC()
Set the default boundary conditions.
const bcPtr_Type & bc(const bcSide_Type &bcSide) const
Get a specific boundary condition.
void applyViscoelasticBC(const fluxPtr_Type &fluxPtr, matrix_Type &matrix, vector_Type &rhs)
Apply boundary conditions to the rhs of the viscoelastic problem.