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,
53  -13.3322); // -10mmHg converted to kg / (cm s^2)
54 }
55 
57 {
58 }
59 
61  const NekDouble &A, const NekDouble &A0,
62  const NekDouble &dAUdx,
63  const NekDouble &gamma,
64  const NekDouble &alpha)
65 {
66  NekDouble c0 = 0.0;
67  GetC0(c0, beta, A0);
68 
69  NekDouble b = 0.0;
70  GetB(b, c0);
71 
72  P = m_PExt +
73  (2 * m_rho * c0 * c0 / b) *
74  (pow((A / A0), b / 2) - 1) // Power law by Smith/Canic/Mynard
75  - A0 * gamma * dAUdx / (A * sqrt(A)); // Viscoelasticity
76 }
77 
79  const NekDouble &A, const NekDouble &A0,
80  const NekDouble &alpha)
81 {
82  NekDouble c0 = 0.0;
83  GetC0(c0, beta, A0);
84 
85  NekDouble b = 0.0;
86  GetB(b, c0);
87 
88  c = c0 * pow((A / A0), b / 4); // Elastic
89 }
90 
92  const NekDouble &beta, const NekDouble &A,
93  const NekDouble &A0, const NekDouble &alpha)
94 {
95  NekDouble I = 0.0;
96  GetCharIntegral(I, beta, A, A0, alpha);
97 
98  W1 = u + I; // Elastic and assumes u0 = 0
99 }
100 
102  const NekDouble &beta, const NekDouble &A,
103  const NekDouble &A0, const NekDouble &alpha)
104 {
105  NekDouble I = 0.0;
106  GetCharIntegral(I, beta, A, A0, alpha);
107 
108  W2 = u - I; // Elastic and assumes u0 = 0
109 }
110 
112  const NekDouble &W2,
113  const NekDouble &beta,
114  const NekDouble &A0,
115  const NekDouble &alpha)
116 {
117  NekDouble c0 = 0.0;
118  GetC0(c0, beta, A0);
119 
120  NekDouble b = 0.0;
121  GetB(b, c0);
122 
123  A = A0 * pow(((b / (8 * c0)) * (W1 - W2) + 1), 4 / b);
124 }
125 
127  const NekDouble &W2)
128 {
129  u = (W1 + W2) / 2;
130 }
131 
133  const NekDouble &A,
134  const NekDouble &A0,
135  const NekDouble &alpha)
136 {
137  NekDouble c = 0.0;
138  NekDouble c0 = 0.0;
139 
140  GetC0(c0, beta, A0);
141  GetC(c, beta, A, A0);
142 
143  NekDouble b = 0.0;
144  GetB(b, c0);
145 
146  I = (4 / b) * (c - c0);
147 }
148 
152  const Array<OneD, NekDouble> &A0, const Array<OneD, NekDouble> &alpha,
153  const std::string &type)
154 {
155  // General formulation
156  if (type == "Bifurcation")
157  {
158  NekMatrix<NekDouble> J(6, 6);
160 
161  for (int i = 0; i < 3; ++i)
162  {
163  GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
164  }
165 
166  J.SetValue(0, 0, 1);
167  J.SetValue(0, 1, 0);
168  J.SetValue(0, 2, 0);
169  J.SetValue(0, 3, c[0] / Au[0]);
170  J.SetValue(0, 4, 0);
171  J.SetValue(0, 5, 0);
172 
173  J.SetValue(1, 0, 0);
174  J.SetValue(1, 1, 1);
175  J.SetValue(1, 2, 0);
176  J.SetValue(1, 3, 0);
177  J.SetValue(1, 4, -c[1] / Au[1]);
178  J.SetValue(1, 5, 0);
179 
180  J.SetValue(2, 0, 0);
181  J.SetValue(2, 1, 0);
182  J.SetValue(2, 2, 1);
183  J.SetValue(2, 3, 0);
184  J.SetValue(2, 4, 0);
185  J.SetValue(2, 5, -c[2] / Au[2]);
186 
187  J.SetValue(3, 0, Au[0]);
188  J.SetValue(3, 1, -Au[1]);
189  J.SetValue(3, 2, -Au[2]);
190  J.SetValue(3, 3, uu[0]);
191  J.SetValue(3, 4, -uu[1]);
192  J.SetValue(3, 5, -uu[2]);
193 
194  J.SetValue(4, 0, 2 * uu[0]);
195  J.SetValue(4, 1, -2 * uu[1]);
196  J.SetValue(4, 2, 0);
197  J.SetValue(4, 3, 2 * c[0] * c[0] / Au[0]);
198  J.SetValue(4, 4, -2 * c[1] * c[1] / Au[1]);
199  J.SetValue(4, 5, 0);
200 
201  J.SetValue(5, 0, 2 * uu[0]);
202  J.SetValue(5, 1, 0);
203  J.SetValue(5, 2, -2 * uu[2]);
204  J.SetValue(5, 3, 2 * c[0] * c[0] / Au[0]);
205  J.SetValue(5, 4, 0);
206  J.SetValue(5, 5, -2 * c[2] * c[2] / Au[2]);
207 
208  invJ = J;
209  invJ.Invert();
210  }
211  else if (type == "Merge")
212  {
213  NekMatrix<NekDouble> J(6, 6);
215 
216  for (int i = 0; i < 3; ++i)
217  {
218  GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
219  }
220 
221  J.SetValue(0, 0, 1);
222  J.SetValue(0, 1, 0);
223  J.SetValue(0, 2, 0);
224  J.SetValue(0, 3, -c[0] / Au[0]);
225  J.SetValue(0, 4, 0);
226  J.SetValue(0, 5, 0);
227 
228  J.SetValue(1, 0, 0);
229  J.SetValue(1, 1, 1);
230  J.SetValue(1, 2, 0);
231  J.SetValue(1, 3, 0);
232  J.SetValue(1, 4, c[1] / Au[1]);
233  J.SetValue(1, 5, 0);
234 
235  J.SetValue(2, 0, 0);
236  J.SetValue(2, 1, 0);
237  J.SetValue(2, 2, 1);
238  J.SetValue(2, 3, 0);
239  J.SetValue(2, 4, 0);
240  J.SetValue(2, 5, c[2] / Au[2]);
241 
242  J.SetValue(3, 0, Au[0]);
243  J.SetValue(3, 1, -Au[1]);
244  J.SetValue(3, 2, -Au[2]);
245  J.SetValue(3, 3, uu[0]);
246  J.SetValue(3, 4, -uu[1]);
247  J.SetValue(3, 5, -uu[2]);
248 
249  J.SetValue(4, 0, 2 * uu[0]);
250  J.SetValue(4, 1, -2 * uu[1]);
251  J.SetValue(4, 2, 0);
252  J.SetValue(4, 3, 2 * c[0] * c[0] / Au[0]);
253  J.SetValue(4, 4, -2 * c[1] * c[1] / Au[1]);
254  J.SetValue(4, 5, 0);
255 
256  J.SetValue(5, 0, 2 * uu[0]);
257  J.SetValue(5, 1, 0);
258  J.SetValue(5, 2, -2 * uu[2]);
259  J.SetValue(5, 3, 2 * c[0] * c[0] / Au[0]);
260  J.SetValue(5, 4, 0);
261  J.SetValue(5, 5, -2 * c[2] * c[2] / Au[2]);
262 
263  invJ = J;
264  invJ.Invert();
265  }
266  else if (type == "Interface")
267  {
268  NekMatrix<NekDouble> J(4, 4);
270 
271  for (int i = 0; i < 2; ++i)
272  {
273  GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
274  }
275 
276  J.SetValue(0, 0, 1);
277  J.SetValue(0, 1, 0);
278  J.SetValue(0, 2, c[0] / Au[0]);
279  J.SetValue(0, 3, 0);
280 
281  J.SetValue(1, 0, 0);
282  J.SetValue(1, 1, 1);
283  J.SetValue(1, 2, 0);
284  J.SetValue(1, 3, -c[1] / Au[1]);
285 
286  J.SetValue(2, 0, Au[0]);
287  J.SetValue(2, 1, -Au[1]);
288  J.SetValue(2, 2, uu[0]);
289  J.SetValue(2, 3, -uu[1]);
290 
291  J.SetValue(3, 0, 2 * uu[0]);
292  J.SetValue(3, 1, -2 * uu[1]);
293  J.SetValue(3, 2, 2 * c[0] * c[0] / Au[0]);
294  J.SetValue(3, 3, -2 * c[1] * c[1] / Au[1]);
295 
296  invJ = J;
297  invJ.Invert();
298  }
299 }
300 
302  const NekDouble &A0)
303 {
304  // Reference c0 from the beta law
305  c0 = sqrt(beta * sqrt(A0) / (2 * m_rho));
306 
307  /*
308  // Empirical approximation from Olufsen et al (1999)
309  NekDouble k1 = 3E3;
310  NekDouble k2 = -9;
311  NekDouble k3 = 337;
312  NekDouble PI = 3.14159265359;
313 
314  NekDouble R0 = sqrt(A0 / PI);
315 
316  c0 = sqrt(2 / (3 * m_rho) * (k1 * exp(k2 * R0) + k3));
317  */
318 }
319 
321 {
322  b = 2 * m_rho * c0 * c0 / (m_PExt - P_Collapse);
323 }
324 
325 } // namespace Nektar
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
Definition: NekFactory.hpp:198
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
@ beta
Gauss Radau pinned at x=-1,.
Definition: PointsType.h:61
The above copyright notice and this permission notice shall be included.
Definition: CoupledSolver.h:1
PressureAreaFactory & GetPressureAreaFactory()
double NekDouble
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:291