LifeV
structure/testsuite/anisotropicLaw/ud_functions.cpp
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 the boundary conditions for the Monolithic Test
30  *
31  * @date 2009-04-09
32  * @author Paolo Tricerri <paolo.tricerri@epfl.ch>
33  *
34  * @maintainer Paolo Tricerri <paolo.tricerri@epfl.ch>
35  *
36  * Contains the functions to be assigned as boundary conditions, in the file boundaryConditions.hpp . The functions
37  * can depend on time and space, while they can take in input an ID specifying one of the three principal axis
38  * if the functions to assign is vectorial and the boundary condition is of type \c Full \c.
39  */
40 
41 #include "ud_functions.hpp"
42 
43 #define PI 3.14159265359
44 
45 namespace LifeV
46 {
47 
48 Real f (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
49 {
50  switch (i)
51  {
52  case 0:
53  return 0.0;
54  break;
55  case 1:
56  return 0.0;
57  break;
58  case 2:
59  return 0.0;
60  break;
61  default:
62  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
63  return 0.;
64  break;
65  }
66 }
67 
68 
69 Real fzero_scalar (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
70 {
71  return 0.0;
72 }
73 
74 Real InternalPressure (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
75 {
76  return -1e+5;
77  //return -260000*sin(80*3.141592*t);
78 }
79 
80 // Initial displacement and velocity
81 Real d0 (const Real& /*t*/, const Real& x, const Real& y, const Real& z, const ID& i)
82 {
83 
84  switch (i)
85  {
86  case 0:
87  return 0.088002 * ( x + 0.5 );
88  break;
89  case 1:
90  return - ( 0.02068 * 2.0 ) * ( y );
91  break;
92  case 2:
93  return - ( 0.02068 * 2.0 ) * ( z );
94  break;
95  default:
96  ERROR_MSG ("This entry is not allowed: ud_functions.hpp");
97  return 0.;
98  break;
99  }
100 
101 }
102 
103 Real w0 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
104 {
105 
106  switch (i)
107  {
108  case 0:
109  return 0.0;
110  break;
111  case 1:
112  return 0.0;
113  break;
114  case 2:
115  return 0.0;
116  break;
117  default:
118  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
119  return 0.;
120  break;
121  }
122 }
123 
124 Real a0 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
125 {
126 
127  switch (i)
128  {
129  case 0:
130  return 0.0;
131  break;
132  case 1:
133  return 0.0;
134  break;
135  case 2:
136  return 0.0;
137  break;
138  default:
139  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
140  return 0.;
141  break;
142  }
143 }
144 
145 
146 //----------------------------------------------Boundary Conditions--------------
147 Real bcZero (const Real& /*t*/, const Real& /*X*/, const Real& /*Y*/, const Real& /*Z*/, const ID& /*i*/)
148 {
149  return 0.;
150 }
151 
152 Real bcNonZero (const Real& t, const Real& X, const Real& Y, const Real& Z, const ID& i)
153 {
154  //Real pressure(200000);
155 
156  // Real top = 1000000;
157 
158  // return top * Y;
159 
160  return 700000;
161 
162  // Real highestPressure(6.666e+6);
163  // Real totalTime = 20.0;
164  // Real halfTime = totalTime / 2.0;
165 
166  // Real a = ( highestPressure / 2 ) * ( 1/ ((totalTime/2)*(totalTime/2)) );
167 
168  // if ( t <= halfTime )
169  // pressure = a * t*t;
170 
171  // if ( t > halfTime )
172  // pressure = - a * (t - totalTime)*(t - totalTime) + highestPressure;
173 
174  // switch (i)
175  // {
176  // case 0:
177  // return 0.0;
178  // break;
179  // case 1:
180  // return pressure;
181  // break;
182  // case 2:
183  // return 0.0;
184  // break;
185  // default:
186  // ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
187  // return 0.;
188  // break;
189  // }
190 }
191 
192 Real bcNonZeroSecondOrderExponential (const Real& /*t*/, const Real& /*X*/, const Real& /*Y*/, const Real& /*Z*/, const ID& /*i*/)
193 {
194  return 19180.;
195 }
196 
197 
198 //----------------------------------------------Fibers Directions--------------
199 Real Family1 ( const Real& /*t*/, const Real& x, const Real& y, const Real& z, const ID& i)
200 {
201  Real theta = ( PI / 6.0 );
202 // Real thetaChangeOfVariable = std::atan( y / x );
203 
204  switch (i)
205  {
206  case 0:
207  // Tube
208  // return - std::sin( thetaChangeOfVariable ) * std::sin( theta );
209  // Cube
210  return std::sin( theta );
211  break;
212  case 1:
213  // Tube
214  // return std::cos( thetaChangeOfVariable ) * std::sin( theta );
215  // Cube
216  return std::cos( theta );
217  break;
218  case 2:
219  // Tube
220  // return std::cos( theta );
221  // Cube
222  return 0.0;
223  break;
224  default:
225  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
226  return 0.;
227  break;
228  }
229 }
230 
231 Real Family2 ( const Real& /*t*/, const Real& x, const Real& y, const Real& z, const ID& i)
232 {
233  Real theta = ( - PI / 6.0 );
234 // Real thetaChangeOfVariable = std::atan( y / x );
235 
236  switch (i)
237  {
238  case 0:
239  // Tube
240  // return - std::sin( thetaChangeOfVariable ) * std::sin( theta );
241  // Cube
242  return std::sin( theta );
243  break;
244  case 1:
245  // Tube
246  // return std::cos( thetaChangeOfVariable ) * std::sin( theta );
247  // Cube
248  return std::cos( theta );
249  break;
250  case 2:
251  // Tube
252  // return std::cos( theta );
253  // Cube
254  return 0.0;
255  break;
256  default:
257  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
258  return 0.;
259  break;
260  }
261 }
262 
263 Real Family3 ( const Real& /*t*/, const Real& x, const Real& y, const Real& z, const ID& i)
264 {
265 
266  switch (i)
267  {
268  case 0:
269  return 0.0;
270  break;
271  case 1:
272  return 0.0;
273  break;
274  case 2:
275  return -1.0;
276  break;
277  default:
278  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
279  return 0.;
280  break;
281  }
282 }
283 
284 
285 Real Family4 ( const Real& /*t*/, const Real& x, const Real& y, const Real& z, const ID& i)
286 {
287 
288  switch (i)
289  {
290  case 0:
291  return 0.0;
292  break;
293  case 1:
294  return 0.0;
295  break;
296  case 2:
297  return 0.0;
298  break;
299  default:
300  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
301  return 0.;
302  break;
303  }
304 }
305 
306 
307 Real Family5 ( const Real& /*t*/, const Real& x, const Real& y, const Real& z, const ID& i)
308 {
309 
310  switch (i)
311  {
312  case 0:
313  return 0.0;
314  break;
315  case 1:
316  return 0.0;
317  break;
318  case 2:
319  return 0.0;
320  break;
321  default:
322  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
323  return 0.;
324  break;
325  }
326 }
327 
328 Real Family6 ( const Real& /*t*/, const Real& x, const Real& y, const Real& z, const ID& i)
329 {
330 
331  switch (i)
332  {
333  case 0:
334  return 0.0;
335  break;
336  case 1:
337  return 0.0;
338  break;
339  case 2:
340  return 0.0;
341  break;
342  default:
343  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
344  return 0.;
345  break;
346  }
347 }
348 
349 // Method for the definition of the fibers
350 fibersDirectionList::fibersDirectionList() :
351  M_mapNameDefinition( )
352 {}
353 
354 fibersDirectionList::~fibersDirectionList()
355 {}
356 
357 void fibersDirectionList::setupFiberDefinitions( const UInt nbFamilies )
358 {
359  // At the moment the creation of the table of fiber functions is done
360  // manually. There should be a way to make it automatically. Btw, only
361  // the first nbFamilies that are set in the data file are taken into account
362 
363  ASSERT( nbFamilies < 6, "At the moment, a maximum number = 6 of families can be used! If you want more \n modifiy the file ud_functions.hpp in the application folder." );
364 
365  // Creation of the database of functions
366  fiberFunctionPtr_Type pointerToFunction( new fiberFunction_Type( Family1 ) );
367  M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
368  ( "Family1", pointerToFunction ) );
369 
370  pointerToFunction.reset( new fiberFunction_Type( Family2 ) );
371  M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
372  ( "Family2", pointerToFunction ) );
373 
374  pointerToFunction.reset( new fiberFunction_Type( Family3 ) );
375  M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
376  ( "Family3", pointerToFunction ) );
377 
378  pointerToFunction.reset( new fiberFunction_Type( Family4 ) );
379  M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
380  ( "Family4", pointerToFunction ) );
381 
382  pointerToFunction.reset( new fiberFunction_Type( Family5 ) );
383  M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
384  ( "Family5", pointerToFunction ) );
385 
386  pointerToFunction.reset( new fiberFunction_Type( Family6 ) );
387  M_mapNameDefinition.insert( std::pair<std::string, fiberFunctionPtr_Type>
388  ( "Family6", pointerToFunction ) );
389 
390 
391 }
392 
393 fibersDirectionList::fiberFunctionPtr_Type fibersDirectionList::fiberDefinition( const std::string nameFamily )
394 {
395 
396  mapNameDefinitionFiberFunction_Type::const_iterator IT;
397 
398  IT = M_mapNameDefinition.find ( nameFamily );
399 
400  if ( IT != M_mapNameDefinition.end() )
401  {
402  return IT->second;
403  }
404  else
405  {
406  std::cout << " Wrong identification of the fiber function! " << std::endl;
407  fiberFunctionPtr_Type pointerToFunction( new fiberFunction_Type() );
408 
409  return pointerToFunction;
410  }
411 }
412 
413 }
Real d0(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
#define PI
void updateInverseJacobian(const UInt &iQuadPt)
Real w0(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
#define ERROR_MSG(A)
Definition: LifeAssert.hpp:69
#define ASSERT(X, A)
Definition: LifeAssert.hpp:90
uint32_type ID
IDs.
Definition: LifeV.hpp:194
Real f(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
double Real
Generic real data.
Definition: LifeV.hpp:175
uint32_type UInt
generic unsigned integer (used mainly for addressing)
Definition: LifeV.hpp:191