scieee AI-readable full text Open interactive document viewer

Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions

Rosado Bailón, Gisela

Abstract

Microgravity is the condition perceived in an object or body when gravity effect is negligible. This can mostly happen when the object is in a constant free fall state, which gives the false perception of Zero Gravity. It being useful to study for space applications or small-scale applications like microfluidics. In this project, we work with numerical simulations to study the bubble generation in microgravity conditions inside a T-junction channel. The simulations are made through open source softwares like OpenFOAM, which performs them; and ParaView, which is responsible of the post-processing and the visualization of the problem. The solver chosen from OpenFOAM is interFoam since it treats the multiphase fluid of our simulations as incompressible, immiscible and isothermal in a Reynolds laminar region. Before generating results, the methodology of this project implies generating the mesh, get to detach bubbles with the correspondent conditions [1] and perform convergence tests for the mesh, the time step and the contact angle at the mesh walls. The goal of the convergence tests is to use the most convenient mesh possible to obtain good results and a small time step to be close to convergence without extra computational cost. The contact angle allows us to determine which fluid sticks to the wall the most and how this is done. The results are divided in two parts. From one hand, we measure the pressure at four points around the junction of both pipes to see its evolution when a bubble is formed. On the other hand, with the chosen mesh, time step and contact angle; we combine different inlet velocities for both fluids to see how the bubble parameters change at their detachment. The change in these parameters makes us justify if the bubbles behaviour is adequate and close to the real physical behaviour. In the end, the methodology has been followed at all times, but some stages of it have taken extra time or have presented challenges that produced larger errors in our results. Even so, despite the causes of these errors, the analysis of the results and behaviours have been made in a similar way as expected.

Full text

TREBALL DE FI DE GRAU TFG TITLE: Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions DEGREE: Grau en Enginyeria d’Aeronavegaci´ o AUTHOR: Gisela Rosado Bail ´ on ADVISOR: Santiago Arias DATE: July 16, 2019 T´ıtol: Estudi num` eric amb OpenFOAM del proc´ es generaci´ o de bombolles en una cru¨ ılla en forma de T inversa en condicions de microgravetat Autor: Gisela Rosado Bail´ on Director: Santiago Arias Data: 16 de juliol de 2019 Resum La microgravetat ´ es la condici´ o que es percep en un objecte o cos quan l’efecte gravitatori ´ es negligible. Aix` o pot passar quan aquest es troba en un estat de caiguda lliure constant, el qual falseja una percepci´ o de manca de gravetat que ´ es molt ´ util d’estudiar per a aplicacions espacials o aplicacions a petita escala com la microflu´ ıdica. En aquest projecte treballem amb simulacions num` eriques per a estudiar la formaci´ o de bombolles en condicions de microgravetat, dins d’un capilar en forma de T. Les simulacions es fan a trav` es de programari lliure com OpenFOAM, que s’encarrega de dur-les a terme; i ParaView, que fa el processament a posteriori i la visualitzaci´ o del problema. Dins d’OpenFOAM, el solver escollit ´ es l’interFoam, ja que tracta el fluid multif` asic de les nostres simulacions com a incompressible, immiscible i isot` ermic sota un r` egim laminar. Abans de generar resultats, la metodologia seguida a aquest treball implica generar la malla, aconseguir la formaci´ o de bombolles amb les condicions corresponents [1] i dur a terme tests de converg` encia de malla, pas de temps i angle de contacte a les parets del capilar. Als tests de converg` encia l’objectiu ´ es utilitzar la malla m´ es convenient possible per obtenir bons resultats i un pas de temps petit als c` alculs per estar el m´ es a prop possible de la converg` encia sense tenir un gran cost computacional. L’angle de contacte ens permet decidir quin dels fluids s’adhereix a les parets i com ho fa. De cara als resultats, aquests es divideixen en dos parts. Per una banda, mesurem la pressi´ o a quatre punts localitzats a l’aflu` encia dels dos canals del capilar per a veure la seva evoluci´ o quan es forma una bombolla. I per l’altre banda, amb la malla, el pas de temps i l’angle de contacte escollits; combinem diferents velocitats d’entrada per ambd` os fluids per tal de veure com varien els par` ametres de les bombolles que es formen. La variaci´ o d’aquests par` ametres ´ es el que ens fa determinar si el comportament de les bombolles ´ es adequat i proper al comportament f´ ısic real. En definitiva, la metodologia a seguir s’ha complert en tot moment, per` o algunes etapes d’aquesta s’han allargat o han presentat reptes que han arrossegat errors que han acabat perjudicant els resultats. Tot i aix´ ı, donades les causes dels errors, els an` alisis de resultats i comportaments s’han pogut portar a terme de forma similar a l’esperada. Title : Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions Author: Gisela Rosado Bail´ on Advisor: Santiago Arias Date: July 16, 2019 Overview Microgravity is the condition perceived in an object or body when gravity effect is negligible. This can mostly happen when the object is in a constant free fall state, which gives the false perception of Zero Gravity. It being useful to study for space applications or small-scale applications like microfluidics. In this project, we work with numerical simulations to study the bubble generation in microgravity conditions inside a T-junction channel. The simulations are made through open source softwares like OpenFOAM, which performs them; and ParaView, which is responsible of the post-processing and the visualization of the problem. The solver chosen from OpenFOAM is interFoam since it treats the multiphase fluid of our simulations as incompressible, immiscible and isothermal in a Reynolds laminar region. Before generating results, the methodology of this project implies generating the mesh, get to detach bubbles with the correspondent conditions [1] and perform convergence tests for the mesh, the time step and the contact angle at the mesh walls. The goal of the convergence tests is to use the most convenient mesh possible to obtain good results and a small time step to be close to convergence without extra computational cost. The contact angle allows us to determine which fluid sticks to the wall the most and how this is done. The results are divided in two parts. From one hand, we measure the pressure at four points around the junction of both pipes to see its evolution when a bubble is formed. On the other hand, with the chosen mesh, time step and contact angle; we combine different inlet velocities for both fluids to see how the bubble parameters change at their detachment. The change in these parameters makes us justify if the bubbles behaviour is adequate and close to the real physical behaviour. In the end, the methodology has been followed at all times, but some stages of it have taken extra time or have presented challenges that produced larger errors in our results. Even so, despite the causes of these errors, the analysis of the results and behaviours have been made in a similar way as expected. This is to my family, my colleagues and my advisor Santiago Arias for their support and help through this project. CONTENTS Acknowledgements ............................... 1 CHAPTER 1. Introduction ........................... 3 1.1. What is microgravity? ............................. 3 1.2. Why is it important to study microgravity? . . . . . . . . . . . . . . . . . . 4 1.3. Studying microgravity on Earth. . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3.1. Parabolic flights and drop towers . . . . . . . . . . . . . . . . . . . 5 1.3.2. Space medicine and biology . . . . . . . . . . . . . . . . . . . . . 8 1.3.3. Fluids in space . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.3.4. Low-cost microgravity facilities . . . . . . . . . . . . . . . . . . . . 10 1.4. Microfluidics .................................. 10 1.5. Motivation of this project ............................ 11 CHAPTER 2. Problem statement and methodology . . . . . . . . . . 12 2.1. Background ................................... 12 2.2. Problem statement ............................... 13 2.2.1. Fluid characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.2.2. Work regime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 2.3. Pre-processing ................................. 16 2.3.1. Software and computer requirements . . . . . . . . . . . . . . . . . 16 2.3.2. Mesh generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.3.3. Initial conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2.3.4. Boundary conditions . . . . . . . . . . . . . . . . . . . . . . . . . . 20 2.3.5. Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 2.4. Post-processing ................................. 24 2.4.1. Brief methodology summary . . . . . . . . . . . . . . . . . . . . . . 24 2.4.2. Measurements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 2.4.3. Matlab processing . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 CHAPTER 3. Convergence tests . . . . . . . . . . . . . . . . . . . . . . 33 3.1. Mesh convergence ............................... 33 LIST OF TABLES 2.1 Basic fluid parameters for air and water at 25oCroom temperature. . . . . . . . 14 2.2 Work regime dimensionless parameters. . . . . . . . . . . . . . . . . . . . . . 15 2.3 Boundary conditions for the velocity field. . . . . . . . . . . . . . . . . . . . . 20 2.4 Boundary conditions for the pressure field. . . . . . . . . . . . . . . . . . . . . 21 2.5 Boundary conditions for the air fraction field. . . . . . . . . . . . . . . . . . . . 21 3.1 Mesh parameters comparison. . . . . . . . . . . . . . . . . . . . . . . . . . . 35 3.2 Time convergence parameters comparison. . . . . . . . . . . . . . . . . . . . 39 4.1 Velocity inlet combinations for further parameters discussion. . . . . . . . . . . 48 4.2 Parameter values for the different inlet velocities combinations . . . . . . . . . 50 ACKNOWLEDGEMENTS First, I would like to thank my advisor Santiago Arias for guiding me in this project. For the last seven and a half months I have immersed myself in this challenging project with no previous knowledge about multi-phase fluids in microgravity conditions. I have been a slow learner, especially with tools I have barely treated, but Santiago was patient with me and assisted me when I needed. I enrolled myself in a numerical simulation subject in September 2018 to learn about numerical simulations in case I needed them for my final project, as Santiago advised me. I am really thankful for the opportunity that was given to me to do this project with him. I have been able to understand better the numerical simulations thanks to that subject. I would also like to thank my colleague Adri` a Espinosa for his help. He has been working with Santiago Arias as well in another project but using the same tools. I appreciate his time and tips to master OpenFOAM and Ubuntu, especially when we were both very busy with our respective projects. I appreciate it. And last but not least, I would like to thank my family, my partner and my friends for being there every step of the way. I learnt a lot from this project, personally and professionally, and I would like to thank their patience and their faith in me to excel myself as a student. 1 2 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions CHAPTER 1. INTRODUCTION In this project, we perform numerical simulations in which microgravity conditions play an important role. Before getting into detail and describing the aspects and features of the simulations, microgravity and its affects to scientific breakthrough nowadays must be understood. 1.1. What is microgravity? The concept of gravity is very well known by the current society since Isaac Newton defined it more than three centuries ago. According to classical Newtonian mechanics, gravity is a force generated by the attraction of at least two masses, one being bigger and heavier than the others. This force is not constant and it weakens differently in each system, depending on the number of elements involved in it and their size. An example of gravitational field could be a system composed by the Earth and a smaller body, like a human. In this case, Earth’s mass is 1024 times bigger than a regular person of 80 kilograms, so it generates a force of attraction between the human body (the smaller mass) towards the centre of the planet. The reason behind a person jumping and an object falling to the floor is precisely that gravitational field. The force of attraction created is directly proportional to the amount of mass difference between the bodies that conform the system. This one can be big enough to maintain the planets of the Solar System orbiting around the Sun (where the biggest mass is around 2·1030 kilograms) or small enough to be neglected, considering the attraction between an apple and a TV. Gravity usually weakens as the smaller mass distances itself from the largest. According to this principle, the further away a small mass gets from Earth in space, the smaller it is the gravity effect. That depends on the smaller mass, which may be big enough to orbit around Earth (like the Moon satellite) or small enough to keep an astronaut floating around the International Space Station (ISS). That floating is known as Zero Gravity effect. This effect is not real itself because gravity is never null unless the distance from one mass to the other is infinite, theoretically. Also, the term ”floating” would not be accurate for the situation, since both the astronaut and the spacecraft are on a free fall with the same acceleration towards Earth. It is from the astronaut’s point of view that this is seen as floating, even though gravity still works. What really happens is that the force of gravity remains high (gravity force at the ISS is nearly at 90% the Earth’s surface value, [2]), but this one is perceived as if it was very small. When the perceived gravity acceleration is of about 10−6gor less, the weightless effect appears. Also known as the condition of microgravity. Microgravity is caused by an object in free fall or orbiting around a big mass. In some cases, it may also appear when the object gets far away from the gravitational source of interaction or when it is located at a point in space where the forces are in equilibrium. Only then, the object is said to be weightless, but in reality its mass remains the same. 3 4 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions 1.2. Why is it important to study microgravity? Many space agencies are interested in studying microgravity to understand what happens to an equipment, spacecraft, satellite or a living being in space. These study how the lack of gravity affects objects or systems that are originally from Earth. To do so, scientists and engineers have found alternative technologies to generate a weightless condition on Earth, as it is more affordable than going out space. The strength of the gravity force on the Earth’s surface adds limitation in the time tests in these conditions. Nonetheless, these artificial conditions are still useful to study space matters before sending an equipment or people on a mission. The experiments reduce risks and increase the safety of those onboard. The prestigious agency NASA has been studying for decades microgravity on Earth with the help of additional infrastructures. The facilities used for these studies allow the possibility to conduct experiments that last a few seconds or sometimes minutes. The research for new alternatives continues in order to find a way to experience weightlessness on free fall for a larger period of time. If this was endured, the missions on space would become safer and have a higher rate of success, thus everything would have been studied and tested on Earth already. The drawback of all this is that the construction of a perfect scenario to conduct these experiments costs millions of dollars. So why do people invest in these, when there are so many other issues to fix in the world? There is an article published in the digital Forbes magazine[3] which transcripts a response letter from the associate NASA director and top rocket scientist, Ernst Stuhlinger in the 1970s. This one justifies why investing in research and exploring space is non-negotiable, even when the population suffers. A nun who had worked in Zambia wrote to the agency to ask ”how could they justify spending billions on the Apollo program when children were starving to death.”. Stuhlinger justified that NASA employees believed that the missions and travelling to the Moon or Mars in the future, would bring benefits and solutions for such grave situations on Earth on the long run. He compared this with the story of the microscope, which appeared after very serious plagues in Europe in the middle ages. Many people died without a cure, but after that the microscope helped many more people by eradicating lots of diseases. The letter also explained how the American government worked in the 1970s. At that time, from the 200 billion dollars the president of the US used as a yearly budget, only 1.6% was given to space exploration in 1970. Stuhlinger ensured that the national budget distribution was planned with a year or so in advanced, and usually a percentage of it was allocated in foreign issues (if approved by the council), which could include aiding the poorest. Detect which countries needed the aid the most was easy thanks to satellites. This distinction could help with the budget’s allocation decision for foreign affairs, and either way people had to be patient and wait for the benefits to come from future researches. CHAPTER 1. INTRODUCTION 5 1.3. Studying microgravity on Earth. This section is about the different kind of tests that can be made on Earth to test microgravity or weightless conditions. 1.3.1. Parabolic flights and drop towers The most common way to create a microgravity condition, used by many organizations of the sector around the world like ESA in Europe, NASA in the US and JAXA in Japan; consists on making an airplane fly up-and-down parabolic manoeuvrers. The parabolic trajectory enables running some tests near a microgravity condition for a period of 20 seconds or so with an acceleration of 10−2g, usually. Figure 1.1 shows the trajectory of this facility. Figure 1.1: Parabolic pattern flown by the airplane to create microgravity condition [4]. There are similar facilities that improve the microgravity conditions perception to 10−5gfor tests and experiments in free fall and vacuum. NASA call them Anti-Gravity Chambers, but this type of facility is usually known as drop towers. Their structures are frequently made of steel or aluminium and have a cylindrical shape. The way they work is quite simple as it consists on dropping a chamber through the tower to experience a microgravity condition for a few seconds until the system brakes or impacts. NASA has two important drop towers: the Zero Gravity Research Facility and the 2.2 second drop tower. The first one is the worlds’ biggest drop tower, which is about 142 metres deep and allows tests of around 5 seconds. This facility can study combustion, materials, biotechnology and fluid dynamics to improve future space missions technology. 6 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions Figure 1.2: Drop Area of the Zero Gravity Facility [5]. The 2.2 second drop tower performs tests of a couple of seconds at a distance of about 24 metres. It has been used for the last 50 years as a pre-test site for future experiments in the ISS. This drop tower uses a drag shield in order to minimize the aerodynamic drag in free fall to make the experiment as space alike as possible. The lack of drag implies putting an airbag at the end of the tower to reduce the impact of the object falling at such high velocities. The real acceleration is always 1g until the impact, where it can reach the 30-40g depending on the brake system. Figure 1.3: Drag shield and airbag of the 2.2 second drop tower [6]. Many universities around the world have collaborated in projects with space agencies to improve the test scenario created in the American company. This is the case of the European drop tower in the Centre of Applied Space Technology and Microgravity (ZARM), CHAPTER 1. INTRODUCTION 7 from the University of Bremen. The project was a collaboration between the research centre and the European Space Agency, which implemented a new methodology for the drop tower by throwing the box upwards so that it can fall later on and increase the weightless condition time to 9.3 s. Following the same work principle as the ZARM drop tower, the sounding rockets launch from 5 to 20 minutes to collect data and conduct experiments with a ”reduced cost”. The maximum height they can reach is of almost 1.300 km, and even though sounding rockets work like a drop tower, their flight trajectory is parabolic and the payload usually returns. When it does, it is gently dropped with a parachute as shown in Figure 1.4. These are the main mission developers of the NASA since 1959. Figure 1.4: Sounding rocket’s flight trajectory [7]. Figure 1.5: Sounding rocket’s structure [8]. 14 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions Property Gas value Gas symbol Liquid Value Liquid symbol Units Viscosity (µ)10−5µG10−3µLPa ·s Density (ρ)1.225 ρG103ρLkg/m3 Kinematic viscosity (ν)8.163 ·10−6νG10−6νLm2/s Sigma (σ)0.072 N/m Table 2.1: Basic fluid parameters for air and water at 25oCroom temperature. The parameters in 2.1 are adopted from [1] and [15]. The kinematic viscosity is computed dividing the viscosity by the density. This is made per each fluid as it determines if the fluids are viscous enough to create a bubble. If the kinematic viscosity is confused with the viscosity itself, the bubbles never form since the fluid would be perceived in simulations as too viscous. The viscosity (µ) is the only parameter that does not appear in the definition of the transport properties or work regime of the simulations. 2.2.2. Work regime Air and water are considered incompressible since water is a liquid and a low-speed gas belongs to a subsonic regime, which at such small scale can be considered as incompressible, too. These flow at low speeds in this project, so their inlet superficial velocities must be smaller than 1 m/s. Gas and liquid superficial velocities are 2.1 and 2.2. USL =QL A(2.1) USG =QG A(2.2) Being, QL= Liquid volumetric flow rate at the inlet QG= Gas volumetric flow rate at the inlet A = Capillary cross-section of each inlet The inlet velocities define important parameters for our simulation. One of those is the Courant number, which must be as close to 0 as possible to compute correctly. The Courant number shows the relation between the cell size of the mesh (∆x) and the time step of the computations (∆t), while also depending on the gas velocity at the inlet (USG). That dependency is exclusive of this project. Co =USG ·∆t ∆x(2.3) The Bond number shows the equilibrium between the gravitational and the capillary forces, which are strongly related to the surface tension defined in 2.2.1.. This number is defined in 2.4. Bo =(ρL−ρG)g·φ2 c σ(2.4) Where, CHAPTER 2. PROBLEM STATEMENT AND METHODOLOGY 15 g = Gravity φc= Capillary internal diameter (around 10−3m in this problem) The equation 2.4 shows Bond number’s dependency from gravity. It must be smaller than a threshold of 0.29 (Bo <0.29) in order to consider gravity effects negligible [1]. If gravity is considered as zero (g = 0 m2/s), the Bond number stays below the threshold for sure. Otherwise, the condition should be checked every single time a simulation finishes. The dimensionless Weber number defines the work regime as well. It depends on the bubble velocity (UG) and it can be defined for both fluids through equations 2.5 and 2.6. WeSG =ρG·φc·(UG)2 σ(2.5) WeSL =ρL·φc·(USL)2 σ(2.6) UG=C0·(USG +USL)(2.7) Where, C0= Void fraction distribution coefficient. The Weber number evaluates the competition between the capillary and the liquid drag forces at the interphase of two multiphase flows[1]. The desirable Weber must be below a threshold value of 2 (We <2) so that the capillary forces overcome the inertial ones [1]. If this is accomplished, the bubble detachment will take place. The number of Reynolds (Re) is important to specify the turbulent state of the simulation’s flow. There are two types of Reynolds that can be defined in this project: ReMfor average mixture superficial velocity, and ReLfor liquid superficial velocity. The formula is coincident for both Reynolds, but the ReMtakes into account the sum of inlet velocities (UMfrom equation 2.9), while ReLconsiders the liquid inlet velocity (USL). ReM/L=ρL·φc·UM/SL µL (2.8) UM=USG +USL (2.9) Lastly, the Capillary number (CaSL) is defined as: CaSL =WeSL ReSL (2.10) The first set of simulations have both inlet velocities set to 0.1 m/sand its corresponding velocity for the fully developed fluid is 0.4 m/s(section 3). According to these, the dimensionless numbers that define the simulation work regime are presented in 2.2. Parameter Bo Co C0ReMReLWeSL WeSG CaSL Value [-] 0 0.01 to 0.06 2 200 100 0.14 2.72 ·10−31.39 ·10−3 Table 2.2: Work regime dimensionless parameters. 16 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions According to table 2.2, the Bond and both Weber numbers are below their limit values, the Courant is very close to 0 empirically and the Capillary number is the same order as in [1]. That means the simulation works just fine and the capillary forces overcome the inertial ones to form bubbles. Also, both Reynolds are below 2,300, which is the turbulent flow threshold [16]. This means that our simulations correspond to a Reynolds in laminar flow conditions region. 2.3. Pre-processing All the software involved in this project will be explained in this section, along with the definition of initial and boundary conditions in it and the post-processing program management. 2.3.1. Software and computer requirements Free source software will be used for the computations and visualization of the simulations. This presents the advantage of being available for anyone, including students. However, this kind of programs have a less intuitive approach. In this project, OpenFOAM is the program used for computations and ParaView does the post-processing and visualizations. The versions installed have been the 6.0 for Open- FOAM and the 5.4 for ParaView. These two are meant to be used in Ubuntu operating system as they work through commands. Windows is the default operating system of the local PC, so a virtual box has been installed to create an Ubuntu 18.04 platform to work on. The virtual box used is Oracle VM Virtual Box. Matlab 2019a is installed in Ubuntu as well to do the post-processing of the simulations collected data. Some of the mesh generators were in it too. However, this report is not written in Ubuntu but in L A T EX, which is installed in the operating system of Windows. 2.3.2. Mesh generation This section explains the process of mesh generation, along with some of its difficulties and adjustments. Further details about this section are available in B. 2.3.2.1. Geometry The geometry of the mesh has been changed due to the difficulties presented while creating the initial mesh. At first, the geometry of the mesh was based on a cylindrical T-junction (see Figure 2.3). CHAPTER 2. PROBLEM STATEMENT AND METHODOLOGY 17 Figure 2.3: Initial mesh geometry created in [17]. The dimensions of the initial mesh are shown in Figure 2.4 in millimetres. Figure 2.4: Mesh dimensions in millimetres2. Even though Figure 2.4 shows the real dimensions of the mesh, at the beginning to test boundary conditions and the bubble detachment, a shorter mesh was used to focus on the joint. This one was 5 mm long and its vertical pipe was reduced to 0.5 mm, just like in 2.5. Figure 2.5: Example of short mesh for initial simulations3. 2Dimensions scheme created in NX Siemens 10.0 modelling software. 3Caption extracted from ParaView simulation visualizer. 18 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions The newest geometry maintained the dimensions from both the regular and reduced meshes. The only thing that changed was the section of both pipes, which were now squares of 1 millimetre per side (see Figure 2.6). With it, the problem simplified itself, so extra work is added to compensate the drawback. Figure 2.6: Final mesh geometry created in [17]. When generating a mesh, the walls had to be identified as face groups (or patches) to assign the boundary conditions to each of them. For the final mesh, 5 types of face groups are differentiated: gasInlet,liquidInlet, outlet, walls1 and finally, walls2. The gasInlet corresponds to the injection of air in the horizontal pipe, while liquidInlet is the patch associated to the vertical pipe inlet. The outlet patch is located at the end of the horizontal tube, and then there is the distinction between walls1 and walls2.Walls1 includes two vertical walls covering the vertical pipe, while walls2 cover the walls forming the horizontal pipe. Figure 2.7 shows the patches scheme. Figure 2.7: Patches scheme. Isometric and bottom view4. 43D mesh geometry created inNX Siemens 10.0 modelling software. CHAPTER 2. PROBLEM STATEMENT AND METHODOLOGY 19 2.3.2.2. Tools for mesh generation The mesh generation is one of the longest processes of this project due to the software compatibility and utilities. The tools and programs used were the following: •GMSH program. •BlockMesh tool from OpenFOAM. •SnappyHexMesh from OpenFoam. •OnShape website for geometry exportation. •ANSYS Mesh Generation extension. Students package software. First, blockMesh generates simple geometry meshes through a text file called blockMesh- Dict. Initially, to test the tool, we managed to create a cylinder as a mesh, but it was a slow process. Then GMSH software appeared, which was much easier to use when it came to generate a complex geometry with a progressive mesh density. Plus, the command gmshToFoam could be used to convert the mesh to an OpenFOAM compatible format before proceeding with the computations. The problem was that the cells of the cylindrical T-junction mesh were tetrahedral and different in size. It was complicated to modify these, which caused the Courant number to rise enough to stop the computations abruptly. Then another shot was given to the blockMesh tool. After weeks invested in the cylinder T- junction mesh, it came to our realization that the blockMesh tool does not allow the junction between two complex geometries as cylinders. They were overlapped instead. SnappyHexMesh tool from OpenFOAM implied the use of blockMesh as well, so it was more complex and even slower than the rest of the programs and tools. The biggest drawback of this tool was that it is usueful to generate environmental meshes outside the established geometry, but not contained in it like our case was. Finally, ANSYS was the final software used for mesh generation despite the chosen geometry. A geometry of the mesh had to be designed with a modelling software and imported to the mesh generator, so we used OnShape website to do that. Then, ANSYS created the mesh inside the geometry with the Mesh generator package included in the student software installed in the local Windows PC. Adjusting the cell size and shape uniformly for the cylindrical T-junction mesh was not possible with the mesh generator package, so in the end, to avoid problems regarding the Courant number, the mesh geometry was simplified. Using the command ”fluent3DMeshToFoam meshname.msh”, the fluent mesh extension from ANSYS could become compatible with OpenFOAM and ParaView readers. The final geometry mesh had a ∆x=4.375 ·10−5m, which corresponds to an approximation of 290,000 elements, and a ∆t=5·10−6s. 2.3.3. Initial conditions The initial conditions of the problem are defined in a folder named ”0” inside the simulation case. This name corresponds to the initial time, when the simulation starts. In it, since 20 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions temperature is constant along the process, the initial and boundary conditions are defined in three text files for velocity, pressure and air fraction. Inside those documents, the internalField is defined, which defines the initial state of the mesh for any property from above. The files regarding initial conditions are available in Appendix A.2. In the velocity file, the internal field defines that the fluid of the mesh remains quiet until the simulation starts. The pressure file states that the entire mesh is under atmospheric and free stream conditions initially, meaning that its gage pressure is 0 Pa. And finally, the air fraction file defines the value of α=1for air and α=0for water. Bubbles form because of the injection of air into the junction, so the internal field is fully defined as water (α=0) before that happens. 2.3.4. Boundary conditions The boundary conditions are defined in the same files from the initial ones. The difference is that each boundary condition is related to a face group from the mesh. Section 2.3.2.1. shows that there are 5 differentiated face groups in this project’s mesh, so there are at least 5 boundary conditions per file. The boundary conditions might change depending on the interest behind each simulation, but the chosen ones are collected in tables 2.3,2.4 and 2.5 for each field. Changing these do not affect the fluids’ properties. Path or wall Condition type Value (m/s) Meaning gasInlet fixedValue uniform (+0.1, 0, 0) At any time, the injection of air to the tube is made at a fixed velocity of 0.1 m/s only in the positive x-axis direction. liquidInlet fixedValue uniform (0, 0, -0.1) At any time, the injection of water is made downwards the z-axis direction with a fixed velocity of 0.1 m/s. outlet zeroGradient - Applies a zero gradient condition from the internal field to the outlet patch, where no further conditions are imposed. walls1 and walls2 fixedValue uniform (0, 0, 0) The fluid at the walls does not move in any direction. It can also be defined as a ”noSlip” condition. Table 2.3: Boundary conditions for the velocity field. CHAPTER 2. PROBLEM STATEMENT AND METHODOLOGY 21 Path or wall Condition type Value (Pa) Meaning gasInlet and liquidInlet zeroGradient - Applies a zero gradient condition from the internal field to both inlet patches, meaning that no further conditions are imposed there for pressure. outlet fixedValue uniform 0 Applies a uniform value of 0 Pa in gage pressure to identify the outlet as a free stream outflow. walls1 and walls2 zeroGradient - Applies a zero gradient condition from the internal field to the walls, where no other pressure conditions are imposed. Table 2.4: Boundary conditions for the pressure field. Path or wall Condition type Value (-) Meaning gasInlet fixedValue uniform 1 Indicates the entrance of air to the pipe through this inlet. liquidInlet fixedValue uniform 0 Indicates the entrance of liquid to the pipe through this inlet, which is not different than the initial state condition. outlet zeroGradient - It does not impose any condition, as any mixture of air and water can be released as an outflow, depending on the bubbles. walls1 fixedValue uniform 0 Maintains the initial state condition at the wall, so liquid sticks to it. walls2 fixedValue uniform 0 Maintains the initial state condition at the wall, so liquid sticks to it. It can also have a contact angle condition. Table 2.5: Boundary conditions for the air fraction field. The conditions established generate a problem with the outflow and the bubbles do not exit the pipe normally. Some sort of vacuum is generated once the bubble reaches the outlet. Other conditions were tried (see Appendix C) but the scenario did not improve much. Therefore, these are the best conditions achieved and other projects have used these as well with no inconvenience so far ([15] and [18]). Table 2.5, does not consider the contact angle condition. It is in the convergence tests phase that the conditions for walls2 change with a contact angle specification. This one says how the fluids stick to the wall or not. It is also known as wetting. Wetting condition defines the angle between walls2 face group in this case, and a liquid drop’s boundary stuck in the wall. Usually the angle is defined from the inner part of the drop, as shown in the Figure 2.8. However, OpenFOAM defines the supplementary angle in its files. For example, for contact angle of 45o, the file writes θ=180o−45o. 22 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions Figure 2.8: Contact angle and wetting schemes from inside the drop [19]. The files with the boundary conditions written for OpenFOAM are shown in Appendix A.2., including the contact angle condition. 2.3.5. Solver Here, equations and warranty of the solver chosen in OpenFOAM will take place, considering the properties of the problem statement. First of all, there are two fluids in multiphase at use in this project simulations. Therefore, a multiphase solver from OpenFOAM will be used for sure. Then, our mesh is static and does not present any optional motion nor change in its topology. In the mesh, neither air nor water change their phase along the tube. The interface between them is a mixture of both fluids, but it is small enough to consider them immiscible. The previous statements narrow the list to two possible solvers: •InterFoam solver, which works for two incompressible fluids, isothermal, immiscible fluids. This has interface capturing approach. •PotentialFreeSurfaceFoam solver, which solves incompressible fluids through Navier Stokes. This enables a single-phase free-surface approximation. Recalling the simulation properties from sections 2.2.1. and 2.2.2., air and water are considered incompressible and isothermal fluids. So far, the PotentialFreeSurfaceFoam solver does not specify any temperature condition. Also, both fluids run through the mesh and generate an interface between them that leads to free surface hypothetically. Air cannot create a free surface on its own and it needs water’s help for that to happen. However, the problem is that water needs a gravitational field to form a free surface. So, considering a zero gravity condition, no free-surface can be created and the last solver does not apply for our case. CHAPTER 2. PROBLEM STATEMENT AND METHODOLOGY 23 After all, the chosen solver is interFoam. This solver uses the VOF (Volume of Fluid) method, so that is why the air fraction property file needs to have at least one of the fluids defined at all times. The mathematical process behind this solver is not seen by the user, but it can appears explained in OpenFOAM associated websites [20]. InterFoam solves the Navier Stokes equations of constant-density continuity and momentum (2.11 and 2.12) for both fluids. Their properties are constant when a cell is filled with only one of them and variable when the cell is located at the interphase. In the interphase, a weighted average of volume fraction computes the physical properties of each fluid, according to how much of the cell they occupy. ∂uj ∂xj =0(2.11) ∂(ρui) ∂t+∂ ∂xj (ρujui) = −∂p ∂xi +∂ ∂xj (τi j +τti j)+ρgi+fσi(2.12) u= Velocity gi= Gravitational acceleration, neglected in this case p= Pressure τi j = Viscose stress τti j = Turbulent stress fσi= Surface tension ρ= Density The density for the momentum equation 2.12 is the result of the following definition: ρ=αρ1+(1−α)ρ2,(2.13) where αis 1 for ρ1, and 0 for ρ2. The density range between the values: α= Air fraction value ρ1= Density of the fluid 1 (AIR, ρG) ρ2= Density of the fluid 2 (WATER, ρL) The form of the previous equation is also used to find the general velocity vector (U) and viscosity (µ). The surface tension ( fσi) from the equation 2.12 is modelled as a continuum surface force (CSF). See the equation 2.14. fσi=σK∂α ∂xi (2.14) Equation 2.14 shows the dependency of fσion the x position of the cell, the air fraction (α) in it and the following two parameters. σ= Surface tension constant, defined in files K= Curvature 30 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions The length of the bubble also depends on the difference between the final and initial points of a bubble in Figure 2.15 from below. LB,stable =UG,78 ·(tf inal,i−tinitial,i)(2.19) UG,78 = Velocity of the bubbles when crossing the region 7-8 mm tfinal,i= Exit time from the bubble ”i” to surface 8 mm tinitial,i= Entry time from the bubble ”i” to surface 8 mm The equation 2.19 shows a different nomenclature for a bubble ”i”, where ”i” is the number of bubble crossing the sampled surface at 8 mm. Examples of this nomenclature are shown in Figure 2.15. PROBE 1 Z X INITIAL TIME FOR CONSECUTIVE BUBBLES T B,8 tinitial,1 tfinal,1 tinitial,7 tfinal,7 PROBE 0 PROBE 3 PROBE 2 Figure 2.15: Entry and exit points of each bubble at surface 8mm. The volume depends as well on bubbles real computed area from surface x = 8 mm, shown in Figure 2.16. The volume takes into account the squared section of the pipe, where each side of the section measures 1mm (see equation 2.20). VB,stable =Asection ·AB·UG,78 (2.20) Asection = Area of the pipe’s section (0.0012in this case) AB= Real area of the bubble Figure 2.16 has a bubble painted in pink colour to show the area that Matlab computations will take into account. CHAPTER 2. PROBLEM STATEMENT AND METHODOLOGY 31 Figure 2.16: Real area bubbles crossing section at x = 8mm surface. The bubbles’ velocity is the only parameter that is computed considering two surfaces. When having 6 sampled surfaces along the x-axis (see Figure 2.9), four velocities can be computed from here: UG,34,UG,67,UG,78 and UG,89. The stable speed is UG,78 (also called UG,stable) and it appears in volume and length formulas (2.19 and 2.20). The velocity computation depends on the distance between two sampled surfaces and the initial times for a bubble crossing those two. This is shown clearly in the equation 2.21, which is applicable for any pair of sampled surfaces. UG,stable =UG,78 =X2−X1 tinitial,2−tinitial,1 (2.21) X2= Position of the second surface the bubble crosses(x = 8mm in case) X1= Position of the first surface the bubble crosses(x = 7mm for stable speed) tinitial,2= Entry time of the bubble to the second surface tinitial,1= Entry time of the bubble to the first surface 2.4.3.3. Speed evolution To determine if the computed parameters show a logical evolution, the evolution of the velocity along the T-junction will be evaluated. Our simulations go from from t0=0 s to tend =0.2 s. In that time, 10 bubbles are generated for a 290,000 elements mesh and a time step of 0.000 005 s. Ideally, the bubble speed for the surfaces closest to the junction (x = 3 mm and x = 4 mm) should not be much higher than the sum of both inlet velocities (UM). For USG =USL = 0.1 m/s,UM=0.2 m/s. 32 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions According to the boundary conditions established, after crossing the first couple of sampled surfaces, a bubble’s velocity should increase a little along the pipe until it reaches a stable value. Then, the velocity remains somehow constant. The stable value should never be greater than the double of the initial sum (UM). In Figure 2.17, it is possible to see the real behaviour of the 10th bubble in the simulation. Figure 2.17: Velocity evolution along the sampled surfaces. The velocity values computed are set in x = 4 mm, x = 7 mm, x = 8 mm and x = 9 mm in Figure 2.17 to indicate the end of each sampled region (3-4, 6-7, 7-8 and 8-9). Figure 2.17 shows that the bubble velocity sticks to the predicted behaviour written above. The velocity value never exceeds 0.4m/s, which is the double of the inlet velocities sum, and the value between sections 3 and 4 is 0.25m/s. All the values adjust to what we wanted then. This also proves that the stable speed belongs to the constant region and that this value is indeed a good choice to represent the fully developed fluid. It is true that regions 6-7mm and 8-9mm have the same value, but these cannot be chosen for two reasons. 1. Region 6-7 conditions is between two states of the bubble, where it goes from increasing its speed to stabilize on a certain value. That makes the region transient. 2. Region 8-9 is discarded by its closeness to the outlet and the rareness of the outflow. It may give unexpected parameters. In the end, the chosen capillary region where the flux is fully developed does not present variations and it is far enough from the outlet to consider its behaviour ”average”. Considering this one the expected behaviour, the mesh seems to be stable enough to proceed with the convergence tests from chapter 3. CHAPTER 3. CONVERGENCE TESTS This chapter compares meshes of different cell size, time steps and contact angles to obtain a higher accuracy in results’ chapters (4). 3.1. Mesh convergence The mesh convergence tests compare the bubble parameters between three meshes with different cell sizes and elements. Their overall time step considered in this test is 5·10−6 seconds. The convergence test is made to the following meshes. •Coarse mesh of about 145k elements. It lasts less than 12 hours in the cluster. •Medium mesh of approximately 290k cells. It lasts a day in the cluster and this is the mesh used until this section. •And a fine mesh of about 435k elements. This one lasts more than two days computing in the cluster. The parameter comparison of this test will be made at the capillary region, where the fluid is fully developed. A plot of the bubbles crossing surfaces 7 and 8, the variation of parameters per bubble at the surface x = 8 m and a table collecting the computed parameters per mesh will be shown. Figure 3.1 illustrates the first difference in bubbles according to the mesh. For the same period of time, the coarse mesh creates 10 thin bubbles while the others make less. This proves that the coarse mesh has a higher ”bubble velocity”, caused by the big cell size and the lack of accuracy it causes to the computations. 33 34 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0 0.2 0.4 0.6 0.8 1Alpha at mid point's surface, coarse mesh Surface 7 mm Surface 8 mm 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0 0.2 0.4 0.6 0.8 1 Air fraction Alpha at mid point's surface, medium mesh 0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 Time (s) 0 0.2 0.4 0.6 0.8 1Alpha at mid point's surface, fine mesh Figure 3.1: Bubbles from each mesh crossing surfaces x = 7mm and x = 8mm. Each mesh has associated the parameters of frequency, length, volume and stable velocity of the bubble in this test. The bubble volume dependencies (2.4.3.2.) makes the comparison between bubble velocities be enough to determine its difference in each mesh. Therefore, Figure 3.2 illustrates the variation of frequency, length and velocity parameters per bubble crossing the surface with the most developed flux. The plot includes the first 9 bubbles released per mesh, as one of them only releases that amount. The medium mesh has the lowest bubble velocity, while the others differ greatly from it. We believe that this unexpected outcome might come from the rare resulting outflow. CHAPTER 3. CONVERGENCE TESTS 35 0 1 2 3 4 5 6 7 8 9 Bubble number 0.35 0.4 0.45 0.5 0.55 Velocity (m/s) Stable speed (U78) for each bubble Coarse mesh (145,000 elements) Medium mesh (290,000 elements) Fine mesh (435,000 elements) 0 1 2 3 4 5 6 7 8 9 Bubble number 2 2.2 2.4 2.6 2.8 3 Length (m) 10-3 Bubble's length 012345678 Bubble number 50 60 70 80 Frequency (Hz) Bubbles frequency Figure 3.2: Parameters evolution per bubble and mesh. Table 3.1 shows the parameters computed for the 9th bubble of each simulation. The finer the mesh is closest to the correct results, so the errors are calculated respect to the finest mesh values. Mesh UG,78 (m/s) εU(%) LB(mm) εL(%) fB(Hz) εf(%) 145k cells 0.50 25.0 2.00 23.1 72.7 1.8 290k cells 0.40 0.0 2.60 0.0 59.7 16.4 435k cells 0.40 -2.60 -71.4- Table 3.1: Mesh parameters comparison. The 145k cells mesh errors are smaller for the frequency value, where its behaviour is quite similar to the finest mesh, according to Figure 3.2. That mesh resemblance should not happen in the fully developed flux sampled surface, since both meshes present a lot of variations that show instability. Despite the frequency error, the 290k elements mesh seems to be the most stable mesh out of all three. The boundary conditions at the outlet 36 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions may manipulate the outcome of table 3.1, but the medium mesh parameters have a better physical behaviour in the flux developed surface. The timing of computations in the cluster is quite long for the fine mesh in comparison with the other two meshes. Seeing the variations and similarities from Figure 3.2 and Table 3.1, the extra time taken for computations is not worth it in this case. It is also known that coarser meshes does not provide the best accuracy and presents oscillations in values. These statements confirm that the 290k cells mesh is the best fit for future simulations due to its stability and ”short” computational time (24 hours). The errors committed in it respect to the finest for frequency, length and stable velocity of the bubble are 16.4%, 0% and 0%, respectively. 3.2. Time convergence The time convergence uses the 290k cells mesh and tests computations time steps that do not jeopardize the Courant number. Ideally, the smaller the time step is, the closer the results are to convergence. Then the time steps to study will be the following: •Big time step of 1·10−5seconds. It lasts half-day in the cluster computing. •Medium time step of 5·10−6seconds. Its the current one and it lasts about a day calculating. •Small time step of 2.5·10−6seconds. It lasts about one and a half days in the cluster. Now that the mesh is the same in all tests, it is assumed that there should not be such big difference between the three simulations. The shortest number of bubbles generated in the 3 simulations for this test is 9. So the parameter comparison will be made for the first 9 bubbles. As it happened in the mesh convergence test, the bigger time step generates more bubbles than the rest cases for a same period of time. When the biggest time step simulation detaches 9 bubbles, the other two have not made the half of it. Figure 3.3 illustrates this for the capillary region of fully developed flux. CHAPTER 3. CONVERGENCE TESTS 37 0 0.02 0.04 0.06 0.08 0.1 0 0.2 0.4 0.6 0.8 1Alpha at mid point's surface, big t.s.(0.00001s) Surface 7 mm Surface 8 mm 0 0.02 0.04 0.06 0.08 0.1 0 0.2 0.4 0.6 0.8 1Alpha at mid point's surface, medium t.s.(0.000005s) 0 0.02 0.04 0.06 0.08 0.1 Time (s) 0 0.2 0.4 0.6 0.8 1 Air fraction Alpha at mid point's surface, small t.s.(0.0000025s) Figure 3.3: Bubbles crossing surfaces 7 and 8mm for each time step simulation. The medium and small time steps simulations make the same number of bubbles as it is seen in Figure 3.3, which demonstrate that they are both closer to convergence. The biggest time step simulation should not present the best results and be out of the picture in no time if Figure 3.4 and table 3.2 prove us right. Figure 3.4 presents the parameters variation for the first 9 bubbles to see if their behaviour is stable as expected or not. 38 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions 0 1 2 3 4 5 6 7 8 9 Bubble number 0.35 0.4 0.45 0.5 0.55 0.6 0.65 Velocity (m/s) Stable speed (U78) for each bubble Big t.s.(0.00001s) Medium t.s.(0.000005s) Small t.s.(0.0000025s) 0 1 2 3 4 5 6 7 8 9 Bubble number 1.5 2 2.5 3 3.5 4 Length (m) 10-3 Bubble's length 012345678 Bubble number 60 80 100 120 Frequency (Hz) Bubbles frequency Figure 3.4: Parameters evolution per bubble and time step. Contrary to the mesh convergence results, Figure 3.4 plots present a reasonable physical behaviour: the medium time step sticks the most to the smallest one in all parameters, meaning that they are both closer to convergence than the big time step computations. Also, the bigger time change values per bubble while the other two present practically a straight line. Apparently, the stability of the mesh used brings parameters to stable conditions when they are closer to convergence. Being the medium and small time steps results so alike implies that the extra hours for the smallest time computations are not worth it. Table 3.2 must confirm the veracity of this statement. The errors presented are respect to the smallest time step, whose results are considered the most convergent in this case. CHAPTER 3. CONVERGENCE TESTS 39 Time step UG,78 (m/s) εU(%) LB(mm) εL(%) fB(Hz) εf(%) 1·10−5seconds 0.50 31.3 2.25 14.1 95.2 46.9 5·10−6seconds 0.40 5.0 2.60 0.7 59.7 5.2 2.5·10−6seconds 0.38 -2.62 -56.7- Table 3.2: Time convergence parameters comparison. Table 3.2 confirms the predicted statement. The errors between the medium and the short time steps are small enough to consider the medium time step results good and close to convergence. Therefore, the time step 5·10−6sis chosen with errors in frequency, length and speed of the bubble of 5.2%, 0.7% and 5%, respectively. 3.3. Contact angle simulations With the 290k mesh and 5·10−6stime step, it is time to test different contact angle values to improve the performance of our simulations. According to the conclusions of Arias and Montlaur (2017) [1], the chosen contact angle value was 25◦for the walls of the horizontal pipe. We can expect a similar value to work but several contact angles will be tested just to be sure. The tested angles vary from 0◦to 90◦to make the fluids stick to the wall when running through the horizontal pipe. Within the selected range, smaller angles increase the water adhesion to the wall, while the largest do the opposite. Angles greater than 90◦do not guarantee the adhesion of any fluid to the wall. When no contact angle is determined, any fluid can stick to the wall depending on the bubbles’ trajectory through the pipe. Figures 3.5 and 3.6 illustrate that behaviour. They show captions and contour plots of a bubble in each simulation crossing surface x = 8 mm. 46 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions 0.125 0.13 0.135 -500 0 500 1000 1500 2000 2500 Pressure Gage (Pa) Pressure evolution, front point 0.125 0.13 0.135 Time(s) -500 0 500 1000 1500 2000 2500 Pressure Gage (Pa) Pressure evolution, rear point 0.125 0.13 0.135 Time(s) -500 0 500 1000 1500 2000 2500 Pressure evolution, bottom point 0.125 0.13 0.135 -500 0 500 1000 1500 2000 2500 Pressure evolution, top point Figure 4.2: Pressure evolution of the 8th bubble generation and detachment. 0.122 0.124 0.126 0.128 0.13 0.132 0.134 0.136 0.138 Time(s) -500 0 500 1000 1500 2000 2500 Pressure Gage (Pa) Pressure evolution for a bubble Front point Top point Rear point Bottom point S1 S2 S3 S4 Figure 4.3: 8th bubble superposed pressure evolution probes. CHAPTER 4. RESULTS 47 The time vector from Figures 4.2 and 4.3 cover from the moment the 7th bubble leaves the four probes region (0.121 655 s), to the moment the 8th bubble does the same (0.139 455 s). The process of the 8th bubble detachment is summarized in captions from 4.4. Figure 4.4: 8th bubble generation sequence (S1, S2, S3 and S4 from 4.3). From the previous images regarding the 8th bubble, it is noticeable that the front point (probe0) is always in the gas region, so its pressure is slightly higher than the rest of the points. This is actually seen in Figure 4.4, where the overall values are higher, especially in early stages and the highest peaks of variation. The top point (probe1) is always in the liquid region. The initial pressure is smaller until the gas covers the entire junction (Figure 4.4) and rises the pressure, creating the peaks in the red plot of Figure 4.2. The rear point (probe2) has the lowest pressure at the early stages of Figure 4.3. It has a little variation caused by the trail the 7th bubble leaves behind (Figure 4.4). Then just before the bubble detaches, the pressure rise of this point is the second highest of all. The 48 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions bottom point (probe3) presents quite average values and no other significant fluctuations. All plots present the biggest change in pressure when the bubble starts detaching, around the time shown between the 3rd and 4th caption from sequence 4.4. That is the highest peak of pressure for all points, probably due to their closeness to one another. 4.2. Inlet speeds variations Now it is time to try several inlet velocities (USL and USG) and see what happens with the frequency, length, velocity and volume of the bubble. Numbers in table 4.1 correspond to combinations, from case 1 to 9. The already tested inlet velocities are included in Combination 5. PPPPPPPP P USL USG 0.05 m/s 0.1 m/s 0.5 m/s 0.05 m/s 1 2 3 0.1 m/s 4 5 (from previous chapters) 6 0.5 m/s 7 8 9 Table 4.1: Velocity inlet combinations for further parameters discussion. Initially, the tested values for both inlet velocities were supposed to range between 0.1 and 1 m/s. However, some combination between these two extremes could not detach a bubble because 0.01 m/swas too slow against 1 m/s. Therefore, the range is adjusted to the values 0.05 m/sand 0.5 m/sto detach bubbles successfully. The 7th bubble will be evaluated in the capillary region where the flux is developed, since the slowest combination (number 1 in 4.1) only generates 7 bubbles. All the captions and values below are related to this bubble. Figure 4.5 show the same bubble detached for all combinations, in order from top to bottom. The sequence is extracted from ParaView visualizer for most of the cases, except for the 5th, which is a contour built in Matlab (see also the first caption of Figure 4.4). CHAPTER 4. RESULTS 49 Figure 4.5: 7th bubble release for combinations 1, 2, 3, 4, 6, 7, 8 and 9. 50 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions Figure 4.5 shows clear differentiations between the inlet velocity combinations. For starters, Combination 1 presents the slowest bubbles. When increasing a little the gas inlet velocity in Combination 2, the bubbles elongate because the liquid has trouble separating them at the same rate it did in Combination 1. Then, increasing five times the air inlet velocity in Combination 3, makes it impossible to show the whole bubble at its detachment. The separation between bubbles seems to be more abrupt than previous cases here. In Combination 4, the liquid inlet velocity is increased, which makes the bubbles shorter as it cuts them faster without deforming them. Combination 5 (see Figure 4.4) fastens the bubbles at the same time they elongate. Similar to Combination 3, when the gas inlet velocity is 0.5 m/sin the 6th combination, the bubbles break more abruptly and do not maintain the round shape they have regularly in lower inlet velocities. The 7th combination has the slowest gas and the fastest liquid velocities, which generate very small bubbles. From there, Combination 8 has still small bubbles (some smaller than others) but more frequent and differing in size when increasing the gas inlet velocity. And finally, when both inlet velocities are set to 0.5 m/sin the 9th combination, the gas travels so fast that the liquid, even when being equally fast, takes longer to separate bubbles. It seems like when liquid tries to break a bubble, the gas has already gone too far. 4.2.1. Discussion The final discussion can be made through the presented parameters of the 7th bubble for each combination, as shown in Table 4.2 and Figures 4.6,4.7,4.8 and 4.9. Velocity combination USG (m/s) USL (m/s) fB(Hz) LB(mm) UG,78 (m/s) VB(m3) 10.05 0.05 44.4 7.10 0.50 4.45 ·10−9 20.1 0.05 51.3 6.60 0.50 4.16 ·10−9 30.5 0.05 81.6 9.20 0.80 5.15 ·10−9 40.05 0.1 52.6 6.30 0.57 3.92 ·10−9 50.1 0.1 59.7 2.60 0.40 1.41 ·10−9 60.5 0.1 114.3 7.00 1.00 4.21 ·10−9 70.05 0.5 148.1 1.40 0.80 6.48 ·10−10 80.1 0.5 333.3 0.80 0.80 2.85 ·10−10 90.5 0.5 307.7 1.70 1.33 5.64 ·10−10 Table 4.2: Parameter values for the different inlet velocities combinations The parameters from Table 4.2 show values for one bubble, so we do not know the stability of these for each combination. Figure 4.6 illustrates how do parameter values change for the first seven bubbles. CHAPTER 4. RESULTS 51 01234567 Bubble number 0.5 1 1.5 Velocity (m/s) Stable speed (U78) for each bubble 01234567 Bubble number 0 0.005 0.01 0.015 Length (m) Bubble's length 0123456 Bubble number 0 200 400 600 Frequency (Hz) Bubbles frequency Combination 1 Combination 2 Combination 3 Combination 4 Combination 5 Combination 6 Combination 7 Combination 8 Combination 9 Figure 4.6: Parameters evolution per bubble for each combination of inlet velocities. First of all, it can be seen in Table 4.2 that both the volume and the length of the bubble decrease when the liquid inlet velocity is highest (for combinations 7, 8 and 9). From 4.2, it seems like frequency increases noticeably when at least one of the inlet velocities is the highest tested value. Something similar happens with the bubble velocity, which increases greatly when one of inlet velocities is at 0.5 m/sand the other is higher or equal to 0.1 m/s. When the liquid inlet velocity is higher, it becomes more difficult for the liquid to break the bubbles without deforming them a little. Volume’s parameter dependency on the bubble speed is what exempts its appearance in Figure 4.6. Both the bubble’s velocity and length are quite stable for small inlet velocities. From Figure 4.6, the combinations with whether USG or USL equal to 0.5 m/shave higher variations between bubbles. The highest are presented in combinations 3 and 6 for length, and 3, 6, and 9 for velocity. The highest variations in the bubble frequency parameter are found in the 8th and the 9th, where USL is 0.5 m/s. To determine the behaviour of the parameters, we must predict their correlations through a set of equations or fittings. The parameter of frequency of the bubble presents the expected behaviour respect to the gas inlet velocity through the equation 4.1. The curves described in the equation cannot be drawn because we would need more points to plot 52 Numerical study with OpenFOAM of the bubble generation process in an inverse T-junction in microgravity conditions them correctly. However, points in Figure 4.7 present the correct trend of these[1]. f=fsat(1−e(−a0 fsat USG))(4.1) As per the volume and the bubble velocity, using simple fittings from expressions 4.2 and 2.7, we can get the combination points behaviour in Figures 4.8 and 4.9. ¯ VB=USG f·Lsection (4.2) 0 0.1 0.2 0.3 0.4 0.5 0.6 0 50 100 150 200 250 300 350 f (Hz) Frequency VS Air inlet velocity Figure 4.7: Frequency fitting dependence with the gas superficial inlet velocity. 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 Figure 4.8: Normalized volume fitting dependence as a function of USG f·L 6. CHAPTER 4. RESULTS 53 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.2 0.4 0.6 0.8 1 1.2 1.4 Bubble velocity VS Mixed superficial velocity Figure 4.9: Bubble velocity fitting as a function of the mixed superficial velocity. From Figure 4.7, the points for each liquid inlet velocity create a negative exponential curve shape, as expected[1]. However, the three curves cannot be drawn in our plot because three are very few points to define each of them correctly. If these were drawn either way, they would not be very close to their points due to the lack of accuracy. Then Figure 4.8 presents a linear fitting for a normalized bubble volume as a function of USG fB·L, which is an alternative way to compute the normalized volume. The normalized volume takes the bubble volume computed and divides it by 0.001 m from mesh dimensions. Generally, in 4.8, most of the points are very close to the linear fitting as we wanted, except for the three slowest combinations (1, 2 and 4). Finally, Figure 4.9 presents a similar behaviour to the normalized volume, as all combinations are closer to the desired result so they are loyal to what was expected from these. Except for the slowest combinations too. The linear fitting line has the parameter C0as slope, which in this case is about 1.4. This is a little higher than what was obtained from the simulations and experimental values in [1], but we believe the difference is caused by the squared section mesh we used in this project. The overall value of C0for the 9 inlet velocity combinations is also a little lower than what we found in section 2.2.2. for Combination 5 (USL =USG =0.1 m/s). CONCLUSIONS The goal of this project was to conduct numerical simulations in OpenFOAM and ParaView to generate bubbles in a T-junction mesh in microgravity conditions. The results obtained from these simulations were to be close to the ones in [1] and [15], or even improve their values by reducing the errors respect to their experimental results. The methodology followed for the initial project’s purpose was to generate the cylindrical mesh in a software external to OpenFOAM and transform it to a compatible version for the simulations to work properly. Then, the simulation conditions had to be established in OpenFOAM files to detach bubbles successfully. When these were made, samples of surfaces, points of the mesh and values of the evaluated fields had to be taken to process the collected data in Matlab. This was needed to discover which mesh, time step and contact angle were best to improve the performance of the simulations in the results section. In this project, the methodology was strictly followed the way it is explained above. Nonetheless, we faced challenges along the way. At first, the mesh was supposed to be progressive and refined at the junction where both air and water meet and generate the bubbles. Unfortunately, we experienced some drawbacks with the mesh generators and we spent a larger amount of time on them than what we were supposed to. In the end, we changed the geometry of the mesh to a squared-section T-junction to simplify this task and move on. Then, when introducing the boundary conditions, the simulations produced a rare behaviour at the outlet of the mesh that endangered the reliability of the simulations results. Even though we invested time in solving this, no combination of conditions improved what we had initially, so we carried on with them. The strange behaviours obtained in the convergence tests of meshes, time steps and contact angles are due to this error. Also, that is why our results are further away from what we intended to obtain from the beginning. Still, what we learnt from varying the inlet velocities for both fluids is that when the liquid superficial velocity is increased, the bubbles detach sooner so they are more frequent and smaller. When the gas superficial velocity is increased, it generally produces the opposite effect. Other than that, the combination of both inlet velocities do not follow any strict rule that states which is the best for our simulations. We also measured the evolution of pressure at four points around the junction in the results section. When evaluating this behaviour, we obtained similar results due to the closeness between the measuring points. Regardless of the closeness and the rare behaviour, the good news is that the pressure at the junction followed a logical physical behaviour. For future projects, to improve the results we obtained, I think that the project’s duration should be elongated. When organizing our schedule for a similar project, I believe it would be better to try less mesh generators to save some time that could be useful for solving the rare outlet conditions and obtain the desired physical behaviour. Then, the convergence tests would have to be more extensive in order to use the finest possible mesh and time step. The contact angle study should be extended as well in order to improve the results, and be closer to the experiment conclusions [1]. 54 BIBLIOGRAPHY [1] Montlaur A. Arias, S. Numerical study and experimental comparison of two-phase flow generation in a t-junction. Technical report, 2017. AIAA Journal, 12/2018, English. iii,v,12,14,15,16,39,41,43,52,53,54 [2] Gravity of earth - wikipedia. https://en.wikipedia.org/wiki/Gravity_of_ Earth. On-line, 07/2019, English. 3 [3] Forbes business magazine. Why exploring space and investing in research is nonnegotiable. https://www.forbes.com/sites/startswithabang/2017/10/26/ even-while-the-world-suffers-investing-in-science-is-non-negotiable/ #730b64e16470. On-line, 03/2019, English. 4 [4] NASA. What is microgravity? https://www.nasa.gov/audience/forstudents/ 5-8/features/nasa-knows/what-is-microgravity-58.html. On-line, 11/2018, English. 5 [5] NASA. Zero gravity facility tour. https://www.nasa.gov/specials/zero-g/. Online, 11/2018, English. 6 [6] NASA Glenn Research Center. Zero gravity research facility. https://www1.grc. nasa.gov/facilities/zero-g/. On-line, 11/2018, English. 6 [7] California Science Center. Orion sounding rocket. On-line, 06/2019, English. 7 [8] NASA. What is a sounding rocket? https://www.nasa.gov/missions/ research/f_sounding.html. On-line, 06/2019, English. 7 [9] Hajime Yano and JAXA. Microgravity geology: In-situ measurements and laboratory simulations. In International Marco Polo Symposium and other Small Body Sample Return Missions, 2009. PDF conference, 06/2019, English. 8 [10] UNOOSA. Russian research tests and missions. http://www.unoosa.org/pdf/ pres/stsc2010/tech-13.pdf. On-line, 03/2019, English. 9 [11] (extra˜ nas llamas a bordo de la estaci´ on espacial internacional - youtube. https: //www.youtube.com/watch?time%5C_continue=176%5C&v=8eCTKIG9G-M. Online, 11/2018, Spanish. 10 [12] HEMAV. Gravimav. https://hemav.com/gravimav/. On-line, 05/2019, Spanish. 10 [13] mitra UPC Garc´ ıa Terrades, Arnau. Overview of the project ”crear un entorno de microgravedad con un drone”. https://mitra.upc.es/SIA/PFC_PUBLICA.DADES_ PFC?w_codipfc=8723&v_curs_quad=2016-2. On-line, 05/2019, Spanish - Catalan - English. 10 [14] ”The engineer” magazine article. “labyrinth” device sorts cancer cells from healthy blood the engineer. https://www.theengineer.co.uk/ microfluidic-labyrinth-sorts-cancer-healthy-blood/. On-line, 05/2019, English. 11 55 Once the simulation starts its calculations, new folders appear named after numbers. These have the names of its related time step and obtain information about the state of the main parameters (velocity, pressure and air fraction) at that time. These extra folders are needed to visualize the results in ParaView. A.2. Case files This section shows the files corresponding to the three folders of the simulation case: ”0”, ”constant” and ”system”. The commands and key words of these files might change in every OpenFOAM version. User guides regarding the version of the program installed have been used ([21], [22] and [23]). A.2.1. ”0” folder This folder imposes the initial and boundary conditions through three files: alpha.gas for the air fraction definition, p rgh for the pressure scalar field and Ufor the velocity vectorial field in (x,y,z). To set the contact angle in alpha.gas file, the conditions of the face group ”walls2” (see section 2.3.2.1.) should be changed like in Figure A.6. Figure A.5: Caption of the air fraction (alpha.gas) file. Figure A.6: Caption of the contact angle condition in the air fraction (alpha.gas) file. Figure A.7: Caption of the pressure (p rgh) file. Figure A.8: Caption of the velocity (U) file A.2.2. ”Constant” folder The ”constant” folder describes the fluid parameters and the work regime of the simulation through three other files: gfor gravity conditions (neglected in this case), the transport- Properties to define the main properties per fluid, and the turbulenceProperties to define the laminar flow. Figure A.9: Caption of the gravity (g) file. Figure A.10: Caption of the transport properties file for each fluid. Figure A.11: Caption of the turbulence properties file for both fluids. A.2.3. ”System” folder The system folder contains 5 files: controlDict,setFieldsDict,fvSchemes,fvSolution and decomposeParDict. The controlDict file (Figure A.12) is the longest file of the folder. It has the main control parameters of the simulation and the functions for sampling data. The file presents the solver used (application) and the initial and final times in the simulations (startTime and endTime). The initial time in this case is set to latestTime to read which is the last time related folder in the case and starts the simulation from there. This is useful to continue a simulation when this one has been stopped abruptly and the data storage has been interrupted. If the cluster server went down for any reason, the simulation could be continued by writing just one command (”interFoam”). The writing format of the stored data (writeFormat set in ASCII by default), the time step (deltaT) to maintain a desired Courant number and the writeInterval to write a time step folder are set in this first part of the file, too. The writing interval writes a folder every 1000 ticks of the computer clock time, or the cluster for that matter. These store parameters information at its correspondent time in a compressed format to save disk or cluster’s memory. Features like timePrecision and runTimeModifiable are set to the same values as [15] and [18]. The maximum Courant number is set to 2 instead of 1 because this needs to be higher than maxAlphaCo to make the simulation work better, according to www.cfd-online.com users advice. Otherwise, the time step had to be adjustable and a maximum time step had to be fixed to maintain the balance and not raise much the Courant number. In the end, it was preferred to keep a constant time step and use the trick of a higher maxCo limit. The functions to sample data are divided following this order: probes, point and alpha data for the 7 sampled surfaces and then, the mean alpha value file per each sampled surface in the x-axis. The probes use the libsampling.so function onto the given points of the mesh to save the values of the scalar field of pressure (p rgh) every time step (writeControl). The same library is used for surface sampling. Sampled surface of alpha values (3,4,6,7,8,9 mm and Y mid surface) are defined as pointAndNormal planeType surfaces to ensure including all their points and their normalVector direction. Inside the same sample folder, all surfaces have sampled values every 50 time steps (writeControl) to obtain 800 post processing files with the initial and final times set. Then, the average air fraction value is sampled from the surfaces with a normal vector in the x-axis (3, 4, 6, 7, 8 and 9 millimetres). The function used was libFieldFunctionObjects.so and the values were sampled every time step. To sample values from surfaces, these need to be defined as in the previous case with a pointAndNormal planeType.SampledSurfaceDict was used to do this. Then, the fvSolution dictionary file (Figure A.15) controls the equations of the solver interFoam, their tolerances and the algorithms that this one uses. The PIMPLE algorithm is usually the one linked to the interFoam solver, so it is used in this project as well. The relaxationFactors section controls the technique used for stability improvement and convergence in computations, for both velocity and corrected pressure. This is called underrelaxation technique, which limits the changes in a variable from one iteration to the next. Further information about this file composition is available in [24] and examples from similar cases are available in [25]. Figure A.15: Caption of the fvSolution dictionary file of the simulation. Finally, the decomposeParDict dictionary file (Figure A.16) divides the computations of the mesh in regions to run them in parallel and finish the calculations quicker. The numberOf- Subdomains defines the number of cores in which the mesh will be divided. In this project, the mesh should have been divided at least in two parts to treat the inlets separately. The method used is the ”simple” one, so its coefficients were defined in simpleCoeffs. ”N” defines the parts of the mesh in which this is divided in all axes. Each part is computed and saved in a file called ”Processor X”, X being the number of the part, starting from 0. This division adds extra commands before and after the solver calculations, because the mesh must be divided and then unite results again. The hierarchicalCoeffs define which parts are more urgent for calculations. In this project, the order is standard (x, y, z) and the priority is equal to all parts. All parts are computed in one disk to avoid the division in more than one PC physic processor. This file is not used in this project because the cluster from the UPC was used and this one was fas enough already. Some tests took place initially to determine if it was necessary or not to use, though. Further information of this file is available in [26]. Figure A.16: Caption of the decomposePar dictionary file of the simulation. A.3. Cluster files Since the UPC cluster is used for computations in this project, it generates four additional files in our case when sending the simulations there. To run a simulation, the ”run.sh” file is used (explained in section A.4.). The first file generated when running a simulation is the ”mesh.txt”. This file saves the mesh properties when this one is created. Instead of showing this in a terminal screen, the information is saved here. See Figure A.17. When computing, the terminal screen data of the calculation process is saved in the ”computations.txt” (See Figure A.18). And then, two extra files are generated which are not specified by the user: ”run.sh.eNjob” and ”run.sh.oNjob”. The first file writes the errors produced when a simulation (or a job) stops, while the second one writes the operations of the process. These are shown in Figures A.19 and A.20. Figure A.17: File ”mesh.txt” from cluster. Figure A.18: File ”computations.txt” from cluster. Figure A.19: File ”run.sh.eNjob” generated by the cluster. Figure A.20: File ”run.sh.oNjob” generated by the cluster. A.4. Commands In this project, a UPC cluster has been used to perform the computations quicker. The commands used are the same whether it is on a cluster or on a local PC. The difference remains in how these are claimed. A.4.1. Running a simulation in a local PC The laptop used for this project runs simulations in an Ubuntu platform from the virtual box. The commands must be written from the terminal in the case directory. To change from home directory in the terminal, the following command must be used. 1cd SimulationCase Name When the files of the case are complete (section A.2.), we write the following commands in order to run the simulation. 1fluent3DMeshToFoam meshRect3 . msh / / Converts ANSYS mesh to an OpenFOAM compatible format 2setFields / / I n i t i a l i z e s the sim ulat ion 3interFoam / / I n i t i a l i z e s the s ol ve r and s t a r t s the c a l c u l a t i o n s 4paraFoam / / Opens ParaView to v i s u a l i z e the computations of the solver In case the decomposeParDict is used in a simulation, the commands change slightly as shown below. 1fluent3DMeshToFoam meshRect3 . msh 2setFields 3decomposePar / / Creates f o l d e r s f o r each core / processor 4interFoam / / S t ar t s the c a l c u l a t i o n s i n each core f i l e 5recomposePar / / Unites a l l core f o l d e r s i n fo r m at i on and generates time step stored data as in usual s imula tions 6paraFoam A.4.2. Running a simulation in the cluster To run this same simulation in the cluster, a bash file must be created with the extension ”.sh”. These are quite common on Ubuntu, and they are created by introducing in a regular blank text file a set of commands to convert the file and some more from A.4.1. The cluster user provided by the university does include OpenFOAM software installed but not ParaView, so the steps are: 1.- Copy the simulation case from the local PC to the cluster with one command. 1scp −r . / SimulationCase Name grosado@147 . 83 .7 .212: Case GivenName The local directory was ”home/user”, so the access through terminal could be simplified with a point, while grosado is my username assigned from the university. The cluster and the local PC can have different names for the same case if wanted. 2.- Once inside the cluster case directory, only one command is needed to run the bash file. All bash files were called ”run.sh” in this case. 1qsub run . sh / / Adds the s p ec i fi e d job of the bash f i l e to the c l u s t e r queue In ”run.sh”, the commands to convert the text file to a bash document must be written at the heading of the file before writing anything else. 1#! / bin / bash 2# 3#$−cwd 4#$−S / bin / bash 5# 6#$−q allnodes To run simulations in the cluster, only the following commands are written in the job file (”run.sh”). Some instructions must save the processes in a file because the cluster does not print these in a terminal nor screen to indicate its correct working. 1unlimit −s 50000 / / Not necessary but i t does ensure there i s enough free space i n the c l u s t e r f o r the computations 2 3fluent3DMeshToFoam meshRect3 . msh >mesh . t x t 4setFields 5interFoam >computations . t x t 3.- When the job is done, the case must be copied back to the local PC directory. 1scp −r grosado@147 . 8 3 . 7 . 2 1 2 : / c l u s t e r / users / students / grosado / Case GivenName . / SimulationCase Name 4.- Eventually, when the case is back to the local PC, we visualize the results by writing ”paraFoam” on the terminal to open ParaView. We can also open Matlab by writing ”matlab” on terminal to work the post processing of the simulation. In the cluster, neither the decomposePar and reconstructPar commands work. Somehow, these commands are not recognized in the cluster, so there are no exceptions in this case. The bright side of the cluster though, is that this one can compute several simulations at once without slowing down any process. That is not possible in an ordinary local PC. APPENDIX B. MESH GENERATION In this section of the appendix, there will examples of how the meshes or the files from OpenFOAM tools looked like. As it is explained in 2.3.2.1., the geometry of the mesh was changed at some point to simplify the problem, but the goal here is showing part of the work behind the mesh generation process before it came to that. The programs and tools used to generate meshes were: •blockMesh from OpenFOAM. •GMSH program. •snappyHexMesh from OpenFOAM. •www.onshape.com only to export geometries. •ANSYS. B.1. BlockMesh tool The blockMesh tool was used initially to generate the mesh in OpenFOAM, following instructions from documents like [27] for simpler meshes. At first, a cylinder-shaped mesh was generated to try the tool, and it worked just fine. However, generate a T-junction requires multiple interconnected vertices, which added extra difficulty to the process. Some samples of files for a cylindrical T-junction can be seen in Figures B.1,B.2 and B.3 to show the progress made in each file. Figure B.1 shows the initial attempt of generating a T-junction mesh. This one has some errors related to the orientation of the faces written in the boundary section. Figure B.2 shows the following version of the T-junction mesh formed in blockMesh. The errors of orientation from the first attempt were fixed and a new association of the geometry is made, through smaller blocks in cylindrical pipes. This new association was supposed to save some lines in the file, but that did not generate the mesh we wanted at all, so we had to go to write a third version of the file. In the end, Figure B.3 was the final attempt to generate a mesh with this tool. The mesh in this case was reorganized as there were already too many vertices to connect while the tool had problems uniting both cylindrical pipes in a junction. To realise where was the problem, we divided the mesh in 4 parts when creating it: the gasInlet region, the liquidInlet and vertical pipe region, the joint region and the rest of the horizontal pipe until the outlet. Then, it came to realization that the problem was at the junction and that this tool was not made to generate two pipes sharing a joint like in this case. Even when the errors were fixed, ParaView always showed a twisted mesh far from what we intended, which was the result of blockMesh putting together the different parts of the mesh oddly. According to www.cfd-online.com users, blockMesh must be used for simple meshes with one block at most, meaning no junctions could be made. Also, when searching similar examples like [28], it was seen that users tend to use other programs like ANSYS or 86 GMSH for a quick complex mesh generation, or generate complex geometries with snappyHexMesh tool from OpenFOAM. Figure B.2: BlockMeshDict file, modifications to the first T-junction attempt. Figure B.3: BlockMeshDict file, last T-junction attempt. B.2. GMSH programme The GMSH programme was one of the easiest programmes to use. To generate the mesh geometry, it was only necessary to indicate the dimensions of both cylinders and use the option ”unite” to create their junction. The mesh generation was more complex, though. The only things that could be defined from the mesh were its style (if it goes from one face to the other or if it is contained in a volume) and its density at some point of the geometry, which allowed progressive mesh generation at the joint. The downside of the program was that the cells shape could not be chosen at all with our geometry, as hexagonal cells were only available for simpler geometries. Sometimes a few cells forced the conversion of their shape to hexagonal, but that created more problems for the simulation as the surrounding cells needed to adjust their geometry to cover the rest of the mesh. To do that, very small angles were produced in several cells while others were just too small to adapt their geometry, which increased insanely the Courant number. The solver never ended the computations, it was always interrupted first. The first mesh generated in this program was made in millimetres instead of using the international system of units as I should have. Also the first attempt had a very long horizontal pipe while the rest got cut every attempt for simplicity and spare time. Images of the first meshes generated appear in pictures B.4,B.5 and B.6. These were refined at the joint region, so it is hard to differentiate the cells. The face groups were assigned in GMSH to visualize them in OpenFOAM as in Figure B.7. Figure B.4: First mesh created in GMSH. Figure B.5: Shorter second mesh created in GMSH with new liquidInlet localization. Figure B.6: Fourth mesh created in GMSH, this time with new dimensions. Figure B.7: Differentiated patches of the first mesh seen in ParaView, once converted. The meshes produced in this program were quite a few, as shown in the stand-alone files of Figure B.8. GMSH generates the geometry and the mesh separately in the program, so even though these are always dependant from one another, GMSH outputs two files with each extension: ”.geo” and ”.msh” for geometry and mesh, respectively. The difference between both files contents are shown in Figures B.9 and B.10 Figure B.8: Most of the GMSH files (”.geo” and ”.msh”) generated in this project. Figure B.9: ”.geo” extension of the GMSH generated mesh. Figure B.10: ”.msh” extension of the GMSH generated mesh. For OpenFOAM, it was enough to convert the file with the extension ”.msh” to work, using the gmshToFoam nameMesh.msh command. Figure B.10 shows the real data the mesh as specified by the user, while geometry file only generates a sample to show how the mesh would be embedded in the geometry. B.4. OnShape website This website (www.onshape.com) allows any user to create a free account and draw a geometry on-line without the need to download a CAD program. This way, geometry files do not occupy space on the local PC and they can also be exported from the website with any extension. This website started being used because snappyHexMesh needed patches exported in an STL format, and OnShape could generate a geometry and export its face groups within less than five minutes. The website editing tools platform looks like a basic version of a CAD software and it is very intuitive. When generating a geometry for other mesh generators like ANSYS, this website seemed like the fastest option. Programs like ANSYS could not select faces or parts of the geometry if this was exported in STL format, though. Every selection included the entire volume and that did not allow the face groups assignment. Thankfully OnShape also offered the possibility to export any geometry in STEP format, which fixed the problem. Only two geometries were created in this website, both using international system units dimensions for compatibility reasons between programs. These appear as captions in section 2.3.2.1.. B.5. ANSYS The last mesh generator used was ANSYS student package, which is a free software for college students from around the world. ANSYS is known to be very graphic and intuitive like CFD Autodesk software, which I used in previous subjects from college. ANSYS is installed in Windows, so the meshes were sent to Ubuntu through a shared directory between the local operating system and the virtual box of Ubuntu. The quickest meshing in ANSYS is made through the Mesh generator of the program, which required the definition of a geometry and then the creation of the mesh according to it. The geometry of extension ”.stp” was imported from OnShape. Once imported the geometry to ANSYS, the mesh itself was created. This one had to be made for ”CFD” purposes in ”Fluent” extension (”.msh”) to ease the conversion later on in OpenFOAM with the command ”fluent3DMeshToFoam nameMesh.msh”. That way, ANSYS generated the modifiable mesh file in ”.wpfj” extension and this one could also be exported as a MSH format. The cell shape, the number of cells and their distribution were the parameters modified in every trial to obtain the best possible result. As it is known from 2.3.2.1., the cylindrical T-junction did not work well enough for the same reason it did not either in GMSH, so the geometry ended up being changed. Although squared section or not, there are a lot of meshes generated that are around the virtual box in Ubuntu, each version improving the previous one in cell shape or size. The majority of them are shown in Figure B.14, excluding the ones used in the convergence tests and the two PDF documents. Figure B.14: Meshes imported to Ubuntu from the ANSYS software in Windows. The rectangular mesh versions changed the number of cells to adjust the Courant number according to the parameters imposed in the simulation. As for the cylindrical meshes, the initial shape and size fo the cells is shown in Figure B.15. The rest of them consisted on generating a layered mesh at the inlets and outlet and change the shape and size of the cells. Some examples of mesh modifications are shown in Figures B.16,B.17,B.18,B.19 and B.20. The combination of all these modifications brought more problems, though. In the end, my tutor and I came to an agreement to simplify the mesh as time was running out and there was still a lot of work to do. Figure B.15: First mesh generated in ANSYS with the default size and shape of the cells. Figure B.16: First layered short mesh generated in ANSYS. Figure B.17: Regular short mesh generated in ANSYS. Figure B.18: Second mesh created in ANSYS. Figure B.19: Second mesh refined in ANSYS. Figure B.20: Final layered mesh in ANSYS, half section. The shortest meshes from above (Figures B.16 and B.17) were enough to evaluate the bubble detachment at the junction of the mesh and save time from computations. The ideal mesh should have layers so that the cell shape is not deformed at the junction between the two pipes. Still, both the layered case and the default cells distribution were simulated. The same happened with the longer meshes. The second mesh (Figure B.18) was using a regular distribution of the cells, and when the size of the cells were modified (Figure B.19), some areas were more refined than others due to the cell shape and size. The change in geometry of the cell was possible but the concentrations of smaller cells would not disappear, so it made the Courant number rise. To minimize the effect of they caused in the computations, layers were added to improve the quality of the cells around the mesh (see Figure B.20). That did not work either, so that was the last trial before changing the geometry and break off the need to add layers to squared cells. APPENDIX C. BOUNDARY CONDITIONS TRY OUTS As explained in section 2.3.4., the chosen boundary conditions lead to some strange behaviour at the outlet of the mesh. This behaviour can be seen in the following sequence C.1. Figure C.1: Caption of the outflow sequence in ParaView visualizer. From the previous sequence C.1, we conclude that the bubble travels through the pipe without any anomalies, but once it touches the outlet, some kind of vacuum process takes place and absorbs the bubble from the centre of the face. The chosen boundary conditions are from 2.3.4., but a lot of hours have been invested in trying to find better conditions for the outlet to improve the scenario. None of them improved it much though. Then, some of the most recent boundary conditions changed will be posted in this section from now on. Not all of them though, as there are a lot of possibilities [29]. Most of them 114 were used at some point while testing. In the end, the boundary conditions from 2.3.4. were maintained, which are mostly coincident to the ones used in Blanca Dalf´ o and Amina Bakkali projects, [15] and [18]. At the beginning, when consulting tutorials from [22] and [23] and reading users experiences in www.cfd-online.com forums, it was confirmed that fvSolution and fvSchemes files were wrong. Apparently, a model of cavity simulation was used with different tolerances and numerical schemes that could have aggravated the behaviour. Once these were changed, some freeStream conditions from [29] were used for pressure and velocity, as it seemed these were the cause of the problem. C.1. Change in the pressure condition One of the most recent cases consisted on changing the outlet condition for the pressure and leave the rest as in section 2.3.4.. Figure C.2 shows this. The idea was to define the absolute pressure instead of the gage one, but it turned out to be a condition for compressible flows, according to [30], which is not our case. The behaviour turned out to be even more strange at the outlet due to this condition, where the bubble exited the mesh through a smaller section of the outlet. Back to the gage pressure, a similar behaviour was obtained when changing the outlet condition to a freeStreamPressure value of p0 = 0 Pa. Therefore, we thought the velocity at the walls and the outlet might have something to do with it. So maybe the solution was to change the velocity condition. After all, when visualizing the vectors of the velocity field in ParaView, these showed a bigger magnitude at the centre of the outlet than the rest of the face. Figure C.2: Caption of the total pressure condition at the outlet. C.2. Change in the velocity condition Since the changes in pressure did not work as expected, the initial conditions for that field were left while the velocity outlet was changed in order to see if this was the wrong condition. At first, the walls got the ”noSlip” condition type, so these were changed to fix 0 m/svelocity for all axes. Nothing changed so far, so we tried other options, being one of them the following example. The velocity condition of the outlet was changed in the ”U” file for an ”inletOutlet” boundary. This condition computes the velocity value at the outlet (a zeroGradient with no restriction) but taking into account the inlet velocity. Since there are two inlets in the mesh, the inlet value was assigned as the sum of both inlet velocities, which were equal to 0.1 m/s. Therefore, the inlet value was 0.2 m/s. The condition was a mistake for sure as there was no guarantee that the combined velocity would be exactly the sum and not some higher value. Matlab actuallythat this one was way higher in section x = 3 millim. However, the error produced would have been worth it if the scenario fixed itself with this condition. It did not work. It seemed like there was something missing in this condition, like maybe the pressure and velocity conditions combined were the key to solve this. Figure C.3: Caption of the inletOutlet condition for the velocity at the outlet. C.3. Change in both pressure and velocity conditions The last example implies changes in both the pressure and the velocity fields. Changing the conditions for only one of the fields felt like it was not enough, so maybe the conditions imposed until now were not compatible and that made the simulation ”fail” somehow. Several combinations were tried, especially using the outletInlet condition at the inlet for the pressure field and a freeStream velocity condition or so. Most of the examples for the outlet listed on [29] were combined. There was one example that seemed to improve just a little the scenario but not enough to change the boundary conditions. With it, the bubbles seemed to increase its speed along the mesh and the outflow made the bubbles deform while crossing the outlet. In 2.3.4., the conditions maintained the round shape of it while exiting. After all, this combination did not make the vacuum effect disappear, so it was not better than what was written initially. The outflow sequence related to this change of conditions is shown in Figure C.4 Figure C.4: Outflow sequence in ParaView for pressure and velocity change. The conditions from the sequence C.4 has its files illustrated in pictures C.5 and C.6. Even when putting the pressure outlet condition in gasInlet instead, it did not improve either. No combination of changes topped this one, so we thought to be best if the initial boundary conditions were put for the simulations as they were basic commands and made more sense due to the simplicity of the simulation physical problem. Figure C.5: Caption of the outletInlet pressure condition at the outlet. D.3. Average air fraction file per surface Inside the post-processing folder there are other folders called ”surface3mean”, ”surface4mean”, ”surface6mean”, ”surface7mean”, ”surface8mean” and ”surface9mean”. These have a file in each that collects the main value of air fraction at every time step to compute the bubble parameters. The Y surface was not sampled in this case. It was only used to draw a contour plot in Matlab. As all these files are quite similar, just showing the file of the first sampled surface (x = 0.003 m in Figure D.5) is enough to see what the file is about. Figure D.5: Caption of the surface 3 file for average air fraction values. APPENDIX E. MATLAB CODES The codes used for this project are made from scratch, but following the same criteria as Blanca Dalf´ o and Amina Bakkali projects [[15] and [18]]. E.1. Surface samplings and contour plots First of all, most of the simulations went through this code to save the sampled data in Matlab ”structs” and organize this information for future consultations in other codes. The main code also includes the possibility to draw the contour of a sampled surface, as well as plotting the evolution of the air fraction per time, whether it is through the sampled surface mid-point or using mean values. The last section of the main code obtains the area and the initial and final times of bubbles crossing each surface. This information is stored in new ”structs” to import them to parameters computation codes. These are lighter, so they run the codes quicker. 1%BUBBLE PLOTS FROM SAMPLED SURFACES 2%Run t h i s section f o r each mesh : L ig h ter mesh (L ) , Medium mesh (M) , 3%Denser mesh (D) . 4cl e a r a l l 5format long ; casesList = s o r t ( s t r i n g ( s t r s p l i t ( l s (”/home/ gis / bubbleFV11 / postProcessing / surfacesample / ” ) ) ) ) ; 6casesList ( 1 ) = [ ] ; 7%I create a l i s t of d i r e c t o r i e s 8%Creating the data frame 9s6 = s t r u c t ( ” time ” , [ ] , ” data ” , s t r u c t ( ” x ” , [ ] , ” y ” , [ ] , ” z ” , [ ] , ” alpha ” , [ ] , ” dy ” , [ ] , ” dz ” , [ ] ) , ” midPoint ” , s t r u c t ( ” y ” , 0 , ” z ” , 0) , ” alphaMidP ” , [ ] , ” meanAlpha ” , [ ] , ” realTime ” , [ ] ) ; 10 s3 = s6 ; 11 s4 = s6 ; 12 s7 = s6 ; 13 s8 = s6 ; 14 s9 = s6 ; 15 16 %Surfaces alpha p l o t s 17 f o r i =1:1: length( casesList) 18 %Alpha per each surface point 19 [ f3 , err3 ] = fopen (”/home/ gi s / bubbleFV11 / postProcessing / surfacesample / ” + casesList ( i ) +” / alpha . gas surface3mm . raw ” , ’r’) ; 20 [ f4 , err4 ] = fopen (”/home/ gi s / bubbleFV11 / postProcessing / surfacesample / ” + casesList ( i ) +” / alpha . gas surface4mm . raw ” , ’r’) ; 21 [ f6 , err6 ] = fopen (”/home/ gi s / bubbleFV11 / postProcessing / surfacesample / ” + casesList ( i ) +” / alpha . gas surface6mm . raw ” , ’r’) ; 22 [ f7 , err7 ] = fopen (”/home/ gi s / bubbleFV11 / postProcessing / surfacesample / ” + casesList ( i ) +” / alpha . gas surface7mm . raw ” , ’r’) ; 23 [ f8 , err8 ] = fopen (”/home/ gi s / bubbleFV11 / postProcessing / surfacesample / ” + casesList ( i ) +” / alpha . gas surface8mm . raw ” , ’r’) ; 24 [ f9 , err9 ] = fopen (”/home/ gi s / bubbleFV11 / postProcessing / surfacesample / ” + casesList ( i ) +” / alpha . gas surface9mm . raw ” , ’r’) ; 25 %Mean Alpha per surface 26 [ f3m , err3m ] = fopen (”/home/ gis / bubbleFV11 / postProcessing / surface3mean / 0 / surfaceFieldValue . dat” , ’r’) ; 128 27 d = textscan ( f3m , ”%f64 %f64 ” , ” HeaderLines ” , 5 , ” De l i m i t e r ” , ”\n ” ) ; 28 fclose( f3m ) ; 29 d3 = cel l2 ma t ( d ) ; 30 s3 . realTime = d3 ( : , 1 ) ; 31 s3 . meanAlpha = d3 ( : , 2 ) ; 32 [ f4m , err4m ] = fopen (”/home/ gis / bubbleFV11 / postProcessing / surface4mean / 0 / surfaceFieldValue . dat” , ’r’) ; 33 d = textscan ( f4m , ”%f64 %f64 ” , ” HeaderLines ” , 5 , ” De l i m i t e r ” , ”\n ” ) ; 34 fclose( f4m ) ; 35 d4 = cel l2 ma t ( d ) ; 36 s4 . realTime = d4 ( : , 1 ) ; 37 s4 . meanAlpha = d4 ( : , 2 ) ; 38 [ f6m , err6m ] = fopen (”/home/ gis / bubbleFV11 / postProcessing / surface6mean / 0 / surfaceFieldValue . dat” , ’r’) ; 39 d = textscan ( f6m , ”%f64 %f64 ” , ” HeaderLines ” , 5 , ” De l i m i t e r ” , ”\n ” ) ; 40 fclose( f6m ) ; 41 d6 = cel l2 ma t ( d ) ; 42 s6 . realTime = d6 ( : , 1 ) ; 43 s6 . meanAlpha = d6 ( : , 2 ) ; 44 [ f7m , err7m ] = fopen (”/home/ gis / bubbleFV11 / postProcessing / surface7mean / 0 / surfaceFieldValue . dat” , ’r’) ; 45 d = textscan ( f7m , ”%f64 %f64 ” , ” HeaderLines ” , 5 , ” De l i m i t e r ” , ”\n ” ) ; 46 fclose( f7m ) ; 47 d7 = cel l2 ma t ( d ) ; 48 s7 . realTime = d7 ( : , 1 ) ; 49 s7 . meanAlpha = d7 ( : , 2 ) ; 50 [ f8m , err8m ] = fopen (”/home/ gis / bubbleFV11 / postProcessing / surface8mean / 0 / surfaceFieldValue . dat” , ’r’) ; 51 d = textscan ( f8m , ”%f64 %f64 ” , ” HeaderLines ” , 5 , ” De l i m i t e r ” , ”\n ” ) ; 52 fclose( f8m ) ; 53 d8 = cel l2 ma t ( d ) ; 54 s8 . realTime = d8 ( : , 1 ) ; 55 s8 . meanAlpha = d8 ( : , 2 ) ; 56 [ f9m , err9m ] = fopen (”/home/ gis / bubbleFV11 / postProcessing / surface9mean / 0 / surfaceFieldValue . dat” , ’r’) ; 57 d = textscan ( f9m , ”%f64 %f64 ” , ” HeaderLines ” , 5 , ” De l i m i t e r ” , ”\n ” ) ; 58 fclose( f9m ) ; 59 d9 = cel l2 ma t ( d ) ; 60 s9 . realTime = d9 ( : , 1 ) ; 61 s9 . meanAlpha = d9 ( : , 2 ) ; 62 i f f3 == −1 63 fprintf(”========\nCannot open the f i l e f3 : error %g , %g\n ” , err3 , i ) ; 64 elseif f4 == −1 65 fprintf(”========\nCannot open the f i l e f4 : error %g , %g\n ” , err4 , i ) ; 66 elseif f6 == −1 67 fprintf(”========\nCannot open the f i l e f6 : error %g , %g\n ” , err6 , i ) ; 68 elseif f7 == −1 69 fprintf(”========\nCannot open the f i l e f7 : error %g , %g\n ” , err7 , i ) ; 70 elseif f8 == −1 71 fprintf(”========\nCannot open the f i l e f8 : error %g , %g\n ” , err8 , i ) ; 72 elseif f9 == −1 73 fprintf(”========\nCannot open the f i l e f9 : error %g , %g\n ” , err9 , i ) ; 74 elseif f3m == −1 75 fprintf(”========\nCannot open the f i l e f3m : error %g , %g\n ” , err3m , i ) ; 76 elseif f4m == −1 77 fprintf(”========\nCannot open the f i l e f4m : error %g , %g\n ” , err4m , i ) ; 78 elseif f6m == −1 79 fprintf(”========\nCannot open the f i l e f6m : error %g , %g\n ” , err6m , i ) ; 80 elseif f7m == −1 81 fprintf(”========\nCannot open the f i l e f7m : error %g , %g\n ” , err7m , i ) ; 82 elseif f8m == −1 83 fprintf(”========\nCannot open the f i l e f8m : error %g , %g\n ” , err8m , i ) ; 84 elseif f9m == −1 85 fprintf(”========\nCannot open the f i l e f3m : error %g , %g\n ” , err9m , i ) ; 86 else 87 format long ; 88 s3 . time ( i ) = double ( s t r i n g ( casesList ( i ) ) ) ; 89 s4 . time ( i ) = double ( s t r i n g ( casesList ( i ) ) ) ; 90 s6 . time ( i ) = double ( s t r i n g ( casesList ( i ) ) ) ; 91 s7 . time ( i ) = double ( s t r i n g ( casesList ( i ) ) ) ; 92 s8 . time ( i ) = double ( s t r i n g ( casesList ( i ) ) ) ; 93 s9 . time ( i ) = double ( s t r i n g ( casesList ( i ) ) ) ; 94 %F i l l s3 95 n = 1; 96 while ˜fe o f ( f3 ) 97 l i n e =fgetl( f3 ) ; 98 words = s t r s p l i t ( l i n e ,’ ’ ) ; 99 i f strcmp ( words (1 ) , ’ # ’ ) == 0 % 0 to be d i f f e r e n t , 1 to be equal 100 %F i r s t value is at the top of the f i l e . Many values f o r each time ( i ) − data ( i ) 101 format long ; 102 s3 . data ( i ) . x ( n ) = double ( s t r i n g ( words (1 ) ) ) ; 103 s3 . data ( i ) . y ( n ) = double ( s t r i n g ( words (2 ) ) ) ; 104 s3 . data ( i ) . z ( n ) = double ( s t r i n g ( words (3 ) ) ) ; 105 s3 . data ( i ) . alpha ( n) = double ( s t r i n g ( words (4 ) ) ) ; 106 n = n+1; 107 end 108 end 109 fclose( f3 ) ; 110 %F i l l s4 111 n = 1; 112 while ˜fe o f ( f4 ) 113 l i n e =fgetl( f4 ) ; 114 words = s t r s p l i t ( l i n e ,’ ’ ) ; 115 i f strcmp ( words (1 ) , ’ # ’ ) == 0 116 format long ; 117 s4 . data ( i ) . x ( n ) = double ( s t r i n g ( words (1 ) ) ) ; 118 s4 . data ( i ) . y ( n ) = double ( s t r i n g ( words (2 ) ) ) ; 119 s4 . data ( i ) . z ( n ) = double ( s t r i n g ( words (3 ) ) ) ; 120 s4 . data ( i ) . alpha ( n) = double ( s t r i n g ( words (4 ) ) ) ; 121 n = n+1; 122 end 123 end 124 fclose( f4 ) ; 125 %F i l l s6 126 n = 1; 127 while ˜fe o f ( f6 ) 128 l i n e =fgetl( f6 ) ; 129 words = s t r s p l i t ( l i n e ,’ ’ ) ; 130 i f strcmp ( words (1 ) , ’ # ’ ) == 0 131 format long ; 132 s6 . data ( i ) . x ( n ) = double ( s t r i n g ( words (1 ) ) ) ; 133 s6 . data ( i ) . y ( n ) = double ( s t r i n g ( words (2 ) ) ) ; 134 s6 . data ( i ) . z ( n ) = double ( s t r i n g ( words (3 ) ) ) ; 135 s6 . data ( i ) . alpha ( n) = double ( s t r i n g ( words (4 ) ) ) ; 136 n = n+1; 137 end 138 end 139 fclose( f6 ) ; 140 %F i l l s7 141 n = 1; 142 while ˜fe o f ( f7 ) 143 l i n e =fgetl( f7 ) ; 144 words = s t r s p l i t ( l i n e ,’ ’ ) ; 145 i f strcmp ( words (1 ) , ’ # ’ ) == 0 146 format long ; 147 s7 . data ( i ) . x ( n ) = double ( s t r i n g ( words (1 ) ) ) ; 148 s7 . data ( i ) . y ( n ) = double ( s t r i n g ( words (2 ) ) ) ; 149 s7 . data ( i ) . z ( n ) = double ( s t r i n g ( words (3 ) ) ) ; 150 s7 . data ( i ) . alpha ( n) = double ( s t r i n g ( words (4 ) ) ) ; 151 n = n+1; 152 end 153 end 154 fclose( f7 ) ; 155 %F i l l s8 156 n = 1; 157 while ˜fe o f ( f8 ) 158 l i n e =fgetl( f8 ) ; 159 words = s t r s p l i t ( l i n e ,’ ’ ) ; 160 i f strcmp ( words (1 ) , ’ # ’ ) == 0 161 format long ; 162 s8 . data ( i ) . x ( n ) = double ( s t r i n g ( words (1 ) ) ) ; 163 s8 . data ( i ) . y ( n ) = double ( s t r i n g ( words (2 ) ) ) ; 164 s8 . data ( i ) . z ( n ) = double ( s t r i n g ( words (3 ) ) ) ; 165 s8 . data ( i ) . alpha ( n) = double ( s t r i n g ( words (4 ) ) ) ; 166 n = n+1; 167 end 168 end 169 fclose( f8 ) ; 170 %F i l l s9 171 n = 1; 172 while ˜fe o f ( f9 ) 173 l i n e =fgetl( f9 ) ; 174 words = s t r s p l i t ( l i n e ,’ ’ ) ; 175 i f strcmp ( words (1 ) , ’ # ’ ) == 0 176 format long ; 177 s9 . data ( i ) . x ( n ) = double ( s t r i n g ( words (1 ) ) ) ; 178 s9 . data ( i ) . y ( n ) = double ( s t r i n g ( words (2 ) ) ) ; 179 s9 . data ( i ) . z ( n ) = double ( s t r i n g ( words (3 ) ) ) ; 180 s9 . data ( i ) . alpha ( n) = double ( s t r i n g ( words (4 ) ) ) ; 181 n = n+1; 182 end 183 end 184 fclose( f9 ) ; 185 end 186 187 %Find midPoint alpha , s3 188 f o r t =1:1: length( s3 . time ) 189 for p=1:1: length ( s3 . data ( t ) . y ) 190 format long ; 191 s3 . data ( t ) . dy (p ) = abs( s3 . data ( t ) . y (p ) +0.0005) ; %y<0 192 s3 . data ( t ) . dz (p ) = abs( s3 . data ( t ) . z ( p ) −0.0005) ; %z>0 193 end 194 %Let ’ s f i n d the minimum d i ff e r en c e with the midPoint , which should have a common index f o r both y and z . 195 minimaY = min ( s3 . data ( t ) . dy ) ; 196 [ miny , indexy ] = f i n d ( s3 . data ( t ) . dy == minimaY ) ; 197 for q = 1 : 1 : length( indexy ) 198 minzV ( q ) = s3 . data ( t ) . dz ( indexy ( q ) ) ; 199 end 200 minimaZ = min ( minzV ) ; 201 [ minz , indexz ] = f i n d ( minzV == minimaZ ) ; 202 zReal = indexy ( indexz ) ; 203 format long ; 204 s3 . midPoint ( t ) . y = s3 . data ( t ) . y ( zReal ) ; 205 s3 . midPoint ( t ) . z = s3 . data ( t ) . z ( zReal ) ; 206 s3 . alphaMidP ( t ) = s3 . data ( t ) . alpha ( zReal ) ; 207 end 208 timecontour = input ( ” I n s e r t a number from 1 to 1000 ( time increases ) : ” ) ; 209 [ meshCy, meshCz ] = meshgrid ( unique ( s3 . data ( timecontour ) . y ) , unique ( s3 . data ( timecontour ) . z ) ) ; 210 F = s c a t t e r e d I n t e r p o l a n t ( s3 . data ( timeco ntour ) . y ’ , s3 . data ( timecontour ) . z ’ , s3 . data ( timecontour ) . alpha ’ ) ; 211 i n t e r p o l a t e d d a t a = F (meshCy , meshCz) ; 212 figure(1 ) 213 su r f (meshCy, meshCz, interpolate d d a t a , ’ EdgeColor ’ ,’ none ’ ) ; 214 title ( ” Contour p l o t of S3mm alpha , seen from gas I n l e t ” ) ; xlabel ( ” y axis ” ) ; ylabel ( ” z axis ” ) ; 215 axis ([ −0.001 0 0 0.001 0 1 ] ) 216 view(−180,−90) %changes the view of the plane , as i f i t was seen from the gasInlet (−Y) 217 colormap j e t ;caxis ([0 1]) ; colorbar 218 219 %Find midPoint alpha , s4 220 f o r t =1:1: length( s4 . time ) 221 for p=1:1: length ( s4 . data ( t ) . y ) 222 format long ; 223 s4 . data ( t ) . dy (p ) = abs( s4 . data ( t ) . y (p ) +0.0005) ; %y<0 224 s4 . data ( t ) . dz (p ) = abs( s4 . data ( t ) . z ( p ) −0.0005) ; %z>0 225 end 226 minimaY = min ( s4 . data ( t ) . dy ) ; 227 [ miny , indexy ] = f i n d ( s4 . data ( t ) . dy == minimaY ) ; 228 for q = 1 : 1 : length( indexy ) 229 minzV ( q ) = s4 . data ( t ) . dz ( indexy ( q ) ) ; 230 end 231 minimaZ = min ( minzV ) ; 232 [ minz , indexz ] = f i n d ( minzV == minimaZ ) ; 233 zReal = indexy ( indexz ) ; 234 format long ; 235 s4 . midPoint ( t ) . y = s4 . data ( t ) . y ( zReal ) ; 236 s4 . midPoint ( t ) . z = s4 . data ( t ) . z ( zReal ) ; 237 s4 . alphaMidP ( t ) = s4 . data ( t ) . alpha ( zReal ) ; 238 end 239 timecontour = input ( ” I n s e r t a number from 1 to 1000 ( time increases ) : ” ) ; 240 [ meshCy, meshCz ] = meshgrid ( unique ( s4 . data ( timecontour ) . y ) , unique ( s4 . data ( timecontour ) . z ) ) ; 241 F = s c a t t e r e d I n t e r p o l a n t ( s4 . data ( timeco ntour ) . y ’ , s4 . data ( timecontour ) . z ’ , s4 . data ( timecontour ) . alpha ’ ) ; 242 i n t e r p o l a t e d d a t a = F (meshCy , meshCz) ; 243 figure(2 ) 244 su r f (meshCy, meshCz, interpolate d d a t a , ’ EdgeColor ’ ,’ none ’ ) ; 245 title ( ” Contour p l o t of S4mm alpha , seen from gas I n l e t ” ) ; xlabel ( ” y axis ” ) ; ylabel ( ” z axis ” ) ; 246 axis ([ −0.001 0 0 0.001 0 1 ] ) 247 view(−180,−90) %changes the view of the plane , as i f i t was seen from the gasInlet (−Y) 248 colormap j e t ;caxis ([0 1]) ; colorbar 249 250 %Find midPoint alpha , s6 251 f o r t =1:1: length( s6 . time ) 252 for p=1:1: length ( s6 . data ( t ) . y ) 253 format long ; 254 s6 . data ( t ) . dy (p ) = abs( s6 . data ( t ) . y (p ) +0.0005) ; %y<0 255 s6 . data ( t ) . dz (p ) = abs( s6 . data ( t ) . z ( p ) −0.0005) ; %z>0 256 end 257 minimaY = min ( s6 . data ( t ) . dy ) ; 258 [ miny , indexy ] = f i n d ( s6 . data ( t ) . dy == minimaY ) ; 259 for q = 1 : 1 : length( indexy ) 260 minzV ( q ) = s6 . data ( t ) . dz ( indexy ( q ) ) ; 261 end 262 minimaZ = min ( minzV ) ; 263 [ minz , indexz ] = f i n d ( minzV == minimaZ ) ; 264 zReal = indexy ( indexz ) ; 265 format long ; 266 s6 . midPoint ( t ) . y = s6 . data ( t ) . y ( zReal ) ; 267 s6 . midPoint ( t ) . z = s6 . data ( t ) . z ( zReal ) ; 268 s6 . alphaMidP ( t ) = s6 . data ( t ) . alpha ( zReal ) ; 269 end 270 timecontour = input ( ” I n s e r t a number from 1 to 1000 ( time increases ) : ” ) ; 271 [ meshCy, meshCz ] = meshgrid ( unique ( s6 . data ( timecontour ) . y ) , unique ( s6 . data ( timecontour ) . z ) ) ; 272 F = s c a t t e r e d I n t e r p o l a n t ( s6 . data ( timeco ntour ) . y ’ , s6 . data ( timecontour ) . z ’ , s6 . data ( timecontour ) . alpha ’ ) ; 273 i n t e r p o l a t e d d a t a = F (meshCy , meshCz) ; 274 figure(3 ) 275 su r f (meshCy, meshCz, interpolate d d a t a , ’ EdgeColor ’ ,’ none ’ ) ; 276 title ( ” Contour p l o t of S6mm alpha , seen from gas I n l e t ” ) ; xlabel ( ” y axis ” ) ; ylabel ( ” z axis ” ) ; 277 axis ([ −0.001 0 0 0.001 0 1 ] ) 278 view(−180,−90) %changes the view of the plane , as i f i t was seen from the gasInlet (−Y) 279 colormap j e t ;caxis ([0 1]) ; colorbar 280 281 %Find midPoint alpha , s7 282 f o r t =1:1: length( s7 . time ) 283 for p=1:1: length ( s7 . data ( t ) . y ) 284 format long ; 285 s7 . data ( t ) . dy (p ) = abs( s7 . data ( t ) . y (p ) +0.0005) ; %y<0 286 s7 . data ( t ) . dz (p ) = abs( s7 . data ( t ) . z ( p ) −0.0005) ; %z>0 287 end 288 minimaY = min ( s7 . data ( t ) . dy ) ; 289 [ miny , indexy ] = f i n d ( s7 . data ( t ) . dy == minimaY ) ; 290 for q = 1 : 1 : length( indexy ) 291 minzV ( q ) = s7 . data ( t ) . dz ( indexy ( q ) ) ; 292 end 293 minimaZ = min ( minzV ) ; 294 [ minz , indexz ] = f i n d ( minzV == minimaZ ) ; 295 zReal = indexy ( indexz ) ; 296 format long ; 297 s7 . midPoint ( t ) . y = s7 . data ( t ) . y ( zReal ) ; 298 s7 . midPoint ( t ) . z = s7 . data ( t ) . z ( zReal ) ; 299 s7 . alphaMidP ( t ) = s7 . data ( t ) . alpha ( zReal ) ; 300 end 301 timecontour = input ( ” I n s e r t a number from 1 to 1000 ( time increases ) : ” ) ; 302 [ meshCy, meshCz ] = meshgrid ( unique ( s7 . data ( timecontour ) . y ) , unique ( s7 . data ( timecontour ) . z ) ) ; 303 F = s c a t t e r e d I n t e r p o l a n t ( s7 . data ( timeco ntour ) . y ’ , s7 . data ( timecontour ) . z ’ , s7 . data ( timecontour ) . alpha ’ ) ; 304 i n t e r p o l a t e d d a t a = F (meshCy , meshCz) ; 305 figure(4 ) 306 su r f (meshCy, meshCz, interpolate d d a t a , ’ EdgeColor ’ ,’ none ’ ) ; 307 title ( ” Contour p l o t of S7mm alpha , seen from gas I n l e t ” ) ; xlabel ( ” y axis ” ) ; ylabel ( ” z axis ” ) ; 308 axis ([ −0.001 0 0 0.001 0 1 ] ) 309 view(−180,−90) %changes the view of the plane , as i f i t was seen from the gasInlet (−Y) 310 colormap j e t ;caxis ([0 1]) ; colorbar 311 312 %Find midPoint alpha , s8 313 f o r t =1:1: length( s8 . time ) 314 for p=1:1: length ( s8 . data ( t ) . y ) 315 format long ; 316 s8 . data ( t ) . dy (p ) = abs( s8 . data ( t ) . y (p ) +0.0005) ; %y<0 317 s8 . data ( t ) . dz (p ) = abs( s8 . data ( t ) . z ( p ) −0.0005) ; %z>0 318 end 319 minimaY = min ( s8 . data ( t ) . dy ) ; 320 [ miny , indexy ] = f i n d ( s8 . data ( t ) . dy == minimaY ) ; 321 for q = 1 : 1 : length( indexy ) 322 minzV ( q ) = s8 . data ( t ) . dz ( indexy ( q ) ) ; 323 end 324 minimaZ = min ( minzV ) ; 325 [ minz , indexz ] = f i n d ( minzV == minimaZ ) ; 326 zReal = indexy ( indexz ) ; 327 format long ; 328 s8 . midPoint ( t ) . y = s8 . data ( t ) . y ( zReal ) ; 329 s8 . midPoint ( t ) . z = s8 . data ( t ) . z ( zReal ) ; 330 s8 . alphaMidP ( t ) = s8 . data ( t ) . alpha ( zReal ) ; 331 end 332 timecontour = 605; %i np ut ( ” I n s e r t a number from 1 to 1000 ( time increases ) : ” ) ; 333 [ meshCy, meshCz ] = meshgrid ( unique ( s8 . data ( timecontour ) . y ) , unique ( s8 . data ( timecontour ) . z ) ) ; 334 F = s c a t t e r e d I n t e r p o l a n t ( s8 . data ( timeco ntour ) . y ’ , s8 . data ( timecontour ) . z ’ , s8 . data ( timecontour ) . alpha ’ ) ; 335 i n t e r p o l a t e d d a t a = F (meshCy , meshCz) ; 336 figure(5 ) 337 su r f (meshCy, meshCz, interpolate d d a t a , ’ EdgeColor ’ ,’ none ’ ) ; 338 title ( ” Contour p l o t of S8mm alpha , seen from gas I n l e t ” , ” Fontsize ” ,1 5) ; xlabel ( ” y axis ” , ” Fontsize ” ,12) ; ylabel ( ” z axis ” , ” Fontsize ” ,1 2) ; 339 axis ([ −0.001 0 0 0.001 0 1 ] ) 340 view(−180,−90) %changes the view of the plane , as i f i t was seen from the gasInlet (−Y) 341 colormap j e t ;caxis ([0 1]) ; colorbar 342 343 %Find midPoint alpha , s9 344 f o r t =1:1: length( s9 . time ) 345 for p=1:1: length ( s9 . data ( t ) . y ) 346 format long ; 347 s9 . data ( t ) . dy (p ) = abs( s9 . data ( t ) . y (p ) +0.0005) ; %y<0 348 s9 . data ( t ) . dz (p ) = abs( s9 . data ( t ) . z ( p ) −0.0005) ; %z>0 349 end 350 minimaY = min ( s9 . data ( t ) . dy ) ; 351 [ miny , indexy ] = f i n d ( s9 . data ( t ) . dy == minimaY ) ; 352 for q = 1 : 1 : length( indexy ) 353 minzV ( q ) = s9 . data ( t ) . dz ( indexy ( q ) ) ; 354 end 355 minimaZ = min ( minzV ) ; 356 [ minz , indexz ] = f i n d ( minzV == minimaZ ) ; 357 zReal = indexy ( indexz ) ; 358 format long ; 359 s9 . midPoint ( t ) . y = s9 . data ( t ) . y ( zReal ) ; 360 s9 . midPoint ( t ) . z = s9 . data ( t ) . z ( zReal ) ; 361 s9 . alphaMidP ( t ) = s9 . data ( t ) . alpha ( zReal ) ; 362 end 363 timecontour = input ( ” I n s e r t a number from 1 to 1000 ( time increases ) : ” ) ; 364 [ meshCy, meshCz ] = meshgrid ( unique ( s9 . data ( timecontour ) . y ) , unique ( s9 . data ( timecontour ) . z ) ) ; 365 F = s c a t t e r e d I n t e r p o l a n t ( s9 . data ( timeco ntour ) . y ’ , s9 . data ( timecontour ) . z ’ , s9 . data ( timecontour ) . alpha ’ ) ; 366 i n t e r p o l a t e d d a t a = F (meshCy , meshCz) ; 367 figure(6 ) 368 su r f (meshCy, meshCz, interpolate d d a t a , ’ EdgeColor ’ ,’ none ’ ) ; 369 title ( ” Contour p l o t of S9mm alpha , seen from gas I n l e t ” ) ; xlabel ( ” y axis ” ) ; ylabel ( ” z axis ” ) ; 370 axis ([ −0.001 0 0 0.001 0 1 ] ) 371 view(−180,−90) %changes the view of the plane , as i f i t was seen from the gasInlet (−Y) 372 colormap j e t ;caxis ([0 1]) ; colorbar 373 374 %Subplots midPoint alpha ( Usg , Lb , fb ) 375 figure(7 ) 376 subplot(6 , 1 , 1) ; 377 p l o t ( s3 . time , s3 . alphaMidP ) ; 378 title ( ” Bubbles at Surface 3 mm ( midPoint ) ” , ” FontSize ” ,14) ; ylabel ( ” Ai r Fraction ” , ” FontSize ” ,12) ; 379 subplot(6 , 1 , 2) ; 380 p l o t ( s4 . time , s4 . alphaMidP ) ; 381 title ( ” Bubbles at Surface 4 mm ( midPoint ) ” , ” FontSize ” ,14) ; ylabel ( ” Ai r Fraction ” , ” FontSize ” ,12) ; 382 subplot(6 , 1 , 3) ; 383 p l o t ( s6 . time , s6 . alphaMidP ) ; 384 title ( ” Bubbles at Surface 6 mm ( midPoint ) ” , ” FontSize ” ,14) ; ylabel ( ” Ai r Fraction ” , ” FontSize ” ,12) ; 385 subplot(6 , 1 ,4) ; 386 p l o t ( s7 . time , s7 . alphaMidP ) ; 387 title ( ” Bubbles at Surface 7 mm ( midPoint ) ” , ” FontSize ” ,14) ; ylabel ( ” Ai r Fraction ” , ” FontSize ” ,12) ; 388 subplot(6 , 1 ,5) ; 389 p l o t ( s8 . time , s8 . alphaMidP ) ; 390 title ( ” Bubbles at Surface 8 mm ( midPoint ) ” , ” FontSize ” ,14) ; ylabel ( ” Ai r Fraction ” , ” FontSize ” ,12) ; ylim ( [0 1 . 1 ] ) ; 391 subplot(6 , 1 ,6) ; 392 p l o t ( s9 . time , s9 . alphaMidP ) ; 393 title ( ” Bubbles at Surface 9 mm ( midPoint ) ” , ” FontSize ” ,14) ; ylabel ( ” Ai r Fraction ” , ” FontSize ” ,12) ; 394 xlabel ( ” Time ( s ) ” , ” FontSize ” ,1 2) ;