“Capillary Race” in Circular Tubes Using Openfoam 1 Tutorial
Total Page:16
File Type:pdf, Size:1020Kb
\Capillary Race" in Circular Tubes using OpenFOAM Duc Nguyen [email protected] March 22, 2014 1 Tutorial Overview This tutorial presents two major topics: the introduction to OpenFOAM, a well-known open- source CFD code, and the instruction for using it to obtain numerical results and visual simulation to fluid mechanics problems. In the first part, an introduction to OpenFOAM is presented and followed by the instruction to build OpenFOAM framework on a personal computer. Next, the standard steps to achieve simulation are presented from pre-processing, setting up and controlling the solver to post-processing. These tasks are done by a set of open-source tools and utilities such as Salome, Paraview, PyFoam, etc. which are also covered in this tutorial as part of the OpenFOAM Framework. The fluid mechanics problems for simulation in this tutorial is the phenomenon of liquid column rising in square tubes with different side length in micro gravity environment. This problem is inferred in this tutorial as \Capillary Race" problem. Following the tutorials, the numerical results and visual simulation are obtained to compare with the experimental data using drop tower mentioned in [16]. 2 Introduction to OpenFOAM Framework OpenFOAM [8] is an open-source CFD toolbox started in 2004. The code was initially developed late 1980s at Imperial College and now is distributed by OpenFOAM foundation and maintained by ESI group, a French-based CAE software company. OpenFOAM is a set of solvers and utilities primarily for CFD with capabilities of standard tasks of CFD working flow from pre-processing, solving and post-processing. OpenFOAM solves wide-rage of problem from incompressible flow, heat transfer to turbulence modeling and fluid structure interaction; it is also not limited to fluid mechanics and is being developed as general modelling platform including mutltiphysic simulation, numerical analysis and differential solver. For the last decade, OpenFOAM has recently raised its popularity with a vibrant user base as can be shown in Figure 1 showing the OpenFOAM download for countries around the world. Figure 1: OpenFOAM download for countries around the world 1 ME448 \Capillary Race" in Circular Tubes using OpenFOAM Duc Nguyen \Today, OpenFOAM is a proven player in commercial CFD and academic research" [12], said Hrvoje Jasak, main creator of OpenFOAM and also Director of Wikki Ltd., a UK-based Open- FOAM Consultancy said in the 6th International OpenFOAM Workshop [9], Penn State University in 2011. The OpenFoam workshop has been annually held since 2006 visting 6 countries in 3 con- tinents. Main users of OpenFOAM include industrial CFD consultancies, academic institution, community. According to extend-project.de [3], the major OpenFOAM community, around 50 groups are active around the world using and developing OpenFOAM as the main research and/or services. Several groups with details information are listed in Appendix A of this tutorial. The contributions of users from these vibrant community such as creating and sharpening solvers for OpenFOAM are frequent, many are on monthly basis; this strengthens the power OpenFOAM. In this tutorials, an example of using OpenFOAM for CFD purpose is introduced. OpenFOAM core package is combined with third party tools for enhancing CFD work flow of OpenFOAM. This approach is so-called in this tutorial as OpenFOAM Framework and is described Figure 2. Open-source enables OpenFOAM to couple with numerous third-party enhancing tools including also optimization tool such as DAKOTA [6] and high quality rendering tools such as Blender [2] which go beyond the regular scope of CFD work flow. This tutorial introduces several tools and choose some of those as the tools to solve the problem in this tutorial and to detail the instruc- tion. SALOME [11], a well-known CAE platform, is used for pre-processing, ParaView [10], also a well-known visualization program for post-processing, matplotlib [7] for plotting, built-in Open- FOAM utilites and Python program such as PyFoam [4] and swak4Foam [5] for manipulating the OpenFOAM solver. Appendix B provides a description of several notable tools to work within OpenFOAM framework. This tutorial opens the door for users to open-source code world and learning opportunities of UNIX, python, C programming, and code development. It also fosters users understanding of the underlying algorithms and computation for numerical simulation. Figure 2: OpenFOAM Framework Structure 2 of 51 ME448 \Capillary Race" in Circular Tubes using OpenFOAM Duc Nguyen 3 The \Capillary Race" Overview This subject of this tutorial is simulation of sudden capillary rise in families of cylindrical tubes in micro- gravity environment during drop tower experiments. Such experiments typically consist of a fluid filled chamber mounted to an experiment rig which is then dropped while a high-speed cameras captures the response of the fluid. The experiment corresponding to this tutorials is part of the meticulous and tremendous research by Wollman [16] using novel Dryden Drop Tower at PSU. It features four cylindrical tubes with 2.9, 3.8, 7.1 and 10.8 mm of ID with length of 160 mm each partially submerging width depth of 10mm in PDMS that fills a reservoir. These four cylinders then experience 2s drop test in which the capillary forces dominate driving the rise. The rate of the rise is different so that synchronization the video of these rises looks like a \Capillary Race" as shown in Figure 3. The rate of capillary rise has been studied using analytical method by Washburn [15] while digitized values from experiments for the rise height of the bulk meniscus are used by Wollman [16]. In this tutorial, the same experiment will be set up in OpenFOAM framework aiming to produce the corresponding CFD simulation. The simulation produces animation which could be directly compared with experimental video; it is also can be extracted for plotting against experimental data for the rise height of the bulk meniscus as shown in Figure 4. Figure 3: \(C) Dynamic rise heights of the menisci in (a)2.9, (b)3.8, (c)7.1, and (d)10.8mm ID circular tubes are shown after 2s of flow where 0.65cS PDMS rises a maximum length of 143mmin (b) 3.8mm ID tube. The arrow highlights the optimal tube used to achieve maximum flow length within the freefall time. (D) Dynamic rise heights of the menisci in (a)2.9, (b)3.8, (c)7.1,and (d)10.8mm ID circular tubes are shown after 2s of flow where 5cS PDMS rises a maximum length of 67mmin (d) 10.8mm ID tube. The arrow highlights the optimal tube used to achieve maximumflow length within the freefall time." [16] 3 of 51 ME448 \Capillary Race" in Circular Tubes using OpenFOAM Duc Nguyen Figure 4: \Sample of reduced data from tests performed in Fig. 2.1b, where the capillary rise in circular tubes height l (t) is plotted against t and t 1/2 for 0.65cS (solid symbols) and 5cS PDMS (open symbols). Predicting the flow that travels the farthest in the 2.1s drop time available is an optimization problem between capillary, inertial, and viscous forces as functions of tube dimensions." [16] 4 The Overall Workflow The tutorial presents step-by-step instruction to solve the \Capillary Race" problem based on the OpenFOAM framework. The following list outlines the steps from initial setup to the simulation result: 1. Building OpenFOAM Framework on a Personal Computer 2. Prepare Geometry, Mesh with SALOME 3. Introduction to OpenFOAM directory structure 4. Prepare an OpenFOAM case directory and importing the mesh 5. Setting Transport Properties, Initial and Boundary Conditons. Setting Solver Parameters and Stopping Criteria for Transient Solution 6. Running the solver and Extracting Data with PyFoam and swak4Foam 7. Visualization with ParaView, Video encoding the results with avconv, Plotting the results with matplotlib 5 Building OpenFOAM Framework on a Personal Computer 5.1 Building a Ubuntu on VMware • The first step of buidling OpenFOAM Framework is to install an operating system on which it runs. In this tutorial, the choosen method is to build Ubuntu, a free operating system on a virtual machine, VMware Player, also a free and popular virtual machine software. VMware Player software is installed on a host computer installed with Windows 7 (64-bit). 4 of 51 ME448 \Capillary Race" in Circular Tubes using OpenFOAM Duc Nguyen • Go to https://my.vmware.com/web/vmware/free and create a free account to download a free version of VMware Player compatible with Windows 7 (64-bit) • Installation of VMware Player is similiar to other Windows 7 software. After installation, the start screen of VMware Player looks like below: • An image of Ubuntu 13.04 (64-bit) code-name Raring Ringtail is recommended as the operat- ing system for OpenFOAM framework to run on. Go to http://www.ubuntu.com/download/ desktop to download a copy. The file should be ubuntu-13.04-desktop-amd64.iso • Click on Create a new Virtual Machine and choose the file downloaded on the above step as the installer disc image file • The next steps include naming the virtual machine, setting a personal account, specifying the disk capacity for your virtual machine. It is recommended to have at least 20GB for the disk size and stored as a single file to enhance the performance of the virtual machine or as Split for moderate amount of capacity. During installation, other hardware configuration is also required. Below is an example of configuration for a virtual machine. Click Finish to start the installation of Ubuntu. • Internet connection is mandatory since the VMware Player needs to download the VMWare Tools for Linux. The installation of Ubuntu comes shortly after. 5 of 51 ME448 \Capillary Race" in Circular Tubes using OpenFOAM Duc Nguyen • The installation takes around 30 to 40 minutes.