Saturday 17 November 2012

Joining the Pieces of the Puzzle

12:50 am

So, have been delaying the real implementation so much. Why? I know what all has to be done, how it has to be done, but not sure if it will all work together. So, confirm it all, I have to implement it. But I have been delaying it for so long. Why? I know why.. It’s only because, the work that I have planned is scattered among all the blogs that I have written. Need to put it all together and sit and implement it. Was hoping I could finish all by today, but looks like that’s not happening!! So, today I enlist the things I have to do regarding the model. Here we go.

Step 1 : c1(p) block
Create a polynomial block with given values of constants, to be multiplied by pressure p which is the input from fetal heart.

Step 2 : c2(z) block
Create a waveform that approximates the waveform given in the paper. The values could be:
z = [0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80]
c2(z) = [1 3.5 7.5 10 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 11 11.1 11.2 11.3 11.4]
Once that is ready, approximate the input z to the closest value and give out the corresponding c2(z)

Step 3 : c2(p,z) block
multiply the outputs of step 1 and step 2. This gives a continuous output which is a variable dependent on p.

Step 4 : Location Block
Take the z input and find which arterial segment or bifurcation it belongs to (switch case), and give the distance in that segment as the output.

Step 5 : Initial Cross Section block
Find its initial cross section according to formula for that segment or bifurcation with the output from step 4.

Step 6 : Final Cross Section Block
Multiply the output from step 3 to the blood density constant continuously, find its reciprocal, add it to 1, and then multiply the whole to the output of Step 5. This gives a continuously varying cross section variable.

Step 7 : Stokes – Navier block
Write the S-function which calculates the solution to the stokes navier equation using the Thermal regulator: PDE Toolbox - Simulink application and the following:
image
image

Step 8 : Export to the workspace and store, and plot against time

ONLY THE PROBLEM IS PLOTTING AGAINST TIME!!! DISCUSS WITH SIR!!

Friday 16 November 2012

Confirming the 4th Change in Direction and Some Relief!!

11:05 pm
So, after trying very hard with the method of characteristics used in the original paper, I realized that, the mathematical part is too difficult for a child like me. So, will not be solving the stokes Navier equation using method of characteristics but will be doing it using pdetool in Simulink. This was the same idea that I had posted before. I realize that this means it is a waste of at least a week, but, I’ll call it use,.. since I know, exactly WHY I’m not using the method of characteristics. Have to enlist the reasons.

So, today, before going to sleep, the agenda is, use Simulink to create a module for the Generates the solution to the Stokes-Navier equations. I think the designing part will be easy, but what we need to verify is whether the output we are getting is right or wrong. To do that, we need to connect the entire system together, or give a temporary input that represents the practical input to the module.

1. Think how to calculate mean pressure at any point in the system which I suppose becomes the input to the Stokes-Navier module.
2. Think up if and how this module and the rest of the modules can work together.
3. Form the Stokes-Navier module, using the document mentioned before.
This document will be edited after about half an hour.
So, here I am, trying to design the Stokes – Navier module. Firstly consider this equation given in the document:image

Now consider the Stokes-Navier Equation given in one of the ppts that I’m referring to which helps me understand the meaning of the equation:

image

Consider this Stokes-Navier equation which is given as the prototype in the mathwork manual with good explaination:
image

Now consider this Stokes-Navier Equation which is given as the prototype in the pdetool with notations which are somewhat different:

image

Now I have to create an equivalency to match the coefficients. I’m guessing that it’s as follows:
rho = d = density of blood
mu = c = viscosity of blood
The controversy is about a and f. Going by the signs of the terms, the pde toolbox help document and the ppt that I’m referring to, I guess,
p = a = pressure and
f = f = other forces

Now, hoping that these assumptions are correct, I’ve got to substitute the values of these constants. These values are, unfortunately not given in the paper, so I will have to borrow from google, possibly, wikipedia.
Taking, d = 1060 kg/m3, c = \mu = (3 \sim 4) \cdot 10^{-3} \, Pa \cdot s(from wikipedia), a will be the time varying mean arterial input pressure, f I think we’ll consider as 1(not sure).

Just figured out how to apply the elasticity to the generated Cross Section of the vessel.

With the Cross section and  space coordinate equations, we can find out a value S of the cross section. Now, as per the formula given in the base paper, we have,

image

This equation defines elasticity as the steady cross section value, divided by the product of blood density and change in the cross section due to pressure. Now consider the following:

2012-11-17 01.54.35

Here, as we know, S becomes the input, we have to have a module for calculation of c2.
From here I realise that I have solved the problem of Elasticity application to vessels.
Then, there was this problem about finding the mean pressure.. well just realized how much a of a fool I am to think that pressure in an artery can come from two directions!! Haha.. So, this problem will come only at the placenta. But there too, we have a division as maternal side of the placenta, and the fetal side of the placenta, so, nowhere we will have to encounter a scenario where we will have to calculate the ‘mean’ pressure! HA! Such a fool! Shi.

So now that I have figured out almost the entire deal I am at peace. Aaah! This feels great! There’s a time for everything. Jab jab jo jo hona hai, tab tab so, so, hota hai. Smile Happy!! So, Again! I’ll do all of this tomorrow!!

Now what remains is the thinking up that I have to do regarding the bifurcations.. There is nothing about the bifurcations that is mentioned in the paper! Only the geometrical dimentions are given! What the hell is that all about? I guess, it should be treated in the same way as the arterial segments, but the only difference is that, there are two different values of cross sections at the second end. yoyo! Very happy and relieved! Everything has its own time!

ATB!

Wednesday 14 November 2012

Serious Glitches..! Worried Now..

11:36 pm

Have been trying to avoid it, but that's going to be dangerous, gotto face it, and find a way out! Not run away! So here we go!

After reading the "Model of the Main Arterial Tree" part from the paper very carefully I have realised the following things:

The model is based on, firstly, the Mass Conservation Equation given by,

image

where,

 v is the mean blood flow velocity

S is the arterial cross-section

z is the distance from the aortic valve along the arterial tree

psi is a function describin outflow from the small arteries which are not geometrically depicted

They have mentioned in the paper that they’ve solved this equation using the method of characteristics. Studied it with the help of this video and tried to solve my equation in the following way: (hope it is all understandable)

2012-11-14 23.50.14

As you can see, I encounter many problems while trying to solve the mass conservation equation.

Firstly, I do not know if v is a variable which is dependent on the value of z or not. Thinking about it, we realize that the velocity does actually change depending on its distance away from the heart. But that happens only due to the change in pressure with distance which we rae going to accommodate for. If we include this dependence, the equation becomes difficult to be solved using the method of characteristics. Saying this, coz I tried doing that as shown below:

2012-11-15 00.11.15

Thus, I decided to assume it independent of z, and continued as shown in the first image.

Secondly, knowing that v is the mean velocity, we try to understand the meaning of the word mean velocity. Considering the fact that in the paper, they have mentioned that the objective of using this method is to be able to compute blood velocity and pressure at any point in the arterial tree as the contribution of the incident and reflected velocity and pressure. Which implies that, by mean velocity, they mean, the resultant of velocity and pressure from maternal side and the fetal side. This makes us think that the v mentioned, needs to be the input to the simulink block that will solve the mass conservation equation, and before entering this block, there needs to exist a simulink block that will calculate this mean velocity. At whichever point in the arterial tree we  need to check the velocity or pressure, we need to do the calculation for that part.

This conclusion gives rise to a controversy. Is this input velocity the same that will be shown as the output velocity? Cannot accurately answer this question right now, coz we haven’t come to that point in the process still, but all that I can guess right now, is that, this input velocity will be acted upon by the mass conservation equation, then the stokes navier equation etc. and get modified. Coming to think of it now, I feel that the input to the system is this mean velocity, but the output might be the pressure wave. This might be needed to be converted into velocity somehow, since none of the equations in this part give velocity as the output.<== Problem

Going into the depth of the above mentioned problem, now we need to

  1. Figure out how to calculate the mean velocity
  2. Find the expression that describes the relation between velocity and pressure of an incompressible fluid.

Once the mean velocity calculation problem is solved, we need to know how to incorporate this into the mass conservation equation, and design a simulink block that implements the mass conservation equation.

So now, let us talk about this solution of the mass conservation equation, In the equation, they have mentioned psi, whose value hasn’t been mentioned anywhere in the paper. Need to ask what value to input as PSI. Assuming currently that it is zero, I move ahead. As shown in the first image, this gives the solution as

S= f(zo)=f(z-vt)

This equation says that the cross sectional area for the curve represented by z-vt = zo is given by the function which is the initial condition at t=0 for that curve.

For all arterial segment we have been given the length of the segment and the cross sectional area at its 2 ends. The table is as follows:

image

Now as the solution the cross section needs to be a function of z-vt. What function? As the tutorial video suggests, this function is the initial condition given. What is the initial condition given to us? These are just numbers. Thus we need to form relationships, preferably, linear from the given values of cross sections and length. To do this, I used curve fitting tool from MATLAB. Here’s the video of how I did it. Sorry for the delay between video and audio, and the overall bad quality.

Okay, the video refuses to get uploaded, sorry! Here are the equations that I got:

For Arterial segment 2,    image

For Arterial segment 3,    image

For Arterial segment 4,   image

For all the above expressions, y is the respective Cross section and x is the respective position coordinate.

For arterial segment 1 and arterial segment 5, the cross section remains constant. That is it does not change for any value of length. Thus the initial value remains the same for all space coordinates.

Now that we have a relationship that describes the initial condition and relates cross section with the z coordinates, we need to figure out how to incorporate the value of z into the initial condition and how to incorporate the initial condition into the solution.

For each of the above x, we substitute z- vt where z is the distance from the aortic valve along the arterial tree to the beginning / end (?) of the arterial segment, v is the computed mean velocity and t is the simulation time. So now, we have got the logic for doing a part of the Arterial segments modeling.

After this, is the block that computes the arterial vascular elasticity and incorporates that into the model. This part is given as follows:

image

So, c1(p) is a polynomial block, and c2(z) is a waveform to be approximated. these can be implemented on SIMULINK.

All this to be implemented on MATLAB and have to think about the mean velocity block, tomorrow!

ATB!