LifeV
lumpedHeart.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 lumped heart for the Monolithic Test
30  *
31  * @date 2009-06-03
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 
38 
39 #include <cmath>
40 
41 
42 #include "lumpedHeart.hpp"
43 
44 #define TESTING
45 #define PI 3.14159265
46 
47 namespace LifeV
48 {
49 
50 void LumpedHeart::initParameters ( FSIOperator& /*oper*/, const std::string& FileName )
51 {
52  M_ODEscheme.setInitialCondition (0.);
53 
54  GetPot dataFile (FileName);
55  M_dt = dataFile ("problem/timestep", 0.001);
56  M_T_max = dataFile ("problem/T_max", 0.8);
57  M_E_max = dataFile ("problem/E_max", 1333.22);
58  M_V_0 = dataFile ("problem/V_0", 2);
59  M_Vt_ao = dataFile ("problem/Vt_ao", 5);
60  M_RV_art = dataFile ("problem/RV_art", 10);
61  M_RA_V = dataFile ("problem/RA_V", 10);
62  M_LV_art = dataFile ("problem/LV_art", 0.6879);
63  M_LA_V = dataFile ("problem/LA_V", 0.6670);
64  M_pressure = dataFile ("problem/p0", 1000);
65  M_Tpb = dataFile ("problem/Tpb", 0.1);
66  M_Tpw = dataFile ("problem/Tpw", 0.55);
67 }
68 
69 Real& LumpedHeart::outPressure (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
70 {
72 }
73 
74 void LumpedHeart::renewParameters ( FSIOperator& /*oper*/, const int& /*flag*/, const Real& time , const Real& flux)
75 {
76  M_intFlux += flux * M_dt;
77  //should have a different sign, but it is assigned as a Normal bc so we take the opposite
78  M_ODEscheme.updateRHSContribution (M_dt);
79  LumpedHeart::M_pressure = (-flux * (M_RV_art) - M_elastance (time) * (M_Vt_ao - M_intFlux - M_V_0) ) + (M_LV_art) * (-flux / M_dt + M_ODEscheme.rhsContributionFirstDerivative() );
80  // flux = (M_ODEScheme.time_der(M_dt)-M_Pressure+M_elastance*(M_Vt_ao-M_intFlux-M_V_0))/(M_LV_art+M_elastance*M_dt+M_RV_art);
81  M_ODEscheme.shiftRight (flux);
82 }
83 
85 {
86  Real ret = 1 - cos ( (t - M_Tpb) / M_Tpw * 2 * PI);
87  if (t < M_Tpb)
88  {
89  return (0.0);
90  }
91  else if (t < M_Tpb + M_Tpw)
92  {
93  return ret * 1333.22;
94  }
95  else
96  {
97  return (0.0);
98  }
99 }
100 
101 
102 Real LumpedHeart::fZero (const Real& /*t*/, const Real& /*x*/, const Real& /*y*/, const Real& /*z*/, const ID& /*i*/)
103 {
104  return 0.0;
105 }
106 
108 }
void assignFunction(bcBase_Type &base)
Assign the function to the base of the BCHandler.
static Real & outPressure(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
Definition: lumpedHeart.cpp:69
double operator()(const char *VarName, const double &Default) const
Definition: GetPot.hpp:2033
Real M_elastance(const Real &t)
Definition: lumpedHeart.cpp:84
void renewParameters(FSIOperator &Oper, const int &flag, const Real &time, const Real &flux)
Definition: lumpedHeart.cpp:74
#define PI
void initParameters(FSIOperator &Oper, const std::string &FileName)
Definition: lumpedHeart.cpp:50
uint32_type ID
IDs.
Definition: LifeV.hpp:194
Real fZero(const Real &t, const Real &x, const Real &y, const Real &z, const ID &i)
static Real M_pressure
Definition: lumpedHeart.hpp:90
double Real
Generic real data.
Definition: LifeV.hpp:175
int operator()(const char *VarName, int Default) const
Definition: GetPot.hpp:2021