26
INUDENT COMFLOW TUTORIAL 1 FLOW IN A WATER TUBING SYSTEM WITH A SUDDEN EXPANSION B. Tuinstra rev. 2, for Comflow versions 5.x (Dolfyn solver) May 2008

Comflow tutorial 1.2 · COMFLOW TUTORIAL 1. SETTING UP A SIMPLE, ISOTHERMAL, STEADY FLOW PROBLEM. To calculate the flow inside a user-defined geometry, we need to take the following

Embed Size (px)

Citation preview

INUDENT

COMFLOW TUTORIAL 1

FLOW IN A WATER TUBING SYSTEM

WITH A SUDDEN EXPANSION

B. Tuinstra rev. 2, for Comflow versions 5.x (Dolfyn solver) May 2008

INUDENT

2

CONTENTS

ABOUT THIS DOCUMENT 3

1. START COMFOW AND CREATE A NEW, EMPTY DOCUMENT 5

2. DEFINE THE GEOMETRY OF THE FLOW AREA 6

3. SPECIFY COMPONENTS 9

4. SPECIFY INLETS AND OUTLETS 10

5. GENERATE THE COMPUTATIONAL GRID 16

6. CHOOSING THE FLOW MEDIUM 19

7. SET CALCULATION PARAMETERS AND SOLVE THE PROBLEM 21

8. PLOT AND JUDGE THE SOLUTION 23

INUDENT

3

ABOUT THIS DOCUMENT

This tutorial teaches novice users of Comflow in a step-by-step way how to set up a simple flow problem. Some background information is provided, however, without the ambition to be exhaustive. For more information, see the Comflow online help facility. This document also contains some general tips that can be useful when setting up any Comflow problem; these may be of interest to more experienced users also. This document adheres to the following style conventions: The main text is set in this style. It explains what needs to be done and why, both in general sense and explicitly for the tutorial case. � Actions that need to be taken by the user are set in this style. These are actions that are needed

to create and run the tutorial case.

� Notes are set in this style and contain background information that may be useful but that is not required to follow the tutorial but are useful for a better understanding of Comflow.

☺ Tips are set in this style. Tips may aid you in solving problems you encounter using Comflow or help you to do things quicker.

Words that refer to terms used in the user interface (e.g., the names of menus etc.) are underlined.

INUDENT

4

COMFLOW TUTORIAL 1.

SETTING UP A SIMPLE, ISOTHERMAL, STEADY FLOW PROBLEM.

To calculate the flow inside a user-defined geometry, we need to take the following steps (usually but not necessarily in this order): 1. Start Comflow and create a new, empty document 2. Define the geometry (shape) of the flow area 3. Define the size and position of any components inside the flow 4. Define boundary conditions: a) an opening or openings (inlets) where the flow enters our domain,

b) an opening or openings (outlets) where the flow leaves and c) walls. 5. Generate the computational grid 6. Choose a flow medium 7. Set calculation parameters and solve the problem 8. Plot and judge the solution For this tutorial we will compute the flow near a sudden expansion in a potable water tubing system. The diameter of the tube is 60 cm, after the expansion it is 100 cm. Water flows through the system with a velocity of 1 m/s (in the thinner pipe section).

0.3 m

0.5 m

1 m/s

Schematic drawing of the geometry of the tutorial case.

INUDENT

5

1. START COMFOW AND CREATE A NEW, EMPTY DOCUMENT

� Start Comflow by selecting it from the Start menu or by double-clicking the application icon. Before we can create a new, empty case, we need to determine which Comflow module (Ducting, Conjugate heat transfer or Reactor) we need to use. In general, if you need to model heterogeneous catalysis, choose REA; if you need to calculate heat transfer inside solids, choose CHT; in all other cases, choose DUC.

� Note: Conjugate Heat Transfer (CHT) has not been implemented in Comflow 5.x yet.

For our simple example case, we will use DUC. � Choose from the File menu New; from the list of document types choose Ducting (DUC). A new, empty Ducting case will appear and we are ready to define the flow area.

INUDENT

6

2. DEFINE THE GEOMETRY OF THE FLOW AREA

� Note: Comflow is a 2-dimensional flow calculation program. This means that it cannot calculate intrinsically 3-dimensional flow problems. However, many 3D geometries can be modelled by a 2D geometry. For instance if the flow problem is symmetrical, the flow in the symmetry plane is 2-dimensional. Also, if a geometry is wide in a direction (compared to the other two), the flow perpendicular to this direction is often approximately 2-dimensional. Comflow can also calculate flow in cylindrical-polar coordinates so flow problems with a rotational symmetry can be modelled by a 2D calculation.

First you have to determine the appropriate cross-section of an apparatus you want to model. In the case of our water pipeline, this would be a section through the centre of the tube, near the expansion. Note that we only model one half of the cross-section in this case, due to symmetry considerations.

☺ Tip: Look carefully at your flow problem to find any symmetry lines. When the geometry as well as the flow is symmetrical, you only have to model one half of the geometry. This will reduce the computational effort by at least a factor two.

Now we have to determine the size of the computational domain to use, or, in other words, what to include in the computation. It is good practice to start the computation a small distance from the section in which we are interested. Also, it is often desirable to extend the domain a little beyond the last interesting point. This will prevent recirculations i.e., flow entering, through the outlet.

☺ Tip: rotate your geometry so the main flow is approximately parallel to the horizontal (x) axis. Alignment of the flow along a coordinate axis will decrease the effect of numerical diffusion and thus increase accuracy. Also, the numerical solution process is more efficient when the flow is approximately horizontal (instead of vertical) and in the positive x direction (i.e., from left to right).

For our water pipeline, we will start the simulation about one tube diameter upstream of the expansion and end it nine diameters downstream of the expansions. Since we have an axisymmetric case, our computational domain will extend 50 cm in the X (radial) direction and 5 m in the Y (axial) direction.

� Note: for axisymmetric cases, the axis of (rotational) symmetry is always the X (horizontal) axis.

Next, think about the amount of detail in which you are going to model the geometry. You will want to include all details that influence the flow; however, the computational effort required to solve the problem is depends strongly on the smallest detail in the geometry. You usually will not model details that are smaller than about 1 % of the size of the domain. We will go into this issue in more detail when we will generate the computational grid, below. � Action: Fill in the size of the computational domain and (optionally) the detail size (Snap) in the

Overall Dimensions dialog. This dialog will appear when you choose the Dimensions item from the Model menu.

INUDENT

7

The new domain dimensions will be drawn in the Comflow window after you press OK. Next, we will define the geometry of the flow area within our rectangular domain. This is done by blocking off the zones outside the flow area. In Comflow, there are three basic building blocks that can be used to create the geometry of the flow area: blocks, triangles and circles. Triangular blockages are limited to triangles with one oblique side (and one horizontal and one vertical side); however, any triangle can be built up from three of these rectangular triangles. Circles are confined to perfect circles or rectangular one-quarter circle segments. The flow is kept out of the blocked-off areas by setting the porosity to zero. At the edge of a block, symmetry conditions are assumed (unless you add a wall condition, see below). This means that there is no gradient of any variable perpendicular to the edge of the block (slip condition).

☺ Tip: you can create complex shapes by (partially) overlaying closed blockages (with zero porosity) with (rectangular, triangular of circular) blocks with a porosity different from zero (usually 1). In this way, it is possible to create e.g. a rectangular block with a cut-out triangle or a circle segment smaller than 90 °.

Four our water pipeline, we only need to create a single rectangular block that excludes the flow from the region above the narrow part of the tube. The coordinates of this block are (x=0,y=0.3) - (x=0.5, y=0.5). You can either specify this block by typing in the coordinates or by drawing it with the mouse using the Block tool at the bottom of the screen. In this case we will enter the coordinates with the keyboard. � Choose from the Model menu in the Obstructions submenu the Block item. A new blockage will be

created and the Block properties dialog will appear. Enter the size and position of the block as shown below.

INUDENT

8

☺ Tip: you can either specify the dimensions and position of the blockage by entering the four coordinates (left, top, right and bottom) or by entering the coordinates of one corner point and the width and height of the block.

☺ Tip: you can get on-line help about this dialog by pressing the Help button or F1.

Next we can define the porosity of the block. In this case, we want to block the flow completely from the area of the blockage, so a porosity of zero is required. Since this is the default value of the porosity for a blockage, no changes need to be made. � Verify that the porosity is specified correctly on the Porous Block tab of the dialog and press OK. The porous block will be drawn inside the domain as a black rectangle with a blue line around it.

� Note: the blue line around the object means that all parameters have been entered. When Comflow finds missing, incorrect or incompatible parameters in an object, the object is drawn with a red line around it.

� Note: Blockages are drawn in shades of grey. Darker shades of grey correspond with lower porosities; black areas are fully blocked and white areas are fully open to the flow.

We have now defined the shape of the flow area and can continue with the next step in the modelling process.

INUDENT

9

3. SPECIFY COMPONENTS

As we have seen, blockages are used in Comflow to define the geometry of the duct or flow area. Inside the flow there can be objects that act as a resistance to the flow. Examples are perforated plates and pipe bundles. Although these components could, in theory, be modelled directly by drawing their geometry using blockages, they are often modelled using empirical formulations for the pressure drop. The reason for this is that the finest detail of, for instance, a perforated plate (a hole) is very much larger than the size of the plate itself. Since no components are present in our drinking water duct, no actions need to be taken for this step.

INUDENT

10

4. SPECIFY INLETS AND OUTLETS

Now we have defined the geometry of our flow area, we need to specify where the fluid enters the domain. To do this we create an inlet object. Inlets are always situated at one of the domain edges.

☺ Tip: The calculation procedure is more efficient when the main fluid flow is horizontal and in the positive x direction (from left to right). Therefore, the inlet is often situated at the left (low x) side of the domain.

In our water duct, the inlet is vertical and situated at the left edge of the domain. It extends from the symmetry axis (y = 0) to the wall of the pipe (at y = 0.3 m). � From the Boundaries submenu in the Model menu, choose the Inlet item and fill in the dimensions

of the inlet as shown below.

☺ Tip: as an alternative to choosing the Inlet menu item, you can press the Inlet button on the drawing tool bar.

Now we can specify the velocity of the fluid that enters the domain through the inlet, using the X-velocity and Y-velocity tabs on the Inlet properties dialog. In the water duct, water is flowing with a velocity of 1 m/s (in the thinner pipe section), so the mean velocity is 1 m/s. We will assume that there is a long stretch of pipe to the left of our model and choose a parabolic flow profile (the profile that will exist in a long pipe if the flow is laminar). Since the fluid is flowing horizontally, we will set the vertical velocity to zero.

INUDENT

11

� Select the X-velocity tab. From the range of possible flow profiles, choose Half-parabolic Down (since only half of the pipe is modelled) and set the mean flow rate to 1 m/s.

� Select the Y-velocity tab and specify a uniform vertical velocity of 0 m/s. Since in this case we are not interested in the temperature field, we will leave the Temperature tab alone. Now we have fluid entering the flow domain, there must also be a place where it can leave. In Comflow, outlets can be defined at a domain boundary. The relative pressure is specified at an outlet; it is nearly always set to 0 Pa.

� Note: The absolute pressure is not usually used in a flow simulation. The only place where it arises is in the calculation of the fluid properties (see below). Often, the pressure differences in the flow field are in the order of 1 Pa, while the absolute pressure is in the order of 100.000 Pa or more. When the absolute pressures would be used instead of the relative pressures, the pressure differences that determine the flow field would disappear in the numerical error. Therefore, it is good practice to set the outlet pressure to zero; the absolute pressure field can be reconstructed from the calculated relative pressure field by adding the (measured or estimated) absolute pressure at the outlet.

For our water duct, the outlet is located at the right side of the domain and extends over the whole diameter of the tube (from the symmetry axis at y=0 to y=0.5). � From the Boundaries submenu in the Model menu, choose the Outlet item. In the Outlet properties

dialog that appears, enter the dimensions of the outlet as shown. Verify that the outlet pressure is set to 0 Pa on the Pressure tab and press OK.

INUDENT

12

Now the boundary conditions have been specified for the (unblocked area of the) vertical domain edges. By default, symmetry conditions are assumed for domain edges where no boundary conditions are explicitly defined. For the low boundary (y=0), this is correct since this is the symmetry axis. For the high boundary (y=0.5) this is not completely correct. Due to the symmetry condition, in the model the fluid velocity will not decrease at the wall, while in reality, the fluid velocity will be zero at the wall. To correct this, we will define a wall condition along the tube edge. In our water duct, the tube wall starts at the left side of the domain (x=0) at the lower side of the blockage (y=0.3). It will follow the blockage around the corner (at x=0.5) to the edge of the domain (y=0.5) and from there to the outlet (x=5). You can define this line by entering the coordinates of the corner points in a dialog, but in this case we will draw it using the mouse. � From the drawing toolbar, choose the Wall tool (the fourth button from the right). The mouse cursor will change into a plus when you move over the computational domain.

� Note: the coordinates of the cursor in the domain (in meters) are displayed on the right side of the status bar.

� Move the cursor until the coordinates of the first point of the line (x=0, y=0.3) are shown in the

status bar. Press the left mouse button and hold it down while you move the mouse cursor to the location of the second point (x=0.5, y=0.3). At the second point, release the mouse button.

A (horizontal) line will be drawn from the first point to the second point, showing the points as small black squares (handles). � Move the mouse cursor over the handle of the second point.

INUDENT

13

The mouse cursor will change to an arrow with a small plus sign, indicating that you can add points to the wall. � While the mouse cursor is over the second point handle, press the left mouse button again and

hold it down while you drag the cursor to the coordinates of the third point of the wall (x=0.5, y=0.5). Release the mouse while holding it over the third point, press it again to add a fourth point to the wall. Holding down the mouse button, drag the mouse cursor to the coordinates of the fourth and last point of the wall at the topright corner of the domain (x=5, y=0.5) and release it.

We have finished defining the wall. The wall will be drawn as a blue zigzag line with hatches (or fringes) on one side. Now we are ready to modify the wall condition (or to correct any mistakes you made while drawing it).

☺ Tip: Comflow has 10 levels of Undo. If you modify an object in the domain or delete it by accident, you can reverse your latest action and those before it by choosing Undo from the Edit menu (or by pressing Ctrl-Z).

� From the drawing tool bar, select the arrow tool (the first on the left). The hatched side indicates the solid side of the wall, so the conditions for the fluid are set on the flat side of the wall. In our case, the wall conditions need to be set for the fluid that flows below the wall and the hatches appear on the wrong side of the wall. � To edit the properties of the wall, make sure it is selected (the corner points appear as black

squares). If the corner points are not shown, click the wall once with the left mouse button to select it. From the Edit menu, choose the Edit item.

☺ Tip: instead of choosing the item from the menu, you can double-click the wall (with the arrow tool).

INUDENT

14

The wall properties dialog will appear. The first tab will be the Points tab. The cornerpoints that define the wall are listed and can be edited by selecting a row with the mouse and pressing the Edit button. You can also add or delete points. Below the points list you can specify whether the wall condition is applied on the left or on the right side of the wall, moving from the first point to the second and onward. Verify that in our case, the wall condition needs to be applied to the right side of the line. � In the Points tab of the Wall properties dialog, set the Side to Right. Next we specify the velocity condition that is applied to the wall. Note that the velocity perpendicular to the wall is always set to zero by setting the cell wall porosities to zero. The wall condition applies to the velocity parallel to the wall. We can either set the fluid velocity or the wall velocity. In the first case, the velocity in the cell next to the wall will be set to the specified value. In the latter case, a velocity profile will be assumed inside the cell next to the wall. Usually and by default the latter option is used with a wall velocity of 0 m/s. � Select the Velocity tab of the Wall properties dialog and verify that the wall velocity is set to 0 m/s.

Press OK.

INUDENT

15

The wall will now be drawn with the hatches at the correct (upper) side, inside the blockage and outside the domain. We have now completed the specification of the boundary conditions and can move to the next step, the computational grid.

INUDENT

16

5. GENERATE THE COMPUTATIONAL GRID

Now that we have defined the geometry of the model, we can generate the computational grid. The computational grid consists of segments, each of which is subdivided into a number of cells; a segments consists of at least one cell. The segments are defined by the borders and cornerpoints of the objects we have defined. The computational effort required to solve the flow problem increases with the number of cells; on the other hand, the accuracy will increase with the number of cells. Thus, we want to create a grid with the smallest number of cells that gives sufficient accuracy.

☺ Tip: it is good practice to start your model with a relatively low number of cells; then when a solution is reached, try again with a finer grid mesh, for instance, double the number of cells. The difference between the solution with the fine mesh and that with the coarser mesh gives you an indication of the error made in discretization. If it is large, try again with an even larger number of cells.

Apart from the number of cells, the shape of the cells is also of some importance. In general, square cells are better than oblong ones, especially when the flow at the location of the cell is not in the direction in which the cell is long. As a rule of thumb, the aspect ratio of a cell should be between 0.2 and 5. Also, the size of a cell should not differ too much (say, more than a factor 2) from its neighbours.

� Note: when the x- or y coordinate of two cornerpoints are very close together, a very small grid segment and thus at least one very small cell will be created between the two points. When the guidelines are followed, his small cell will influence the whole grid. In this case, it is often better to round off the coordinates of the corner points so that they are on the same grid line. Usually details that are smaller than about 1% of the domain size are not modelled.

For our water duct, the initial grid mesh would be, say 40 by 15 cells. In this tutorial, we will use a computational grid of 5 by 10 cells, so that it can be solved in DEMO mode. Of course, the accuracy of the results will be limited with a coarse grid. Registered users can proceed later with finer grid meshes. We will use the automatic grid generation facility to generate the mesh. This will create a grid mesh based on an approximate number of x and y grid lines we can specify that is as even as possible. � From the Model menu, choose Auto Grid. A dialog window will appear in which we can specify the

desired number of cells in the horizontal (x) and vertical (y) direction. Enter the numbers (10 and 5 resp.) and press OK.

The grid will be generated. It is wise to inspect the grid before attempting to solve the flow problem so that you can fine-tune the grid, if required. � To make Comflow draw the grid lines, choose from the View menu the item Show Grid.

Alternatively, you can press the Show Grid button on the toolbar.

INUDENT

17

The grid lines will be drawn and the rulers will change; instead of a length scale in meters, the grid segments will be shown with the number of cells in each segment. Segments for which the rules of thumb regarding cell aspect ratios are not adhered to will be drawn in red. In our model, the autogrid facility will have generated a grid with 4 rows and 10 columns. We are especially interested in the flow just downstream of the expansion; we expect a recirculation area in the upper part of the model. To get a somewhat better accuracy, we will increase the number of grid lines in the Y grid to 6 by adding two grid lines to the upper Y-grid segment. � Bring up the Y-grid dialog by choosing from the Model menu the Y-grid item. The Grid Segment dialog box will appear, showing the data for the first (bottom) grid segment.

� Move to the next segment by pressing the button with the up arrow.

☺ Tip: instead of choosing the Y-grid item from the menu and move to a segment you want to modify with the arrow buttons, you can also click the segment in the ruler with the mouse.

� Change the number of grid lines to 3 and press OK. The grid mesh will be redrawn with the increased number of cells.

The cells in the grid we have generated are all rather long in the x-direction; this is not very good for accuracy. Since we are especially interested in the flow just after the expansion, we will increase the number of grid lines in the x-grid in this area. � Bring up the X-grid dialog by clicking in the second grid segment in the horizontal ruler (the area

with the number 9 in it).

INUDENT

18

The X-grid dialog will show the number of cells (9) and the grid power. Normally, all grid cells in a segment have the same width. The grid power can be used to create grids where the size of the cells increases or decreases uniformly (see the help entry for the Grid dialog box for details). In this case, we will set the grid power to a value greater than 1 to let the cell size increase in the positive x-direction. In this way, we will get smaller cells on the left side of the segment. � Enter 8 for the number of cells and 1.5 as the grid power. Now we will set the number of cells in the first segment to 2. � Press the button with the left arrow on it in the grid dialog. The data for the first X-segment will

appear. Enter 2 for the number of cells and click OK. The modified grid should look something like this:

As you can see, the cells on the left are smaller and the aspect ratio is closer to 1. On the other hand, the cells on the right have become longer. In this case, this may be permitted because the flow will (or should) be approximately horizontal near the outlet, so parallel to the longest dimension of the cells. As a first try, we will accept this grid.

INUDENT

19

6. CHOOSING THE FLOW MEDIUM

The last part of the physical model that needs to be specified is the nature of the fluid. In Comflow, there are four ways to specify the fluid, which correspond to four different ways in which the fluid properties (density, viscosity, heat conductivity and specific heat) are computed.

� Note: for isothermal flow cases, the fluid properties can usually be treated as a constant. When there are temperature differences in the flow field, i.e., if the temperature is a solved variable, fluid properties can differ from one point in the flow field to another. In this case, Comflow can calculate the fluid properties as a function of the local temperature (see the section below).

You can choose

• Artificial fluid: properties are calculated by interpolation between values you specify at up to three temperatures.

• Water: the fluid is (subcooled) water, (superheated) steam or a (saturated) mixture of water and steam. In the latter case, average property values are used.

• Air: the fluid is air with a given relative humidity

• Exhaust gas: the fluid is a mixture of gases that often appear in exhaust gases (Nitrogen, Argon, Carbon dioxide, Carbon monoxide, Water, Hydrogen, Oxygen and Sulphur dioxide). You can specify the composition of the mixture.

For our water tube, we naturally take the second option. Since the temperature is not an issue in this case, the properties of our fluid (potable water) can be taken constant in the whole computational domain. � From the Properties menu, Fluid submenu, choose the Water item. The Water/Steam dialog will appear where you can specify the conditions at which the fluid properties are calculated.

� Note: when the temperature is solved and the properties are computed as a function of the temperature, the conditions you enter here will be used to compute the initial values of the properties (at the start of the calculations). In this case, you should enter the estimated mean temperature in the domain.

In our case, the fluid is subcooled water at 5 degrees Celsius and atmospheric pressure. � Enter the fluid pressure and temperature.

INUDENT

20

� Note: the calculated properties are shown on the right side of the dialog. These are the numbers that are used in the calculations (see the note above). When you modify the pressure or temperature, the numbers on the right will not be updated until you leave the field that you have edited, for instance by pressing the Tab key (the numbers will, of course, be updated before they are used).

☺ Tip: you can use the various fluid property dialogs to quickly get an estimate for the properties of water, steam (or a water/steam mixture), air or exhaust gas at different temperatures and pressures.

The second category of fluid parameters that need to be set are the turbulence parameters. The dimensionless Reynolds number is used to characterise the flow regime:

Re =vD

υ

where v is the (mean) velocity of the flow (m/s), D is a characteristic length scale (m) and n is the kinematic viscosity (m

2/s). When the Reynolds number is small (say Re<0.2), the flow is laminar and

the transport of momentum and heat is by molecular diffusion. When the Reynolds number is large (larger than 100.000) the flow is turbulent and transport of momentum and heat is mainly facilitated by eddies in the flow. Since the transport by eddies is much more efficient than transport by molecular diffusion, the transport will increase with increasing Reynolds number. In Comflow, the effect of Turbulence is modelled in a simple but limited way: the user can enter a factor by which transport (i.e., the value of the effective viscosity and heat conductivity) increases due to turbulence. There are two of these factors, one for the transport of momentum and one for the transport of heat. However, these are usually given the same value since the increase is caused by the same mechanism (i.e., eddies). As a rule of thumb, the value of Re/100 can be used. We need to calculate the value of Reynolds for our water pipe. We will assume that the effect of the expansion of the tube on the turbulence is not important for the flow in the modelled section of the tube. As a characteristic diameter, we will take the diameter of the inlet, 0.6 m; the velocity is taken as 1 m/s (the inlet velocity). The kinematic viscosity for water at the inlet conditions is 1.538e-006 m

2/s,

so Re has a value of about 390.000.

☺ Tip: you can use the Water/Steam properties dialog to obtain the value of the kinematic viscosity at inlet conditions (1.01325 bar and 5 degrees Celsius).

The value we can use for the turbulent over laminar viscosity and conductivity ratio is Re/100 = 3900. � Choose from the Properties menu the Flow Model item. In the Flow Type dialog that appears,

choose Constant Eddy Viscosity and fill in the value for the ratios and press OK.

Now we have completed the physical modelling.

INUDENT

21

7. SET CALCULATION PARAMETERS AND SOLVE THE PROBLEM

Before trying to solve the flow problem, it is useful to know something about the nature of the solution procedure. The equations that describe the flow, the so-called Navier-Stokes equations, are coupled non-linear partial differential equations. In order to solve these equations, they are discretized and linearized. In step 5, we have divided the computational domain into small rectangular regions: cells. The flow field is calculated by solving the laws of conservation of mass and momentum (and heat if the temperature is solved) for each of these cells. Of course, fluid that flows into one cell must flow out of one of its neighbours and thus, the conservation equations of one cell are linked directly to those of each of its neighbours, and indirectly to any other cell in the domain. We will first determine which variables we want to compute. For most flow problems, you will calculate the horizontal (x) and vertical (y) velocity components and the pressure. When the temperature is important and for conjugated heat transfer (CHT) problems, you will also want to calculate the temperature field. You can also calculate cases where there is no flow but only heat conduction; in that case the pressure and velocity components are not solved. For our water duct problem, we only need to calculate velocity and pressure. � From the Solve menu, choose the Variables item. Make sure that the boxes for the solution and

output of X-Velocity, Y-Velocity and Pressure are checked. Uncheck the box for the solution of the temperature field.

For each variable, you can enter a relaxation parameter. Relaxation is a numerical technique to improve convergence in the solution of linearized equations. For low numbers of the relaxation parameters, convergence is more certain but slower; for high values convergence is less certain but faster.

INUDENT

22

☺ Tip: you can usually leave the relaxation parameters at their default values; if convergence is slow, you can try increasing the relaxation parameters. If a case diverges, you can try decreasing the relaxation parameters.

The solution procedure consists of an inner iteration loop and an outer iteration loop; you can set the convergence limit and the number of iterations (for the outer loop these are called sweeps) for both. Since the inner iteration loop depends on the estimate from the outer loop, the number of iterations is usually much lower than the number of sweeps. � From the Solver menu, choose the Iterations item. For the number of sweeps, enter 100. Leave

the number of iterations at its default value of 10. Press OK. Now we are ready to solve our problem. To be sure we did not miss anything, we can let Comflow check the data we entered. � From the Solver menu, choose Check Model. If you made no mistakes, a message box should appear saying that the model is OK. If not, a box will appear listing any problems found. � Correct any problems that were found in the model check.

☺ Tip: objects that are causing errors are drawn with a red border.

Before we can solve the problem, we must save the data to disk. Intermediary and result files will be given a name derived from the file name you choose. � Save the data in a new file, for instance, tut1.duc. Now we can solve the case. The solution process consists of three steps. First, the in the presolving step the Comflow DUC file is translated into input files that readable by Dolfyn. Then the Dolfyn preprocessor translates the grid information to a geometry file readable by the Dolfyn solver. In case the presolver or the preprocessor finds any additional errors or generates any warnings, they will be shown; otherwise the preprocessor window will appear only briefly. After presolving the solver (dolfyn.exe) will be started in a DOS window. At the same time, the monitor application will be started to display the convergence graphically.

☺ Tip: the solver and the preprocessor are separate executables. This means that you can continue working on one Comflow case in the presolver while another is solved in the background. You can also set up a number of cases in the preprocessor and then create an batch file to solve them one after another overnight.

� Start the solver by choosing from the Solver menu the Solve item. The presolver window will appear with a warning for ill-conditioned cells (i.e., cells with a aspect ratio larger than 10). We have given reasons above why we can ignore this message. After the presolver window has been dismissed, the solver window will appear and the calculation will start. In the monitor window, the residues (numbers that are a measure for the current error in the field) are plotted as a function of the sweep number for each solved variable. When all residues have become smaller than a limit value (by default 0.001), the solution has converged.

� Note: the residuals as displayed in the solver window are normalised by the residual reference values. These values should be estimates of the magnitude of the variable in the field. These are set in the Residual References dialog that appears when you press the Res. Refs button in the Variables dialog in the preprocessor. You can enter custom values, but by default they are set to zero which implies that they are computed during the flow calculation from the sources in the field.

INUDENT

23

8. PLOT AND JUDGE THE SOLUTION

In Comflow, there are two separate ways to view the solution of a flow problem. The easiest way and often the best place to start is to create a field plot and show the solution as a vector field or a filled contour plot. Once you have an idea about the nature (and the quality) of the solution, a variable plot can be created to give the value of a variable along one or more horizontal or vertical lines. The latter will usually give more detailed information, the former a better overview. For our tutorial case, we will first create a field plot. You can create a new Field plot file from the New item in the File menu and then read in the data from any case for which results are available. However, by far the easiest and quickest way is to create a field plot directly from the preprocessor, which is what we will do. � From the Solve menu, View Results submenu, choose the Field Plot item. A new Comflow Field Plot postprocessor window will open on top of the preprocessor window; the model as we defined it will be drawn. The different plots are available from the Plot menu. We will first create a vector plot to show the magnitude and direction of the velocity of the fluid in the field. � From the Plot menu, choose the Vector item. The Vector plot dialog will appear, in which you can enter the maximum velocity that is plotted and a magnification factor.

☺ Tip: you can enter a fixed value for the maximum velocity in combination with a magnification value larger than one to get a clear view of the flow field in regions where the velocity is low.

For now, we will use the default values. After you have pressed OK, the vectors (one per computational cell) will be drawn.

INUDENT

24

Note that there is a recirculation zone just after the expansion with a predicted length of about 1 meter. To enlarge the vectors in this area, you can edit the settings for the vector field. � Make sure the vector plot is selected (shown by the black handles at the corners and sides) and

choose Edit Item from the Edit menu. The Vector Plot dialog will appear. Set the maximum to a fixed value of 0.5 m/s and the magnification factor to 2.

☺ Tip: you can create a vector plot for a subregion of the domain by dragging the selection handles with the mouse.

� Experiment with the different field plots: fill, contour and streamline. Add shapes, lines, arrows and

text using the drawing tools at the bottom of the screen or the items from the Draw menu. You can print your graph using the Print item from the File menu.

Although a field plot gives a good overview of the flow, often more accurate or numerical data is needed. We will create a variable plot to show a graph of the pressure inside the tube. To do this, we will first bring forward the preprocessor window with our DUC file. � From the Window menu, select the preprocessor window (presumably called Tut1.duc). The window with our model will come forward. Now create a new variable plot. � From the View Results submenu on the Solve menu choose Variable Plot. A new variable plot window will open with a blank axis system. We first have to specify which variables will be attached to the horizontal and vertical axis. The horizontal axis always has an independent variable (horizontal or vertical position or time) as variable, on the vertical axis any field variable can be plotted. We will plot the pressure as a function of the horizontal (x) position along the symmetry axis. � From the Plot menu, choose the Graph item. The Graph dialog will appear. Make sure the variable

plotted on the horizontal axis is the x-coordinate and that it runs along the whole domain from the inlet at x=0 m to the outlet at x=5 m. For the variable on the vertical axis, choose the pressure (PRES) and let it run from -400 Pa to 0 Pa.

INUDENT

25

� Note: the relative pressure is negative in the whole domain. It runs from -400 Pa at the inlet to 0 Pa (a boundary condition) at the outlet. These counter-intuitive values are caused by the fact that the pressure plotted is the static pressure, not the total pressure. Bernoulli’s law states that (in the absence of friction) the total pressure is constant along a streamline:

p + 0.5 ρ v2 = constant

Thus, as at the inlet the velocity v is high, the static pressure p must be low. At the outlet, the reverse is

true. For the tutorial case, the mean inlet velocity is 1 m/s and the mean outlet velocity is 0.36 m/s. With a density of 998 kg/m3 (from the property dialog), this leads to a dynamic pressure of 499 Pa at the inlet and 65 Pa at the outlet. The resulting estimate for the pressure difference (434 Pa) is in the same order as the predicted pressure difference (400 Pa). Apparently, the pressure loss in our model due to friction is much lower than this dynamic effect. Due to the velocity profiles at the inlet and outlet, it is not straightforward to calculate the exact loss in static pressure from our model.

☺ Tip: the Automatic range for the different field and variable plots are a convenient way to get the minimum and maximum values of variables in the field.

When you press OK, the axes will be adjusted to the ranges you just entered. Now we can draw lines of the pressure at different constant-y cross-sections of the model, for instance at the symmetry axis. � From the Plot menu, select the Add Line item. The line properties dialog box will appear. You can enter the y-value at which the cross-section is taken in the Y-position box on the Curve tab; for now, leave it at y=0 (the symmetry axis). If you wish, you can also modify the line style (colour, thickness, dash) and marker on the Line Style tab. When you press OK, the line will be drawn in the plot area.

INUDENT

26

☺ Tip: for more extensive line plotting, you can export the data from Comflow to a Comma Separated (.csv) text file that can be imported in dedicated plotting programs or spreadsheet applications (e.g., Excel). The Export item in the Plot menu will save the data for all lines in the plot to a file you name.

It is advisable to check the effect of the discretization on the solution by solving the problem again with a finer grid mesh. However, since we are limited to 10x10 cells in the DEMO mode, this is left as an exercise for those who own the full version. You can also contact Jacob Comprimo to obtain a temporary evaluation version. Of course, this is only a very simple example; models with a much higher complexity can be calculated using Comflow. You can use the tutorial case as a starting point for further experiments. For instance, you could add temperature boundary conditions at the inlet and at the wall of the tube to calculate the temperature field in the expanding tube with a cooled wall. Or you could make the expansion smooth by using a triangular blockage instead of the existing rectangular blockage and compare the results with the sudden expansion. When you are stuck, pressing F1 will often bring up additional information from the online help facility. For more complicated models, explore the examples that are included in the Comflow package (in the folder Samples).