Umeå University Department of Physics FLUID DYNAMICS Computer laboratories using COMSOL 4.3a Lecturer: Vitaly Bychkov Lab. Supervisors: Oleksii Iukhymenko (oleksii.iukhymenko@physics.umu.se) Erik Löfgren Umeå, 2014 Report requirements In order to pass the computer labs every student has to either show all results of all 3 labs to a supervisor during the classes (see the schedule) or write and send by e-mail a brief report including all necessary plots and the answers to all the questions. If you fail to present the first or the second labs during their classes there is no need to make a report for them. A report is needed in a single case: if you haven’t passed the labs or some of the labs after the last lab day. Computer labs must be done by every student personally, not by a group. The reports should be sent to my e-mail (oleksii.iukhymenko@physics.umu.se) before Midsommerdagen, 2014-06-21, 23:59. It is more convenient if you mention your name in the report file name, like “Eric_Andersson_fluid_2013” or similar. Students, who are not experienced enough in COMSOL to do the fluid dynamics labs, might go through “Introduction to COMSOL”. Attention! Those exercises (Introduction to COMSOL) are optional, and are not required for the fluid dynamics course. Introduction What is COMSOL? Here is a short introduction into COMSOL 4.3a program package. Several previous versions of this software have is been used in computer labs in Fluid Dynamics, Vector Analysis, Electrostatics, Electrodynamics, and in other related courses. COMSOL 4.3a is a powerful software package based on the Finite Elements Method (FEM) for solving Partial Differential Equations (PDE). It is written in a special programming language and includes a number of built-up modules and submodules. COMSOL has an interactive Graphical User Interface and can be run together with MATLAB (although using appropriate module). COMSOL provides extremely useful and representative tools for preliminary studies as well as thorough research in many different areas of physics. Besides it perfectly suits education purposes, showing first results just after a few mouse clicks. 2 What are we going to study? The main purpose of the following labs is to study some examples of incompressible flows: flows inside channels and pipes, flows outside cylinders and spheres and flows outside other objects with more complex shape, like an aerofoil. With the help of COMSOL you will see the flow fields distributions, like velocity and pressure in a chosen geometry; integration procedure to calculate drag and lift forces is also rather simple, as you will see below. The flow motion is governed by the set of the Navier-Stokes equations together with the continuity equation ρ ∂v + ρ (v ⋅ ∇ )v = −∇P + µ∇ 2 v ∂t (1) ∇⋅v = 0, (2) where v is the flow velocity, ρ = const is the density, P is the pressure, and µ is the dynamic viscosity. Very often it is convenient to study a process in dimensionless variables, then in a steady state, stationary momentum equation takes form (u ⋅ ∇ )u = −∇Ρ + Re ∇ 2 u , where u = (3) v P ρUL is the scaled velocity, Ρ = and Re = is the Reynolds number and 2 ν U ρU ν = µ / ρ is the kinematic viscosity. In the first two labs we are going to study dependence of entry length and drag force against Reynolds number, so it is convenient to use this number as the main parameter to specify viscosity. First start of using COMSOL 4.3a. Launch COMSOL Multiphysics 4.3a from your desktop or under start button menu. In all the labs we will mostly consider two dimensional geometry, so you should choose 2D case in the Modal Wizard, and press Next button, see Fig. 1. In the next window of Model Wizard you select the physics involved, in our case it is Fluid Flows → Single-Phase Flow → Laminar Flow (This consequence can be a little bit different, but finally you should have single phase laminar flow), press Next button. And finally select Stationary Study Type, as we consider only stationary problems in these labs, and press Finish button. 3 Fig.1. Appearance of COMSOL 4.3a software. Now you see the Model Builder and it consists of several layers and sublayers. In the first one, Global Definition you can define important parameters and constant that you will use in the labs, like flow density, length sizes, velocity value. It is not necessary though it is much more convenient to have all the parameters in one place. Here you can also determine some value for Reynolds number and later we will substitute it into viscosity term. In the next section – Model you define you geometry, set the boundary and initial conditions. You can also take advantage of material database and specify some certain material, although in these labs we will use just a simplest model flow of unity density and viscosity defined through the Reynolds number. At the bottom of the Model section you can specify mesh settings; by default, it says Physics-Controlled mesh with Normal element size. The involved geometries in the labs are quite simple, so you can keep the mesh to be Physics-Controlled. Having created some object you can check that normal meshing provides sometimes rather coarse mesh hence it is better it change it to Finer or Extra fine mesh. Numerical solution to Navier-Stocks system of equations is very sensitive to the particular task parameters, although the considered problems are pretty simple. Still it is better and more accurate to use finer mesh resolution, however convergence problem may arise if you make it too fine. So if you have obtained such an error change the mesh resolution and see how it influences the results. These setting are common for all the labs you are to perform (with one exception in lab 2 for 3D case) within the course of Fluiddynamics. Other details of COMSOL option will be described further in the labs. Comment on the Reynolds numbers In all the labs we are working in a laminar case, so that the Reynolds number is limited to some critical value, about 100-1000, depending on particular geometry. If your solution doesn’t 4 converge, then probable you should reduce the Reynolds number. In the first two labs you are to study dependence against the Reynolds number, which implies that you should take sufficiently different values, coming from very viscous flow to almost turbulent one. Typical range of the Reynolds number is from 0.01 to 100, you can also try higher values, if the solution converges. Within this interval you should have about 10 points to draw the plot asked in a lab. Lab 1 Entry length in the Poiseuille flow In this Lab we consider a stationary incompressible flow in a tube in two geometries: first, in a 2D channel, and then in a cylindrical pipe. Two-dimensional channel flow We start with the simplest geometry of a channel of width d formed by two parallel plates as shown in Fig. 2. The plates are assumed to be infinitely long in the z - direction. Then the velocity depends on the x and y coordinates only. The velocity at the inlet ( x = 0 ) is u0 in the x direction. Downstream the inlet, the velocity profile resembles that of a fully developed Poiseuille flow in a channel 2 y 2 = u ( y ) U max 1 − . d (4) The flow in the configuration of Fig. 2 is characterized by the entry length, and the Reynolds number of the flow. The entry length may be defined as a distance from the inlet to the point on the x - axis where the flow becomes plain parallel and the velocity saturates to its maximal value. In order to determine entry length from COMSOL simulation you can fix some 5 Fig. 2. A flow between two parallel plates. velocity value close to the maximal one, 95% – 99% of the maximal value U max . This value can be determined by means of a cross-section along central line of the channel. Main Task: Determine the dependence of the entry length on the Reynolds number. You should plot this dependence together with the second task of this lab. Besides you should check that the velocity profile correspond to a fully developed Poiseuille flow, see Eq. 4. Draw the appropriate cross-section of the channel, to check the parabolic velocity profile. Below is a step-by-step instruction how to build the geometry and fulfil the lab tasks. In further labs these instructions won’t be repeated, so you are to get into the way of working with COMSOL during this lab. New actions can be described with fewer details, as major algorithm is the same. • Under Geometry section in Model Builder choose Draw Rectangle from the geometry toolbar above. At the next step you adjust its parameters like Width, Height and position coordinates; it is more convenient to use corner base with zero x-coordinate. • Your rectangle must be rather elongated, so that width to height ratio must be far from unity, around 10. 6 • Next step is to define important parameters of the flow. Right click on Global Definition and add Parameters section. Here you can specify density, inlet velocity, Reynolds number, and rectangle sizes as well, for example, give some name to density, say rho, print it under name, and in expression section define value, say 1. Besides, you can determine viscosity here as an inverse proportional to the Reynolds number. • Under Model, Laminar Flow, you specify initial and boundary conditions. In Fluid Properties subsection you can see what equation is to solve. In Fluid Properties Settings you must specify density and viscosity as User defined and put your values or names there. • Right click on Laminar Flow and you see different kinds of initial and boundary conditions, choose Inlet and Outlet conditions. By default option all the walls are set as non-slip. Press Inlet, and in the following Settings choose boundary conditions – velocity (default option) and specify your inlet velocity. In Graphics window choose your inlet boundary and add it to the selection (plus button) (Boundary selection should be set as Manual). The same procedure should be done for Outlet boundary condition, leave the settings by the default one. • Check the Mesh element size under Mesh Settings window. You can see the present grid pressing Build All button ( ); Zoom In, Zoom Out, Zoom Box and Zoom Extents buttons are very convenient (check upper Graphics toolbar for these buttons). • Solve the problem, by pressing Compute button ( ) under Study section. After a few seconds you will see velocity profile as default result plot. • In order to see the velocity profile in details along some line you should add two crosssections. In the Model Builder, under Results, Velocity or Pressure you can add a Cut line. From the top toolbar choose Select First Point for Cut Line and Select Second Point for Cut Line. You can adjust these points under Results, Data Sets, Cut Line 2D settings. Also in the Results section 1D Plot Group must appear, where you will see the velocity profile along the particular cross-section. You should draw two cross-sections, one along the central line and one across the channel. Due to the first cross-section you can define the entry length, by fixing some appropriate velocity value. Then take another Reynolds number and solve the problem again. How does the entry length change? You can also add Parametric Sweep under Study area, where you choose the Reynolds number as a parameter and specify its values. 7 Pipe flow Now you will study the same problem in a pipe, which stimulates 3D case, however cylindrical coordinate system allows us to use 2D-axisymmetric geometry. Follow the same algorithm to create a rectangle, setting of boundary conditions and getting the results. You should mind, that the cylinder axis is vertical by default and one long side of your rectangle must coincide with the axis. Consequently, inlet and outlet should be set to bottom and top sides. Calculate the entry length for the same Reynolds number and draw the two curves at the same plot. Besides, compare velocity profile across the channel and a pipe as well. Think about the difference between the two cases. Lab 2 Drag on a cylinder and on a sphere In the present lab you will study the flow outside a cylinder and outside a sphere and how it depends on the Reynolds number. Cylinder – 2D case Let us consider the flow around a circular cylinder of radius R. We are interested in drag force and drag coefficient CD , which is given by CD = 2D , ρ u0 2 R (5) where D is the drag per unit length. It may be calculated in COMSOL by means of line integration over the cylinder surface. In this laboratory you should draw one large elongated rectangle – computational domain (width to length ratio around 5) and then a small circle inside it. Under Geometry, Boolean Operations choose Difference to subtract the circle from the rectangle. For the rectangle you specify boundary and initial conditions as in Lab 1, but it is better to set outer boundaries as Slip, to eliminate additional wall influence on the drag force upon the cylinder. Set cylinder boundaries as No slip and solve the problem. 8 Under Results, right click on Derived Values choose Line Integration and add all the boundaries of the cylinder to the Selection window. For Expression ( ) choose Laminar Flow, Total Stress, and its appropriate component to calculate drag force. Repeat this calculation for other values of the Reynolds number, similar to Lab 1. Sphere – 2D axisymmetrical case Next you should do the same calculations for a sphere. Main Task: Present the drag for both cases against the Reynolds number. If you are fast and/or interested in you can study this case in fully 3D case. It can take longer time to do all the calculations, so you can check the drag force only for one or several specific values of the Reynolds number. 9 Lab 3 Flow around airfoil and elongated body In this lab you will investigate flow around objects with more complex shape compared to a cylinder or a sphere. The first part of the lab is devoted to drag and lift forces acting on an aerofoil. In the second part of the lab you are to study drag force acting on a streamlined body of variable shape. Flow around an aerofoil In this example we are interested how the drag and lift on an aerofoil depends on the angle of attack, α , see Fig. 3. For simplicity and reasonable time scales we will use two-dimensional airfoil with a characteristic length l , the flow velocity u 0 and flow density is as usual equal to unity. To perform calculations at relatively large Reynolds number, say 200 (may be varied from 100 to 1000), although it is limited due to numerical convergence. So you should either set viscosity to obtain such a Reynolds number or simply set a certain value of the Reynolds number and calculate viscosity as in previous laboratories. The drag CD and the lift coefficients CL of the aerofoil are defined similar to Eq. 5 CD = 2L 2D , CL = . 2 ρ u0 2 l ρ u0 l (6) Here D and L are the drag and lift per unit length. Main Task: Determine how the drag and lift coefficients for an aerofoil depends on the angle of attack, α , at Re = 500 (use negative angles as well as positive). Define optimal angle for the lift to drag ratio C L C D . Fig. 3. Flow around an aerofoil. 10 In order to rotate an airfoil use Geometry, Transform, Rotate and select our body. After that do logical subtraction, as in Lab 2. To calculate lift you are to integrate y-component of the total stress force. Hint: you can save your time if you start with maximal angles and then reduce it. Otherwise if you start with smaller angle and increase it, you can end up with convergence problem at some angle; then you have to decrease your Reynolds number and redo all the calculations. Flow around a streamlined body In this part of the lab you are to study the dependence of the drag on a streamlined body on its shape. As usual we consider two-dimensional flow, assuming the body to be infinitely long in the direction perpendicular to the flow. The maximum width of the body, d, is kept constant while the length, L, of the tail is varied, see Fig. 4. You can use similar Reynolds number as in previous part, Re = 200 . Fig. 4. Flow around a streamlined body. Main Task: Determine how the drag varies as a function of the ratio of the length of the body tail to the body width d. of the tail of the body. 11