Nektar++
BetaPressureArea.cpp
Go to the documentation of this file.
1///////////////////////////////////////////////////////////////////////////////
2//
3// File: BetaPressureArea.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: BetaPressureArea class
33//
34///////////////////////////////////////////////////////////////////////////////
35
37
38namespace Nektar
39{
40
44 "Beta law pressure area relationship for the arterial system");
45
49 : PulseWavePressureArea(pVessel, pSession)
50{
51}
52
54 const NekDouble &A, const NekDouble &A0,
55 const NekDouble &dAUdx,
56 const NekDouble &gamma,
57 [[maybe_unused]] const NekDouble &alpha)
58{
59 P = m_PExt + beta * (sqrt(A) - sqrt(A0)) -
60 gamma * dAUdx / sqrt(A); // Viscoelasticity
61}
62
64 const NekDouble &A,
65 [[maybe_unused]] const NekDouble &A0,
66 [[maybe_unused]] const NekDouble &alpha)
67{
68 c = sqrt(beta / (2 * m_rho)) * sqrt(sqrt(A)); // Elastic
69}
70
72 const NekDouble &beta, const NekDouble &A,
73 const NekDouble &A0,
74 [[maybe_unused]] const NekDouble &alpha)
75{
76 NekDouble I = 0.0;
77 GetCharIntegral(I, beta, A, A0);
78
79 W1 = u + I; // Elastic and assumes u0 = 0
80}
81
83 const NekDouble &beta, const NekDouble &A,
84 const NekDouble &A0,
85 [[maybe_unused]] const NekDouble &alpha)
86{
87 NekDouble I = 0.0;
88 GetCharIntegral(I, beta, A, A0);
89
90 W2 = u - I; // Elastic and assumes u0 = 0
91}
92
94 const NekDouble &W2,
95 const NekDouble &beta,
96 const NekDouble &A0,
97 [[maybe_unused]] const NekDouble &alpha)
98{
99 A = pow((W1 - W2) * sqrt(2 * m_rho / beta) / 8 + sqrt(sqrt(A0)), 4);
100}
101
103 const NekDouble &W2)
104{
105 u = (W1 + W2) / 2; // Necessarily the case for all tube laws
106}
107
109 NekDouble &I, const NekDouble &beta, const NekDouble &A,
110 const NekDouble &A0, [[maybe_unused]] const NekDouble &alpha)
111{
112 NekDouble c = 0.0;
113 NekDouble c0 = 0.0;
114
115 GetC(c, beta, A, A0);
116 GetC(c0, beta, A0, A0);
117
118 I = 4 * (c - c0);
119}
120
122 const Array<OneD, NekDouble> &Au,
123 const Array<OneD, NekDouble> &uu,
125 const Array<OneD, NekDouble> &A0,
126 const Array<OneD, NekDouble> &alpha,
127 const std::string &type)
128{
129 /*
130 In the interest of speed, the inverse of the Jacobians for bifurcations,
131 merges and junctions for the beta law have been calculated analytically.
132 This can be done for other laws too, or the general formulation can be used
133 instead.
134 */
135
136 NekDouble k = 0.0;
137
138 if (type == "Bifurcation")
139 {
140 NekMatrix<NekDouble> J(6, 6);
143
144 for (int i = 0; i < 3; ++i)
145 {
146 GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
147 }
148
149 k = c[0] * Au[1] * c[2] + Au[0] * c[2] * c[1] + Au[2] * c[0] * c[1];
150 K[0] = (c[0] - uu[0]) * k;
151 K[1] = (c[1] + uu[1]) * k;
152 K[2] = (c[2] + uu[2]) * k;
153
154 invJ.SetValue(0, 0,
155 (-c[1] * uu[0] * c[2] * Au[0] +
156 Au[2] * c[1] * c[0] * c[0] +
157 Au[1] * c[0] * c[0] * c[2]) /
158 K[0]);
159 invJ.SetValue(0, 1, Au[1] * (c[1] - uu[1]) * c[0] * c[2] / K[0]);
160 invJ.SetValue(0, 2, Au[2] * (c[2] - uu[2]) * c[0] * c[1] / K[0]);
161 invJ.SetValue(0, 3, c[0] * c[1] * c[2] / K[0]);
162 invJ.SetValue(0, 4, -0.5 * c[0] * Au[1] * c[2] / K[0]);
163 invJ.SetValue(0, 5, -0.5 * Au[2] * c[0] * c[1] / K[0]);
164
165 invJ.SetValue(1, 0, Au[0] * (c[0] + uu[0]) * c[1] * c[2] / K[1]);
166 invJ.SetValue(1, 1,
167 (c[0] * uu[1] * c[2] * Au[1] +
168 Au[2] * c[0] * c[1] * c[1] +
169 c[2] * c[1] * c[1] * Au[0]) /
170 K[1]);
171 invJ.SetValue(1, 2, -Au[2] * (c[2] - uu[2]) * c[0] * c[1] / K[1]);
172 invJ.SetValue(1, 3, -c[0] * c[1] * c[2] / K[1]);
173 invJ.SetValue(1, 4, -0.5 * (c[0] * Au[2] + Au[0] * c[2]) * c[1] / K[1]);
174 invJ.SetValue(1, 5, 0.5 * Au[2] * c[0] * c[1] / K[1]);
175
176 invJ.SetValue(2, 0, Au[0] * (c[0] + uu[0]) * c[1] * c[2] / K[2]);
177 invJ.SetValue(2, 1, -Au[1] * (c[1] - uu[1]) * c[0] * c[2] / K[2]);
178 invJ.SetValue(2, 2,
179 (c[0] * c[1] * uu[2] * Au[2] +
180 c[0] * Au[1] * c[2] * c[2] +
181 c[1] * c[2] * c[2] * Au[0]) /
182 K[2]);
183 invJ.SetValue(2, 3, -c[0] * c[1] * c[2] / K[2]);
184 invJ.SetValue(2, 4, 0.5 * c[0] * Au[1] * c[2] / K[2]);
185 invJ.SetValue(2, 5, -0.5 * (Au[1] * c[0] + c[1] * Au[0]) * c[2] / K[2]);
186
187 invJ.SetValue(3, 0,
188 Au[0] *
189 (Au[0] * c[2] * c[1] - uu[0] * c[2] * Au[1] -
190 uu[0] * c[1] * Au[2]) /
191 K[0]);
192 invJ.SetValue(3, 1, -Au[0] * Au[1] * (c[1] - uu[1]) * c[2] / K[0]);
193 invJ.SetValue(3, 2, -Au[0] * Au[2] * (c[2] - uu[2]) * c[1] / K[0]);
194 invJ.SetValue(3, 3, -Au[0] * c[2] * c[1] / K[0]);
195 invJ.SetValue(3, 4, 0.5 * Au[0] * Au[1] * c[2] / K[0]);
196 invJ.SetValue(3, 5, 0.5 * Au[0] * c[1] * Au[2] / K[0]);
197
198 invJ.SetValue(4, 0, Au[0] * Au[1] * (c[0] + uu[0]) * c[2] / K[1]);
199 invJ.SetValue(4, 1,
200 -Au[1] *
201 (c[0] * Au[1] * c[2] + c[0] * uu[1] * Au[2] +
202 c[2] * uu[1] * Au[0]) /
203 K[1]);
204 invJ.SetValue(4, 2, -Au[2] * Au[1] * (c[2] - uu[2]) * c[0] / K[1]);
205 invJ.SetValue(4, 3, -c[0] * Au[1] * c[2] / K[1]);
206 invJ.SetValue(4, 4,
207 -0.5 * Au[1] * (c[0] * Au[2] + Au[0] * c[2]) / K[1]);
208 invJ.SetValue(4, 5, 0.5 * Au[2] * Au[1] * c[0] / K[1]);
209
210 invJ.SetValue(5, 0, Au[0] * Au[2] * (c[0] + uu[0]) * c[1] / K[2]);
211 invJ.SetValue(5, 1, -Au[2] * Au[1] * (c[1] - uu[1]) * c[0] / K[2]);
212 invJ.SetValue(5, 2,
213 -Au[2] *
214 (Au[2] * c[0] * c[1] + c[0] * uu[2] * Au[1] +
215 c[1] * uu[2] * Au[0]) /
216 K[2]);
217 invJ.SetValue(5, 3, -Au[2] * c[0] * c[1] / K[2]);
218 invJ.SetValue(5, 4, 0.5 * Au[2] * Au[1] * c[0] / K[2]);
219 invJ.SetValue(5, 5,
220 -0.5 * Au[2] * (Au[1] * c[0] + c[1] * Au[0]) / K[2]);
221 }
222 else if (type == "Merge")
223 {
224 NekMatrix<NekDouble> J(6, 6);
227
228 for (int i = 0; i < 3; ++i)
229 {
230 GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
231 }
232
233 k = c[0] * Au[1] * c[2] + Au[0] * c[2] * c[1] + Au[2] * c[0] * c[1];
234 K[0] = (c[0] - uu[0]) * k;
235 K[1] = (c[1] + uu[1]) * k;
236 K[2] = (c[2] + uu[2]) * k;
237
238 invJ.SetValue(0, 0,
239 (-c[1] * uu[0] * c[2] * Au[0] +
240 Au[2] * c[1] * c[0] * c[0] +
241 Au[1] * c[0] * c[0] * c[2]) /
242 K[0]);
243 invJ.SetValue(0, 1, Au[1] * (c[1] - uu[1]) * c[0] * c[2] / K[0]);
244 invJ.SetValue(0, 2, Au[2] * (c[2] - uu[2]) * c[0] * c[1] / K[0]);
245 invJ.SetValue(0, 3, c[0] * c[1] * c[2] / K[0]);
246 invJ.SetValue(0, 4, -0.5 * c[0] * Au[1] * c[2] / K[0]);
247 invJ.SetValue(0, 5, -0.5 * Au[2] * c[0] * c[1] / K[0]);
248
249 invJ.SetValue(1, 0, Au[0] * (c[0] + uu[0]) * c[1] * c[2] / K[1]);
250 invJ.SetValue(1, 1,
251 (c[0] * uu[1] * c[2] * Au[1] +
252 Au[2] * c[0] * c[1] * c[1] +
253 c[2] * c[1] * c[1] * Au[0]) /
254 K[1]);
255 invJ.SetValue(1, 2, -Au[2] * (c[2] - uu[2]) * c[0] * c[1] / K[1]);
256 invJ.SetValue(1, 3, -c[0] * c[1] * c[2] / K[1]);
257 invJ.SetValue(1, 4, -0.5 * (c[0] * Au[2] + Au[0] * c[2]) * c[1] / K[1]);
258 invJ.SetValue(1, 5, 0.5 * Au[2] * c[0] * c[1] / K[1]);
259
260 invJ.SetValue(2, 0, Au[0] * (c[0] - uu[0]) * c[1] * c[2] / K[2]);
261 invJ.SetValue(2, 1, -Au[1] * (c[1] + uu[1]) * c[0] * c[2] / K[2]);
262 invJ.SetValue(2, 2,
263 -(c[0] * uu[2] * c[1] * Au[2] -
264 Au[1] * c[0] * c[2] * c[2] -
265 c[1] * c[2] * c[2] * Au[0]) /
266 K[2]);
267 invJ.SetValue(2, 3, -c[0] * c[1] * c[2] / K[2]);
268 invJ.SetValue(2, 4, -0.5 * Au[1] * c[0] * c[2] / K[2]);
269 invJ.SetValue(2, 5, 0.5 * (Au[1] * c[0] + Au[0] * c[1]) * c[2] / K[2]);
270
271 invJ.SetValue(3, 0,
272 -Au[0] *
273 (Au[0] * c[2] * c[1] + uu[0] * c[2] * Au[1] +
274 uu[0] * c[1] * Au[2]) /
275 K[0]);
276 invJ.SetValue(3, 1, Au[0] * Au[1] * (c[1] + uu[1]) * c[2] / K[0]);
277
278 invJ.SetValue(3, 2, -Au[0] * Au[2] * (c[2] - uu[2]) * c[1] / K[0]);
279 invJ.SetValue(3, 3, -Au[0] * c[2] * c[1] / K[0]);
280 invJ.SetValue(3, 4, 0.5 * Au[0] * Au[1] * c[2] / K[0]);
281 invJ.SetValue(3, 5, 0.5 * Au[0] * c[1] * Au[2] / K[0]);
282
283 invJ.SetValue(4, 0, Au[0] * Au[1] * (c[0] + uu[0]) * c[2] / K[1]);
284 invJ.SetValue(4, 1,
285 -Au[1] *
286 (c[0] * Au[1] * c[2] + c[0] * uu[1] * Au[2] +
287 c[2] * uu[1] * Au[0]) /
288 K[1]);
289 invJ.SetValue(4, 2, -Au[2] * Au[1] * (c[2] - uu[2]) * c[0] / K[1]);
290 invJ.SetValue(4, 3, -c[0] * Au[1] * c[2] / K[1]);
291 invJ.SetValue(4, 4,
292 -0.5 * Au[1] * (c[0] * Au[2] + Au[0] * c[2]) / K[1]);
293 invJ.SetValue(4, 5, 0.5 * Au[2] * Au[1] * c[0] / K[1]);
294
295 invJ.SetValue(5, 0, Au[0] * Au[2] * (c[0] + uu[0]) * c[1] / K[2]);
296 invJ.SetValue(5, 1, -Au[2] * Au[1] * (c[1] - uu[1]) * c[0] / K[2]);
297 invJ.SetValue(5, 2,
298 -Au[2] *
299 (Au[2] * c[0] * c[1] + c[0] * uu[2] * Au[1] +
300 c[1] * uu[2] * Au[0]) /
301 K[2]);
302 invJ.SetValue(5, 3, -Au[2] * c[0] * c[1] / K[2]);
303 invJ.SetValue(5, 4, 0.5 * Au[2] * Au[1] * c[0] / K[2]);
304 invJ.SetValue(5, 5,
305 -0.5 * Au[2] * (Au[1] * c[0] + c[1] * Au[0]) / K[2]);
306 }
307 else if (type == "Interface")
308 {
309 NekMatrix<NekDouble> J(4, 4);
312
313 for (int i = 0; i < 2; ++i)
314 {
315 GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
316 }
317
318 k = (c[0] * Au[1] + Au[0] * c[1]);
319 K[0] = (c[0] + uu[0]) * k;
320 K[1] = (c[1] + uu[1]) * k;
321
322 invJ.SetValue(0, 0,
323 (Au[1] * c[0] * c[0] - c[1] * uu[0] * Au[0]) / K[0]);
324 invJ.SetValue(0, 1, Au[1] * (c[1] - uu[1]) * c[0] / K[0]);
325 invJ.SetValue(0, 2, c[0] * c[1] / K[0]);
326 invJ.SetValue(0, 3, -0.5 * c[0] * Au[1] / K[0]);
327
328 invJ.SetValue(1, 0, Au[0] * (c[0] + uu[0]) * c[1] / K[1]);
329 invJ.SetValue(1, 1,
330 (c[0] * uu[1] * Au[1] + c[1] * c[1] * Au[0]) / K[1]);
331 invJ.SetValue(1, 2, -c[0] * c[1] / K[1]);
332 invJ.SetValue(1, 3, -0.5 * Au[0] * c[1] / K[1]);
333
334 invJ.SetValue(2, 0, Au[0] * (Au[0] * c[1] - uu[0] * Au[1]) / K[0]);
335 invJ.SetValue(2, 1, -Au[0] * Au[1] * (c[1] - uu[1]) / K[0]);
336 invJ.SetValue(2, 2, -Au[0] * c[1] / K[0]);
337 invJ.SetValue(2, 3, 0.5 * Au[1] * Au[0] / K[0]);
338
339 invJ.SetValue(3, 0, Au[0] * Au[1] * (c[0] + uu[0]) / K[1]);
340 invJ.SetValue(3, 1, -Au[1] * (c[0] * Au[1] + uu[1] * Au[0]) / K[1]);
341 invJ.SetValue(3, 2, -c[0] * Au[1] / K[1]);
342 invJ.SetValue(3, 3, -0.5 * Au[1] * Au[0] / K[1]);
343 }
344}
345
346} // namespace Nektar
BetaPressureArea(Array< OneD, MultiRegions::ExpListSharedPtr > pVessel, const LibUtilities::SessionReaderSharedPtr pSession)
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_GetCharIntegral(NekDouble &I, 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)
static std::string className
void v_GetW2(NekDouble &W2, const NekDouble &u, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5) override
void v_GetUFromChars(NekDouble &u, const NekDouble &W1, const NekDouble &W2) override
void v_GetC(NekDouble &c, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, 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 v_GetW1(NekDouble &W1, const NekDouble &u, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5) override
void v_GetAFromChars(NekDouble &A, const NekDouble &W1, const NekDouble &W2, const NekDouble &beta, const NekDouble &A0, const NekDouble &alpha=0.5) override
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
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)
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
scalarT< T > sqrt(scalarT< T > in)
Definition: scalar.hpp:285