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 [[maybe_unused]] 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 [[maybe_unused]] 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 [[maybe_unused]] 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 NekDouble &I, const NekDouble &beta, const NekDouble &A,
134 const NekDouble &A0, [[maybe_unused]] const NekDouble &alpha)
135{
136 NekDouble c = 0.0;
137 NekDouble c0 = 0.0;
138
139 GetC0(c0, beta, A0);
140 GetC(c, beta, A, A0);
141
142 NekDouble b = 0.0;
143 GetB(b, c0);
144
145 I = (4 / b) * (c - c0);
146}
147
151 const Array<OneD, NekDouble> &A0, const Array<OneD, NekDouble> &alpha,
152 const std::string &type)
153{
154 // General formulation
155 if (type == "Bifurcation")
156 {
157 NekMatrix<NekDouble> J(6, 6);
159
160 for (int i = 0; i < 3; ++i)
161 {
162 GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
163 }
164
165 J.SetValue(0, 0, 1);
166 J.SetValue(0, 1, 0);
167 J.SetValue(0, 2, 0);
168 J.SetValue(0, 3, c[0] / Au[0]);
169 J.SetValue(0, 4, 0);
170 J.SetValue(0, 5, 0);
171
172 J.SetValue(1, 0, 0);
173 J.SetValue(1, 1, 1);
174 J.SetValue(1, 2, 0);
175 J.SetValue(1, 3, 0);
176 J.SetValue(1, 4, -c[1] / Au[1]);
177 J.SetValue(1, 5, 0);
178
179 J.SetValue(2, 0, 0);
180 J.SetValue(2, 1, 0);
181 J.SetValue(2, 2, 1);
182 J.SetValue(2, 3, 0);
183 J.SetValue(2, 4, 0);
184 J.SetValue(2, 5, -c[2] / Au[2]);
185
186 J.SetValue(3, 0, Au[0]);
187 J.SetValue(3, 1, -Au[1]);
188 J.SetValue(3, 2, -Au[2]);
189 J.SetValue(3, 3, uu[0]);
190 J.SetValue(3, 4, -uu[1]);
191 J.SetValue(3, 5, -uu[2]);
192
193 J.SetValue(4, 0, 2 * uu[0]);
194 J.SetValue(4, 1, -2 * uu[1]);
195 J.SetValue(4, 2, 0);
196 J.SetValue(4, 3, 2 * c[0] * c[0] / Au[0]);
197 J.SetValue(4, 4, -2 * c[1] * c[1] / Au[1]);
198 J.SetValue(4, 5, 0);
199
200 J.SetValue(5, 0, 2 * uu[0]);
201 J.SetValue(5, 1, 0);
202 J.SetValue(5, 2, -2 * uu[2]);
203 J.SetValue(5, 3, 2 * c[0] * c[0] / Au[0]);
204 J.SetValue(5, 4, 0);
205 J.SetValue(5, 5, -2 * c[2] * c[2] / Au[2]);
206
207 invJ = J;
208 invJ.Invert();
209 }
210 else if (type == "Merge")
211 {
212 NekMatrix<NekDouble> J(6, 6);
214
215 for (int i = 0; i < 3; ++i)
216 {
217 GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
218 }
219
220 J.SetValue(0, 0, 1);
221 J.SetValue(0, 1, 0);
222 J.SetValue(0, 2, 0);
223 J.SetValue(0, 3, -c[0] / Au[0]);
224 J.SetValue(0, 4, 0);
225 J.SetValue(0, 5, 0);
226
227 J.SetValue(1, 0, 0);
228 J.SetValue(1, 1, 1);
229 J.SetValue(1, 2, 0);
230 J.SetValue(1, 3, 0);
231 J.SetValue(1, 4, c[1] / Au[1]);
232 J.SetValue(1, 5, 0);
233
234 J.SetValue(2, 0, 0);
235 J.SetValue(2, 1, 0);
236 J.SetValue(2, 2, 1);
237 J.SetValue(2, 3, 0);
238 J.SetValue(2, 4, 0);
239 J.SetValue(2, 5, c[2] / Au[2]);
240
241 J.SetValue(3, 0, Au[0]);
242 J.SetValue(3, 1, -Au[1]);
243 J.SetValue(3, 2, -Au[2]);
244 J.SetValue(3, 3, uu[0]);
245 J.SetValue(3, 4, -uu[1]);
246 J.SetValue(3, 5, -uu[2]);
247
248 J.SetValue(4, 0, 2 * uu[0]);
249 J.SetValue(4, 1, -2 * uu[1]);
250 J.SetValue(4, 2, 0);
251 J.SetValue(4, 3, 2 * c[0] * c[0] / Au[0]);
252 J.SetValue(4, 4, -2 * c[1] * c[1] / Au[1]);
253 J.SetValue(4, 5, 0);
254
255 J.SetValue(5, 0, 2 * uu[0]);
256 J.SetValue(5, 1, 0);
257 J.SetValue(5, 2, -2 * uu[2]);
258 J.SetValue(5, 3, 2 * c[0] * c[0] / Au[0]);
259 J.SetValue(5, 4, 0);
260 J.SetValue(5, 5, -2 * c[2] * c[2] / Au[2]);
261
262 invJ = J;
263 invJ.Invert();
264 }
265 else if (type == "Interface")
266 {
267 NekMatrix<NekDouble> J(4, 4);
269
270 for (int i = 0; i < 2; ++i)
271 {
272 GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
273 }
274
275 J.SetValue(0, 0, 1);
276 J.SetValue(0, 1, 0);
277 J.SetValue(0, 2, c[0] / Au[0]);
278 J.SetValue(0, 3, 0);
279
280 J.SetValue(1, 0, 0);
281 J.SetValue(1, 1, 1);
282 J.SetValue(1, 2, 0);
283 J.SetValue(1, 3, -c[1] / Au[1]);
284
285 J.SetValue(2, 0, Au[0]);
286 J.SetValue(2, 1, -Au[1]);
287 J.SetValue(2, 2, uu[0]);
288 J.SetValue(2, 3, -uu[1]);
289
290 J.SetValue(3, 0, 2 * uu[0]);
291 J.SetValue(3, 1, -2 * uu[1]);
292 J.SetValue(3, 2, 2 * c[0] * c[0] / Au[0]);
293 J.SetValue(3, 3, -2 * c[1] * c[1] / Au[1]);
294
295 invJ = J;
296 invJ.Invert();
297 }
298}
299
301 const NekDouble &A0)
302{
303 // Reference c0 from the beta law
304 c0 = sqrt(beta * sqrt(A0) / (2 * m_rho));
305
306 /*
307 // Empirical approximation from Olufsen et al (1999)
308 NekDouble k1 = 3E3;
309 NekDouble k2 = -9;
310 NekDouble k3 = 337;
311 NekDouble PI = 3.14159265359;
312
313 NekDouble R0 = sqrt(A0 / PI);
314
315 c0 = sqrt(2 / (3 * m_rho) * (k1 * exp(k2 * R0) + k3));
316 */
317}
318
320{
321 b = 2 * m_rho * c0 * c0 / (m_PExt - P_Collapse);
322}
323
324} // namespace Nektar
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
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)
void v_GetUFromChars(NekDouble &u, const NekDouble &W1, const NekDouble &W2) override
PowerPressureArea(Array< OneD, MultiRegions::ExpListSharedPtr > pVessel, const LibUtilities::SessionReaderSharedPtr pSession)
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
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
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)
void v_GetAFromChars(NekDouble &A, const NekDouble &W1, const NekDouble &W2, const NekDouble &beta, const NekDouble &A0, const NekDouble &alpha=0.5) override
void v_GetC(NekDouble &c, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5) override
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:59
@ P
Monomial polynomials .
Definition: BasisType.h:62
PressureAreaFactory & GetPressureAreaFactory()
double NekDouble
STL namespace.
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:294