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