LifeV
OneDFSIDefinitions.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 One Dimensional Model Global Definitions
30  *
31  * @version 1.0
32  * @date 15-04-2010
33  * @author Cristiano Malossi <cristiano.malossi@epfl.ch>
34  *
35  * @maintainer Cristiano Malossi <cristiano.malossi@epfl.ch>
36  */
37 
38 #ifndef OneDFSIDefinitions_H
39 #define OneDFSIDefinitions_H
40 
41 
42 // STD
43 #include <string>
44 #include <iostream>
45 #include <sstream>
46 #include <fstream>
47 #include <cmath>
48 
49 // BOOST
50 #include <boost/numeric/ublas/vector_proxy.hpp>
51 #include <boost/numeric/ublas/vector.hpp>
52 #include <boost/function.hpp>
53 #include <boost/shared_ptr.hpp>
54 
55 
56 // LIFEV
57 #include <lifev/core/LifeV.hpp>
58 #include <lifev/core/util/StringUtility.hpp>
59 #include <lifev/core/util/Factory.hpp>
60 #include <lifev/core/util/FactorySingleton.hpp>
61 #include <lifev/core/util/LifeChrono.hpp>
62 #include <lifev/core/fem/FESpace.hpp>
63 #include <lifev/core/algorithm/SolverAmesos.hpp>
64 
65 namespace ublas = boost::numeric::ublas;
66 
67 namespace LifeV
68 {
69 namespace OneDFSI
70 {
71 
72 //#define HAVE_NEUMANN_VISCOELASTIC_BC 1 // Define whether to use homogeneous Neumann/Dirichlet BC for the viscoelastic problem.
73 
74 /*! @enum Physics Types
75  */
77 {
78  LinearPhysics, /*!< Use Linear Physics */
79  NonLinearPhysics /*!< Use Non Linear Physics */
80 };
81 
82 /*! @enum Flux Types
83  */
85 {
86  LinearFlux, /*!< Use Linear Flux */
87  NonLinearFlux /*!< Use Non Linear Flux */
88 };
89 
90 /*! @enum Physics Types
91  */
93 {
94  LinearSource, /*!< Use Linear Source */
95  NonLinearSource /*!< Use Non Linear Source */
96 };
97 
98 // Map objects
100 extern std::map< std::string, fluxTerm_Type > fluxMap;
102 
103 // Forward class declarations
104 class OneDFSIModel_Physics;
105 class OneDFSIModel_Flux;
106 class OneDFSIModel_Source;
107 class OneDFSIModel_BCFunction;
108 
110 {
111  W1, /*!< Riemann variable 1 */
112  W2, /*!< Riemann variable 2 */
113  A, /*!< Area */
114  Q, /*!< Flow rate */
115  P, /*!< Pressure */
116  S, /*!< Normal stress */
117  T /*!< Total normal stress */
118 };
119 
121 {
124 };
125 
127 {
130 };
131 
132 // ===================================================
133 // OneDFSIModel Utility Methods
134 // ===================================================
135 
136 //! Define the map of the OneDFSIModel objects
137 inline void
139 {
140  physicsMap["OneD_LinearPhysics"] = LinearPhysics;
141  physicsMap["OneD_NonLinearPhysics"] = NonLinearPhysics;
142 
143  fluxMap["OneD_LinearFlux"] = LinearFlux;
144  fluxMap["OneD_NonLinearFlux"] = NonLinearFlux;
145 
146  sourceMap["OneD_LinearSource"] = LinearSource;
147  sourceMap["OneD_NonLinearSource"] = NonLinearSource;
148 }
149 
150 //! Fast pow for the case of exponent 0.5
151 inline Real
152 pow05 ( const Real& base, const Real& exponent )
153 {
154  if ( exponent == 0.5 )
155  {
156  return std::sqrt ( base );
157  }
158  else
159  {
160  return std::pow ( base, exponent );
161  }
162 }
163 
164 //! Fast pow for the case of exponent 1.0
165 inline Real
166 pow10 ( const Real& base, const Real& exponent )
167 {
168  if ( exponent == 1.0 )
169  {
170  return base;
171  }
172  else
173  {
174  return std::pow ( base, exponent );
175  }
176 }
177 
178 //! Fast pow for the case of exponent 1.5
179 inline Real
180 pow15 ( const Real& base, const Real& exponent )
181 {
182  if ( exponent == 1.5 )
183  {
184  return std::sqrt ( base ) * base;
185  }
186  else
187  {
188  return std::pow ( base, exponent );
189  }
190 }
191 
192 //! Fast pow for the case of exponent 2.0
193 inline Real
194 pow20 ( const Real& base, const Real& exponent )
195 {
196  if ( exponent == 2.0 )
197  {
198  return base * base;
199  }
200  else
201  {
202  return std::pow ( base, exponent );
203  }
204 }
205 
206 //! Fast pow for the case of exponent 3.0
207 inline Real
208 pow30 ( const Real& base, const Real& exponent )
209 {
210  if ( exponent == 3.0 )
211  {
212  return base * base * base;
213  }
214  else
215  {
216  return std::pow ( base, exponent );
217  }
218 }
219 
220 //! Fast pow for the case of exponent 4.0
221 inline Real
222 pow40 ( const Real& base, const Real& exponent )
223 {
224  if ( exponent == 4.0 )
225  {
226  return base * base * base * base;
227  }
228  else
229  {
230  return std::pow ( base, exponent );
231  }
232 }
233 
234 } // OneDFSI namespace
235 } // LifeV namespace
236 
237 #endif // OneDFSIDefinitions_H
Real pow15(const Real &base, const Real &exponent)
Fast pow for the case of exponent 1.5.
std::map< std::string, fluxTerm_Type > fluxMap
Real pow10(const Real &base, const Real &exponent)
Fast pow for the case of exponent 1.0.
std::map< std::string, physicsType_Type > physicsMap
void updateInverseJacobian(const UInt &iQuadPt)
Real pow05(const Real &base, const Real &exponent)
Fast pow for the case of exponent 0.5.
Real pow40(const Real &base, const Real &exponent)
Fast pow for the case of exponent 4.0.
void mapsDefinition()
Define the map of the OneDFSIModel objects.
Real pow30(const Real &base, const Real &exponent)
Fast pow for the case of exponent 3.0.
Real pow20(const Real &base, const Real &exponent)
Fast pow for the case of exponent 2.0.
double Real
Generic real data.
Definition: LifeV.hpp:175
std::map< std::string, sourceTerm_Type > sourceMap