Uploaded by kaka.akak49

report1

advertisement
OpenFOAM-Simulink Solver for Flow in Carotid Arteries
I was able to develop and compile a solver based on OpenFOAM that accepts data from Simulink to
impose boundary condition on the governing equations. I am still testing the solver and its capabilities.
I will share results from the solver today. Before that, I would like to briefly discuss my plan and
underlying theory for the work.
Theory:
The basic idea is to model the carotid arteries in a 1D-3D-1D scheme where the carotid bifurcation will
be modeled in 3D and the remaining parts will be modeled in 1D. The rational behind this is, most
plaques are situated in the bifurcation zone, and we have velocity data for the distal and proximal (also
mid) region of the arteries. The intuition here is, the morphologies of the bifurcation and the plaque can
give clues to differentiate between symptomatic and asymptomatic patients.
3D case:
The governing equations for 3D case will be the incompressible Navier Stokes equation and are shown
as follows:
 u

+ u u  = −P +  2u + f
 t

 u=0

(1)
( 2)
wherein the density of blood ρ is assumed to be constant, u is the flow velocity field, p is the pressure, f
is the body force, and μ is the fluid viscosity.
1D case:
The assumption here is the radius of the artery is much smaller than the length considered. So 1D
model is applicable. For the 1D model I would like to start with a 3-element Windkessel model
implemented by many researchers for studying blood flow. An example taken from P. Xu et al
(Biomechanics and Modeling in Mechanobiology (2018) 17:1581-1597) is shown below.
With the help of Kirchhoff’s law, the equation of microcirculation can be obtained as:
 R p + Rd

 Rd

dP
dQ1 Pout
−
− C out = 0
 Q1 + CR p
dt
Rd
dt

(3)
where Q1 represents outflow rate, Pout represents the pressure to predict, Rd represents the distal
resistance, Rp represents the proximal resistance, and C represents the compliance of the artery. This
equation satisfies conservation of mass of blood flowing in the artery.
Coupling conditions
The coupling conditions for the 3D-1D case are described in detail in the paper of Heiber et al
(Comput. Methods Appl. Mech. Engrg. 195 (2006) 4002-4017). I am briefly discussing their study.
Consider first a 1D segment divided into two parts, as shown in the figure below. Two conditions must
be satisfied for the interface between the two segments, the continuity of pressure and the continuity of
flow (or mass). As shown in the figure, we have
P− = P+ ,
(4)
Q − = −Q +
(5)
The area continuity is implicitly assured if both segments have the same constitutive law for the arterial
wall.
In the paper of Heiber et al, using a variational formulation of the momentum equation it was shown
that the mean pressure at the cross-section is related to the spatially varying pressure and also to the
component of shear stress.
Pmeann =
1
( Pn − u n ) dA
A A
(6)
The above equation shows that condition (4) is not exactly right for the 3D case because of the u n
term. However, by using dimensional analysis the above equation can be shown as,
Pmean = P −
1 u*
Re x*
(7)
where the * superscript means that the corresponding quantity is non-dimensional and delta is the
Kronecker delta. In the limit of high Reynold numbers (Re), a condition that is fulfilled for the flow
regimes prevailing at the carotid artery, pressure continuity can be achieved using equation (4).
Now, an additional equation is required to impose flow continuity at each coupling face, resulting the
following expression that satisfies condition (5)
Qmean = −  u ndA
A
The aim of the coupling scheme is to supply appropriate boundary conditions for both the 1D case and
the 3D case. The figure below, taken from the same paper, shows the coupling scheme.
Now finding the value of the resistances and compliance for the Windkessel scheme can be challenging
so for now we can use values from the literature. Table 1 given in the same paper by Heiber et al has
some values for the resistances and the compliance.
Implementation
The implementation requires an working installation of Matlab and OpenFOAM. On top of that, mex
the C++ API for Matlab, need to be set up. The command for that is:
mex -v setup
from Matlab command window. The following figure shows the directory lists of the attached folder.
RaihanT
├── Cases
│ ├── 1_OF_OFBC
│ ├── 1_OF_SimulinkBC
│ └── Coupled_1D3D
├── MatlabBC
│ ├── externalPipe
│ ├── timeVaryingFromMatlab
│ └── timeVaryingFromMatlabScalar
└── mySonicLiquidFoam
├── compressibleContinuityErrs.H
├── createFields.H
├── Make
├── mySonicLiquidFoam.C
├── readThermodynamicProperties.H
└── readTransportProperties.H
mySonicLiquidFOAM is just a solver which has been slightly modified to test the new boundary
conditions in MatlabBC. The constructor from the file myFirstMatlabPipe.C in the externalPipe folder
is shown below. Here the word “pipe” has nothing to do with a physical pipe but refers to the MatlabOpenFOAM pipeline.
// Filename: myFirstMatlabPipe.C //
#include<iostream>
#include<cmath>
#include "engine.h"
#include "myFirstMatlabPipe.H"
//
using namespace std;
// Constructor //
myFirstMatlabPipe::myFirstMatlabPipe()
{
cout << "Matlab engine pointer initialized" << endl;
// Create matlab engine pointer //
eMatlabPtr=engOpen(NULL);
if (!(eMatlabPtr)) {
cout << "Can't start MATLAB engine" << endl;
}
// Create a matlab call no. iterator ii
engEvalString(eMatlabPtr,"ii=0;");
}
Here eMatlabPtr=engOpen(NULL) is the line that creates a Matlab engine pointer. It basically opens
a Matlab session without GUI and allows executing Matlab scripts and commands. To test the code a
simple case is developed in 1_OF_SimulinkBC. The case consists of reading data from the Simulink
output for a 1D case where a simple time varying inlet velocity profile shown in the figure below is
applied and a 1D momentum equation is solved for the pressure. The pressure at the exit and the
velocity at the 0.5 L is given below.
Conclusion
I am still testing the code for the 3D-1D coupled case. Hopefully, the testing and validation will be
completed by next week and we can get meaning results for our problem in hand.
Download