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 const NekDouble &alpha)
64{
65 boost::ignore_unused(alpha);
66
67 P = m_PExt + beta * (sqrt(A) - sqrt(A0)) -
68 gamma * dAUdx / sqrt(A); // Viscoelasticity
69}
70
72 const NekDouble &A, const NekDouble &A0,
73 const NekDouble &alpha)
74{
75 boost::ignore_unused(A0, alpha);
76
77 c = sqrt(beta / (2 * m_rho)) * sqrt(sqrt(A)); // Elastic
78}
79
81 const NekDouble &beta, const NekDouble &A,
82 const NekDouble &A0, const NekDouble &alpha)
83{
84 boost::ignore_unused(alpha);
85
86 NekDouble I = 0.0;
87 GetCharIntegral(I, beta, A, A0);
88
89 W1 = u + I; // Elastic and assumes u0 = 0
90}
91
93 const NekDouble &beta, const NekDouble &A,
94 const NekDouble &A0, const NekDouble &alpha)
95{
96 boost::ignore_unused(alpha);
97
98 NekDouble I = 0.0;
99 GetCharIntegral(I, beta, A, A0);
100
101 W2 = u - I; // Elastic and assumes u0 = 0
102}
103
105 const NekDouble &W2,
106 const NekDouble &beta,
107 const NekDouble &A0,
108 const NekDouble &alpha)
109{
110 boost::ignore_unused(alpha);
111
112 A = pow((W1 - W2) * sqrt(2 * m_rho / beta) / 8 + sqrt(sqrt(A0)), 4);
113}
114
116 const NekDouble &W2)
117{
118 u = (W1 + W2) / 2; // Necessarily the case for all tube laws
119}
120
122 const NekDouble &A,
123 const NekDouble &A0,
124 const NekDouble &alpha)
125{
126 boost::ignore_unused(alpha);
127
128 NekDouble c = 0.0;
129 NekDouble c0 = 0.0;
130
131 GetC(c, beta, A, A0);
132 GetC(c0, beta, A0, A0);
133
134 I = 4 * (c - c0);
135}
136
138 const Array<OneD, NekDouble> &Au,
139 const Array<OneD, NekDouble> &uu,
141 const Array<OneD, NekDouble> &A0,
142 const Array<OneD, NekDouble> &alpha,
143 const std::string &type)
144{
145 /*
146 In the interest of speed, the inverse of the Jacobians for bifurcations,
147 merges and junctions for the beta law have been calculated analytically.
148 This can be done for other laws too, or the general formulation can be used
149 instead.
150 */
151
152 NekDouble k = 0.0;
153
154 if (type == "Bifurcation")
155 {
156 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 k = c[0] * Au[1] * c[2] + Au[0] * c[2] * c[1] + Au[2] * c[0] * c[1];
166 K[0] = (c[0] - uu[0]) * k;
167 K[1] = (c[1] + uu[1]) * k;
168 K[2] = (c[2] + uu[2]) * k;
169
170 invJ.SetValue(0, 0,
171 (-c[1] * uu[0] * c[2] * Au[0] +
172 Au[2] * c[1] * c[0] * c[0] +
173 Au[1] * c[0] * c[0] * c[2]) /
174 K[0]);
175 invJ.SetValue(0, 1, Au[1] * (c[1] - uu[1]) * c[0] * c[2] / K[0]);
176 invJ.SetValue(0, 2, Au[2] * (c[2] - uu[2]) * c[0] * c[1] / K[0]);
177 invJ.SetValue(0, 3, c[0] * c[1] * c[2] / K[0]);
178 invJ.SetValue(0, 4, -0.5 * c[0] * Au[1] * c[2] / K[0]);
179 invJ.SetValue(0, 5, -0.5 * Au[2] * c[0] * c[1] / K[0]);
180
181 invJ.SetValue(1, 0, Au[0] * (c[0] + uu[0]) * c[1] * c[2] / K[1]);
182 invJ.SetValue(1, 1,
183 (c[0] * uu[1] * c[2] * Au[1] +
184 Au[2] * c[0] * c[1] * c[1] +
185 c[2] * c[1] * c[1] * Au[0]) /
186 K[1]);
187 invJ.SetValue(1, 2, -Au[2] * (c[2] - uu[2]) * c[0] * c[1] / K[1]);
188 invJ.SetValue(1, 3, -c[0] * c[1] * c[2] / K[1]);
189 invJ.SetValue(1, 4, -0.5 * (c[0] * Au[2] + Au[0] * c[2]) * c[1] / K[1]);
190 invJ.SetValue(1, 5, 0.5 * Au[2] * c[0] * c[1] / K[1]);
191
192 invJ.SetValue(2, 0, Au[0] * (c[0] + uu[0]) * c[1] * c[2] / K[2]);
193 invJ.SetValue(2, 1, -Au[1] * (c[1] - uu[1]) * c[0] * c[2] / K[2]);
194 invJ.SetValue(2, 2,
195 (c[0] * c[1] * uu[2] * Au[2] +
196 c[0] * Au[1] * c[2] * c[2] +
197 c[1] * c[2] * c[2] * Au[0]) /
198 K[2]);
199 invJ.SetValue(2, 3, -c[0] * c[1] * c[2] / K[2]);
200 invJ.SetValue(2, 4, 0.5 * c[0] * Au[1] * c[2] / K[2]);
201 invJ.SetValue(2, 5, -0.5 * (Au[1] * c[0] + c[1] * Au[0]) * c[2] / K[2]);
202
203 invJ.SetValue(3, 0,
204 Au[0] *
205 (Au[0] * c[2] * c[1] - uu[0] * c[2] * Au[1] -
206 uu[0] * c[1] * Au[2]) /
207 K[0]);
208 invJ.SetValue(3, 1, -Au[0] * Au[1] * (c[1] - uu[1]) * c[2] / K[0]);
209 invJ.SetValue(3, 2, -Au[0] * Au[2] * (c[2] - uu[2]) * c[1] / K[0]);
210 invJ.SetValue(3, 3, -Au[0] * c[2] * c[1] / K[0]);
211 invJ.SetValue(3, 4, 0.5 * Au[0] * Au[1] * c[2] / K[0]);
212 invJ.SetValue(3, 5, 0.5 * Au[0] * c[1] * Au[2] / K[0]);
213
214 invJ.SetValue(4, 0, Au[0] * Au[1] * (c[0] + uu[0]) * c[2] / K[1]);
215 invJ.SetValue(4, 1,
216 -Au[1] *
217 (c[0] * Au[1] * c[2] + c[0] * uu[1] * Au[2] +
218 c[2] * uu[1] * Au[0]) /
219 K[1]);
220 invJ.SetValue(4, 2, -Au[2] * Au[1] * (c[2] - uu[2]) * c[0] / K[1]);
221 invJ.SetValue(4, 3, -c[0] * Au[1] * c[2] / K[1]);
222 invJ.SetValue(4, 4,
223 -0.5 * Au[1] * (c[0] * Au[2] + Au[0] * c[2]) / K[1]);
224 invJ.SetValue(4, 5, 0.5 * Au[2] * Au[1] * c[0] / K[1]);
225
226 invJ.SetValue(5, 0, Au[0] * Au[2] * (c[0] + uu[0]) * c[1] / K[2]);
227 invJ.SetValue(5, 1, -Au[2] * Au[1] * (c[1] - uu[1]) * c[0] / K[2]);
228 invJ.SetValue(5, 2,
229 -Au[2] *
230 (Au[2] * c[0] * c[1] + c[0] * uu[2] * Au[1] +
231 c[1] * uu[2] * Au[0]) /
232 K[2]);
233 invJ.SetValue(5, 3, -Au[2] * c[0] * c[1] / K[2]);
234 invJ.SetValue(5, 4, 0.5 * Au[2] * Au[1] * c[0] / K[2]);
235 invJ.SetValue(5, 5,
236 -0.5 * Au[2] * (Au[1] * c[0] + c[1] * Au[0]) / K[2]);
237 }
238 else if (type == "Merge")
239 {
240 NekMatrix<NekDouble> J(6, 6);
243
244 for (int i = 0; i < 3; ++i)
245 {
246 GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
247 }
248
249 k = c[0] * Au[1] * c[2] + Au[0] * c[2] * c[1] + Au[2] * c[0] * c[1];
250 K[0] = (c[0] - uu[0]) * k;
251 K[1] = (c[1] + uu[1]) * k;
252 K[2] = (c[2] + uu[2]) * k;
253
254 invJ.SetValue(0, 0,
255 (-c[1] * uu[0] * c[2] * Au[0] +
256 Au[2] * c[1] * c[0] * c[0] +
257 Au[1] * c[0] * c[0] * c[2]) /
258 K[0]);
259 invJ.SetValue(0, 1, Au[1] * (c[1] - uu[1]) * c[0] * c[2] / K[0]);
260 invJ.SetValue(0, 2, Au[2] * (c[2] - uu[2]) * c[0] * c[1] / K[0]);
261 invJ.SetValue(0, 3, c[0] * c[1] * c[2] / K[0]);
262 invJ.SetValue(0, 4, -0.5 * c[0] * Au[1] * c[2] / K[0]);
263 invJ.SetValue(0, 5, -0.5 * Au[2] * c[0] * c[1] / K[0]);
264
265 invJ.SetValue(1, 0, Au[0] * (c[0] + uu[0]) * c[1] * c[2] / K[1]);
266 invJ.SetValue(1, 1,
267 (c[0] * uu[1] * c[2] * Au[1] +
268 Au[2] * c[0] * c[1] * c[1] +
269 c[2] * c[1] * c[1] * Au[0]) /
270 K[1]);
271 invJ.SetValue(1, 2, -Au[2] * (c[2] - uu[2]) * c[0] * c[1] / K[1]);
272 invJ.SetValue(1, 3, -c[0] * c[1] * c[2] / K[1]);
273 invJ.SetValue(1, 4, -0.5 * (c[0] * Au[2] + Au[0] * c[2]) * c[1] / K[1]);
274 invJ.SetValue(1, 5, 0.5 * Au[2] * c[0] * c[1] / K[1]);
275
276 invJ.SetValue(2, 0, Au[0] * (c[0] - uu[0]) * c[1] * c[2] / K[2]);
277 invJ.SetValue(2, 1, -Au[1] * (c[1] + uu[1]) * c[0] * c[2] / K[2]);
278 invJ.SetValue(2, 2,
279 -(c[0] * uu[2] * c[1] * Au[2] -
280 Au[1] * c[0] * c[2] * c[2] -
281 c[1] * c[2] * c[2] * Au[0]) /
282 K[2]);
283 invJ.SetValue(2, 3, -c[0] * c[1] * c[2] / K[2]);
284 invJ.SetValue(2, 4, -0.5 * Au[1] * c[0] * c[2] / K[2]);
285 invJ.SetValue(2, 5, 0.5 * (Au[1] * c[0] + Au[0] * c[1]) * c[2] / K[2]);
286
287 invJ.SetValue(3, 0,
288 -Au[0] *
289 (Au[0] * c[2] * c[1] + uu[0] * c[2] * Au[1] +
290 uu[0] * c[1] * Au[2]) /
291 K[0]);
292 invJ.SetValue(3, 1, Au[0] * Au[1] * (c[1] + uu[1]) * c[2] / K[0]);
293
294 invJ.SetValue(3, 2, -Au[0] * Au[2] * (c[2] - uu[2]) * c[1] / K[0]);
295 invJ.SetValue(3, 3, -Au[0] * c[2] * c[1] / K[0]);
296 invJ.SetValue(3, 4, 0.5 * Au[0] * Au[1] * c[2] / K[0]);
297 invJ.SetValue(3, 5, 0.5 * Au[0] * c[1] * Au[2] / K[0]);
298
299 invJ.SetValue(4, 0, Au[0] * Au[1] * (c[0] + uu[0]) * c[2] / K[1]);
300 invJ.SetValue(4, 1,
301 -Au[1] *
302 (c[0] * Au[1] * c[2] + c[0] * uu[1] * Au[2] +
303 c[2] * uu[1] * Au[0]) /
304 K[1]);
305 invJ.SetValue(4, 2, -Au[2] * Au[1] * (c[2] - uu[2]) * c[0] / K[1]);
306 invJ.SetValue(4, 3, -c[0] * Au[1] * c[2] / K[1]);
307 invJ.SetValue(4, 4,
308 -0.5 * Au[1] * (c[0] * Au[2] + Au[0] * c[2]) / K[1]);
309 invJ.SetValue(4, 5, 0.5 * Au[2] * Au[1] * c[0] / K[1]);
310
311 invJ.SetValue(5, 0, Au[0] * Au[2] * (c[0] + uu[0]) * c[1] / K[2]);
312 invJ.SetValue(5, 1, -Au[2] * Au[1] * (c[1] - uu[1]) * c[0] / K[2]);
313 invJ.SetValue(5, 2,
314 -Au[2] *
315 (Au[2] * c[0] * c[1] + c[0] * uu[2] * Au[1] +
316 c[1] * uu[2] * Au[0]) /
317 K[2]);
318 invJ.SetValue(5, 3, -Au[2] * c[0] * c[1] / K[2]);
319 invJ.SetValue(5, 4, 0.5 * Au[2] * Au[1] * c[0] / K[2]);
320 invJ.SetValue(5, 5,
321 -0.5 * Au[2] * (Au[1] * c[0] + c[1] * Au[0]) / K[2]);
322 }
323 else if (type == "Interface")
324 {
325 NekMatrix<NekDouble> J(4, 4);
328
329 for (int i = 0; i < 2; ++i)
330 {
331 GetC(c[i], beta[i], Au[i], A0[i], alpha[i]);
332 }
333
334 k = (c[0] * Au[1] + Au[0] * c[1]);
335 K[0] = (c[0] + uu[0]) * k;
336 K[1] = (c[1] + uu[1]) * k;
337
338 invJ.SetValue(0, 0,
339 (Au[1] * c[0] * c[0] - c[1] * uu[0] * Au[0]) / K[0]);
340 invJ.SetValue(0, 1, Au[1] * (c[1] - uu[1]) * c[0] / K[0]);
341 invJ.SetValue(0, 2, c[0] * c[1] / K[0]);
342 invJ.SetValue(0, 3, -0.5 * c[0] * Au[1] / K[0]);
343
344 invJ.SetValue(1, 0, Au[0] * (c[0] + uu[0]) * c[1] / K[1]);
345 invJ.SetValue(1, 1,
346 (c[0] * uu[1] * Au[1] + c[1] * c[1] * Au[0]) / K[1]);
347 invJ.SetValue(1, 2, -c[0] * c[1] / K[1]);
348 invJ.SetValue(1, 3, -0.5 * Au[0] * c[1] / K[1]);
349
350 invJ.SetValue(2, 0, Au[0] * (Au[0] * c[1] - uu[0] * Au[1]) / K[0]);
351 invJ.SetValue(2, 1, -Au[0] * Au[1] * (c[1] - uu[1]) / K[0]);
352 invJ.SetValue(2, 2, -Au[0] * c[1] / K[0]);
353 invJ.SetValue(2, 3, 0.5 * Au[1] * Au[0] / K[0]);
354
355 invJ.SetValue(3, 0, Au[0] * Au[1] * (c[0] + uu[0]) / K[1]);
356 invJ.SetValue(3, 1, -Au[1] * (c[0] * Au[1] + uu[1] * Au[0]) / K[1]);
357 invJ.SetValue(3, 2, -c[0] * Au[1] / K[1]);
358 invJ.SetValue(3, 3, -0.5 * Au[1] * Au[0] / K[1]);
359 }
360}
361
362} // namespace Nektar
BetaPressureArea(Array< OneD, MultiRegions::ExpListSharedPtr > pVessel, const LibUtilities::SessionReaderSharedPtr pSession)
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_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
virtual void v_GetW2(NekDouble &W2, const NekDouble &u, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5) override
virtual void v_GetUFromChars(NekDouble &u, const NekDouble &W1, const NekDouble &W2) 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_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
virtual void v_GetW1(NekDouble &W1, const NekDouble &u, const NekDouble &beta, const NekDouble &A, const NekDouble &A0, const NekDouble &alpha=0.5) override
virtual 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.
Definition: NekFactory.hpp:198
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: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