Nektar++
PowerPressureArea.cpp
Go to the documentation of this file.
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // File PowerPressureArea.cpp
4 //
5 // For more information, please see: http://www.nektar.info
6 //
7 // The MIT License
8 //
9 // Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10 // Department of Aeronautics, Imperial College London (UK), and Scientific
11 // Computing and Imaging Institute, University of Utah (USA).
12 //
13 // License for the specific language governing rights and limitations under
14 // Permission is hereby granted, free of charge, to any person obtaining a
15 // copy of this software and associated documentation files (the "Software"),
16 // to deal in the Software without restriction, including without limitation
17 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
18 // and/or sell copies of the Software, and to permit persons to whom the
19 // Software is furnished to do so, subject to the following conditions:
20 //
21 // The above copyright notice and this permission notice shall be included
22 // in all copies or substantial portions of the Software.
23 //
24 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
27 // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
29 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
30 // DEALINGS IN THE SOFTWARE.
31 //
32 // Description: PowerPressureArea class
33 //
34 ///////////////////////////////////////////////////////////////////////////////
36 
37 using namespace std;
38 
39 namespace Nektar
40 {
41 
42 std::string PowerPressureArea::className =
44  "Power", PowerPressureArea::create,
45  "Power law pressure area relationship for the arterial system");
46 
47 PowerPressureArea::PowerPressureArea(
50  : PulseWavePressureArea(pVessel, pSession)
51 {
52  m_session->LoadParameter("P_Collapse", P_Collapse, -13.3322); // -10mmHg converted to kg / (cm s^2)
53 }
54 
56 {
57 }
58 
60  const NekDouble &A, const NekDouble &A0, const NekDouble &dAUdx,
61  const NekDouble &gamma, const NekDouble &alpha)
62 {
63  NekDouble c0 = 0.0;
64  GetC0(c0, beta, A0);
65 
66  NekDouble b = 0.0;
67  GetB(b, c0);
68 
69  P = m_PExt + (2 * m_rho * c0 * c0 / b) * (pow((A / A0), b / 2) - 1) // Power law by Smith/Canic/Mynard
70  - A0 * gamma * dAUdx / (A * sqrt(A)); // Viscoelasticity
71 }
72 
74  const NekDouble &A, const NekDouble &A0, const NekDouble &alpha)
75 {
76  NekDouble c0 = 0.0;
77  GetC0(c0, beta, A0);
78 
79  NekDouble b = 0.0;
80  GetB(b, c0);
81 
82  c = c0 * pow((A / A0), b / 4); // Elastic
83 }
84 
86  const NekDouble &beta, const NekDouble &A, const NekDouble &A0,
87  const NekDouble &alpha)
88 {
89  NekDouble I = 0.0;
90  GetCharIntegral(I, beta, A, A0, alpha);
91 
92  W1 = u + I; // Elastic and assumes u0 = 0
93 }
94 
96  const NekDouble &beta, const NekDouble &A, const NekDouble &A0,
97  const NekDouble &alpha)
98 {
99  NekDouble I = 0.0;
100  GetCharIntegral(I, beta, A, A0, alpha);
101 
102  W2 = u - I; // Elastic and assumes u0 = 0
103 }
104 
106  const NekDouble &W2, const NekDouble &beta, const NekDouble &A0,
107  const NekDouble &alpha)
108 {
109  NekDouble c0 = 0.0;
110  GetC0(c0, beta, A0);
111 
112  NekDouble b = 0.0;
113  GetB(b, c0);
114 
115  A = A0 * pow(((b / (8 * c0)) * (W1 - W2) + 1), 4 / b);
116 }
117 
119  const NekDouble &W2)
120 {
121  u = (W1 + W2) / 2;
122 }
123 
125  const NekDouble &A, const NekDouble &A0, const NekDouble &alpha)
126 {
127  NekDouble c = 0.0;
128  NekDouble c0 = 0.0;
129 
130  GetC0(c0, beta, A0);
131  GetC(c, beta, A, A0);
132 
133  NekDouble b = 0.0;
134  GetB(b, c0);
135 
136  I = (4 / b) * (c - c0);
137 }
138 
140  const Array<OneD, NekDouble> &Au, const Array<OneD, NekDouble> &uu,
141  const Array<OneD, NekDouble> &beta, const Array<OneD, NekDouble> &A0,
142  const Array<OneD, NekDouble> &alpha, const std::string &type)
143 {
144  // General formulation
145  if (type == "Bifurcation")
146  {
147  NekMatrix<NekDouble> J(6, 6);
149 
150  for (int i = 0; i < 3; ++i)
151  {
152  GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
153  }
154 
155  J.SetValue(0, 0, 1);
156  J.SetValue(0, 1, 0);
157  J.SetValue(0, 2, 0);
158  J.SetValue(0, 3, c[0] / Au[0]);
159  J.SetValue(0, 4, 0);
160  J.SetValue(0, 5, 0);
161 
162  J.SetValue(1, 0, 0);
163  J.SetValue(1, 1, 1);
164  J.SetValue(1, 2, 0);
165  J.SetValue(1, 3, 0);
166  J.SetValue(1, 4, -c[1] / Au[1]);
167  J.SetValue(1, 5, 0);
168 
169  J.SetValue(2, 0, 0);
170  J.SetValue(2, 1, 0);
171  J.SetValue(2, 2, 1);
172  J.SetValue(2, 3, 0);
173  J.SetValue(2, 4, 0);
174  J.SetValue(2, 5, -c[2] / Au[2]);
175 
176  J.SetValue(3, 0, Au[0]);
177  J.SetValue(3, 1, -Au[1]);
178  J.SetValue(3, 2, -Au[2]);
179  J.SetValue(3, 3, uu[0]);
180  J.SetValue(3, 4, -uu[1]);
181  J.SetValue(3, 5, -uu[2]);
182 
183  J.SetValue(4, 0, 2 * uu[0]);
184  J.SetValue(4, 1, -2 * uu[1]);
185  J.SetValue(4, 2, 0);
186  J.SetValue(4, 3, 2 * c[0] * c[0] / Au[0]);
187  J.SetValue(4, 4, -2 * c[1] * c[1] / Au[1]);
188  J.SetValue(4, 5, 0);
189 
190  J.SetValue(5, 0, 2 * uu[0]);
191  J.SetValue(5, 1, 0);
192  J.SetValue(5, 2, -2 * uu[2]);
193  J.SetValue(5, 3, 2 * c[0] * c[0] / Au[0]);
194  J.SetValue(5, 4, 0);
195  J.SetValue(5, 5, -2 * c[2] * c[2] / Au[2]);
196 
197  invJ = J;
198  invJ.Invert();
199  }
200  else if (type == "Merge")
201  {
202  NekMatrix<NekDouble> J(6, 6);
204 
205  for (int i = 0; i < 3; ++i)
206  {
207  GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
208  }
209 
210  J.SetValue(0, 0, 1);
211  J.SetValue(0, 1, 0);
212  J.SetValue(0, 2, 0);
213  J.SetValue(0, 3, -c[0] / Au[0]);
214  J.SetValue(0, 4, 0);
215  J.SetValue(0, 5, 0);
216 
217  J.SetValue(1, 0, 0);
218  J.SetValue(1, 1, 1);
219  J.SetValue(1, 2, 0);
220  J.SetValue(1, 3, 0);
221  J.SetValue(1, 4, c[1] / Au[1]);
222  J.SetValue(1, 5, 0);
223 
224  J.SetValue(2, 0, 0);
225  J.SetValue(2, 1, 0);
226  J.SetValue(2, 2, 1);
227  J.SetValue(2, 3, 0);
228  J.SetValue(2, 4, 0);
229  J.SetValue(2, 5, c[2] / Au[2]);
230 
231  J.SetValue(3, 0, Au[0]);
232  J.SetValue(3, 1, -Au[1]);
233  J.SetValue(3, 2, -Au[2]);
234  J.SetValue(3, 3, uu[0]);
235  J.SetValue(3, 4, -uu[1]);
236  J.SetValue(3, 5, -uu[2]);
237 
238  J.SetValue(4, 0, 2 * uu[0]);
239  J.SetValue(4, 1, -2 * uu[1]);
240  J.SetValue(4, 2, 0);
241  J.SetValue(4, 3, 2 * c[0] * c[0] / Au[0]);
242  J.SetValue(4, 4, -2 * c[1] * c[1] / Au[1]);
243  J.SetValue(4, 5, 0);
244 
245  J.SetValue(5, 0, 2 * uu[0]);
246  J.SetValue(5, 1, 0);
247  J.SetValue(5, 2, -2 * uu[2]);
248  J.SetValue(5, 3, 2 * c[0] * c[0] / Au[0]);
249  J.SetValue(5, 4, 0);
250  J.SetValue(5, 5, -2 * c[2] * c[2] / Au[2]);
251 
252  invJ = J;
253  invJ.Invert();
254  }
255  else if (type == "Junction")
256  {
257  NekMatrix<NekDouble> J(4, 4);
259 
260  for (int i = 0; i < 2; ++i)
261  {
262  GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
263  }
264 
265  J.SetValue(0, 0, 1);
266  J.SetValue(0, 1, 0);
267  J.SetValue(0, 2, c[0] / Au[0]);
268  J.SetValue(0, 3, 0);
269 
270  J.SetValue(1, 0, 0);
271  J.SetValue(1, 1, 1);
272  J.SetValue(1, 2, 0);
273  J.SetValue(1, 3, -c[1] / Au[1]);
274 
275  J.SetValue(2, 0, Au[0]);
276  J.SetValue(2, 1, -Au[1]);
277  J.SetValue(2, 2, uu[0]);
278  J.SetValue(2, 3, -uu[1]);
279 
280  J.SetValue(3, 0, 2 * uu[0]);
281  J.SetValue(3, 1, -2 * uu[1]);
282  J.SetValue(3, 2, 2 * c[0] * c[0] / Au[0]);
283  J.SetValue(3, 3, -2 * c[1] * c[1] / Au[1]);
284 
285  invJ = J;
286  invJ.Invert();
287  }
288 }
289 
291  const NekDouble &A0)
292 {
293  // Reference c0 from the beta law
294  c0 = sqrt(beta * sqrt(A0) / (2 * m_rho));
295 
296  /*
297  // Empirical approximation from Olufsen et al (1999)
298  NekDouble k1 = 3E3;
299  NekDouble k2 = -9;
300  NekDouble k3 = 337;
301  NekDouble PI = 3.14159265359;
302 
303  NekDouble R0 = sqrt(A0 / PI);
304 
305  c0 = sqrt(2 / (3 * m_rho) * (k1 * exp(k2 * R0) + k3));
306  */
307 }
308 
310 {
311  b = 2 * m_rho * c0 * c0 / (m_PExt - P_Collapse);
312 }
313 
314 } // namespace Nektar
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:200
virtual void v_GetJacobianInverse(NekMatrix< NekDouble > &invJ, const Array< OneD, NekDouble > &Au, const Array< OneD, NekDouble > &uu, const Array< OneD, NekDouble > &beta, const Array< OneD, NekDouble > &A0, const Array< OneD, NekDouble > &alpha, const std::string &type)
virtual void v_GetUFromChars(NekDouble &u, const NekDouble &W1, const NekDouble &W2)
virtual void v_GetW1(NekDouble &W1, const NekDouble &u, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5)
virtual void v_GetAFromChars(NekDouble &A, const NekDouble &W1, const NekDouble &W2, const NekDouble &beta, const NekDouble &A0, const NekDouble &alpha=0.5)
virtual void GetC0(NekDouble &c0, const NekDouble &beta, const NekDouble &A0)
virtual void v_GetPressure(NekDouble &P, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &dAUdx, const NekDouble &gamma=0, const NekDouble &alpha=0.5)
virtual void GetB(NekDouble &b, const NekDouble &c0)
virtual void v_GetCharIntegral(NekDouble &I, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5)
virtual void v_GetW2(NekDouble &W2, const NekDouble &u, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5)
virtual void v_GetC(NekDouble &c, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5)
void GetCharIntegral(NekDouble &I, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5)
void GetC(NekDouble &c, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5)
LibUtilities::SessionReaderSharedPtr m_session
std::shared_ptr< SessionReader > SessionReaderSharedPtr
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
PressureAreaFactory & GetPressureAreaFactory()
double NekDouble
P
Definition: main.py:133
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:267