Universität Stuttgart - Institut für Wasser und Umweltsystemmodellierung Lehrstuhl für Hydromechanik und Hydrosystemmodellierung Prof. Dr.-Ing. Rainer Helmig Diplomarbeit Inspecting endovascular aneurysm treatments with porous medium flow simulations and the use of a statistical framework Submitted by Sebastian Warmbrunn Matrikelnummer 2425845 Stuttgart, October 31th, 2012 Examiner: Prof. Dr.-Ing. R. Helmig Tutors: Dipl.-Ing. K. Baber Dr. Kent-Andre Mardal Øyvind Evju, M.Sc. Preface This thesis was written during the period of May 2012 - November 1st 2012. It is the final project for the degree program “Umweltschutztechnik” at the University of Stuttgart. Most parts of this thesis were written at the Simula Research Laboratory, Oslo. I am very grateful for the possibility that was given to me, to work abroad in such a great working environment, with so many open-minded people. First of all I want to thank Prof. Rainer Helmig, who gave me this opportunity. I want to thank Kent-Andre Mardal, who was my supervisor in Oslo. He was always very helpful and supportive during my stay at Simula. Thanks to Øyvind Evju, who was my second supervisor in Oslo helped me when needed. Another thanks goes to Katherina Baber. She was my supervisor in Germany and helped me, especially during the last month of finalizing my work. A five year long study now comes to an end and I would like to thank my friends and the people who were surrounding me during this period of my life. Last, but not the least, I want to thank my parents and my sisters for their love and support. Contents 1 Introduction 10 2 Medical Background 12 2.1 The clinical picture . . . . . . . . . . . . . . . . . . . . . . . . 12 2.2 The treatment methods . . . . . . . . . . . . . . . . . . . . . 13 3 Physical Model 3.1 Simplifying the fluid . . . . . . . . . . . . . . . . . . . . . . . 3.2 Simplifying the structure and boundaries . . . . . . . . . . . . 3.3 Generation of the aneurysm model . . . . . . . . . . . . . . . 16 16 18 22 4 Mathematical Model 4.1 Mathematical approach for the free flow . . . . . . 4.2 Mathematical approach for the porous medium flow 4.3 Coupling of the approaches . . . . . . . . . . . . . . 4.4 The surrogate management framework . . . . . . . . . . . 29 29 31 32 33 . . . . 39 39 45 46 49 . . . . . 51 51 53 62 66 70 5 Numerical Model 5.1 The finite element method . . . . . 5.2 The incremental pressure correction 5.3 Implementation in FEniCS . . . . . 5.4 Verification of the implementation . . . . . . scheme . . . . . . . . . . 6 Results 6.1 Two dimensional flow field . . . . . . . . . . 6.2 Aneurysm geometry - three design variables 6.3 Aneurysm geometry - stent . . . . . . . . . . 6.4 Mesh convergence . . . . . . . . . . . . . . . 6.5 Discussion . . . . . . . . . . . . . . . . . . . 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . List of abbreviations CT computed tomography FEM finite element method FSI fluid structure interaction GDC Guglielmi detachable coil IPCS incremental pressure correction scheme LHS latin hypercube sampling PDE partial differential equation REA represatentive elementary area SMF surrogate management framework vmtk vascular modeling toolkit WSS wall shear stress 6 List of Figures 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 Different treatment methods for the endovascular treatment of an aneurysm. Top left: many coils, lower left: less coils, top right: stent, lower right: flow diverter . . . . . . . . . . . The two considered types of a cerebral aneurysm. A sidewall aneurysm on the left side and a bifurcation aneurysm on the right side. . . . . . . . . . . . . . . . . . . . . . . . . . . . . A very simplified scheme of the Circle of Willis. The arrows represent the blood flow from the heart. . . . . . . . . . . . Illustration of the procedure to define the representative elementary area . . . . . . . . . . . . . . . . . . . . . . . . . . The porosity of the coil configuration with a shrinking area. The user can drag the three planes along their normals to investigate the cerebral vessel system. The structures with a higher contrast are bones, the ones with a lower contrast are vessels. The red encircled part is an aneurysm. . . . . . . . . The fast marching method with the start point on the left image, the end point on the center image and the result on the right image. . . . . . . . . . . . . . . . . . . . . . . . . . The two points for the colliding front method on the top image, the resulting vessel structure on the bottom image. . . . . . A smoothed aneurysm geometry with added flow extensions. The aneurysm geometry with the size information for the generation of the mesh cells. Red is a small mesh size and dark blue a coarse mesh size. Those parameters can be scaled. . . The aneurysm geometry with a small sphere, representing a flow diverter and a bigger sphere representing a coiling. The white line marks the degree of freedom. . . . . . . . . . . . . Illustrations of the surrogate management framework. On the top, the initial points for the calculation of the first Kriging surrogate are shown. The picture in the middle shows a first mesh, with new chosen points. On the bottom, the mesh was refined and the poll step is initiated. . . . . . . . . . . . . . The surrogate management framework as a flow chart . . . . The domain on which the Poisson equation is solved. The Dirichlet condition continues on the green axes. . . . . . . . The results for the pressure drop of the Poisson equation . . 7 . 10 . 13 . 14 . 19 . 20 . 23 . 24 . 25 . 26 . 27 . 28 . 37 . 38 . 41 . 44 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 Illustration of the example problem . . . . . . . . . . . . . . Pressure distributions for the two different models . . . . . . The velocity distribution for the third surrogate management framework (SMF) run . . . . . . . . . . . . . . . . . . . . . Different placement possibilities for the spheres and the corresponding porous medium areas (red) . . . . . . . . . . . . The geometry of the sidewall aneurysm . . . . . . . . . . . . Streamlines for the three results of the SMF runs and without coil placement . . . . . . . . . . . . . . . . . . . . . . . . . . Velocity inside the aneurysm for the three results of the SMF runs and without coil placement . . . . . . . . . . . . . . . . The geometry of the bifurcation aneurysm . . . . . . . . . . Streamlines for the three results of the SMF runs and without coil placement . . . . . . . . . . . . . . . . . . . . . . . . . . Velocity inside the aneurysm. No coiling on the very left, following run01 - run03 from the left to the right . . . . . . . The sidewall aneurysm geometry with a spherical shaped disk, representing the aneurysm. . . . . . . . . . . . . . . . . . . . The change of the volume Vkinen , used for the calculation of the kinetic energy measure Ekin . . . . . . . . . . . . . . . . The aneurysm with the coiled area (red) and the point of the velocity measurement (white dot) . . . . . . . . . . . . . . . The pressure drop from inlet to outlet with increasing mesh resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . The kinetic energy inside the aneurysm with increasing mesh resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . The velocity at a measurement point with increasing mesh resolution . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 . 50 . 50 . 53 . 54 . 55 . 56 . 58 . 59 . 60 . 61 . 62 . 64 . 66 . 67 . 68 . 69 List of Tables 1 2 3 4 5 6 7 8 The thresholds for the design variables. First row: lower threshold. Second row: upper threshold . . . . . . . . . . . . The results for the SMF runs of the example problem . . . . The results for the design variables and cost functions for the sidewall geometry . . . . . . . . . . . . . . . . . . . . . . . . The results for the SMF runs on the bifurcation geometry . The thresholds of the design variables for the SMF . . . . . The comparision between stent and coils on the sidewall geometry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The components of the goal function for a stent and a coil situation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The components of the goal function with another Vkinen . . 9 . 52 . 52 . 58 . 60 . 63 . 64 . 64 . 65 1 Introduction In fact, the interrelation between medical science and engeneering already exists quite a long time. The design of surgical instruments, the building of medical devices like an ultrasound device or the inspection of material properties of tissues are all examples where engeneering experience and knowledge from clinicians fuse together. With the constant development of new technologies, especially in the field of computer science, this interrelation grew stronger during the past decades. Therefore, it is not surprising that also computer simulations contribute more and more to the understanding of medical processes. In the context of this work, a computer simulation begins with setting up a simplified physical model for a certain phenomenon or process in nature. The physical model is then described by mathematical equations. Most of the time those mathematical equations are too complex to be solved without the help of numerical tools and fast computers. Figure 1: Different treatment methods for the endovascular treatment of an aneurysm. Top left: many coils, lower left: less coils, top right: stent, lower right: flow diverter In this case, we are interested in the blood flow through an aneurysm. Different variants of treatment are considered and compared with respect to the developing flow. Figure 1 gives an idea of how an aneurysm and the different treatments look like. Chapter 2 describes the clinical picture of an aneurysm and the relevant treatment methods more detailed. The physical model is 10 discussed with all its simplifications in Chapter 3. To find a good treatment solution for a certain aneurysm, the different variants are compared. Therefore a mathematical model to describe the flow is set up. Together with the help of a statistical framework, a good treatment variant for the aneurysm is expected to be found. Both the mathematical flow equations and the statistical framework are covered in Chapter 4. The equations have to be solved with the help of numerical schemes, which are summarized in Chapter 5. Finally the results of the executed simulations are presented in Chapter 6 and a discussion about the possible improvements of the method is given. 11 2 Medical Background A short introduction to the medical aspects of the topic is given in this chapter. This is not meant to be an examination of all the clinical details, but a brief summary of the most important facts. First of all, the clinical picture of a cerebral aneurysm is described, so that the reader gets a basic understanding of the disease. The second part is focused on the possible treatment methods, emphasizing endovascular treatment, as it is the main subject of this thesis. 2.1 The clinical picture A cerebral aneurysm is a local dilatation of an artery in the head. There are four main artery branches in the neck, leading to the brain, two in the front and two in the back. They fuse in the Circle of Willis (see Figure 3), from where several branches spread into the brain, to supply it with blood. This is also the most common region for cerebral aneurysms to occur, and will be the area where most of our discussed aneurysms are located. The diameters of the vessels in the Circle of Willis range from < 0.1mm up to 3mm. [22] The size of a cerebral aneurysm itself varies from such aneurysms, which are barely distinguishable from the surrounding vessels of the Circle of Willis, to aneurysms with diameters of 50mm and above. Figure 2 shows the types of aneurysms, which are inspected in this study. Cerebral aneurysms are a frequent disease. A reasonable assumption for the average prevalence in the general population is 2% [10,20] . Once present, a severe danger about aneurysms is the risk of rupture, associated with a subarachnoid hemmorhage. Although it is not exactly understood why aneurysms develop and rupture, certain risk factors like older age, atherosclerosis, hypertension and smoking are known [10,24,11] . Also, mechanical stresses on the blood vessel walls are considered to influence the development of a cerbral aneurysm. So it is interesting to look at the flow patterns, flow velocities and pressure conditions inside aneurysms, to draw conclusions from the impact of the flow on the blood vessel wall. It is difficult to get high resolution data for these flow informations though, which 12 Figure 2: The two considered types of a cerebral aneurysm. A sidewall aneurysm on the left side and a bifurcation aneurysm on the right side. is why computational models are used. If unruptured aneurysms are found incidentally, it is not easy to decide whether to perform a treatment or not. The risk of rupture may be very low in various cases, depending on the size, geometry and location of the aneurysm and the general physical condition of the patient. If an invasive treatment seems necessary though, there are several options from which the clinician can choose. 2.2 The treatment methods There are two general options for the invasive treatment of a cerebral aneurysm: craniotromy with clip ligation (clipping) and endovascular treatment. [5] Endovascular treatment has become the method of choice for many cases. Especially if the patient is already in a bad condition (e.g. a brain bleeding already occured), it is desireable not to impose more physiological stress through a craniotomy. Interventional neuroradiologist Guido Guglielmi invented the Guglielmi detachable coil (GDC), which has become the standard device for endovascular treatment of cerebral aneurysms. Coils can be imagined as very thin, preshaped wires. In January 1991 the first surgery with GDCs was performed and in 1995 the Food and Drug Administration approved commercial sale for the GDC. [23] GDCs appear in a vast variety of length and cross sectional shapes. 13 Anterior Cerebral Artery Anterior Communicating Artery Internal Carotid Artery Middle Cerebral Artery Posterior Communicating Artery Posterior Cerebral Artery Basilar Artery Vertebral Artery Figure 3: A very simplified scheme of the Circle of Willis. The arrows represent the blood flow from the heart. 14 In the procedure of an endovascular treatment, a microcatheter is injected in the thigh and guided up to the location of the aneurysm. With the help of this microcatheter, the detachable coils are introduced into the lumen of the aneurysm. In most of the cases, several coils are used to clog the aneurysm. The coils are preshaped, such that they interlace when released into the aneurysm and create a twine. This constellation is supposed to prevent high velocity blood flow inside the aneurysm. Another way to reduce the flow velocity inside the aneurysm is the use of a stent. Stents are tube shaped meshes, which can be placed in the vessel adjacent to the aneurysm using a microcatheter. Thereby the flow is guided past the aneurysm. There is also an active development of new possibilities to prevent high flow velocities in aneurysms. Here, we also want to consider denser structures, which could be placed at the inflow of the aneurysm (possibly with the help of a stent). Those structures are called flow diverter in the following, unlike in some literature, where stents are sometimes called flow diverter. Figure 1 illustrates different treatment variants. It is not always clear for clinicians, which treatment method is the best for a specific aneurysm geometry. Many of the desicions for a particular treatment method are based on experience today. In this work, several treatment variants with coils, stents and flow diverters are inspected and compared with respect to the resulting flow field. We use flow simulations and a computational model to perform this procedure. 15 3 Physical Model Models are by definition simplifications of the processes occuring in nature. An investigation of the blood flow inside an aneurysm is a problem with highly complex geometries and system properties. Therefor, we have to make some assumptions. The descriptions of our simplifications and assumptions are divided in two parts. First, the simplifications of the fluid are described, followed by the simplifications of the structural parts of our model (including the vessel walls, inflow and outflow conditions and the porous medium approach). The final part of this section describes how the model areas of the aneurysms were generated for the further use in our computational model. 3.1 Simplifying the fluid Blood is a suspension of various particles (∼ 45%) — mainly red blood cells (∼ 97%), white blood cells, and platelets — in plasma (∼ 55%). Plasma in turn consists mostly (∼ 92%) of water. The concentration level of the suspended particles influence the behaviour of blood. Due to the high concentration of red cells, they have the most influence on the mechanical properties of blood. [9] As can be seen in the following sections, the blood is described as simple as possible in our models. Many assumption in this section follow the explanations given in [9,27,26] . Continuum approach for fluids Fluids are aggregations of molecules, widely spaced for a gas, closely spaced for a liquid [27] . We want to look at fluids in an averaged way, excluding molecular movement and effects. A fixed volume of a certain size is assumed. The interchange of molecules over the boundaries is so large, that it can be assumed to be nearly constant. Hence, we can for example assume a density without fluctuations for this volume, which is the mass of molecules times the molecules per volume unit. The limiting volume for the continuum approach is about 10−9 mm3 for all liquids. The volumes we take into account are in the mm − cm range. That means we can assume the continuum approach for fluids of our problems and use averaged quantities such as the density or viscosity. 16 Incompressibilty Liquids are mostly considered as incompressible in flow simulations. The density of water, for example, changes one percent if the pressure is increased by a factor of 220 [27] . Blood can be described as an incompressible fluid in our simulations as well. kg We assume blood to have a constant density ρ = 1060 m 3 for our simulations. Viscosity and surface stress model We know from experience, that fluids deform while they are in motion. This deformation behaviour varies from fluid to fluid. A heavy oil, for example, has a higher resistance to flow than water. The viscosity is a measure to describe this resistance of a fluid to its movement. In general, viscosity relates the fluid strain rate to the shear stress which is applied. For some common fluids as water, the applied shear σ is proportional to the velocity gradient of the fluid [27] . If this linear relationship is observed, we call the fluid a Newtonian fluid. For a one-dimensional case, with fluid flow in the x-direction only, the proportionality can be expressed by σ=µ du , dy (3.1) where µ is the constant viscosity coefficient, sometimes also called dynamic viscosity, and du describes the velocity change in y-direction. dy Blood does in fact not show a Newtonian fluid behaviour. The concentration of red blood cells, or hematocrit level, influences the flow behaviour. It is a shear-thinning fluid, which means that it has a lower (apparent) viscosity with an increasing rate of deformation. [9] Especially in smaller vessels like capillaries, or if local fluid behaviour is in focus, it is important to take those effects into account. We are not really interested in the local behaviour of the blood flow, but more in the system behaviour as a whole. So to keep our model as simple as possible, we assume blood to have a Newtonian behaviour and assign a constant value to µ. Generalizing (3.1) to three dimensions, σ becomes a nine-component tensor σ ∗ = µ(∇u + ∇u> ) 17 (3.2) σ ∗ describes the viscous stresses acting on a fluid that arise from motion with velocity gradients. In addition to that, the hydrostatic pressure contributes to the surface stresses in the main directions σ = −pI + µ(∇u + ∇u> ) (3.3) where p is the scalar value of pressure at a specific position and I the identity matrix. σ is also called the Cauchy stress tensor. This is the final equation for the surface stresses acting in the blood flow. We will include this tensor later in the mathematical model (see Section 4.1). 3.2 Simplifying the structure and boundaries Boundaries We assume rigid vessel walls and do not include the complexity of fluid structure interaction (FSI). FSI is a highly complex model approach and it would be too time consuming to include it in this work. Also, the vessel walls are assumed impermeable, as the interchange over the vessel wall only takes place in capillaries. The blood flow through the body is pulsatile. In our models, we use an averaged, stationary inflow velocity. This is probably one of the most drastic simplifications in our model. Pulsatile flow can lead to turbulences inside the aneurysm, which in turn leads to a high kinetic energy inside the aneurysm. At the outflow of the aneurysm, a zero pressure condition is imposed. The outlet profiles are placed far away from the aneurysm, such that the pressure drop in this region should not be influenced by the boundary condition. Nevertheless it is an assumption and due to a lack of time we could not check for every aneurysm if the distance is sufficient. Porous media approach Instead of modeling the geometry of every single coil which is introduced into the aneurysm, the coils are considered a porous medium. This allows us to describe the area occupied with the coils with a few parameters in an averaged way. Thereby we prevent computationally demanding complex flow fields around accurately modeled coils. 18 (a) Aan ∼ = 78.5 (b) Aan ∼ = 50.3 (c) Aan ∼ = 19.6 (d) Aan ∼ = 3.1 Figure 4: Illustration of the procedure to define the representative elementary area There is a variety of porous media to be found in technical applications as well as in nature. Defining a porous medium is not an easy task and an agreed-upon definition does not exist. However, in general one can say that a porous medium is a solid material which includes a pore space. A good example for a porous medium is a sponge. We argue in the following paragraphs, why it is reasonable in our case to apply the porous medium approach. According to [3,4] , one part of a porous medium is a persistent solid phase, called the solid matrix. In our case, the intertwisted coils represent the solid matrix. The other part is at least one gas or fluid phase, which is present in the spaces between the solid matrix. Those spaces are referred to as void space. We only have the blood as a fluid phase present. The void space should be interconnected, which is assumed to be true in our case. There is no realistic scenario, where the coils are configured in a way that the flow is guided only through seperated pores. Another criterium for a material to be described as a porous medium is the definition of a continuum. This means, that the material properties can be described with few effective parameters. To be able to do that, a material needs to fulfill certain geometrical properties, which are examined for coils in the following. We do this with an analysis of the geometrical proportions of coils and an aneurysm for a representative case. A Python script was written for this purpose. It includes the Polygon [19] package for Python, which adds the ability to handle polygonal shapes in 2D. A circle for the aneurysm is generated with smaller circles inside, representing 19 0.7 Porosity [-] 0.6 0.5 0.4 0.30 10 20 30 40 Area [mm^2] 50 60 70 Figure 5: The porosity of the coil configuration with a shrinking area. the coils. We want to take a look at the porosity of this configuration, which is defined in our case as φ=1− Acoils Aan (3.4) where φ is the porosity. Acoils and Aan is the area of the coils and the aneurysm respectively. We take approximately the measurements from [12] for the aneurysm lumen and radius of the coils. The radius of the aneurysm is set to 5mm, the radius of the coils to 0.127mm and the porosity to 0.7. The script then generates the circles necessary to reach the porosity. We now keep the configuration of the coils constant and start shrinking Aan stepwise. For every step we calculate the porosity, such that we can create a graph like shown in Figure 5. We recognize that the porosity starts fluctu20 ating as we approach Aan = 0. The point where the fluctuation is starting can be defined as the represatentive elementary area (REA). The REA is the minimal area which can be used for the porous medium approach with the current coil size. This means that for areas larger than the REA, we can describe the geometry averaged and use the porosity as a suitable parameter. This is obviously only a rough approximation, as our problems are three dimensional. Nevertheless it shows, that the geometrical proportions of a typical coil configuration are in the right range to be considered a porous medium. Another parameter, which is widely used to describe the properties of a porous medium is the permeability. It can be imagined as the resistance of the material against the flow. In general, the permeability is not only dependent on the porosity. There are model approaches though, which connect the porosity with the permeability directly. We follow the capillary theory of Kozeny and set up a linear relationship between the porosity and the permeability, as described in Section 4.2. 21 3.3 Generation of the aneurysm model Patient specific image data is used in our procedure, to create the geometry models of aneurysms. We obtained images from Rikshospitalet in Oslo. The images were produced by computed tomography (CT). In this section, we briefly describe our main procedure of using those images to create a three dimensional model for the flow simulations. Besides that, we want to describe how the coil area i.e. the porous medium area is defined in our model. We used the software tools ParaView [18] and the vascular modeling toolkit (vmtk) [25] for those tasks. This is only a general, compact summary of the workflow. It is recommended to visit the websites of the software packages to get more insight into the program features. Generating the surface The first thing we have to do is to generate a surface from the CT-images. A surface is a representation of the vessel, and is the limiting surface of the volumes, which are obtained from the CT-images. The starting point for the generation is a three dimensional set of CT-images of the patients head. Using vmtk, the user can scroll layer-wise along three main axes and see the images of the head. This way it is possible to get an overview of the vessel system. The images have different contrast values for the various biological structures in the head. This is used by vmtk to seperate the vessels from the surrounding structures (see Figure 6). To generate a surface, we extract another image set, called a level set. The contrast value in the level set is set to small negative values for the vessels and small positive values for the surrounding area. The mathematical description of the interface — i.e. where the contrast value is zero — is then the surface. In general, we use three methods to create the level sets for different kinds of vessel structures. The fast marching method for the aneurysm lumen, the colliding front method for bigger vessels and the seeds method for smaller vessel segments. 22 Figure 6: The user can drag the three planes along their normals to investigate the cerebral vessel system. The structures with a higher contrast are bones, the ones with a lower contrast are vessels. The red encircled part is an aneurysm. 23 Figure 7: The fast marching method with the start point on the left image, the end point on the center image and the result on the right image. Fast marching method Before the algorithm of this method is starting, the user has to set contrast value thresholds, to tell vmtk the contrast range of the desired vessel structures. In addition to that, start points and end points are chosen on the CT-images. Every start point emmits a spherical front with the same front velocity. When one of the fronts reaches one of the endpoints, the algorithm is stopped. Only the areas which are inside the spheres around the start points and have an appropriate contrast value are then considered for the level set. We often use this method to model the aneurysm lumen by placing one start point in the center of the lumen. For the end point we choose the farthest point of the lumen wall. Figure 7 shows an example, where this method creates a nice volume for the aneurysm lumen. 24 Figure 8: The two points for the colliding front method on the top image, the resulting vessel structure on the bottom image. Colliding front method Here, we can only define two points on the image and again a threshold. A front is propagated from each point in the direction of the other point and the parts of the image within the threshold are recognized by the algorithm. With a good choice for the thresholds, we often can use this method for big vessels, like shown in Figure 8. Smaller vessels, especially if the contrast value fluctuates a lot, are hard to model with this method. Seeds method This is the method of choice when it comes to modeling smaller vessel segments. We can create many points on the image and every point is modeled as a part of the vessel segment independent of a threshold. This way allows us to manually influence the model area. 25 Figure 9: A smoothed aneurysm geometry with added flow extensions. Preparing the surface for meshing The generated surface might need some smoothing and refinement, depending on the volume mesh, that we want to create from it later. For most of our models, we use the recommended smoothing settings from the vmtk homepage. The different mesh resolution are generated from the same surface, so that they are comparable, regarding this aspect. Often, it is necessary to add pipe-shaped flow extensions to extend the model area, if the artery system posterior to the aneurysm has too many bifurcations, which would lead to too much complexity for our system. The extension is necessary to be able to impose a zero pressure boundary condition at the outlet, which does not influence the pressure drop at the important locations e.g. the aneurysm neck. Sometimes, it is also desireable to extend the inflow, such that the flow field at the inflow boundary is fully developed before it reaches the aneurysm. Figure 9 shows a smoothed aneurysm geometry with added flow extensions. Meshing the surface The equations which describe the flow are solved in a discrete way. Hence, a volume mesh is necessary to perform the flow simulations. Our meshes consist of irregular thetrahedal cells. We want to refine the mesh at locations where the flow is expected to be complex. To achieve that, vmtk provides a script to place spheres on the surface we created earlier. With adjustable 26 Figure 10: The aneurysm geometry with the size information for the generation of the mesh cells. Red is a small mesh size and dark blue a coarse mesh size. Those parameters can be scaled. parameters, it is possible to refine the mesh proportional to the distance from the spheres (see Figure 10). From the generated surface with the refinement information we can create the mesh and convert it to the desired format. Placing the porous medium area The porous medium area is in our case the representation of the coils in the aneurysm. It is hard, even for trained clinicians, to decide where to place coils. A case-specific evaluation has to be performed for every patient. In Section 4.4, we present an automated method to find the placement of the porous medium area i.e. the coils. This could be helpful in the future to guide clinicians in their decision making. We use ParaView to place a sphere over the aneurysm lumen. The area inside the sphere is later defined as the porous medium. The coordinates of the sphere center and the radius are used in the code for the flow simulations. It is also possible to define a smaller and less conductive sphere inside the vessel system to model the placement of a flow diverter. Also, we want to define a vector inside the aneurysm. The coil positioning is variable in the automated 27 Figure 11: The aneurysm geometry with a small sphere, representing a flow diverter and a bigger sphere representing a coiling. The white line marks the degree of freedom. process, and this will be the degree of freedom for the coils. We use the line tool in Paraview to define the direction of the vector. Figure 11 illustrates the placement of a coil configuration and a flow diverter configuration with the degree of freedom represented by the line. 28 4 Mathematical Model We apply mathematical models to describe the blood flow inside the aneurysm and the surrounding vessels. The mathematical approach for the free flow region is discussed in the first part of this section. For the region occupied with the coils — thus the porous medium — a slight modification of the free flow approach is necessary, which is covered in the second subsection. Further we focus on how those two models are linked in a proper manner. The final topic of this section is about the surrogate management framework. It is a method, which uses statistical techniques and a search algorithm, to find optimal parameters for our flow model. 4.1 Mathematical approach for the free flow Using the principles of continuum mechanics is a common way to describe fluid flow. Fluid properties, which may fluctuate on the molecular scale, are averaged over a large number of molecules. The fluid flow is described with the help of those averaged fluid properties (like density or viscosity) at a fixed location. This approach of looking at a certain spatial location and observing the changes in the fluid flow there, is also called Eulerian Method. The set of equations, that are used to simulate the flow problems are called the Navier-Stokes Equations. For isothermal problems, they are based on the conservation of mass and momentum. A compact derivation of the equations is given in the following, using [1,7] as a source. Conservation of mass We look at a fixed, infinitesimal small volume V of a fluid, with the boundary ∂V . To describe the total inflow and outflow across ∂V , we write Z (ρu) · n ds = 0, (4.1) ∂V where u is the velocity and n the outward pointing normal vector. Like shown in Section 3.1, a constant density ρ for blood is used here. Applying Gauss’s Theorem, equation 4.1 turns into Z Z ∇ · (ρu) dx = ρ∇ · u dx = 0. (4.2) V V 29 Because infinitesimal small volumes are assumed, the integrand has to become zero. Thus, we get the continuity equation for incompressible fluids ∇ · u = 0. (4.3) Conservation of momentum Consider Newton’s Second Law: ma = F . In this form the law states, that the force F causes an acceleration a on a point mass m. Since we want to look at the driving forces acting on the fluid which penetrates the same fixed volume V as before, the law is adapted, such that Z d ρu dx = F (4.4) dt V Applying Reynolds transport theorem for the left hand side of the equation Z Z ∂ (ρu) dx + (ρu)u · n ds = F (4.5) V ∂t ∂V and using Gauss’s Theorem reveals Z ∂u + ρ∇ · (uu) dx = F . (4.6) ρ V ∂t With the continuity equation, a reformulation of the second term of the integrand is possible. ∇ · (uu) = u · ∇u + (∇ · u)u = u · ∇u, Z (4.7) ∂u + ρu · ∇u dx = F . (4.8) V ∂t Now we want to take a closer look at the forces on the right hand side of the equation. There are two kinds of forces acting on the fluid in motion, namely volume forces and surface forces. Volume forces — like gravity — are here denoted by the vector f and act on every mass unit of the fluid. The surface force vector consists of the scalar product between the stress tensor σ and the normal vector n. Equation (4.8) changes to Z Z Z ∂u ρ + ρu · ∇u dx = σ · n ds + ρf dx. (4.9) V ∂t ∂V V ρ 30 We apply Gauss’s Theorem on the stress term Z Z ∂u ρ + ρu · ∇u dx = ∇ · σ + ρf dx. (4.10) V ∂t V Once again this can be written without integrals, as infinitesimal small volumes are assumed. Also, we want to divide by ρ, and obtain ∂u 1 + u · ∇u = ∇ · σ + f . (4.11) ∂t ρ Following the definition in Section 3.1 we can reformulate the stress tensor to get our final form of the momentum conversation of the Navier-Stokes Equations for Newtonian fluids: u t p p ∂u + u · ∇u = −∇ + ν∆u + f . . . with ∂t ρ ρ ν f 4.2 velocity time pressure (4.12) density kinematic viscosity volume force Mathematical approach for the porous medium flow We derived the Navier-Stokes Equations in the previous subsection as follows ∂u p + u · ∇u = −∇ + ν∆u + f ∂t ρ ∇·u=0 (4.13) This system of equations can be extended according to [12] , to describe the flow in the coiled area. Resistance terms are introduced on the right hand side of the momentum equation ∂u p νφ φ2 CD (4.14) + u · ∇u = −∇ + ν∆u + f − u − √ u|u| ∂t ρ K K where φ represents the porosity, K the permeability of the porous medium and CD a drag factor. 31 The porosity φ is defined by the ratio of the volume occupied by the pores to the total volume of the aneurysm. In this case we can express this by Vcoils . (4.15) Van The permeability K is related to the conductivity of a porous material. Approximating the porous medium as a solid material with straight parallel tubes of the same diameter as the pores, we can write φ=1− φ3 . (4.16) cS 2 The Kozeny parameter c is dependend on how the porous medium is modeled. For the chosen straight tubes c = 2. S is the ratio of the surface area of the pores to the total volume of the aneurysm. The surface area of the pores is assumed to equal the surface area of the coils, hence K= Acoils . (4.17) Van The drag factor CD is related to the local Reynolds number inside the aneurysm d pore diameter Uav averaged velocity in aneurysm dUav ρ (4.18) . . . with Re = ρ µ density µ dynamic viscosity S= and can be taken from standard diagrams. [12] Knowing the geometry of the coils which are introduced into the aneurysm, we can now describe the porous medium and the corresponding flow equation. 4.3 Coupling of the approaches As the equations for the two subsystems described above are of the same mathematical order, a real coupling condition at the interface is not necessary. The pressure and velocity is assumed to be continous at the interface. By setting φ = 1 and K = ”∞” the equations for the free flow region are recovered. 32 This is used to easily model the porous medium. Later on, it is only necessary to mark a region in the parts of the model area, where the porous medium equation is applied. For the implementation in the code this means that only a boolean switch is neeeded to either consider the resistance terms in the momentum equation, or not. 4.4 The surrogate management framework The mathematical model to this point covers the description of the flow processes inside the aneurysm for one predefined coil configuration. Our goal is to figure out what is a good coil setting for one particular aneurysm geometry. That is why we vary the properties of the coils with parameters of our choice and compare the corresponding simulations. The flow simulations can be very time-consuming though, depending on the size of the mesh and the complexity of the flow pattern. To be able to make a clever decision for the parameters we use a SMF, introduced in [15,21] , which is described in the following on the basis of our particular problem. First of all, some kind of measure is necessary to compare the numerous runs of simulations. This measure has to be dependent on the setting of the coils. The coil location, the size of the coiled area and its permeability are possible parameters to describe the properties of the coil set-up. Those parameters are called design variables in the following. We now introduce the cost function J(x) and want to minimize subject to J(x) x, (4.19) where x represents the the design variables. The cost function J(x) can, for instance, depend on the kinetic energy inside the aneurysm and a pressure drop from the inlet to the outlet of the model area. The wall shear stress inside the aneurysm or the velocity at one critical point could be alternatives. J(x) is computed for every flow simulation run with one specific set of design variables x. To start the SMF algorithm, initial simulations have to be performed for different design variables. The design variables of the inital simulations are 33 found by a method called latin hypercube sampling (LHS). This method is generating a random sample of the space of our design variables [14] . Latin Hypercube Sampling Say we want to run k initial simulations and have two design variables. Each of the dimension is divided into k non-overlapping intervals of the same size. From each interval in each dimension, a point is sampled randomly and finally the points from the two dimensions are paired randomly, so we get k pairs of design variables and can run our k simulations. From the results of the initial runs, we get a discrete data set of the cost function, from which a surrogate model is generated using Kriging. We give a basic explanation of this procedure based on [2] . The surrogate model Kriging is a statistical function approximation method. It is very popular in the field of geostatistics and was developed for the purpose of mining [2] . The method uses spatial correlation functions to estimate unknown values from a known data set. ∗ J (x) = n X λi J(xi ) (4.20) i=1 J ∗ (x) is the unknown value at the desired location x, which is to be found through the linear combination of the known values J(xi ) weighted by λi . As there are infinitely possibilities to weight the known values, we restrict them by some conditions. The expected value for J(x) is assumed constant for the domain D of the design variables E[J(x)] = m ∀x ∈ D (4.21) . From this we can write ∗ E[J (x)] = n X λi E[J(xi )] = m, i=1 so for the weights this means 34 (4.22) n X λi = 1. (4.23) i=1 Further, we want to minimize the estimation variance σ 2 (x) which is the variance between the real value J(x) and the estimated value J ∗ (x). This variance can be reformulated with the help of the coviariance function C(h) where h is the distance between two locations. σ 2 (x) = Var[J(x) − J ∗ (x)] = n X ∗ 2 2 E[(J(x) − J (x)) ] = E (J(x) − λi J(xi )) i=1 n X n n X X 2 = E J(x) + λi λj J(xi )J(xj ) − 2 λi J(xi )J(x) = C(0) + i=1 j=1 n n XX n X i=1 j=1 i=1 (4.24) i=1 λi λj C(xi − xj ) − 2 λi C(xi − x) Our goal is to minimize σ 2 (x) with the constraint from equation 4.23 and thereby finding the weights λi . The Lagrange multiplier ζ is introduced for this purpose and 2 σ (x) − 2ζ X n λi − 1 (4.25) i=1 is minimized. The partial derivatives of 4.25 with respect to the weights λi and the Lagrange multiplier ζ are set equal to zero, to find the minimum. This results in the linear equation system n X λj C(xi − xj ) − ζ = C(xi − x) i = 1, . . . , n j=1 n X (4.26) λj = 1 j=1 . Solving this system, we get the weights and can calculate the estimated value at the desired location x with the help of equation 4.20. 35 Using a Kriging algorithm, the space of the design variables can be explored, and points which are likely to improve the cost function J(x) can be selected. This is further on called the SEARCH of the SMF. All the points, where J(x) is evaluated are restricted to lie on a mesh. After the evaluation, the surrogate is updated and the mesh for the evaluation can be refined. The first three pictures on Figure 12 illustrate the SEARCH step for two design variables. The SEARCH step provides means for local and global exploration of the parameter space, but is not strictly required for convergence [15] . The exploratory advantages of the surrogate model are combined with a method that garantuees convergence. The poll In the poll step, or simply POLL, the neighbouring points of the current best found solution by the SEARCH are evaluated on the mesh. Therefore, basis vectors are generated. We want to evaluate n + 1 points, where n is the dimension of the design variable space. For example, in a two dimensional space we take the basis vectors (1, 0), (0, 1) as the first two searching directions and (−1, −1) as the negative linear combination of both. The last picture on Figure 12 shows the POLL step for a two dimensional case. The framework We want to summarize the framework with Figure 13. The figure was generated from the explanation of the SEARCH and the POLL step in [15] . Mk is the mesh at iteration step k, Tk is a set of points on Mk and xk is the current best point of design variables. κk is the set of poll points around xk . 36 permeability permeability position permeability position position Figure 12: Illustrations of the surrogate management framework. On the top, the initial points for the calculation of the first Kriging surrogate are shown. The picture in the middle shows a first mesh, with new chosen points. On the bottom, the mesh was refined and the poll step is initiated. 37 Find initial points with LHS Calculate J(x) for initial points Generate / update surrogate Identify Tk on Mk and evaluate J(x) ∀x ∈ Tk ⊂ Mk Yes Increment k SEARCH J(x) < J(xk )? No, increment k Search for J(xpoll ) < J(xk ) with xpoll ∈ κk POLL Yes Increment k J(xpoll ) < J(xk )? No No Increment k Converged? Yes End Figure 13: The surrogate management framework as a flow chart 38 5 Numerical Model In this section, we want to outline the numerical schemes which were used to discretize the continous partial differential equation (PDE) system, which describes our flow problems (see Sections 4.1 - 4.3). This discretization is necessary, as the governing equations can not be solved analytically. We first focus on the methodology of the finite element method and later on discuss the discretization of the continous governing equations with the incremental pressure correction scheme (IPCS). For a more detailed discussion, especially on the implementation of those schemes in FEniCS, see [13] , which was also used as the main source for the following explanations. 5.1 The finite element method We use the finite element method (FEM) to approximate the solutions of the Navier-Stokes Equations in space. The FEM is a broadly used method to solve all kinds of differential equations in various fields of science and engineering. To keep things simple and focus on the method itself, we want to explain it with an easier equation based on the groundwater flow equation ∂h = −∇ · (−K∇h) + f. (5.1) ∂t This PDE solves for the hydraulic head h. Ss is the storage ability of the soil in the groundwater aquifer, K is the permeability tensor and f is a source or sink term. We assume a stationary problem, ∂h/∂t = 0. The soil has isotropic properties and is uniform over the domain. Hence, the permeability tensor K becomes a scalar constant k and equation 5.1 can be reformulated as Ss −k∆h = f. (5.2) For k = 1 the Poisson’s equation is recovered. It is a partial differential equation of second order and it was published in 1813 by Siméon Denis Poisson [13] . It is applied to model many physical problems. 39 While discussing the FEM, we provide small snippets of sample Python-code which can be used to solve the problem with the help of FEniCS. The system we want to solve with suitable boundary conditions may be written as follows: −∆h = f h = h0 −∂n h = g in Ω, on ΓD ⊂ ∂Ω, on ΓN ⊂ ∂Ω. (5.3) In this set of equations, h = h(x) ∈ Ω ⊂ Rd represents the pressure head field, which is influenced by the function f = f (x). f is sometimes also referred to as a source. Ω is the domain on which the problem is solved, bounded by ∂Ω. The boundary is split into the Dirichlet part ΓD and the Neumann part ΓN = ∂Ω \ ΓD . Boundary conditions are imposed on the system accordingly. A fixed value of h on ΓD and a normal flux on ΓN resulting from the normal derivative of h. This example is two dimensional, d = 2, and standard cartesian coordinates are used, so the Laplace operator ∆ can be written as ∆h = ∂ 2h ∂ 2h + . ∂x2 ∂y 2 (5.4) Let us consider a rectangle as a simple two dimensional domain with the boundary conditions defined as seen in Figure 14. To do that in our code, the functions from the DOLFIN [6] library are imported, which are needed to solve the problem. It is an interface which communicates the Python code with the underlying code written in C++. Further, we use a function to generate the mesh. from dolfin import * mesh = UnitSquare(32,32) UnitSquare(32,32) generates 1024 uniform rectangles, which are then divided in triangles. 40 Neumann no flow Dirichlet x[1] x[0] Figure 14: The domain on which the Poisson equation is solved. The Dirichlet condition continues on the green axes. 41 To solve the partial differential equation 5.3 on this mesh, the equation has to be discretized on those triangles. Multiplying equation 5.3 by a test function v and integrating by parts reveals Z Z Z ∇h · ∇v dx − ∂n h v ds = f v dx. (5.5) Ω ∂Ω Ω h is chosen from a function space, which is suitable to discretize the problem on the given mesh. It is the same as the test function space v is chosen from. The only difference is, that the test function space is shifted by the Dirichlet boundary condition, such that it equals zero on those boundaries. From that we obtain the variational problem: Find h from a suitable function space such that Z Z Z ∇h · ∇v dx = f v dx − gv ds. (5.6) Ω Ω ΓN The Neumann boundary condition is left in our equation, while the Dirichlet boundary condition is defined by the choice of our test function space. This is why we have to define the Dirichlet boundary on the right hand side of our domain by def boundary(x): return x[0] > 1 - DOLFIN_EPS To define the function space with Lagrange elements of first order we simply write V = FunctionSpace(mesh, "Lagrange", 1) From this function space, we choose a basis {Φj }N j=1 for the trial function and {Φ̂i }N i=1 for the test function, where N is the dimension of those spaces. An Ansatz to solve hΦ in terms of the basis functions for the trial space can be done hΦ (x) = N X Hj Φj (x). (5.7) j=1 Hj is the vector with the desired values for hΦ at the locations x of the mesh. Inserting this into 5.6 and using the same Ansatz for the test function 42 (only that its basis is shifted by the Dirichlet boundary condition) we get the equation N X j=1 Z Z ∇Φj · ∇Φ̂i dx = Hj Ω Z f Φ̂i dx − Ω g Φ̂i ds (5.8) ΓN which is a linear system and can be written in the form AH = b. (5.9) To get the functions from the function space it is sufficient to write h = TrialFunction(V) v = TestFunction(V) Now we impose the Dirichlet boundary condition, and define source term and the no flow condition for the remaining Neumann boundaries #Set value for Dirichlet condition and impose it on the system h_bound = Constant(10) bc = DirichletBC(V, h_bound, DC_boundary) #Define source term and set the Neumann condition to no flow f = Expression("10*1/pow(3.14*0.01,0.5)*exp(-(pow(x[0]-0.5,2) +pow(x[1]-0.5,2))/0.01)") g = Constant(0) To finish the code, we have to write down the equation for the variational problem and solve it. #Write the equation system a = inner(grad(h), grad(v))*dx L = f*v*dx - g*v*ds # Compute solution h = Function(V) solve(a == L, h, bc) 43 Figure 15: The results for the pressure drop of the Poisson equation We save the result file in the .pvd format, which can be viewed in ParaView. Figure 15 shows a plot of the result. # Save solution in pvd format file = File("poisson.pvd") file << h 44 5.2 The incremental pressure correction scheme Our results presented in Section 6 all have stationary inflow conditions, so a time discretization is not absolutetely necessary. Nevertheless, we calculate some timesteps, until the flow field is fully developed inside the aneurysm geometries. Also, to do further investigations on this topic, it is recommended to use time dependent inflow conditions, as the stationary inflow is only a rough averaging of the actually pulsating blood flow. The following explanations are a summary of the explanations in [13] . We use the IPCS to solve the Navier-Stokes equations u̇ + u · ∇u = ∇ · σ + f ∇·u=0 (5.10) where u̇ = ∂u/∂t and a unit fluid density is used. For the weak form, the multiplication with a test function is done and the stress term is integrated by parts. The momentum equation in integral form becomes ∂Ω Ω Ω (σ ·n)v+ σ ·∇v dx+ (u·∇u)v dx = − u̇v dx+ Ω Z Z Z Z Z f v dx, (5.11) Ω where Ω is the model area and ∂Ω the boundary. The idea of the IPCS is to first calculate a tentative velocity with the momentum equation, using the pressure and the velocity of the previous timestep. The corrected pressure of the current time-step is then obtained with the help of the tentative velocity by solving the Darcy problem unh − u?h + ∇(pnh − pn−1 h ) = 0, kn ∇ · unh = 0. (5.12) unh , pnh denote the velocity and the pressure of the current time step n discretized on the used mesh. u?h denote the tentative velocity and pn−1 the h pressure of the previous time step. kn is the local time step size tn − tn−1 . Equation system 5.12 can be simplified to a Poisson problem −∆(pnh − phn−1 ) 45 ∇ · u?h = . kn (5.13) With the corrected pressure pnh and the tentative velocity u?h , the corrected velocity unh can be calculated by inserting into the first equation of 5.12. The steps of the IPCS are summarized in the scheme below [13] . h· , ·i marks the inner product of two components. Note that the stress n− 12 tensor is evaluated at uh 0.5(∇v + ∇v > ). = (u?h + un−1 h )/2. (v) is the symmetric gradient 1. Compute the tentative velocity u?h by solving n− 12 n−1 h(u?h − un−1 · ∇uhn−1 , vi + hσ(uh h )/kn , vi + huh , phn−1 ) , (v)i n− 12 > +hpn−1 h n , vi∂Ω − hµ · (∇uh (5.14) ) , vi∂Ω = hf n , vi. 2. Compute the corrected pressure pnh by solving h∇pnh , ∇qi = h∇pn−1 , ∇qi − h∇ · u?h , qi/kn . h (5.15) 3. Compute the corrected velocity unh by solving hunh , vi = hu?h , vi − kn h∇(pnh − pn−1 h ) , vi 5.3 (5.16) Implementation in FEniCS Headflow [8] provides the IPCS scheme discussed in the previous section. Headflow is a collection of Python scripts, which the FEniCS to solve flow related problems. Headflow has the following main directories ~/headflow/data /problems /results /solvers The meshes for the computation are stored in the /data directory. The /problems directory contains the scripts which include information like inflow, outflow- and boundaryconditions and problem specific parameters. The solvers which generate a timestepping algorithm (see Section 5) with the help of FEniCS are located in the /solvers directory. The generated results are written to /results. 46 To solve our problems, we use the IPCS written in /solvers/ipcs.py and adapt it for our purpose. The IPCS scheme in the original file: # Tentative velocity step u_mean = 0.5 * (u + u0) F_u_tent = ((1/k) * inner(v, u - u0) * dx + inner(v, grad(u0)*u0) * dx + inner(epsilon(v), sigma(u_mean, p0, nu)) * dx - nu * inner(grad(u_mean).T*n, v) * ds + inner(v, p0*n) * ds - inner(v, f) * dx) a_u_tent = lhs(F_u_tent) L_u_tent = rhs(F_u_tent) # Pressure correction a_p_corr = inner(grad(q), grad(p))*dx L_p_corr = inner(grad(q), grad(p0))*dx - (1/k)*q*div(u1)*dx # Velocity correction a_u_corr = inner(v, u)*dx L_u_corr = inner(v, u1)*dx - k*inner(v, grad(p1-p0))*dx The terms for the description of the porous medium flow are added in the step of the tentative velocity calculation # Resistance constants for porous media K1 = problem.K1 K2 = problem.K2 # Tentative velocity step u_mean = 0.5 * (u + u0) u_mag = sqrt(inner(u0, u0)) F_u_tent = ( ((1/k)) * inner(v, u - u0) * dx + inner(v, grad(u0)*u) * dx + inner(epsilon(v), sigma(u_mean, p0, nu)) * dx 47 + + + nu * inner(grad(u_mean).T*n, v) * ds inner(v, p0*n) * ds inner(v, f) * dx inner(v, K1*u_mean) * dx inner(v, K2*u_mean*u_mag) * dx) The resistance constants K1 and K2 are defined in a problem file inside the /problems directory: class ResistanceTerms(Expression): def __init__(self, PMVol, term, nu, porosity, diameter): self.por = porosity self.PMVol = PMVol self.term = term self.d = diameter self.nu = nu def eval(self, v, x): VolPM = self.insidePMVol por = self.por #Porous media default parameter... #c1: Drag factor, koz: Kozeny coefficient #K: coillength dependent on porosity c1 = 2.2 koz = 2 K = (1-por)*VolPM/(pi*((self.d/2)**2)) if por >= 1: v[0] = 0 else: #Permeability dependent on porosity per = (por**3)/(koz*(1000*pi*self.d*K/VolPM)**2) #Terms term1 = (por*self.nu/per) term2 = ((por**2)*c1)/sqrt(per) 48 if self.term == 1: v[0] = term1 elif self.term == 2: v[0] = term2 self.K1 = ResistanceTerms(PMVol, 1, self.nu, poros, 0.25)* inside_pm self.K2 = ResistanceTerms(PMVol, 2, self.nu, poros, 0.25)* inside_pm \ \ K1 and K2 are dependent on the size of the porous medium area, its porosity and the kinematic viscosity of the fluid. 5.4 Verification of the implementation To verify the used equations for the description of the flow and their implementation in FEniCS a small example was calculated and compared with a code implementation of DuMux [16] . DuMux is a framework, which is used at the Department of Hydromechanics and Modelling of Hydrosystems, University of Stuttgart. A problem on the unit square was solved with the model properties illustrated in Figure 16. With a constant inflow velocity at the top boundary of the domain, the resulting pressure distribution and the pressure head at the inflow of both implementations are compared. Figure 17 summarizes the results of the simulations. The pressure distributions are very similar. The pressure drop starts to develop in the porous medium part of the domain. The pressure at the inflow is higher for the DuMux code compared to the the FEniCs code. The difference in the pressure values is explained by the use of different equation systems. The used DuMux code is based on a coupling approach, where the Stokes equation is describing the free flow, while the porous medium flow is described with the Darcy equation. The nonlinear convective term of the Navier-Stokes equations is missing, if Stokes flow is considered. This 49 1111111111 0000000000 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 0000000000 1111111111 constant y−velocity velocity = 0 pressure = 0 porous medium area Figure 16: Illustration of the example problem pressure [kPa] DuMux FEniCS 1290 pressure [kPa] 1725 0 0 Figure 17: Pressure distributions for the two different models is why a higher pressure drop is necessary for the development of the same velocity. 50 6 Results In this section the generated results from various runs of the SMF are discussed. First, we give a simple two dimensional example of a flow field, without the use of an aneurysm geometry to present the functionality of the SMF framework in the combination with FEniCS. Next, we present the results for the use of the SMF with three design variables on aneurysm geometries following a section with the discussion of a stent variant. A mesh convergence test is described, finishing with a discussion of the results and a short outlook. 6.1 Two dimensional flow field This is a simple example, which is supposed to show the functionality of the SMF. It solves the stationary Stokes equation on the unit square domain with the resolution of 800 triangular cells. A resistance term is added to the standard Stokes equation in the parts where the porous medium is considered. So the equation −∇ · (∇u + pI)) − k0 u = f (6.1) is solved on the porous medium domain. k0 is the resistance constant. Lagrange elements with a mixed finite element method are used, where the velocity is approximated in second order and the pressure in first order. The inflow boundary condition on the left side of the domain is set to a constant inflow rate with a quadratic velocity distribution. At the top and bottom boundaries, zero-velocity conditions are imposed. On the right boundary a free outflow condition is given. We take the value of the resistance constant k0 , the position of the porous medium x0 , and the edgelength of the porous medium square c as design variables. The position x0 is the position along the horizontal centerline of the domian. Table 1 shows the thresholds for the design variables. As a cost function for this problem, Z ∇p · ∇pdΩ + 1000 ux (1.0, 0.5) Ω 51 (6.2) k0 100 10000 x0 0.1 1 c 0.1 0.5 Table 1: The thresholds for the design variables. First row: lower threshold. Second row: upper threshold run 01 02 03 04 k0 564.0625 564.0625 564.0625 718.7500 x0 0.9718 0.9500 0.9015 1.0000 c 0.1000 0.1000 0.1062 0.1000 cost function 113.4037 110.4510 107.9119 120.1772 Table 2: The results for the SMF runs of the example problem is to be minimized. The pressure gradient ∇p in the whole domain and the outflow velocity on the centerline ux (1.0, 0.5) are considered in the cost function. The SMF was run four times to check whether the resulting design variables for the best found cost function are the same for all runs. Table 2 summarizes the resulting design variables and the cost function for every run. Figure 18 shows the resulting velocity field for the third run. One notes that the resulting optimal placement, size and permeability of the porous medium square tends to be the same for all four runs of the SMF. The fourth run results in a higher resistance value, but also in a higher cost function. For this case, it seems to be a good solution to put a small square with a relatively low resistance next to the point where the velocity for the cost function is measured. We conclude from this small example, that the SMF converges to a solution for a particular problem. This does not necessarily mean that only one solution exists for a more complex structure like an aneurysm. This is why we run the SMF several times on the aneurysm geometries in the following sections and compare the results afterwards. 52 Figure 18: The velocity distribution for the third SMF run 6.2 Aneurysm geometry - three design variables The SMF with three design variables was applied to two different aneurysm geometries. A sphere is defined in the model area which represents the porous medium. The porosity and the radius of the sphere would relate to the amount and the preconditioned shape of the coil, which is introduced into the aneurysm. Besides those two design variables, the position of the sphere along a vector was chosen as the third design variable. Figure 19 shows examples of sphere placements in the model area of a bifurcation geometry and the corresponding porous medium area. The configuration on the top is a coil placement with a neck remnant. Provided that the porosity is very low, the configuration in the middle picture represents the case of a flow diverter. Flow diverters are not used as a standard routine for treating aneurysms. They could possibly be fixed by a stent during the procedure. The configuration on the bottom shows a case, which would be hardly executable in real life, because of the coils being pushed up into the aneurysm by the blood flow. Nevertheless, it is a possible case in the SMF and from an engeneering point of view it is interesting to know whether such a case reveals a better solution for the problem. 53 Figure 19: Different placement possibilities for the spheres and the corresponding porous medium areas (red) 54 Figure 20: The geometry of the sidewall aneurysm To check the robustness of the method, the SMF was always executed three times with the same model properties. The only differnce between the runs is the choice of the design variables for the initial simulations of the SMF. This was done by the LHS method as described in Section 4.4 As a cost function for the SMF, the sum of the pressure drop measure pD and the kinetic energy measure Ekin should be minimized. Ekin is the squared flow velocity integrated inside a defined aneurysm lumen Vkinen . pD is the pressure drop from the inlet to the outlet multiplied with the density. We scale those two measures with constants, such that none of them dominates the other. For the SMF runs of this section, the cost function J(pD , Ekin ) = Ekin + 0.05pD (6.3) is minimized. This is a first try for the choice of a cost function and it is suitable for the comparision of the simulation runs. Sidewall aneurysm The first examined geometry is a sidewall aneurysm, presented in Figure 20. It is a giant aneurysm (∼ 1100mm3 ) located at the right internal carotid artery of the patient. 55 Figure 21: Streamlines for the three results of the SMF runs and without coil placement The model mesh which was generated from the CT images of the patient has about 220000 cells. At the inflow, a constant velocity of 300mm/s and at the outflow, a zero pressure condition is chosen. The vessel walls are assumed impermeable and a no-flow condition is imposed. We enlarge the model area by adding flow extensions to the geometry, such that the flow field is fully developed before it reaches the twisting part of the geometry and the aneurysm. The flow extension at the outflow is needed, so that the zero pressure condition at the outflow does not influence the flow pattern near the aneurysm. A vector from the aneurysm neck to the top of the aneurysm is defined, along which the sphere - representing the porous medium - has one degree of freedom. The position parameter for the SMF ranges from 0 to 1, where 0 is the lowest position in the aneurysm and 1 is the position at the top of the aneurysm. The maximum radius of the sphere has to be large enough, that the sphere at the top of the aneurysm neck covers the whole aneurysm (this corresponds to a coiling without neck remnant). The minimum radius is of the size, that the sphere at the aneurysm neck represents a flow diverter. For this aneurysm geometry, the minimum radius threshold is 1mm and the maximum radius threshold 12mm. The porosity of the porous medium ranges 56 from 0.7 to 0.95. Table 3 shows the resulting design variables, the pressure drop from inlet to outlet and the cost function for the three runs. We found that the results for the design variables are different for the three runs. The cost function is in the same range in all three cases. This shows that there might be several possibilities to place the coils. The pressure drop for run01 is the lowest. Looking at the position of the coils (grayscale) and the streamlines generated in Figure 21 one can see that the flow pattern changes similarly for all three result cases, compared to the situation without coils on the very left of the figure. The resistance against the flow in the aneurysm is increased in all three coiled cases, which results in an acceleration of the flow beneath the aneurysm neck. The location of the interface between the free flow region and the porous medium region is approximately the same for all results. This shows that the size of the neck remnant is determined, according to our simulation runs. Figure 22 shows the velocity distribution inside the aneurysm lumen, which was taken into account for the calculation of the kinetic energy measure. The maximum threshold in the figures is set to 10mm/s, but this is not the maximum velocity. The flow in the aneurysm is prevented by all three coil settings. Run number two and three are coil configurations which would be hard to perform in real life, because the coils would be pushed up into the aneurysm. From the three executed runs we can conclude that for this geometry, a coiling without neck remnant would be a good choice. Also, it is not neccesary to fill the aneurysm lumen with many coils, as the porosity for the first run which has the lowest cost function and is performable in real life - is very high. 57 run 01 02 03 porosity [−] 0.95 0.7 0.7 position [−] 0.7695312 0.3125 0.4609375 radius [mm] 9.421875 4.093750 5.900781 cost function [−] 32248.99 33289.14 32745.46 p.-drop [mmHg] 4.52 4.55 4.59 Table 3: The results for the design variables and cost functions for the sidewall geometry Figure 22: Velocity inside the aneurysm for the three results of the SMF runs and without coil placement 58 Figure 23: The geometry of the bifurcation aneurysm Bifurcation aneurysm The bifurcation aneurysm of this section is located at the middle cerebral artery of the patient. It has a volume of ∼ 90mm3 and a wide aneurysm neck. Figure 23 illustrates the aneurysm from different perspectives. The mesh of this aneurysm geometry has a size of about 120000 cells and the inflow velocity in this case was set to 800mm/s. Besides that, the boundary conditions and the definition for the cost function are taken from the sidewall aneurysm simulations. Flow extensions are added to this geometry, as well. The vector along which the sphere moves is adapted to the geometry and the porosity thresholds ranged from 0.7 to 0.95 as well. The radius for the porous medium sphere ranges from 1 to 4.2 for this aneurysm geometry. We performed the same procedure as with the sidewall aneurysm from the previous part. The results of the three simulation runs are listed in Table 4. The found design variables again differ from run to run, but the cost function is in the same range. The two first simulation runs have a similar location and sphere radius. The porosity of the first run is low, while the porosity of the second run is rather high. As both of the runs produce almost the same cost function, it can be presumed that a smaller amount of coil is sufficient, to avoid the flow into 59 run 01 02 03 porosity [−] 0.703418 0.8875 0.8328125 position [−] 0.4921875 0.484375 0.5791016 radius [mm] 3.459375 3.45 3.903125 cost function [−] 127922.7 128422.4 124315.5 p.-drop [mmHg] 16.38 16.49 16.16 Table 4: The results for the SMF runs on the bifurcation geometry Figure 24: Streamlines for the three results of the SMF runs and without coil placement the aneurysm sufficently. Figure 24 shows streamlines for the uncoiled situation on the very left. The remaining figures illustrate the coil locations of the three simulation runs (grayscale) in combination with streamlines. Even though the location and the radii of the three runs are not the same, the aneurysm is completely filled with porous medium in each case, with approximately the same neck remnant. This results in a reduction of the flow velocity inside the aneurysm. Figure 25 shows the flow fields inside the aneurysm for the uncoiled case and the three SMF runs. The pictured velocity field is a cut through the aneurysm area which was taken into account for the calculation of the kinetic energy measure. All three SMF runs on this aneurysm geometry result in a coil configuration whithout neck remnant. The porosity (and from that, the permeability) does 60 Figure 25: Velocity inside the aneurysm. No coiling on the very left, following run01 - run03 from the left to the right not have a very strong influence on the cost function. In this case, a lower porosity seems necessary to result in a good cost function, compared to the sidewall aneurysm. The reason for that might be the bifurcation geometry with a more direct flow into the aneurysm. Also the inflow velocity was chosen higher in this case. 61 Figure 26: The sidewall aneurysm geometry with a spherical shaped disk, representing the aneurysm. 6.3 Aneurysm geometry - stent From a discussion with a clinician from the Rikshospitalet in Oslo, we learned that it is more likely for some aneurysm geometries to being treated with a stent. The reason for that is, for example, a wide neck of the aneurysm and, resulting from that, the risk of the coils to get loose and block the flow through the vessel. A stent situation is not considered in our previous simulation runs. In this section, we want to implement a stent situation in our SMF, but it is also supposed to emphasize the sensitivity of the cost function. This means we want to take a closer look on the problems that may occur by i.e. choosing different weights for the components of the cost function. We implement the stent situation using a spherical shaped disk, which marks the porous medium area (see Figure 26). To compare the stent with a coiling procedure, we perform seperate SMF simulation runs with two design variables for each situation. For the coils, the position and the porosity of the porous medium area is 62 parameter coil porosity [-] coil position [-] stent porosity [-] stent thickness [mm] min 0.65 0 0.8 0.3 max 0.97 1 0.95 0.8 Table 5: The thresholds of the design variables for the SMF varied like in the previous section. This corresponds to the size of the neck remnant and the amount of coil. The radius is kept constant, such that the aneurysm is always filled completely except for the neck remnant. For the stent situation, we vary the thickness of the disk and its permeability. There are a lot of variants of stents and unfortunately, we could not find a good source with technical properties, so we had to estimate the porosity and thickness. The cost function is changed in this case such that the pressure drop has less weight. For these simulation runs J(pD , Ekin ) = Ekin + 0.025pD (6.4) is minimized. Three SMF runs are performed for each situation and compared afterwards. The sidewall geometry from the previous section is used with the same boundary conditions and mesh resolution. Table 5 shows the thresholds for the SMF design variables. The results of the two different situations is summed up in Table 6. The stent situation results in a much better cost function. This statement should be reviewed critically though. We want to take a closer look at the components of the goal function for one best solution of the two situations. We take run01 for the stent situation and run02 for the coil situation. Table 7 shows the kinetic energy measure Ekin and the weighted pressure drop measure 0.25pD for the two runs. We find that the stent situation has a much lower pD and Ekin , but also that the pressure drop measure dominates the kinetic energy measure in both cases. If we wanted to attribute more importance to the reduction of the kinetic energy inside the aneurysm, we could reduce the weighting of pD even more, such that it only turns the scale. 63 stent run 01 02 03 porosity [−] 0.8 0.809375 0.8 thickness [mm] 0.40156 0.40156 0.3625 cost function [−] 8492.45997651 8492.43277811 8404.60061028 coil run 01 02 03 porosity [−] 0.6575 0.65 0.6525 position [−] 0 0 0 cost function [−] 19793.447378 19792.898641 19793.0778019 Table 6: The comparision between stent and coils on the sidewall geometry situation stent coil 0.025pD [P a ∗ mm3 /g] 8068.45 15739.76 Ekin [mm2 /s2 ] 423.98 4053.14 Table 7: The components of the goal function for a stent and a coil situation Figure 27: The change of the volume Vkinen , used for the calculation of the kinetic energy measure Ekin 64 situation stent coil 0.00025pD [P a ∗ mm3 /g] 80.68 157.4 Ekin [mm2 /s2 ] 269.07 8.56 Table 8: The components of the goal function with another Vkinen Also, we discovered that Ekin is very sensitive to the choice of the aneurysm lumen Vkinen , which is taken to calculate the kinetic energy measure. We changed Vkinen according to Figure 27. Both choices are reasonable for the calculation of the kinetic energy inside the aneurysm, but the results for Ekin - especially for the coiled case - change drastically (see Table 7 and 8). Supposed that the design variables found by the SMF were the same with a different pressure drop weight, we can see from Table 8 that the coil situation could be considered the better choice for this aneurysm geometry. The pressure drop weight is still in a reasonable range, as the values for the measure are not much lower than the values for the kinetic energy measure. 65 Figure 28: The aneurysm with the coiled area (red) and the point of the velocity measurement (white dot) 6.4 Mesh convergence A mesh convergence test was done to check if the mesh resolutions of the meshes of the simulation runs are within a sufficient range. The bifurcation geometry from Section 6.2 with one of the best found SMF solutions for the coiled area was used (see Figure 28). The mesh resolutions range from about 100000 to five million cells. Besides the mesh resolution, the system had the same properties as the one in Section 6.2. Three parameters are plotted over the increasing mesh resolution in Figure 29 - 31. The horizontal axis of the plots is in a logarithmic scale. All three parameters show a clear convergence behaviour. The pressure drop from the inlet to the outlets decreases exponential-like with a threshold value of about 14.3 mmHg. The kinetic energy inside the aneurysm and the velocity measure at one point show a minimum at about 150000 cells and then start converging. As we used the pressure drop and the kinetic energy in our cost function for the SMF, the results could be influenced by the choice of our mesh resolution. The kinetic energy is probably underestimated, while the pressure drop is 66 17 pressure drop [mmHg] 16.5 16 15.5 15 14.5 14 1.0e+05 1.0e+06 mesh resolution [cells] 1.0e+07 Figure 29: The pressure drop from inlet to outlet with increasing mesh resolution overestimated. For the sake of time efficiency we had to use mesh resolutions in the range where those parameters are not converged properly. 67 7.53e+07 kinetic energy measure [mm2/s2] 7.52e+07 7.51e+07 7.5e+07 7.49e+07 7.48e+07 7.47e+07 7.46e+07 1.0e+05 1.0e+06 mesh resolution [cells] 1.0e+07 Figure 30: The kinetic energy inside the aneurysm with increasing mesh resolution 68 815 810 805 velocity [mm/s] 800 795 790 785 780 775 770 1.0e+05 1.0e+06 mesh resolution [cells] 1.0e+07 Figure 31: The velocity at a measurement point with increasing mesh resolution 69 6.5 Discussion In this work, a finite element flow simulator in combination with a statistical framework was applied to compare possible endovascular treatment solutions for an aneurysm. The equations for the porous medium flow, as described in Section 4.2, were implemented in FEniCS. A short verification was done by the compharision of the FEniCS code with a DuMux code. A small example was calculated as described in Section 5.4. The surrogate management framework (SMF), as described in Section 4.4, was implemented as a combination of an existing Octave [17] framework (provided by the Marsden Research Group, University of California San Diego) with the FEniCS code. The coupling was tested on a small example problem (Section 6.1). Based on the results of that test, the framework was applied to the aneurysm geometries. For the application with three design variables (Section 6.2), deviations of the design variables found by the several SMF runs were occuring. Nevertheless, we were able to make statements about the tendency of which treatment would be preferable for the different aneurysm geometries. In Section 6.3, two different treatment methods, namely coiling and the use of a stent, were compared. The SMF was applied to both methods with two design variables each. This section concentrates on the difficulties of choosing a right cost function. It was shown that the method, considered to be the better solution for one cost function, proved to be worse for a slightly different cost function. The choice of the right cost function is considered to be one of the main factors influencing the resulting solution found by the SMF. It is essential to find a reasonable definition of the cost function and it is recommended to further debate with clinicians about what could be best choice. Besides the choice of the goal function, further improvements have to be done regarding the mesh resolution (see Section 6.4). Also, for the sake of time efficiency, stationary inflow velocities were used. This is only a rough estimation, as with a pulsatile inflow velocity, different flow patterns develop and turbulence might occur. This, in turn, might lead 70 to different cost function values. The possibility of coupling a finite element flow simulator with the statistical framework was shown. Reasonable solutions were found for different aneurysm geometries with respect to certain goal functions. Most of the improvements outlined above are easy to accomplish. Before the described method is applicable to guide clinicians in their decision making, it is essential to run many more simulations on different aneurysm geometries with different cost functions and compare the results. 71 References [1] M. S. Alnaes. Finite element simulations of blood flow in the circle of willis. Master’s thesis, University of Oslo, 2006. [2] A. Bárdossy. Introduction to Geostatistics. Lecture script, 2002. [3] J. Bear. Dynamics of Fluids in Porous Media, pages 13–26. Dover Pubn Inc, 1988. [4] J. Bear and Y. Bachmat. Introduction to Modeling of Transport Phenomena in Porous Media, pages 4–13. Springer, 1991. [5] J.L. Brisman, J.K. Song, and D.W. Newell. Cerebral aneurysms. The New England Journal of Medicine, 355:928–939, 2006. [6] DOLFIN, October 2012. URL https://launchpad.net/dolfin. [7] O. Evju. Sensitivity analysis of simulated blood flow in cerebral aneurysms. Master’s thesis, University of Oslo, 2011. [8] Headflow: Solvers for head related biomedical flows, October 2012. URL https://launchpad.net/headflow. [9] L. Formaggia, A. Quarteroni, and A. Veneziani (Eds.). Cardiovascular Mathematics - Modeling and simulation of the circulatory system. Springer, 2009. [10] M. Forsting and I. Wanke. Intracranial Vascular Malformations and Aneurysms: From Diagnostic Work-Up to Endovascular Therapy, pages 167–283. Medical Radiology. Springer, 2008. [11] S. Juvela. Risk factors for multiple intracranial aneurysms. Stroke, 31: 392–397, 2000. [12] N. M. P. Kakalis, A. P. Mitsos, J. V. Byrne, and Y. Ventikos. The haemodynamics of endovascular aneurysm treatment: A computational modelling approach for estimating the influence of multiple coil deployment. IEEE Transactions on Medical Imaging, 27:814–824, 2008. [13] A. Logg, K.-A. Mardal, and G. N. Wells. Automated Solution of Differential Equations by the Finite Element Method - The FEniCS Book. Springer, 2012. 72 [14] S. N. Lophaven, H. B. Nielsen, and J. Sondergaard. Dace - a matlab kriging toolbox. Technical Report, 2002. [15] A. L. Marsden, M. Wang, J. E. Dennis, and P. Moin. Optimal aeroacoustic shape design using the surrogate management framework. Optimization and Engineering, 5(2):235–262, 2004. [16] DuMux , October 2012. URL http://www.dumux.org. [17] Octave, October 2012. URL http://www.gnu.org/software/octave/. [18] ParaView, October 2012. URL http://www.paraview.org. [19] Polygon, October 2012. URL http://www.j-raedler.de/projects/polygon/. [20] G. J. E. Rinkel, M. Djibuti, A. Algra, and J. van Gijn. Prevalence and risk of rupture of intracranial aneurysms: A systematic review. Stroke, 29:251–256, 1998. [21] S. Sankaran, C. Audet, and A. L. Marsden. A method for stochastic constrained optimization using derivative-freesurrogate pattern search and collocation. Journal of Computational Physics, 229:4664–4682, 2010. [22] K.W. Stock, S. Wetzel, E. Kirsch, G. Bongartz, W. Steinbrich, and E.W. Radue. Anatomic evaluation of the circle of willis: Mr angiography versus intraarterial digital substraction angiography. American Journal of Neuroradiology, 17:1495–1499, 1996. [23] C. M. Strother. Electrothrombosis of saccular aneurysms via endovascular approach: Part 1 and part 2. American Journal of Neuroradiology, 22:1011–1012, 2001. [24] J. van Gijn and G. J. E. Rinkel. Subarachnoid haemorrhage: diagnosis, causes and management. Brain, 124:249–278, 2001. [25] vmtk: the Vascular Modeling Toolkit, http://www.vmtk.org. October 2012. [26] F. M. White. Viscous Fluid Flow. McGraw-Hill, 1997. [27] F. M. White. Fluid Mechanics. McGraw-Hill, 2008. 73 URL