LifeV
fsi/testsuite/fsi_monolithic/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 Crosetto <crosetto@iacspc70.epfl.ch>
33  *
34  * @contributor Cristiano Malossi <cristiano.malossi@epfl.ch>
35  * @maintainer Paolo Crosetto <crosetto@iacspc70.epfl.ch>
36  *
37  * Contains the functions to be assigned as boundary conditions, in the file boundaryConditions.hpp . The functions
38  * can depend on time and space, while they can take in input an ID specifying one of the three principal axis
39  * if the functions to assign is vectorial and the boundary condition is of type \c Full \c.
40  */
41 
42 #include "ud_functions.hpp"
43 
44 //#define ANEURISM100170
45 #define AORTA
46 
47 namespace LifeV
48 {
49 
50 Real uInterpolated (const Real& time, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
51 {
52 
53  //GetPot data_file( getpot::StringVector data_file_name );
54  // GetPot data_file(data_file_name.c_str());
55 
56  // Real scale_factor = data_file("fluid/miscellaneous/my_flux_physio_scale_factor", .1);
57  Real scale_factor = -50.;//data_file("fluid/miscellaneous/my_flux_physio_scale_factor", .1);
58 
59  Real newtime;
60  // Real intervallorampa = data_file("fluid/miscellaneous/timeramp",0.05);
61  // Real deltat = data_file("fluid/discretization/timestep",0.01);
62  Real intervallorampa = 0.05; //data_file("fluid/miscellaneous/timeramp",0.05);
63  Real deltat = 0.001; //data_file("fluid/discretization/timestep",0.01);
64 
65  Real strokes = 72.0;
66  Real percar = 60.0 / strokes;
67  Real Tfin = percar;
68  Real pigreco2 = 6.2831853;
69  Real coeff01 = 0.65;
70  Real coeff02 = - 0.35;
71  Real coeff11 = 0.35;
72  Real coeff12 = - 0.05;
73  Real coeff21 = 0.3;
74  Real coeff31 = 0.32;
75  Real coeff41 = 0.36;
76  Real coeff42 = - 0.04;
77  Real prefirst = 0.15 * Tfin;
78  Real first = 0.2 * Tfin;
79  Real presecond = 0.3 * Tfin;
80  Real second = 0.51 * Tfin;
81  Real a, b1, b2, a22, a12, a11, a21, det, dt, coeff22, coeff23, coeff32, coeff33;
82  Real flux (0);
83  Real Tcorr;
84  Real Taux = Tfin;
85 
86  if (time < intervallorampa)
87  {
88  newtime = deltat;
89  }
90  else
91  {
92  newtime = time + deltat - intervallorampa;
93  }
94 
95  while (Taux < newtime)
96  {
97  Taux = Taux + Tfin;
98  }
99  Tcorr = newtime - Taux + Tfin;
100 
101  if (Tcorr == Tfin)
102  {
103  Tcorr = 0;
104  }
105 
106  if (Tcorr <= prefirst)
107  {
108  a = pigreco2 * Tcorr / first;
109  flux = coeff01 + coeff02 * cos (a);
110  }
111 
112  else if ( (Tcorr > prefirst) && (Tcorr <= first) )
113  {
114  b1 = coeff01 - coeff31;
115  b2 = coeff02 * pigreco2 / first;
116  a22 = prefirst - first;
117  a12 = a22 * a22;
118  a11 = a12 * a12;
119  a21 = 4 * a12 * a22;
120  a22 = 2 * a22;
121  det = a22 * a11 - a12 * a21;
122  coeff32 = (a22 * b1 - a12 * b2) / det;
123  coeff33 = (a11 * b2 - a21 * b1) / det;
124  dt = Tcorr - first;
125  flux = coeff32 * dt * dt * dt * dt + coeff33 * dt * dt + coeff31;
126  }
127 
128  else if ( (Tcorr > first) && (Tcorr <= presecond) )
129  {
130  a = pigreco2 * (Tcorr) / first;
131  flux = coeff41 + coeff42 * cos (a);
132  }
133 
134  else if ( (Tcorr > presecond) && (Tcorr <= second) )
135  {
136  a = pigreco2 * (Tcorr - first) / first;
137  flux = coeff11 + coeff12 * cos (a);
138  }
139  else if (Tcorr > second)
140  {
141  a = pigreco2 * (second - first) / first;
142  b1 = coeff11 + coeff12 * cos (a) - coeff21;
143  b2 = - coeff12 * pigreco2 * sin (a) / first;
144  a22 = Tfin - second;
145  a12 = a22 * a22;
146  a11 = a12 * a12;
147  a21 = - 4 * a12 * a22;
148  a22 = - 2 * a22;
149  det = a22 * a11 - a12 * a21;
150  coeff22 = (a22 * b1 - a12 * b2) / det;
151  coeff23 = (a11 * b2 - a21 * b1) / det;
152  dt = Tcorr - Tfin;
153  flux = coeff22 * dt * dt * dt * dt + coeff23 * dt * dt + coeff21;
154  }
155  if (time < intervallorampa)
156  {
157  flux = ( time / intervallorampa ) * scale_factor * flux;
158  }
159  else
160  {
161  flux = scale_factor * flux;
162  }
163 
164  // Real pi = 3.14159265358979;
165 #ifdef AORTA // ifdef ANEURISM100170
166  if ( i == 2 )
167  {
168  return flux; // *1.42?
169  }
170  if ( i == 1 )
171  {
172  return flux; // *1.42?
173  }
174 #endif
175 #ifdef ANEURISM100170 // ifdef ANEURISM100170
176  if ( i == 2 )
177  {
178  return -flux; // *1.42?
179  }
180 #else
181  if ( i == 3 )
182  {
183  return -flux;
184  }
185 #endif
186  return 0;
187 
188 }
189 
190 
191 
192 // fct_type getUInterpolated()
193 // {
194 // fct_type f;
195 // f = std::bind(&Cylinder::Private::uInterpolated, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4, std::placeholders::_5);
196 // return f;
197 // }
198 
199 Real aortaPhisPress (const Real& t, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
200 {
201  /*switch(i) {
202  case 1:
203  return 0.0;
204  break;*/
205  // case 2:
206  if (t <= 0.00)
207  {
208  return -110170;
209  }
210  if (t <= 0.01)
211  {
212  return -109540;
213  }
214  if (t <= 0.02)
215  {
216  return -108930;
217  }
218  if (t <= 0.03)
219  {
220  return -108320;
221  }
222  if (t <= 0.04)
223  {
224  return -107710;
225  }
226  if (t <= 0.05)
227  {
228  return -107120;
229  }
230  if (t <= 0.06)
231  {
232  return -106530;
233  }
234  if (t <= 0.07)
235  {
236  return -111130;
237  }
238  if (t <= 0.08)
239  {
240  return -115440;
241  }
242  if (t <= 0.09)
243  {
244  return -118690;
245  }
246  if (t <= 0.10)
247  {
248  return -121460;
249  }
250  if (t <= 0.11)
251  {
252  return -123940;
253  }
254  if (t <= 0.12)
255  {
256  return -126350;
257  }
258  if (t <= 0.13)
259  {
260  return -128890;
261  }
262  if (t <= 0.14)
263  {
264  return -131510;
265  }
266  if (t <= 0.15)
267  {
268  return -133980;
269  }
270  if (t <= 0.16)
271  {
272  return -136200;
273  }
274  if (t <= 0.17)
275  {
276  return -138330;
277  }
278  if (t <= 0.18)
279  {
280  return -140350;
281  }
282  if (t <= 0.19)
283  {
284  return -142290;
285  }
286  if (t <= 0.20)
287  {
288  return -144360;
289  }
290  if (t <= 0.21)
291  {
292  return -146130;
293  }
294  if (t <= 0.22)
295  {
296  return -147530;
297  }
298  if (t <= 0.23)
299  {
300  return -148780;
301  }
302  if (t <= 0.24)
303  {
304  return -149740;
305  }
306  if (t <= 0.25)
307  {
308  return -150320;
309  }
310  if (t <= 0.26)
311  {
312  return -150470;
313  }
314  if (t <= 0.27)
315  {
316  return -150250;
317  }
318  if (t <= 0.28)
319  {
320  return -149750;
321  }
322  if (t <= 0.29)
323  {
324  return -148990;
325  }
326  if (t <= 0.30)
327  {
328  return -148220;
329  }
330  if (t <= 0.31)
331  {
332  return -147210;
333  }
334  if (t <= 0.32)
335  {
336  return -145940;
337  }
338  if (t <= 0.33)
339  {
340  return -144960;
341  }
342  if (t <= 0.34)
343  {
344  return -143750;
345  }
346  if (t <= 0.35)
347  {
348  return -141980;
349  }
350  if (t <= 0.36)
351  {
352  return -139900;
353  }
354  if (t <= 0.37)
355  {
356  return -137260;
357  }
358  if (t <= 0.38)
359  {
360  return -133970;
361  }
362  if (t <= 0.39)
363  {
364  return -131670;
365  }
366  if (t <= 0.40)
367  {
368  return -131320;
369  }
370  if (t <= 0.41)
371  {
372  return -133150;
373  }
374  if (t <= 0.42)
375  {
376  return -132710;
377  }
378  if (t <= 0.43)
379  {
380  return -131570;
381  }
382  if (t <= 0.44)
383  {
384  return -130280;
385  }
386  if (t <= 0.45)
387  {
388  return -129750;
389  }
390  if (t <= 0.46)
391  {
392  return -129330;
393  }
394  if (t <= 0.47)
395  {
396  return -128910;
397  }
398  if (t <= 0.48)
399  {
400  return -128360;
401  }
402  if (t <= 0.49)
403  {
404  return -127680;
405  }
406  if (t <= 0.50)
407  {
408  return -127000;
409  }
410  if (t <= 0.51)
411  {
412  return -126410;
413  }
414  if (t <= 0.52)
415  {
416  return -125920;
417  }
418  if (t <= 0.53)
419  {
420  return -125480;
421  }
422  if (t <= 0.54)
423  {
424  return -125040;
425  }
426  if (t <= 0.55)
427  {
428  return -124560;
429  }
430  if (t <= 0.56)
431  {
432  return -124050;
433  }
434  if (t <= 0.57)
435  {
436  return -123530;
437  }
438  if (t <= 0.58)
439  {
440  return -123000;
441  }
442  if (t <= 0.59)
443  {
444  return -122440;
445  }
446  if (t <= 0.60)
447  {
448  return -121840;
449  }
450  if (t <= 0.61)
451  {
452  return -121220;
453  }
454  if (t <= 0.62)
455  {
456  return -120580;
457  }
458  if (t <= 0.63)
459  {
460  return -119950;
461  }
462  if (t <= 0.64)
463  {
464  return -119330;
465  }
466  if (t <= 0.65)
467  {
468  return -118710;
469  }
470  if (t <= 0.66)
471  {
472  return -118100;
473  }
474  if (t <= 0.67)
475  {
476  return -117470;
477  }
478  if (t <= 0.68)
479  {
480  return -116840;
481  }
482  if (t <= 0.69)
483  {
484  return -116200;
485  }
486  if (t <= 0.70)
487  {
488  return -115560;
489  }
490  if (t <= 0.71)
491  {
492  return -114920;
493  }
494  if (t <= 0.72)
495  {
496  return -114280;
497  }
498  if (t <= 0.73)
499  {
500  return -113650;
501  }
502  if (t <= 0.74)
503  {
504  return -113020;
505  }
506  if (t <= 0.75)
507  {
508  return -112400;
509  }
510  if (t <= 0.76)
511  {
512  return -111790;
513  }
514  if (t <= 0.77)
515  {
516  return -111200;
517  }
518  if (t <= 0.78)
519  {
520  return -110620;
521  }
522  if (t <= 0.79)
523  {
524  return -110060;
525  }
526  // break;
527  /* case 3:
528  return 0.0;
529  break;}
530  return 0.;*/
531  return 0.;
532 }
533 
534 Real f (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
535 {
536  return 0.;
537 }
538 
539 Real u1 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
540 {
541  return 0.0;
542 }
543 
544 Real vinit (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
545 {
546  if (i == 2)
547  {
548  return 10;
549  }
550  else
551  {
552  return 0.;
553  }
554 }
555 
556 
557 
558 Real fZero (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
559 {
560  return 0.0;
561 }
562 
563 // Initial velocity
564 Real u0 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
565 {
566  return 0.0;
567 }
568 
569 Real p0 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
570 {
571  return 0.0;
572 }
573 
574 
575 Real E (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
576 {
577  return -29; // (see paper by Liu, Dang, etc.. about the sourrounding tissue effect on arteries)
578 }
579 
580 
581 Real hydro (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
582 {
583  return -1.33 * 1e5;
584 }
585 
586 Real u2 (const Real& t, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
587 {
588  switch (i)
589  {
590  case 0:
591  return 0.0;
592  break;
593  case 2:
594  if ( t <= 0.003 )
595  {
596  return 1.3332e5;
597  }
598  // return 0.01;
599  return 0.0;
600  break;
601  case 1:
602  return 0.0;
603  // return 1.3332e4;
604  // else
605  // return 0.0;
606  break;
607  }
608  return 0;
609 }
610 
611 
612 Real u2normal (const Real& t, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
613 {
614  if (t <= 0.003)
615  {
616  return -1.3332e4;
617  }
618 
619  return 0.;
620 }
621 
622 
623 // Initial displacement and velocity
624 Real d0 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
625 {
626  switch (i)
627  {
628  case 0:
629  return 0.;
630  break;
631  case 1:
632  return 0.;
633  break;
634  case 2:
635  return 0.;
636  break;
637  default:
638  ERROR_MSG ("This entry is not allowed: ud_functions.hpp");
639  return 0.;
640  break;
641  }
642 }
643 
644 Real w0 (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& i)
645 {
646 
647  switch (i)
648  {
649  case 0:
650  return 0.0;
651  break;
652  case 1:
653  return 0.0;
654  break;
655  case 2:
656  return 10.0;
657  break;
658  default:
659  ERROR_MSG ("This entrie is not allowed: ud_functions.hpp");
660  return 0.;
661  break;
662  }
663 }
664 
665 Real fluxFunction (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
666 {
667  return -10;
668 }
669 
670 Real squareSinusoidalFluxFunction (const Real& t, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
671 {
672  return - (t < (0.005 / 2) ) * std::sin (2 * M_PI * t / 0.005) * std::sin (2 * M_PI * t / 0.005);
673 }
674 
675 Real benchmarkP (const Real& t, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
676 {
677  if (t < 0.0025)
678  {
679  return -50000 * std::sin (2 * 3.1415 * t / 0.005) * std::sin (2 * 3.1415 * t / 0.005);
680  }
681  else
682  {
683  return 0;
684  }
685 }
686 
687 Real LifeV::aortaVelIn::S_timestep;
688 
689 }
Real fZero(const Real &, const Real &, const Real &, const Real &, const ID &)
Real d0(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
Real E(const Real &, const Real &, const Real &, const Real &, const ID &)
Real fluxFunction(const Real &, const Real &, const Real &, const Real &, const ID &)
Real p0(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
#define M_PI
Definition: winmath.h:20
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
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)
Real benchmarkP(const Real &t, const Real &, const Real &, const Real &, const ID &)
Real uInterpolated(const Real &time, const Real &, const Real &, const Real &, const ID &i)
Real aortaPhisPress(const Real &t, const Real &x=0, const Real &y=0, const Real &z=0, const ID &i=0)
double Real
Generic real data.
Definition: LifeV.hpp:175
Real u1(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
Real u0(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
Real u2(const Real &t, const Real &, const Real &, const Real &, const ID &i)
Definition: cylinder.cpp:81