You are on page 1of 30

Tutorial 11.

Introduction

Using Dynamic Meshes

This tutorial provides information for performing basic dynamic mesh calculations. In addition to combining the basic mesh-motion schemes, this tutorial will introduce rigidbody motion of a cell zone. This is useful for a multitude of realistic cases with moving meshes. In this tutorial you will learn how to: Use the dynamic mesh capability of FLUENT to solve a simple ow-driven rigidbody motion problem. Set boundary conditions for internal ow. Use a compiled user-dened function (UDF) to specify ow-driven rigid-body. motion Calculate a solution using the segregated solver.

Prerequisites
This tutorial assumes that you are familiar with the menu structure in FLUENT and that you have completed Tutorial 1. Some steps in the setup and solution procedure will not be shown explicitly.

Problem Description
The problem to be considered is shown schematically in Figure 11.1. A 2D axisymmetric valve geometry is used, consisting of a pressurized cavity on the left, driving the motion of a poppet that toggles the ow to the circumferential pressure outlets. A spring force is also acting on the poppet. In this case the transient closure of the valve is studied.

c Fluent Inc. January 11, 2005

11-1

Using Dynamic Meshes


pressure outlets

mass ow inlet

moving poppet

Figure 11.1: Problem Specication

Setup and Solution Preparation


1. Download dynamic_mesh.zip from the Fluent Inc. User Services Center or copy it from the FLUENT documentation CD to your working directory (as described in Tutorial 1). 2. Unzip dynamic_mesh.zip. valve.msh and valve.c can be found in the /dynamic mesh folder created after unzipping the le. A user-dened function will be used to dene the rigid-body motion of the poppet in the valve geometry. This function has already been written (valve.c). You will only need to compile it within FLUENT. 3. Start the 2D version of FLUENT.

11-2

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

Step 1: Grid
1. Read the grid le valve.msh. File Read Case... 2. Check the grid. Grid Check Note: You should always make sure that the cell minimum volume is not negative, since FLUENT cannot begin a calculation if this is the case. 3. Scale the grid. Grid Scale...

(a) Under Unit Conversion, select in from the drop-down list to complete the phrase Grid Was Created In in (inches). (b) Click Scale to scale the grid. (c) Click Change Length Units to set inches as the working units for length, and then close the panel.

c Fluent Inc. January 11, 2005

11-3

Using Dynamic Meshes

4. Display the grid (Figure 11.2). Display Grid...

Grid

FLUENT 6.2 (2d, segregated, lam)

Figure 11.2: Initial Grid for the Valve

11-4

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

Step 2: Units
1. For convenience, dene new units for pressure and mass ow. In the problem description, pressure, length, and mass ow are specied in psi, in, and gpm, respectively. While the units for length were switched while scaling the grid in the previous step, psi and gpm are not the default units for pressure and mass ow. Dene Units...

(a) Select pressure under Quantities, and psi under Units. (b) Select mass-ow under Quantities, and click New... The Dene Unit panel will appear.

i. Enter gpm under Unit. ii. Enter 0.0536265 under Factor. iii. Click OK.

c Fluent Inc. January 11, 2005

11-5

Using Dynamic Meshes

Step 3: Models
1. Enable an axisymmetric time-dependent calculation. Dene Models Solver...

(a) Under Space, select Axisymmetric. (b) Select Unsteady under Time. (c) Keep the default Unsteady Formulation option of 1st-Order Implicit.

Dynamic mesh simulations currently work only with rst-order time advancement.

(d) Click OK.

11-6

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

2. Turn on the standard k - turbulence model. Dene Models Viscous...

(a) Select k-epsilon as the Model, and retain the default setting of Standard under k-epsilon Model. (b) Click OK.

c Fluent Inc. January 11, 2005

11-7

Using Dynamic Meshes

Step 4: Materials
You will create a new material called oil. Dene Materials...

1. In the Name eld, enter oil. 2. Specify 850 for the Density. 3. Specify 0.17 for the Viscosity. 4. Click Change/Create. 5. Click No when prompted to overwrite air.

11-8

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

Step 5: Operating Conditions


Set the operating pressure to 0 psi. Dene Operating Conditions...

For this problem, you will work with absolute pressures.

c Fluent Inc. January 11, 2005

11-9

Using Dynamic Meshes

Step 6: Boundary Conditions


Dynamic mesh motion and all related parameters are specied using the items in the Dene/Dynamic Mesh submenu, not through the Boundary Conditions panel. You will set these conditions in the next step. Dene Boundary Conditions... 1. Set the conditions for the mass ow inlet (inlet) as shown in the following gure.

2. Click OK.

11-10

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

3. Set the conditions for the exit boundary (outlet) as shown in the following gure.

4. Set the conditions for the uid zone, def zone.

5. Select oil as the Material Name from the drop-down list, and keep the default Motion Type as Stationary. This replaces air with oil as a working media. 6. Repeat this procedure for the other two uid zones, inlet zone and outlet zone.

c Fluent Inc. January 11, 2005

11-11

Using Dynamic Meshes

Step 7: Grid Interfaces


In this step, you will create a non-conformal grid interface between the deforming walls corresponding to the radial boundary of the pressure outlets, and the deforming wall corresponding to the radial boundary of the deforming uid zone next to the poppet. Dene Grid Interfaces...

1. Select ext intf in the Interface Zone 1 list. Note that when one interface zone is smaller than the other, it is recommended that you choose the smaller zone as Interface Zone 1. 2. Select int int in the Interface Zone 2 list. 3. Enter the name if under Grid Interface. 4. Click Create. Note: In the process of creating the grid interface, FLUENT creates two new wall boundary zones: wall-22 and wall-23. You will not be able to display these walls. wall-22 is the non-overlapping region of the ext intf zone that results from the intersection of the ext intf and int int boundary zones, and is listed under Boundary Zone 1 in the Grid Interfaces panel. wall-23 is the non-overlapping region of the int int zone that results from the intersection of the two interface zones, and is listed under Boundary Zone 2 in the Grid Interfaces panel.

11-12

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

Note that in general, you will need to set boundary conditions for these new wall zones, when they are not empty. In this case, default settings are used.

Step 8: Mesh Motion


1. Select and compile the user-dened function (UDF). Dene User-Dened Functions Compiled...

(a) Under Source Files, click Add... A Select File panel will open. (b) In the Select File panel, select the source code valve.c, and click OK. (c) In the Compiled UDFs panel, click Build. The UDF has already been dened, but it needs to be compiled within FLUENT before it can be used in the solver. Here you will create a library with the default name of libudf in your working directory. If you would like to use a dierent name, you can enter it in the Library Name eld. Note that in this case you need to make sure that you will open the correct library in the next step. (d) Click OK in the dialog box that will appear. (e) Click Load to load the UDF library you just compiled. Once the UDF is built and loaded, it is now available to hook to your model. Its name will appear as valve::libudf and may be selected in drop-down lists of various panels. 2. Hook the reader and writer udf. Dene User-Dened Function Hooks...

c Fluent Inc. January 11, 2005

11-13

Using Dynamic Meshes

(a) Select reader::libudf in the drop-down list next to Read Data. (b) Select writer::libudf in the drop-down list next to Write Data. These two functions will read/write the position of C.G. and velocity in the X direction to the data le. The location of C.G. and the velocity are necessary for restarting a case. When starting from an intermediate case and data le, FLUENT needs to know the location of C.G. and velocity, which are the initial conditions for the motion calculation. Those values are saved in the data le using the writer UDF and will be read in using the reader UDF when reading the data le. (c) Click OK to close the panel.

11-14

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

3. Activate dynamic mesh motion and specify the associated parameters. Dene Dynamic Mesh Parameters...

(a) Under Models, select Dynamic Mesh. See Chapter 10 of the Users Guide for more information the available models for moving and deforming zones. (b) Under Mesh Methods, select Smoothing and Remeshing. FLUENT will automatically ag the existing mesh zones for use of the dierent dynamic mesh methods where applicable. (c) Set the parameters under Smoothing as follows: i. Keep the default specication of 1 for the Spring Constant Factor. ii. Specify 0.7 for the Boundary Node Relaxation. iii. Keep the default specication of 0.001 for the Convergence Tolerance. iv. Specify 50 for the Number of Iterations.

c Fluent Inc. January 11, 2005

11-15

Using Dynamic Meshes

(d) Set the parameters under Remeshing as follows:

i. Under Options, be sure that the Must Improve Skewness option is selected. ii. Specify other parameters as shown the following table: Parameter Minimum Length Scale Maximum Length Scale Maximum Cell Skewness Size Remesh Interval Value 2.0e-5 0.007 0.7 1

If a cell exceeds these limits, the cell is marked for remeshing. Therefore, you will always need to specify problem-specic values under Remeshing Parameters. (e) Click OK. 4. Specify the motion of the poppet, the adjacent walls, and the uid region left of the poppet. The poppet motion and the motion of the deforming wall side-wall-3 are specied by means of the UDF valve. Dene Dynamic Mesh Zones...

11-16

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

(a) Specify the motion of the poppet.

i. In the Zone Names drop-down list, select poppet. ii. Under Type, keep the default selection of Rigid Body. iii. Under Motion Attributes, select valve::libudf in the Motion UDF/Prole drop-down list to hook the UDF to your model. iv. Keep the default values of (0, 0) m for Center of Gravity Location, and 0 for Center of Gravity Orientation. FLUENT will automatically update the position of the CG based on the input you gave for the motion. v. Click the Meshing Options tab. vi. Specify a value of 0.005 for Cell Height. vii. Click Create.

c Fluent Inc. January 11, 2005

11-17

Using Dynamic Meshes

(b) Specify the motion of the deforming axis (def axis).

i. In the Zone Names drop-down list, select def axis. ii. Under Type, select Deforming. The panel will expand to show the inputs for a deforming zone. iii. Click the Geometry Denition tab. iv. In the Denition drop-down list, select plane. The panel will expand again to show the inputs for a planar geometry. v. Under Point on Plane, enter 0, 0. vi. Under Plane Normal, enter 0, 1. vii. Click the Meshing Options tab. viii. Under Methods, keep the default selections of Smoothing and Remeshing. ix. Specify a value of 0.0045 for Minimum Length Scale and a value of 0.0055 for Maximum Length Scale. x. Keep the default value of 1 for Maximum Skewness. xi. Click Create.

11-18

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

(c) Specify the motion of the deforming wall corresponding to the radial boundary of the deforming uid zone next to the poppet (int int). i. In the Zone Names drop-down list, select int int. ii. Under Type, keep the previous selection of Deforming. iii. Click the Geometry Denition tab. iv. In the Denition drop-down list, select plane. The panel will expand again to show the inputs for a planar geometry. v. Under Point on Plane, enter 0, 0.22625. vi. Under Plane Normal, keep the previous setting of 0, 1. vii. Click the Meshing Options tab. viii. Under Methods, be sure that Smoothing and Remeshing are selected, and keep the previous settings for Maximum Skewness to value of 1. ix. Specify a value of 0.0045 for Minimum Length Scale and a value of 0.0055 for Maximum Length Scale. x. Click Create. In many MDM problems, you may want to preview the mesh motion before proceeding any further. In this problem, the mesh motion is driven by the pressure exerted by the uid on the poppet and acting against the inertia of the poppet and the force of a preloaded spring attached to it. Hence, for this problem, mesh motion in the absence of a ow eld solution is meaningless, and you will not use this feature here.

c Fluent Inc. January 11, 2005

11-19

Using Dynamic Meshes

Step 9: Solution
1. Set the solution parameters. Solve Controls Solution...

(a) Keep all default discretization schemes and values for under-relaxation factors. This problem has been found to converge satisfactorily with these default settings. Alternatively, you may want to try the PISO discretization scheme for Pressure-Velocity Coupling in conjunction with higher under-relaxation factors in order to reduce the overall CPU time needed for this simulation. (b) Click OK. 2. Enable the plotting of residuals during the calculation. Solve Monitors Residual... 3. Request that case and data les are automatically saved every 10 time steps. File Write Autosave...

11-20

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

(a) Set the Autosave Case File Frequency and Autosave Data File Frequency to 10. To retain all les, keep the Overwrite Existing Files inactive. (b) In the Filename eld, enter valve. When FLUENT saves a le, it will append the time step value to the le name prex (valve). The standard extensions (.cas and .dat) will also be appended. (c) Click OK. 4. Initialize the solution. You will initialize the ow eld at this point in order to be able to display contours and vectors that you will use to dene animations. Solve Initialize Initialize...

c Fluent Inc. January 11, 2005

11-21

Using Dynamic Meshes

(a) Set Gauge Pressure to 80 psi. (b) Set Axial Velocity to 3.097237 m/s. (c) Set Turbulence Kinetic Energy to 0.1438932. (d) Set Turbulence Dissipation Rate to 16.8147. (e) Click Init. 5. Create animation sequences for the static pressure contour plots and velocity vectors plots in the valve. You will use FLUENTs solution animation feature to save contour plots of temperature every 5 time steps. After the calculation is complete, you will use the solution animation playback feature to view the animated temperature plots over time. Solve Animate Dene...

(a) Increase the number of Animation Sequences to 2. (b) Under Name, enter pressure for the rst animation, and vv for the second one. (c) Under Every, increase the number to 5 for both sequences. The default value of 1 instructs FLUENT to update the animation sequence at every time step. For this case, this would generate a large number of les. (d) In the When drop-down list, select Time Step.

11-22

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

(e) Dene the animation sequence for pressure. i. Click Dene... on the line for pressure to set the parameters for the sequence. The Animation Sequence panel will open.

ii. Under Storage Type, keep the default selection of Metale. Note: If you want to store the plots in a directory other than your working directory, enter the directory path in the Storage Directory eld. If this eld is blank (the default), the les will be saved in your working directory (i.e., the directory where you started FLUENT). iii. Increase the Window number to 1 and click Set. Graphics window number 1 will open. iv. Under Display Type, select Contours. The Contours panel will open.

c Fluent Inc. January 11, 2005

11-23

Using Dynamic Meshes

A. Under Options, turn on Filled. B. In the Contours of drop-down lists, select Pressure... and Static Pressure. C. Click Display.

8.00e+01 7.67e+01 7.35e+01 7.02e+01 6.69e+01 6.37e+01 6.04e+01 5.71e+01 5.39e+01 5.06e+01 4.74e+01 4.41e+01 4.08e+01 3.76e+01 3.43e+01 3.10e+01 2.78e+01 2.45e+01 2.12e+01 1.80e+01 1.47e+01

Contours of Static Pressure (psi) (Time=0.0000e+00) FLUENT 6.2 (axi, segregated, dynamesh, ske, unsteady)

Figure 11.3: Contours of Static Pressure at t = 0 s

11-24

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

v. Click OK in the Animation Sequence panel. The Animation Sequence panel will close, and the checkbox in the Active column next to pressure in the Solution Animation panel will become selected. (f) Dene the animation sequence for the velocity vectors. i. Click Dene... on the line for vv to set the parameters for the sequence. The Animation Sequence panel will open. ii. Under Storage Type, keep the default selection of Metale. iii. Increase the Window number to 2 and click Set. Graphics window number 2 will open. iv. Under Display Type, select Vectors. The Vectors panel will open.

v. Click Display in the Vectors panel. vi. Click OK in the Animation Sequence panel. The Animation Sequence panel will close, and the checkbox in the Active column next to vv in the Solution Animation panel will become selected.

c Fluent Inc. January 11, 2005

11-25

Using Dynamic Meshes

3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00 3.10e+00

Velocity Vectors Colored By Velocity Magnitude (m/s) (Time=0.0000e+00) FLUENT 6.2 (axi, segregated, dynamesh, ske, unsteady)

Figure 11.4: Vectors of Velocity at t = 0 s vii. Click OK in the Solution Animation panel. 6. Set the time step parameters for the calculation. Solve Iterate... (a) Set the Time Step Size to 2e-6 s. (b) Increase the Max Iterations per Time Step to 40. In the accurate solution of a real-life time-dependent CFD problem, it is important to make sure that the solution converges at every time step to within the desired accuracy. Here the rst few time steps will only come to a reasonably converged solution. (c) Click Apply. This will save the time step size to the case le (the next time a case le is saved).

11-26

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

7. Save the initial case and data les (valve.cas and valve.dat). File Write Case & Data... 8. Request 80 time steps. Solve Iterate... Extra: If you decide to read in the case le that is provided for this tutorial on the documentation CD, you will need to compile the UDF associated with this tutorial in your working directory. This is necessary because FLUENT will expect to nd the correct UDF libraries in your working directory when reading the case le. The UDF (valve.c) that is provided can be edited and customized by changing the parameters as required for your case. In this tutorial, the values necessary for this case were preset in the source code. These values may be modied to best suit your model.

c Fluent Inc. January 11, 2005

11-27

Using Dynamic Meshes

Step 10: Postprocessing


1. Inspect the solution at the nal time step. (a) Inspect the contours of static pressure in the valve (Figure 11.5). The negative absolute pressure indicates cavitating ow. See Chapter 24.6.4 of the Users Guide for details about the cavitation model.

8.17e+02 7.60e+02 7.04e+02 6.47e+02 5.90e+02 5.33e+02 4.77e+02 4.20e+02 3.63e+02 3.07e+02 2.50e+02 1.93e+02 1.36e+02 7.97e+01 2.29e+01 -3.38e+01 -9.05e+01 -1.47e+02 -2.04e+02 -2.61e+02 -3.17e+02

Contours of Static Pressure (psi) (Time=1.6000e-04) FLUENT 6.2 (axi, segregated, dynamesh, ske, unsteady)

Figure 11.5: Contours of Static Pressure After 80 Time Steps (b) Inspect the velocity vectors in the valve (Figure 11.6). 2. Optionally, inspect the solution at dierent intermediate time steps. (a) Read in the corresponding case and data les (valve.cas and valve.dat). File Read Case & Data... (b) Display the desired contours and vectors.

11-28

c Fluent Inc. January 11, 2005

Using Dynamic Meshes

7.77e+01 7.38e+01 6.99e+01 6.60e+01 6.21e+01 5.83e+01 5.44e+01 5.05e+01 4.66e+01 4.28e+01 3.89e+01 3.50e+01 3.11e+01 2.73e+01 2.34e+01 1.95e+01 1.56e+01 1.18e+01 7.88e+00 4.00e+00 1.23e-01

Velocity Vectors Colored By Velocity Magnitude (m/s) (Time=1.6000e-04) FLUENT 6.2 (axi, segregated, dynamesh, ske, unsteady)

Figure 11.6: Velocity Vectors After 80 Time Steps

3. Play back the animation of the pressure contours. Solve Animate Playback...

(a) In the Sequences list, select pressure. The playback control buttons will become active.

c Fluent Inc. January 11, 2005

11-29

Using Dynamic Meshes

(b) Set the slider bar above Replay Speed about halfway in between Slow and Fast. (c) Keep the default settings in the rest of the panel and click the play button (the second from the right in the group of buttons under Playback). See Tutorial 4 and Section 26.20 of the Users Guide for additional information on animating the solution. 4. Play back the animation of the velocity vectors. Solve Animate Playback... (a) In the Sequences list, select vv. (b) Keep the default settings in the rest of the panel and click the play button.

Summary
In this tutorial you learned how to use the dynamic mesh feature of FLUENT to simulate the rigid-body motion of a valve poppet in a ow eld, driven by the ow-generated forces, and spring and inertial forces, by means of a user dened function (UDF).

11-30

c Fluent Inc. January 11, 2005

You might also like