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