* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Arbitrary Lagrangian-Eulerian Finite Element Modelling of the
Coronary artery disease wikipedia , lookup
Electrocardiography wikipedia , lookup
Heart failure wikipedia , lookup
Jatene procedure wikipedia , lookup
Arrhythmogenic right ventricular dysplasia wikipedia , lookup
Antihypertensive drug wikipedia , lookup
Myocardial infarction wikipedia , lookup
Mitral insufficiency wikipedia , lookup
Artificial heart valve wikipedia , lookup
Lutembacher's syndrome wikipedia , lookup
Quantium Medical Cardiac Output wikipedia , lookup
Heart arrhythmia wikipedia , lookup
Dextro-Transposition of the great arteries wikipedia , lookup
Arbitrary Lagrangian-Eulerian Finite Element Modelling of the Human Heart MATTHIAS AECHTNER Master of Science Thesis Stockholm, Sweden 2009 Arbitrary Lagrangian-Eulerian Finite Element Modelling of the Human Heart MATTHIAS AECHTNER Master’s Thesis in Numerical Analysis ( 30 ECTS credits) at the Scientific Computing International Master Program Royal Institute of Technology year 2009 Supervisor at CSC was Johan Hoffman Examiner was Michael Hanke TRITA-CSC-E 2009:022 ISRN-KTH/CSC/E--09/022--SE ISSN-1653-5715 Royal Institute of Technology School of Computer Science and Communication KTH CSC SE-100 44 Stockholm, Sweden URL: www.csc.kth.se Abstract The Unicorn solver package, which bases on the FEM library Doln, contains support for the Arbitrary Lagrangian-Eulerian method. This method is used in the present thesis to simulate the blood ow in a human heart. Basis for the simulation are measured data for the movement of the heart wall including inow and outow positions, provided by Larson et al from Umeå Medical University [8]. The main part of the present work deals with the issues that arose within the simulations: The available data had to be converted into a suitable format and scaled to proper dimensions. On the other hand the Unicorn solver had to be modied to provide a suitable interface. Interpolation was necessary to obtain the position and velocity of the wall for every point in time. Boundary conditions were implemented, taking into account that each of two openings of the heart chamber allows ow only in one direction. In the end of the present thesis post processing is discussed and results are visualized. Sammanfattning Arbitrary Lagrangian-Eulerian nita elementmodellering av det mänskliga hjärtat Unicorn paketet, som bygger på FEM biblioteket Doln, är en lösare som har support för Arbitrary Lagrangian-Eulerian metoden. Metoden används i detta arbete för att simulera blodödet i ett mänskligt hjärta. Lösningen bygger på uppmätt data som beskriver hjärtväggarnas rörelse, inklusive inödes och utödes ränder, som tillhandahållits av Larson et al på Umeå Universitet [8]. Till störst del har arbetet gått ut på att lösa problem som uppstått vid simulering: Tillgänglig data behövde konverteras till ett passande format och skalas till rätt dimensioner. Unicorn-lösaren behövde ändras för att få ett bättre anpassat gränssnitt. Interpolering var nödvändigt för att få position och hastighet vid väggen för varje tidspunkt. Randvillkor sattes med hänsyn till ödet, så att vardera av de två öppningarna i hjärtkammaren endast ck öde i en riktning. In slutet av arbetet post-processing discuteras och resultater visualiseras. Contents 1 Introduction 1 1.1 Heart Modelling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 1.2 Overview of the Present Work . . . . . . . . . . . . . . . . . . . . . . . . . 2 2 Formulation of the Mathematical Model 3 2.1 The Structure of the Human Heart . . . . . . . . . . . . . . . . . . . . . . 3 2.2 The Cardiac Cycle . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.3 Simplifying assumptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.4 Boundary and Initial Conditions 6 . . . . . . . . . . . . . . . . . . . . . . . 3 FEniCS and the FSI Solver 7 3.1 FEniCS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 3.2 FSI-solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 4 The discrete Problem: Grid and Interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 4.1 Computation Grid 4.2 Time Discretisation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 13 4.3 Interpolation of the boundary movement . . . . . . . . . . . . . . . . . . . 13 5 The ALE Solver: Modication and Additions to the FEniCS software 15 5.1 ALE_Solver interface 5.2 Moving wall no-slip boundary condition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.3 Heart_Solver class 5.4 Mesh_Deformer class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.5 Common header le heart.h . . . . . . . . . . . . . . . . . . . . . . . . . . 16 5.6 main.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Results: Post-processing and visualisation 16 16 16 17 6.1 Point of reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 6.2 Figures (Paraview) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 6.3 Calculation of path lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 6.4 Calculation of volume 28 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 Conclusions and outlook 7.1 Improvements and Extensions . . . . . . . . . . . . . . . . . . . . . . . . . Bibliography 30 30 32 Chapter 1 Introduction Numerical simulations play an increasing role in many scientic branches. They complement results gained from the traditional disciplines of theory and experiment (measuring). The last decades also medicine discovered the advantages of mathematical modelling and computer simulations. Simulating parts of the human body has been hoped to give medical insight that cannot be obtained in a traditional way. 1.1 Heart Modelling Modelling the human body on all scales from a cell level to modelling of whole organs is subject to the Physiome Project [6]. An example of a Physiome Project organ model is the model of the heart based on a nite-element model of the geometry and brous-sheet structure of myocardial tissue [9]. Another simulation of the human heart was conducted by Peskin and McQueen [10]. Their model, like the Physiome Project model, includes the entire heart with all its chambers and the muscle tissue. Literature about modern heart models is mostly concerned about modelling the behaviour of the heart muscle. Therefore the muscle is seen as an organ which is built up of tissue, which again consists of cells. A summary what has been done in heart modelling gives [11] which outlines the basic ideas on which modern heart models are built on. Work on computational medicine has also been conducted at KTH before. Stöckli [15] modelled the interaction between elastic arteries and the blood that is pumped through them. This work is also to be mentioned because the present work builds on the solver developed withing Stöckli's graduation work. Motivation An important justication for modelling the cardiovascular system is that it may suggest ways to improve the treatment of illness. Every part of the heart can be aected, either by congenital defects or disease (see [1]). Measurements have the drawback that they can lead to ethical conicts; what can be done to a living human in order to serve science? Computer simulation makes it possible to compute quantities that can not be measured. 1 1.2 Overview of the Present Work The present thesis which deals with modelling of the human heart as well, does not include modelling of the heart muscle. Further the model involves only one of the four chambers of the heart (see next chapter). In other words not the actual heart but the blood ow inside a heart chamber is simulated while the movement of the heart is predetermined. The computational work has been carried out at the School of Computer Science and Communication, KTH, using the software platform FEniCS which is developed there. The data for the simulation have been provided by Larson et al [8]. They base on ultrasonic measurements which were conducted on a human patient, and a subdivision routine has been used to construct a ne mesh of surface of the heart chamber. The structure of the remainder of the present work is described in the following. Starting from the physics of the heart, chapter two works its way to a mathematical formulation of the problem. In chapter three the free software FEniCS [4] is explained, focusing on the parts that are used for the present work. Chapter four explains why and how interpolation has been implemented for the boundary of the simulation domain. Changes and additions have been made to the FEniCS software and they are treated in chapter ve. Chapter six visualizes the results, which are the velocity and pressure eld, obtained by the computations. Besides representing the velocity eld as glyphes the blood ow is also visualized using pathlines. Further, the change of the volume over one heart cycle is shown. Chapter seven contains conclusions and points out posibilities to continue on the present work. 2 Chapter 2 Formulation of the Mathematical Model 2.1 The Structure of the Human Heart The human heart (gure 2.1) is a muscle of the size of a st that encloses four bloodlled voids, called heart chambers. It is not controllable at will but controlled by nerve impulses, the rate of which is controlled by the autonomic nervous system. By contracting and expanding periodically the function of the heart is to pump blood through the body circulation system. The pumping capacity is around ve litres per minute for an average adult human and can go up to 35 litres per minute for an athlete. Figure 2.1: Human heart (from Wikipedia) 3 The heart is divided into a left an a right side (from the perspective of the patient). Each side contains two chambers, an atrium and a ventricle, giving a total of four heart chambers. On both sides, the lower ventricles are thicker and stronger than the upper atria. The muscle wall surrounding the left ventricle is thicker than the wall surrounding the right ventricle. As indicated in gure 2.1 the blood (on both sides) rst ows into the atrium and from there into the ventricle. The right side collects de-oxygenated blood from the body and pumps it into the lungs, where carbon dioxide is dropped o and oxygen is picked up. The oxygenated blood from the lungs is collected into the left side. From there it is pumped out into the body. On each side of the heart there is one valve that connects the atrium with the ventricle, called atrioventricular valve, and one that connects the ventricle with artery. name indicates the valves allow ow only in one direction. which is called tricuspid valve on the right side and As their The atrioventricular valve, mitral valve on the left side, allows blood only entering the ventricle. The valve between right ventricle and pulmonary artery is called pulmonary valve and the one between left ventricle and aorta is called aortic valve. These two valves allow blood only to leaving the ventricle. 2.2 The Cardiac Cycle During one heart cycle (HC) the ventricles contract and expand. The duration of one HC is of the order of one second. In the present work the duration seconds, and the starting point of the cycle (t = 0s) T of one cycle will be 1.124 is set to shortly before the moment when the volume of the left ventricle is maximal. One cycle comprises two phases: During the systole the heart muscles are tense and during the diastole they are passive. These two phases are again subdivided into several parts. The rst two, Isovolumic contraction and Ejection, belong to the systole, while the other four, isovolumic relaxation, rapid inow, diastasis and atrial systole, make up the diastole. The following description what happens during the single parts is partly taken from [2]: • Isovolumic contraction (3-5% of HC) As soon as ventricular pressure rises fraction- ally above atrial pressure, the atrioventricular valves are forced shut by the reversed pressure gradient. Back ow during closure is minimal because the cusps are al- ready approximated by vortices behind them in the late lling phase. The ventricle is now a closed chamber, and the growing wall tension causes a steep rise in the pressure of the trapped blood. • Ejection (33% of HC) When ventricular pressure exceeds arterial pressure, the out- ow valves are forced open and ejection begins. Three quarters of the stroke volume are ejected in the rst half of the ejection phase and at rst blood is ejected faster than it can escape from the big arteries connected to the ventricles into the body. As a result, much of it has to be accommodated by distension of the large elastic arteries, and this drives arterial pressure up to its maximum level. As systole weakens and the rate of ejection slows down, the rate at which blood ows away through the arterial system begins to exceed the ejection rate and pressure begin to fall. Active ventricular contraction actually ceases about two-third of the way through the ejection phase, but a slow outow continues for a while owing to the 4 momentum of the blood. As the ventricle begins to relax, ventricular pressure falls below arterial pressure but outward momentum of the blood prevents immediate valve closure. Finally a brief back ow closes the outow valves. The ventricle does not empty completely; the average ejection fraction on man is 0.67. • Isovolumic relaxation (3-5% of HC) With closure of the aortic and pulmonary valves, each ventricle once again becomes a closed chamber. The heart muscle relaxes and ventricular pressure falls very rapidly. • Rapid inow When the ventricular pressure has fallen just below atrial pressure, the atrioventricular valves open. The blood pressure which has slowly built up in the atrium during systole causes blood to quickly ow into the ventricle. • Diastasis Diastasis is the middle stage of diastole, where the initial passive lling of the hearts ventricles has slowed down, but before the atria contract to complete the lling. • Atrial systole The heart muscles (myocardia) of the left and right atria contract. The blood pressure in each atrium increases, forcing additional blood into the ventricles. This additional ow of blood is called atrial kick. 2.3 Simplifying assumptions Distinguishing between all six part of the cardiac cycle can become necessary for more advanced heart models which were mentioned in the introduction. As the present work is only concerned with modelling the blood ow in the left ventricle and not the cardiac muscle or any of the other heart chambers, it will be sucient at this place to only distinguish between the phases systole and diastole. The subdivision into more parts (as above) can become important when extending the model. As mentioned above only the blood ow in one of the chambers of the heart will be simulated. This will be the left ventricle. Therewith the simulation concerns the blood inside the heart as well as the boundaries which are the ventricle's wall and the mitral and aortic valve. The heart wall has a ne structure which inuences the ow of blood; within the scope of the present work however it was not possible to model this ne structure and a at wall that does not allow slip was assumed. Since the elasticity of the heart wall is stronger than the compressibility of blood the blood inside the heart could be modelled as an incompressible uid. Blood which consists of plasma and a suspension of red blood cells generally shows non-Newtonian behaviour. This is because red cells tend to coagulate when the ow shear rates are low, while increasing shear rates break these formations apart, thus reducing blood viscosity. This eect however mainly appears in smaller blood vessels, and inside the heart, blood can be assumed to behave like a Newtonian uid. Hence incompressible Navier-Stokes equations with constant viscosity could be used. 5 Physical parameter: viscosity and density of blood types of viscosity: dynamic viscosity µ and kinematic viscosity There exist two dierent ν. Since both of them are often simply called viscosity, they are easily confused. They are related with each other kg and ρ is the density. Dynamic viscosity has the dimension [µ] = m·s 2 kg m kinematic viscosity [ν] = s . The dimension of density is [ρ] = m3 . kg A typical value of the dynamic viscosity of blood is around µ = 0.0027 ms and the kg density of blood is similar to the one of water, a value of ρ = 1060 3 is chosen. The two m 0.0027 kg m3 −6 m2 . values together give a kinematic viscosity of ν = 1060 ms kg = 2.547 · 10 s by ν = µ/ρ where 2.4 Boundary and Initial Conditions Boundary Conditions The (moving) geometry of the heart wall, i.e. of the domain boundary, is given (see chapter 4) as well as the positions of the valves. The boundary conditions at the valves change during the heart cycle. During the systole the aortic valve is open and the mitral valve is closed and during the diastole the mitral valve is open and the aortic valve is closed. There are only two dierent boundary conditions used for the model: no-slip wall boundary condition for the closed valve(s) and the heart wall and zero-pressure boundary condition for the open valve. At the no-slip boundary the uid velocity is set equal to the wall velocity which can be calculated from the given wall movement and the pressure is not set. At the zero-pressure boundary the pressure is set to zero and the velocity is not set. u − uwall = 0 p = 0 Initial Conditions on no-slip boundary (2.1) on zero-pressure boundary Since the equations contain no time-derivative of (2.2) p, only the veloc- ity at initial time needs to be specied. The initial velocity is set to zero u(t = 0) = 0 This is an acceptable approximation because the simulation starts when the expansion is maximum and thus there are no strong inows or outows at the valves. Further the simulation is run an initial cycle and only the results from the second cycle are used. 6 Chapter 3 FEniCS and the FSI Solver This chapter gives an overview of the software used in the present work as far as it was already available. Modications and additions are described in chapter 5. 3.1 FEniCS The computations have been carried out using the software provided by the open source project FEniCS. FEniCS is a platform for the creation and maintenance of tools used for the solution of dierential equations using the nite element method. DOLFIN At the heart of FEniCS is DOLFIN which is a set of libraries that enable the programmer to create fast and reliable code in a consistent problem solving environment for solving problems in the realm of scientic computing. The software package relies on well-used algebraic back-end software such as LAPACK and PETSC for calculations. DOLFIN itself provides an interface between the back-end and the programmer. In addition it provides important classes for mesh generation, i/o, matrix/vector assembly and various nite element functions and operations. Unicorn Recently added to the FEniCS project Unicorn aims at developing a unied continuum mechanics solver. In its current state as of summer 2008 it mainly consists of four solvers: Incompressible Navier-Stokes equations, Compressible Euler equations, ALE uid-structure interaction and Lagrange elasticity solver. The solvers are written in C++ and build on the Doln libraries (and also use the FEniCS projects FFC and FIAT). In order to guide the user how to use Unicorn, the solvers are accompanied by some example applications that demonstrate Unicorn's capabilities. Unicorn is used by writing a C++ main function that creates an instance of a Unicorn solver class and then calls methods of the solver class to do the computations and save the result for postprocessing. 3.2 FSI-solver In an attempt to model blood ow in elastic arteries, Stöckli [15] implemented a Structure Interaction Fluid- (FSI) solver that uses nite elements. This solver has since become 7 a part of Unicorn. While in the present work no FSI is modelled, the FSI solver implementation contains Arbitrary Lagrangian-Eulerian (ALE) support which is particularly useful to model the moving wall of the heart. ALE makes it possible to do calculations using both Lagrangian and Eulerian descriptions with the use of a third coordinate system. This allows it to move the domain at a dierent velocity compared to the uid without skewing the solution. For a more detailed description see [15]. Eulerian vs. Lagrangian description The dierence between the Eulerian and the Lagrangian description is mainly the position of the observer. In the Lagrangian world, the observer can be though of as attached to a particle and moves with the material. He records the changes of just this particle. The Lagrangian description is suitable if the material is solid. For the Eulerian description the point of observation is no longer xed to the material but xed in space. Now the properties of not only one particle but of the whole material are recorded. The Eulerian description is generally favourable to be used for ow problems. For the Lagrangian material description a domain RX ∈ Rd is given where d is the X . For the Eulerian conguration, Rx x. When deformation of the continuum spatial coordinates, written as a function ϕ spatial dimension made up of material particles is the spatial domain consisting of spatial points occurs, the changes can be mapped to the which takes into account time t. ϕ : RX × [t0 , tnal [ → Rx × [t0 , tnal [ Arbitrary Lagrangian Eulerian ALE, as its name suggests, is a culmination between the Lagrangian and Eulerian descriptions. It provides a means to do calculations using both descriptions with the use of a third coordinate system, the reference coordinate system denoted Rχ with reference points χ. This allows it to move the domain at a dierent velocity compared to the observed material without skewing the solution, because the movement of the domain can be compensated. Much like a mapping ϕ was used to get from the material conguration to the spatial conguration, there are two additional mappings Φ and Ψ which map from the referential conguration to the spatial and material congurations, respectively. Together there are three mappings ϕ : (X, t) 7→ (x, t) Φ : (χ, t) 7→ (x, t) −1 Ψ while it holds that : (X, t) 7→ (χ, t) ϕ = Φ ◦ Ψ−1 . The three mappings have the following gradients ∂x ∂X 0T ∂x , v(X, t) = ∂t X ∂x ∂Φ ∂x v̂ ∂χ , v̂(χ, t) = = ∂(χ, t) ∂t χ 0T 1 ∂χ ∂Ψ−1 ∂χ w ∂X = , w(X, t) = 0T 1 ∂(X, t) ∂t X ∂ϕ = ∂(X, t) v 1 8 (3.1) (3.2) (3.3) where v is the given velocity, v̂ the reference point velocity and w the velocity with respect to the reference system. Using the matrix forms of the various gradients from (3.1), (3.2) and (3.3) ∂x ∂X 0T v 1 = ∂x ∂χ 0T v̂ 1 ∂χ ∂X 0T w 1 (3.4) the dierent velocities can be related: c = v − v̂ = where c ∂x w ∂χ is the particle velocity relative to the mesh as seen from the spatial domain Rx , i.e. the actual velocity of a uid after compensating for the movement of the mesh. Determination of domain movement - Smoothing While ALE allows a moving mesh, the velocity of the mesh still has to be determined. In the case of FSI, in the structure part the mesh velocity was known because it was just the calculated velocity of the material, i.e. the Lagrangian description was used. For the rest of the domain, i.e. the uid part, the movement of the mesh was determined by some mesh smoothing criterion: The mesh at the interface between the solid and the uid becomes deformed by the mesh movement. Therefore the vertices of the mesh belonging to the uid domain must be redistributed. This is done by the following Laplace mesh smoothing technique: each internal vertex is moved to the centre of all vertices that are connected to it by an edge (its neighbours) vi = X vj /n j6=i where vi is an internal vertex vj is a neighbouring vertex and n the number of neighbours. For the present work the movement of the domain can also be obtained by smoothing, just that there is no FSI and instead the boundary movement gives some forced movement of the domain. (If there was no forced movement of a part of the domain, the smoothing condition would still work, but as soon as it is fullled once the mesh would not move any more). Navier-Stokes in ALE The Navier-Stokes equations for incompressible ow u̇ + (u · ∇) u − ν∆u + ∇p = f (3.5) ∇·u = 0 (3.6) are used as a model for the FSI solver as well as for the present work. In order to implement ALE with Navier-Stokes equations the convective term mesh movement velocity above, in this case u. v̂ (u · ∇) u had to be modied: the is taken into account alongside the existing velocity v from To illustrate this small change, the new ALE friendly incompressible Navier-Stokes equations read u̇ + ((u − v̂) · ∇) u − ν∆u + ∇p = f (3.7) ∇·u = 0 (3.8) 9 Stabilized FEM: G2 method the nite element method In order to deal with convection dominated problems (FEM) which is used in the FSI solver and for the present work, requires stabilization. This is achieved by using the Generalized Galerkin which can also be used to compute turbulent ow, see [5]. 10 method (G2) Chapter 4 The discrete Problem: Grid and Interpolation 4.1 Computation Grid For the computations a set of surface meshes, provided by [8], was available. Each mesh contains 2946 nodes that are topologically connected by triangles. Figure 4.1 shows the rst mesh, i.e. the one which corresponds to the time that is dened as t = 0. From this surface mesh the computational grid, consisting of nodes (geometry) and tetrahedra (topology) has been generated. For this purpose TetGen [14] was used. Figure 4.1: Surface mesh at Tetgen t=0 TetGen is a quality tetrahedral mesh generator and three-dimensional Delaunay triangulator which is free for research and non-commercial uses. It allows to give a bound on the radius-edge ratio by the switch -q. Further the -a switch applies a maximum tetrahedron volume constraint. Tetgen was executed with the following command line: $ tetgen -pgYq1.2 -a5.0 -NEF heart3.001.poly 11 Here the above mentioned switches -q and -a were used which lead to a ner discretisation -p, -g, -N, -E, and -F set the in and output le in the inside of the heart. The switches types and format(s); -Y suppresses boundary facets splitting. The resulting computational grid contains 9586 nodes (including boundary) and 51556 tetrahedra. Figure 4.2 shows a cut through the obtained grid. Figure 4.2: Computational grid Computational Grid: Conversion and Scaling a millimetre scale. The geometry data was given in For the computations the decimeter scale has been chosen since it was closest to a normalization with peak velocity U and heart diameter L around one. This way the numerical method was ecient without taking into consideration various scalings of U and L. Thus the geometry data had to be converted from milimeter to decimeter scale. Since the le format of the computational grid had to be converted to Doln format anyway, the best way to do the scaling turned out to be modifying the Doln mesh converter to multiply all geometry data by a scale factor (in this case 10). The physical parameters viscosity and density in the literature typically were given in SI units. Therefore they have been converted into the decimeter scale as well: The solver which is used, uses the dynamic µ = 2.7 · 10−3 viscosity, which is calculated to be kg ms = 2.7 · 10−3 kg 10dm s = 2.7 · 10−4 kg dm s The analogue procedure for the density gives: ρ = 1.060 · 103 kg m3 = 1.060 · 100 Surface Meshes: Conversion and Scaling kg dm 3 The surface meshes also had to be con- verted to a Doln format that can be read in later so that the grid can be moved accordingly. A reasonable choice seem to be to have the surface meshes as Doln mesh functions 12 of type double (class MeshFunction<double>). This class can store one double value for each node of the mesh. The surface data consist of boundary nodes (geometry) and triangles (topology) whereas the latter was not needed for the computations. The boundary nodes each dene a point in three-dimensional space. As the mesh function can only save one real number per node, three mesh functions had to be created for each surface mesh - one for each coordinate. A converter has been written that takes the surface meshes as an input, as well as a scale factor, and outputs the Doln mesh functions containing the scaled geometry information as XML les. (It can be found in directory conv). 4.2 Time Discretisation A xed time step size of ∆t = 0.002s has been used for the computations (the simulation has also been run with with no signicant dierence). ∆t = 0.001s In order to avoid instability a time-step that is small enough to full the CFL-condition ∆t vmax < C ∆x vmax < 8 dm s around 0.01dm. is important. The maximum velocity is (without regarding deformation) and the height of the smallest cells 4.3 Interpolation of the boundary movement The position of the wall of the ventricle, or, speaking in terms of the computational model, the position of the nodes on the boundary, is only known at discrete points in time. The provided surface mesh data were generated from measurements at the following times: ti [ms] = 65, 175, 285, 393, 440, 544, 651, 744, 850, 941, 1033, 1124 i = 1 · · · 12 The data at t0 = 0 are available as well, because the movement is periodic and the position t0 = 0 and t12 = 1124. of the boundary is the same at Since during the computation the positions of the boundary nodes must be available at any time, it is necessary to obtain the position of each node at time t by interpolation from the available data (which is the position of the node at the times above). Linear Interpolation First an α A simple approach which has been tested is linear interpolation. is calculated which is the distance of the current time which data is available, tm , scaled so that α=1 if t = tm+1 : α = (t − tm )/(tm+1 − tm ) Then the position of the node, n, can be obtained as n = (1 − α)nm + αnm+1 13 t to the last time at With this kind of interpolation the problem showed up that the velocity of the wall was piecewise constant in time. Therewith, the velocity of the wall jumped at the times ti . Especially since the uid velocity at the wall is equal to the wall velocity, this lead to an unsatisfactory result. Hermite Interpolation The problem in the last section has been resolved by using Hermite interpolation. The splines are dened by the value and the derivative at both, start and end point. Here the value is the node position and the derivative the velocity. Therewith is made sure that the velocity of the wall is continuous. The Hermite interpolation makes use of the Hermite basis functions h00 (t) = 2t3 − 3t2 + 1 h10 (t) = t3 − 2t2 + t h01 (t) = −2t3 + 3t2 h11 (t) = t3 − t2 First the velocity is calculated as time derivative of the position of the boundary node at the m-th vm sample time: 1 = 2 1 ∆tm−1 1 − ∆tm nm + − 1 ∆tm−1 nm−1 + 1 ∆tm nm+1 with ∆tm = tm+1 − tm Then the node position and velocities vm and n can be calculated from the node positions nm and nm+1 , vm+1 : n = h00 (α)nm + h01 (α)nm+1 + h10 (α)vm ∆tm + h11 (α)vm+1 ∆tm The dierence between the two dierent interpolation methods can be seen in gure 6.36. It shows the change of the volume over time which is just as smooth as the movement of the wall. 14 Chapter 5 The ALE Solver: Modication and Additions to the FEniCS software This chapter describes how the implementation within the present work is organized into classes. Figure 5.1 gives an overview. The orange colour marks all classes that where not already existing. The arrows mean is base class for. Round edges stand for les and sharp edges represent classes, which usually consist of a header le and a le with ending .cpp for the implementation. TimeDependentPDE ICNSPDE heart.h ALE_Solver Mesh_Deformer Heart_Solver Heart_Deformer main.cpp Figure 5.1: Files and Classes 15 5.1 ALE_Solver interface Since the FSI solver was not particularly designed to allow uid only problems, it turned out to be reasonable to implement an ALE solver. This has been done by deriving a class ALE_Solver from the Unicorn class TimeDependentPDE, analogously to the class ICNSPDE [7]. The ALE solver allows only (incompressible, Newtonian) uid, no solid. Instead of the solid computations, it is possible to set a subset of the grid's nodes (e.g. the boundary) by a user-written class (called Mesh_Deformer) in every time step. Thereafter the solver smooths the grid using the Doln standard smoother. 5.2 Moving wall no-slip boundary condition At the moving boundary it is not correct to set a zero velocity, what could easily be set by using the DirichletBC class. Instead a new class has been created that sets the velocity of the moving wall at the wall boundary. 5.3 Heart_Solver class The class Heart_Solver is derived from ALE_Solver. It implements the change of the boundary conditions when the phase changes. Further the class does add post-processing functionality: change of frame of reference for output, and calculation of volume (see chapter 6). It also takes care of initialising the moving wall no-slip boundary condition. This is the class that is actually used as a solver. 5.4 Mesh_Deformer class In the present work the class Mesh_Deformer, which could be used in a more general way in future, is used for the following purposes: reading in the mesh functions that contain the boundary node positions in the constructor, and implementing the interpolation (see chapter 4) in the method update(). Mesh_Deformer Heart_deformer was It implements the method update() and a constructor. To be correct from an object oriented programming point of view is abstract and goes together with derived from the mesh deformer. ALE_Solver . Further a class 5.5 Common header le heart.h The le heart.h contains constants and enums: number of dimensions, number of cycles that simulation lasts, dierent boundary types (inow, outow, wall), phases (start-up, contraction, expansion), physical parameters density and viscosity, sample times, and name of the directory where input data les are. 5.6 main.cpp The le main.cpp connection everything together and contains the main function which is executed by the operating system. The le further sets the time step length. 16 Chapter 6 Results: Post-processing and visualisation In order to get some inside from the computations and not just raw data, this chapter is dedicated to post-processing and visualisation. 6.1 Point of reference When the ventricle is contracting or expanding its bottom keeps in place and the top, where the inow and outow takes place, moves up and down. This means for the velocity eld that the absolute velocity at the outow boundary points inwards while the velocity relative to the outow boundary (which moves) correctly points outwards (gure 6.1). Thus, in order to get a nicer visualisation the observer moves with the outow boundary (which moves roughly like the inow boundary), resulting in the picture in gure 6.2. Figure 6.2: Point of reference at outow Figure 6.1: Original Implementation boundary Before the time stepping starts, the position of the observer is cho- sen. That means a node of the computational grid is selected with which the observer 17 moves. This node will appear stationary in the visualization. Since the outow and inow boundary are supposed to not move, a node that lies on the outow boundary has been chosen. As the inow boundary globally moves with the outow boundary, the inow boundary will also appear stationary. During the computation in every time step the velocity eld and the geometry of the grid (i.e. the position of nodes) will be modied according to the movement of the node which the observer sits on. This modication is done in the method Heart_Solver. After the modication, velocity and to ALE_Solver::save() and then the original values are Heart_Solver::save()). of save() pressure are saved by a call restored (also in the method 6.2 Figures (Paraview) The velocity and pressure distribution has been saved during the calculations in VTK [13] format. Thereby it has been possible to visualise the results with paraview. (Paraview is a GUI expansion to VTK.) Velocity The visualisation of the velocity is done using glyphs (arrows) and a cut through the heart in one picture (gures 6.3 to 6.18). While the glyphs show relative magnitude and direction, the cut shows the magnitude, of the velocity. The 16 gures are taken at the times (in milliseconds) 0, 48, 144, 240, 288, 384, 416, 464, 496, 608, 672, 720, 816, 1008, 1040, 1088 or expressed in fractions of the time of one heart cycle T = 1124ms, 0%, 4.3%, 12.8%, 21.4%, 25.6%, 34.2%, 37.0%, 41.3%, 44.1%, 54.1%, 59.8%, 64.1%, 72.6%, 89.7%, 92.5%, 96.8% and show the behaviour of the ow at the dierent phases during one heart cycle. Figure 6.3 shows the initial velocity which has been obtain by calculating one heart cycle rst. So the gure actually shows the velocity after one cycle if a zero velocity is taken. There can be observed a slight inow, which is because the start of the cycle is set to the end of the expansion phase. Figure 6.4 shows the velocity during the isovolumic contraction of the heart muscle. The lower end of the heart bends slightly, the velocities are low and some weak circulation occurs near the inow boundary. The valve at the outow boundary is about to open. The ejection phase is shown in gures 6.5 to 6.7. It reaches its peak in gure 6.6. From these pictures can also be observed the deformation of the heart which turns from a round into a more acute shape. During isovolumic relaxation (gure 6.9) the blood hardly moves. Then the inow valve opens and shortly later one can observe rapid inow. This phase is shown in gures 6.10 to 6.12. In gure 6.10 the inow is increasing until it reaches its peak in gure 6.11. During the rapid inow phase, a recirculation region evolves. While in gure 6.11 the inowing blood is straightly going into all parts of the ventricle, gure 6.12 already shows a very weak recirculation next to the inowing blood. This recirculation grows in picture 6.13 and 6.14. 18 Figure 6.3: Velocity eld at t − T = 0ms = Figure 6.4: Velocity eld at 0.0T Figure 6.5: t−T = 48ms = 0.043T Velocity eld at t − T = Figure 6.6: 144ms = 0.128T Velocity eld at 240ms = 0.214T 19 t − T = Figure 6.7: Velocity eld at t − T = Figure 6.8: 288ms = 0.256T Figure 6.9: Velocity eld at Velocity eld at t − T = 384ms = 0.342T t = 416ms = Figure 6.10: Velocity eld at 0.57T 0.73T 20 t = 464ms = Figure 6.11: Velocity eld at t = 496ms = Figure 6.12: Velocity eld at 0.441T Figure 6.13: Velocity eld at t = 608ms = 0.541T t = 672ms = Figure 6.14: Velocity eld at 0.598T 0.641T 21 t = 720ms = In picture 6.13 inow weakens and the phase of diastasis starts in gure 6.14. This phase lasts over pictures 6.15 and 6.16. Figures 6.17 and 6.18 show the atrial systole. Inow starts again. At that point the heart cycle starts over again. Pressure The gures 6.19 to 6.34 show the pressure at the heart wall. The same sample times as for the velocity visualization have been taken except gure 6.22 which is 16ms = 0.014T earlier than 6.6. In gures 6.19 to 6.23 the outow boundary always has the same blue-green colour, which corresponds to zero. The same holds for the inow boundary in gures 6.24 to 6.34. This is because of the boundary condition of zero pressure at the open valve. The relative pressure inside the ventricle is negative during expansion and positive during contraction phase. The highest pressure is in gure 6.22 and the lowest pressure in gures 6.26 (t − T = 464s) and 6.27 (t − T = 496s). Since gure 6.22 is taken shortly t − T = 464ms and t − T = 646ms, it can be before the highest outow and since the inow is building up between t − T = 496ms while the pressure is already at the minimum at deduced that the pressure change precedes the change of the velocity eld. 6.3 Calculation of path lines Besides using glyphs like in the last section, there are other possibilities to visualize velocity. As in the present case the ow is time-dependent, pathlines, streamlines, and streak-lines do not coincide like they do in steady ow. Paraview seems to support stream lines. These show the velocity at a certain time, like also glyphs do. For the visualisation of the blood ow in the heart it is more interesting to have pathlines, which show the movement of one (or several) particles in the blood. Implementation of Pathline calculation Since there had not been functionality that would have helped much the integration and especially the interpolation of the velocity to an arbitrary point with the necessary cell search has been implemented. A simple forward Euler integration scheme has been used: starting from a initial point, in every u(xi ) at the last point xi is multiplied with the time step length ki xi in order to obtain the next point xi+1 . The velocity u(xi ) interpolation between the vertices of the cell xi lies in. In order to are checked in a loop if xi is inside. This check is performed in the time step the velocity and the result is added to is obtained by linear nd this cell all cells following way (and taken from [3]): Given the vertices of the tetrahedron cell to be tested as v1 = (x1 , y1 , z1 ), and the point xi v2 = (x2 , y2 , z2 ), v3 = (x3 , y3 , z3 ), v4 = (x4 , y4 , z4 ) as xi = (x, y, z). Then, the following determinants are calculated (using Laplace's formula to expand along the last column) D0 = x1 x2 x3 x4 y1 y2 y3 y4 z1 z2 z3 z4 1 1 1 1 , D1 = x y z x2 y2 z2 x3 y3 z3 x4 y4 z4 22 1 1 1 1 , D2 = x1 y1 z1 x y z x3 y3 z3 x4 y4 z4 1 1 1 1 , Figure 6.15: Velocity eld at t = 816ms = Figure 6.16: Velocity eld at 0.726T Figure 6.17: t = 1008ms = 0.897 Velocity eld at t−T = Figure 6.18: 1040ms = 0.925T Velocity eld at 1088ms = 0.968T 23 t−T = Figure 6.19: Pressure eld at t− Figure 6.20: Pressure eld at T = 0ms = 0.0T Figure 6.21: Pressure eld at 48ms = 0.043T t− Figure 6.22: Pressure eld at T = 144ms = 0.128T Figure 6.23: Pressure eld at t = t− T = 224ms = 0.199T t− Figure 6.24: Pressure eld at T = 288ms = 0.256T T = 384ms = 0.342T 24 t− Figure 6.25: Pressure eld at t− Figure 6.26: Pressure eld at T = 416ms = 0.57T Figure 6.27: Pressure eld at T = 464ms = 0.73 t = Figure 6.28: Pressure eld at 496ms = 0.441T Figure 6.29: Pressure eld at t− t = 608ms = 0.541T t = Figure 6.30: Pressure eld at 672ms = 0.598T 720ms = 0.641T 25 t = Figure 6.31: Pressure eld at t = Figure 6.32: Pressure eld at 816ms = 0.726T Figure 6.33: Pressure eld at t = 1008ms = 0.897 t− Figure 6.34: Pressure eld at T = 1040ms = 0.925T T = 1088ms = 0.968T 26 t− D3 = x1 y2 z3 x2 y2 z2 x y z x4 y4 z4 1 1 1 1 D4 = , x1 y1 z1 x2 y2 z2 x3 y3 z3 x y z 1 1 1 1 The point P is in the tetrahedron if the ve determinants all have the same sign: inside = (D0*D1>=0) && (D0*D2>=0) && (D0*D3>=0) && (D0*D4>=0); The determinants can then also be used to interpolate the velocity in case inside. u(xi ) = 4 X xi was u(vi )Di /D0 i=1 [dm] 1.1 1 0.9 0.8 0.7 0.6 0.5 0.4 0.1 0 −0.1 −0.15 −0.1 0.05 −0.05 0 0.1 0.15 0.2 0.25 0.3 Figure 6.35: Pathlines starting at the inow at Results t = 1546ms The implementation from the last paragraph has been added to the Heart_Solver class. The pathline calculation is started when the rst expansion phase occurs and continues over one expansion and contraction phase until the simulation is stopped after the contraction phase in the second cycle (tstart = 0.416s, tend = 1.546s = T + 0.422s). Start- ing points at the inow have been chosen so that the movement of particles that enter the ventricle when the inow valve opens can be tracked during one heart cycle. The exact starting points are given in table 6.1. Since these points are nodes of the boundary mesh, the table also contains their indices in the input data. 27 index x1 x2 x3 31 -0.081861 -0.0007219 0.981363 42 -0.027046 -0.0003610 0.988429 43 -0.048000 0.0950201 0.993072 44 -0.106322 0.0926933 0.984862 45 -0.154437 -0.0007162 0.973143 46 -0.107161 -0.0948699 0.971502 47 -0.048205 -0.0960973 0.977173 Table 6.1: Starting points of pathlines The resulting pathlines are plotted with Matlab together with the inow and outow boundaries in gure 6.35. In the gure the x2 axis is given to show how far the particles move down into the heart. It can be seen that four out of the seven particles that entered at the beginning of the inow leave the ventricle again within one cycle. The gure also shows that the incoming particles move down to is at around z = 0.1. z = 0.4 while the bottom of the chamber For a healthy heart it is important that there is no blood that stays at the bottom of the chamber without ever leaving the heart. As all path lines start from the inow valve there is still hope that the simulated chamber exchanges also the blood at its bottom and the pathlines of these blood particles are just not shown. 6.4 Calculation of volume An interesting output variable is the volume of the ventricle and how it changes during the heart cycle. the The volume can easily be computed by iterating over all cells (using CellIterator class) and adding up all cell volume() of the class Cell. volumes. Those can be obtained by the member function The result is shown in gure 6.36 which also shows the volume as obtained by using linear interpolation (see chapter 4). From this gure one can see that the minimum of the volume is somewhat bigger than 60ml while the maximum is around 120ml. That means that in every cycle roughly 60ml blood are pumped through the heart. It also means that half of the blood stays in the ventricle. 28 Change of volume of left ventricle during one heart cycle 0.13 0.12 volume in liters 0.11 0.1 0.09 spline interpolation linear interpolation 0.08 0.07 0.06 0.05 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 time in seconds 0.8 0.9 1 1.1 Figure 6.36: Volume over time (2 dierent interpolation methods) 29 Chapter 7 Conclusions and outlook The velocity visualization in section 6.2 shows that results of the simulation nicely match with the phases as described in the theoretical part (section 2.2). Therewith the main conclusion is that the Unicorn solver has been able to successfully simulate blood ow in a contracting chamber of the human heart. This is not supposed to mean that quantitative correctness is expected since the human heart is a very complex organ and its simulation a challenging topic in modern science. Ejection Fraction It was expected that as much blood as possible would be exchanged during one heart cycle. The calculation of the volume showed that the heart volume shrinks only to half of its maximum size. Because of the way the opening and closing of the valves occurs during one heart cycle, the ratio of the volume of the contracted heart to the volume of the expanded heart gives a maximum to the ratio of the blood that is exchanged. This ration should be around 0.67. As the volume of the heart in the present case does not depend on the uid computations, the too low ejection fraction indicates that already the input geometries are quantitatively not precise. 7.1 Improvements and Extensions Extension of geometry Since this simulation contains only one chamber out of four heart chambers it would be a natural approach to extend the geometry to include e.g. the left atrium which directly connects to the left ventricle. Rening of geometry If a better geometry becomes available the interface and tools developed within this thesis can be used to obtain better results. Boundary Conditions Concerning the boundary conditions there are three issues. The rst is that the velocity at the open valves is lower than the velocity of the blood streaming towards the boundary. This is unphysical and should be examined. Secondly the impact of changing the inow during the atrial systole would be an interesting topic. That would mean to force the inow to have a dierent shape or angle, since in the real heart, this phase distinguishes from the rapid inow phase by the fact that the inow is now forced by the compression of the atrium. 30 A third improvement concerning the boundary could be to change the wall boundary condition. In the real heart the wall has a ne structure which should have an impact on the ow behaviour. Check stability The simulation has been conducted with the geometry data in decime- ter and a corresponding viscosity of kg µ = 2.7 · 10−4 dm s. Varying the viscosity or changing to centimeters or meters (while adjusting viscosity and density) led to stability problems. In order to improve the solver (and therewith the FSI solver which is at that point identical with the ALE solver) this stability issue should be further investigated. Run on more powerful hardware Since more powerfully hardware will be available, the mesh could be rened together with the time stepping. The discretisation as described above was chosen to have a reasonable run-time on the authors home computer. Mesh smoothing At present the mesh smoothing provided by Doln is used. This mesh smoother might be insucient for the contracting heart chamber; it could even connect to the stability problem above. Johan Janson is developing a mesh smoothing algorithm which seems a good idea to combine with the present work. 31 Bibliography [1] R. H. Anderson and A. E. Becker. The Heart. Structure in Health and Disease. Gower Medical Publishing, London, 1992. [2] C. W. Cryer and P. P. Lunkenheimer. Mathematical modelling of the cardio- http://wwwmath.uni-muenster.de/num/ Vorlesungen/Herz_WS95/Problem_description.ps.gz. vascular system. WWU Münster, 1995. [3] G. Herron. Newsgroups: comp.graphics, comp.graphics.algorithms. hollasch.net/cgindex/geometry/ptintet.html. [4] J. Homan, J. Jansson, A. Logg, and G. N. Wells. FEniCS. [5] J. Homan and C. Johnson. http://steve. http://www.fenics.org. Comtutational Turbulent Incompressible Flow. Springer- Verlag, 2007. [6] P. J. Hunter and T. K. Borg. project. [7] J. Integration from proteins to organs: the physiome Nature Reviews Molecular Cell Biology, pages 237243, March 2003. Janson. Mercurial http://www.nada.kth.se/cgi-bin/jjan/ Repository. hgwebdir.cgi/fsi-ode. [8] M. Larsson and P. Vesterlund. Umeå Medical University, private communication, 2008. [9] I. LeGrice, P. Hunter, A. Young, and B. Smaill. data-based model. The architecture of the heart: a Phil. Trans. R. Soc. B, pages 12171232, 2001. [10] D. M. McQueen and C. S. Peskin. Heart simulation by an immersed boundary method with formal second-order accuracy and reduced numerical viscosity. In chanics for a New Millennium. Springer, 2000. [11] D. Noble. Modeling the heart. [12] C. S. Peskin. Me- Physiology, pages 191197, 2004. Mathematical aspects of heart physiology. Lecture Notes, Courant Institute of Mathematical Sciences, 1975. [13] W. Schroeder, K. Martin, and B. Lorensen. Oriented Approach To 3D Graphics. The Visualization Toolkit: An Object- Kitware, 2002. [14] H. Si. A quality tetrahedral mesh generator and three-dimensional delaunay triangulator. http://tetgen.berlios.de. 32 [15] M. Stoeckli. A unied continuum uid-structure interaction solver using an ale nite element method. Master's thesis, KTH Computer Science and Comunication, 2007. [16] B. Stroustrup. The C++ Programming Language. 33 Addison Wesley, 2000. TRITA-CSC-E 2009: 022 ISRN-KTH/CSC/E--09/022--SE ISSN-1653-5715 www.kth.se