Vous êtes sur la page 1sur 30

# Tutorial 12.

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. This tutorial demonstrates how to do the following: 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 pressure-based 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.

12-1

## Using Dynamic Meshes

Problem Description
The problem to be considered is shown schematically in Figure 12.1. A 2D axisymmetric valve geometry is used, consisting of a mass ow inlet on the left, and a pressure outlet on the right, driving the motion of a valve. In this case, the transient closure of the valve is studied. Note, however, that the valve in this case is not completely closed. Instead, for the sake of simplicity, a small gap remains between the valve and the valve seat (since dynamic mesh problems require that at least one layer remains in order to maintain the topology).
wall:001 wall mass flow inlet axisinlet seat valve valve axismove pressure outlet

## 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 folder (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 valve geometry. This function has already been written (valve.c). You will only need to compile it within FLUENT. 3. Start the 2D (2d) version of FLUENT.

12-2

## 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. Display the grid (Figure 12.2). Display Grid...

(a) Deselect axis-inlet, axis-move, inlet, and outlet under Surfaces. (b) Click Display. (c) Close the Grid Display panel.

12-3

Grid

## Figure 12.2: Initial Grid for the Valve

Step 2: Models
1. Enable an axisymmetric steady-state calculation. Dene Models Solver...

12-4

## Using Dynamic Meshes

(a) Select Axisymmetric under Space. (b) Click OK. 2. Turn on the standard k- turbulence model. Dene Models Viscous...

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

12-5

## Using Dynamic Meshes

Step 3: Materials
1. Apply the ideal gas law for the incoming air stream. Dene Materials...

(a) Retain the default selection of air in the Name eld. (b) Select ideal-gas for the Density. (c) Click Change/Create. (d) Close the Materials panel.

12-6

## Step 4: 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 a later step. Dene Boundary Conditions...

1. Set the conditions for the mass ow inlet (inlet). Since the inlet boundary is assigned to a wall boundary type in the original mesh, you will need to explicitly assign the inlet boundary to a mass ow inlet boundary type in FLUENT. (a) Select inlet from the Zone list and select mass-ow-inlet from the Type list in the Boundary Conditions panel. (b) Click Yes when FLUENT asks you if you want to change the zone type.

12-7

## The Mass-Flow Inlet boundary condition panel will open.

i. Enter 0.0116 kg/s for Mass Flow-Rate. ii. Select Normal to Boundary from the Direction Specication Method dropdown list. iii. Select Intensity and Hydraulic Diameter from the Specication Method dropdown list under Turbulence. iv. Enter 20 for the Hydraulic Diameter. v. Click OK.

12-8

## Using Dynamic Meshes

2. Set the conditions for the exit boundary (outlet). Dene Boundary Conditions... Since the outlet boundary is assigned to a wall boundary type in the original mesh, you will need to explicitly assign the outlet boundary to a pressure outlet boundary type in FLUENT. (a) Select outlet from the Zone list and select pressure-outlet from the Type list in the Boundary Conditions panel. (b) Click Yes when FLUENT asks you if you want to change the zone type. (c) Specify the pressure outlet boundary conditions as shown in the following gure and click OK.

3. Set the boundary type to axis for both the axis-inlet and the axis-move boundaries. Dene Boundary Conditions... Since the axis-inlet and the axis-move boundaries are assigned to a wall boundary type in the original mesh, you will need to explicitly assign these boundaries to an axis boundary type in FLUENT. (a) Select axis-inlet from the Zone list and select axis from the Type list in the Boundary Conditions panel. (b) Click Yes when FLUENT asks you if you want to change the zone type. (c) Retain the default Zone Name in the Axis panel and click OK.

12-9

## Using Dynamic Meshes

(d) Select axis-move from the Zone list and select axis from the Type list in the Boundary Conditions panel. (e) Click Yes when FLUENT asks you if you want to change the zone type. (f) Retain the default Zone Name in the Axis panel and click OK. 4. Close the Boundary Conditions panel.

## Step 5: Solution: Steady Flow

In this step, you will generate a steady-state ow solution that will be used as an initial condition for the time-dependent solution. 1. Set the solution parameters. Solve Controls Solution...

(a) Retain all default discretization schemes and values for under-relaxation factors. This problem has been found to converge satisfactorily with these default settings. (b) Click OK to close the Solution Controls panel.

12-10

## Using Dynamic Meshes

2. Enable the plotting of residuals during the calculation. Solve Monitors Residual... (a) Enable Plot under Options. (b) Click OK to close the Residual Monitors panel. 3. Initialize the solution. Solve Initialize Initialize...

(a) Select inlet from the Compute From drop-down list. (b) Click Init and close the Solution Initialization panel. 4. Save the case le (valve init.cas). File Write Case... 5. Start the calculation by requesting 150 iterations. Solve Iterate...

12-11

## Using Dynamic Meshes

The solution converges in approximately 100 iterations. 6. Save the case and data les, valve init.cas and valve init.dat. File Write Case & Data...

## Step 6: Unsteady Solution Setup

1. Enable a time-dependent calculation. Dene Models Solver...

(a) Select Unsteady under Time. (b) Retain the default selection of 1st-Order Implicit under Unsteady Formulation.

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

12-12

## Step 7: Mesh Motion

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

(a) Click Add... under Source Files. A Select File panel will open. i. Select the source code valve.c in the Select File panel, and click OK. (b) Click Build in the Compiled UDFs panel. 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 folder. 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. A dialog box will appear warning you to make sure that the UDF source les are in the directory that contains your case and data les. Click OK in the warning dialog box. (c) 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.

12-13

## Using Dynamic Meshes

2. Hook your model to the UDF library. Dene User-Dened Function Hooks...

12-14

## Using Dynamic Meshes

(c) Click OK to close the User-Dened Function Hooks panel. 3. Activate dynamic mesh motion and specify the associated parameters. Dene Dynamic Mesh Parameters...

(a) Enable Dynamic Mesh under Models. See Chapter 11 of the Users Guide for more information the available models for moving and deforming zones. (b) Disable Smoothing and enable Layering under Mesh Methods. FLUENT will automatically ag the existing mesh zones for use of the dierent dynamic mesh methods where applicable. (c) Click the Layering tab and set the following parameters: i. Select Constant Ratio under Options. ii. Retain the default settings of 0.4 and 0.04 for the Split Factor and Collapse Factor, respectively. (d) Click OK.

12-15

## Using Dynamic Meshes

4. Specify the motion of the uid region (uid-move). The valve motion and the motion of the uid region are specied by means of the UDF valve. Dene Dynamic Mesh Zones...

(a) Select uid-move from the Zone Names drop-down list. (b) Retain the default selection of Rigid Body under Type. (c) Make sure that valve::libudf is selected in the Motion UDF/Prole drop-down list under Motion Attributes to hook the UDF to your model. (d) Retain the default settings of (0, 0) m for Center of Gravity Location, and 0 for Center of Gravity Orientation. Specifying the C.G. location and orientation is not necessary in this case, because the valve motion and the initial C.G. position of the valve is already dened by the UDF. (e) Click Create.

12-16

## Using Dynamic Meshes

5. Specify the meshing options for the stationary layering interface (int-layering). Dene Dynamic Mesh Zones...

(a) Select int-layering from the Zone Names drop-down list. (b) Select Stationary under Type. (c) Click the Meshing Options tab. i. Enter 0.5 millimeters for the Cell Height of the fluid-move zone. ii. Retain the default value of 0 millimeters for the Cell Height of the fluid-inlet zone. (d) Click Create. 6. Specify the meshing options for the stationary outlet (outlet). Dene Dynamic Mesh Zones... (a) Select outlet from the Zone Names drop-down list. (b) Retain the previous selection of Stationary under Type. (c) Click the Meshing Options tab and enter 1.9 millimeters for the Cell Height of the fluid-move zone. (d) Click Create.

12-17

## Using Dynamic Meshes

7. Specify the meshing options for the stationary seat valve (seat-valve). Dene Dynamic Mesh Zones... (a) Select seat-valve from the Zone Names drop-down list. (b) Retain the previous selection of Stationary under Type. (c) Click the Meshing Options tab and enter 0.5 millimeters for the Cell Height of the fluid-move zone. (d) Click Create. 8. Specify the motion of the valve (valve). Dene Dynamic Mesh Zones... (a) Select valve from the Zone Names drop-down list. (b) Select Rigid Body under Type. (c) Click the Motion Attributes tab. i. Make sure that valve::libudf is selected in the Motion UDF/Prole dropdown list to hook the UDF to your model. ii. Retain the default settings of (0, 0) m for Center of Gravity Location, and 0 for Center of Gravity Orientation. (d) Click the Meshing Options tab and enter 0 millimeters for the Cell Height of the fluid-move zone. (e) Click Create and close the Dynamic Mesh Zones panel. 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 valve and acting against the inertia of the valve. Hence, for this problem, mesh motion in the absence of a ow eld solution is meaningless, and you will not use this feature here.

12-18

## Using Dynamic Meshes

1. Set the solution parameters for the unsteady simulation. Solve Controls Solution...

(a) Select PISO for the Pressure-Velocity Coupling. (b) Enter 0 for the Skewness Correction. (c) Select PRESTO! for the Pressure discretization method. (d) Enter 0.6 for the Pressure under-relaxation factor. (e) Enter 0.4 for the Turbulent Kinetic Energy under-relaxation factor. (f) Enter 0.4 for the Turbulent Dissipation Rate under-relaxation factor. (g) Click OK.

12-19

## Using Dynamic Meshes

2. Request that case and data les are automatically saved every 50 time steps. File Write Autosave...

(a) Enter 50 for the Autosave Case File Frequency and the Autosave Data File Frequency. To retain all les, keep the Overwrite Existing Files inactive. (b) Make sure that ow-time is selected in the Append File Name with drop-down list. (c) Enter valve tran-.gz in the Filename eld. When FLUENT saves a le, it will append the ow time value to the le name prex (valve tran-). The gzipped standard extensions (.cas.gz and .dat.gz) will also be appended. (d) Click OK.

12-20

## Using Dynamic Meshes

3. 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) Enter 2 for the number of Animation Sequences. (b) Enter pressure under Name for the rst animation. (c) Enter vv under Name for the second animation. (d) Enter 5 under Every for both animation 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. (e) Select Time Step in the When drop-down list for pressure and vv.

12-21

## Using Dynamic Meshes

(f) Click Dene... to dene the animation sequence for pressure. The Animation Sequence panel will open.

i. Retain the default selection of Metale under Storage Type. Note: If you want to store the plots in a folder other than your working folder, enter the directory path in the Storage Directory eld. If this eld is blank (the default), the les will be saved in your working folder (i.e., the folder where you started FLUENT). ii. Enter 1 for the Window number and click Set. The FLUENT [1] graphics window will open.

12-22

## Using Dynamic Meshes

iii. Select Contours under Display Type. The Contours panel will open.

A. Enable Filled under Options. B. Retain Pressure... and Static Pressure as the selection in the Contours of drop-down lists. C. Click Display.
6.41e+02 5.89e+02 5.38e+02 4.86e+02 4.35e+02 3.83e+02 3.31e+02 2.80e+02 2.28e+02 1.77e+02 1.25e+02 7.38e+01 2.22e+01 -2.93e+01 -8.09e+01 -1.32e+02 -1.84e+02 -2.36e+02 -2.87e+02 -3.39e+02 -3.90e+02

Contours of Static Pressure (pascal) (Time=0.0000e+00) FLUENT 6.3 (axi, pbns, dynamesh, ske, unsteady)

12-23

## Using Dynamic Meshes

D. Close the Contours panel. iv. 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 be selected. (g) Click Dene... for vv to dene the animation sequence for the velocity vectors. The Animation Sequence panel will open. i. Retain the default selection of Metale under Storage Type. ii. Enter 2 for the Window number and click Set. The FLUENT [2] graphics window will open. iii. Select Vectors under Display Type. The Vectors panel will open.

12-24

## Using Dynamic Meshes

3.53e+01 3.35e+01 3.18e+01 3.00e+01 2.82e+01 2.65e+01 2.47e+01 2.30e+01 2.12e+01 1.94e+01 1.77e+01 1.59e+01 1.42e+01 1.24e+01 1.06e+01 8.89e+00 7.13e+00 5.37e+00 3.61e+00 1.85e+00 9.44e-02

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

Figure 12.4: Vectors of Velocity at t = 0 s B. Close the Vectors panel. iv. 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. (h) Click OK in the Solution Animation panel. 4. Set the time step parameters for the calculation. Solve Iterate... (a) Enter 0.0001 seconds for the Time Step Size. (b) Retain 20 for the Max Iterations per Time Step. 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. (d) Close the Iterate panel. This will save the time step size to the case le (the next time a case le is saved). 5. Save the initial case and data les for this transient problem (valve tran--0.000000.cas and valve tran--0.000000.dat). File Write Case & Data...

12-25

## Using Dynamic Meshes

6. Request 150 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 folder. This is necessary because FLUENT will expect to nd the correct UDF libraries in your working folder 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.

Step 9: Postprocessing
1. Inspect the solution at the nal time step. (a) Inspect the contours of static pressure in the valve (Figure 12.5). The negative absolute pressure indicates cavitating ow. See Chapter 23.7.4 of the Users Guide for details about the cavitation model.
2.11e+04 1.92e+04 1.73e+04 1.55e+04 1.36e+04 1.18e+04 9.89e+03 8.03e+03 6.16e+03 4.30e+03 2.44e+03 5.75e+02 -1.29e+03 -3.15e+03 -5.01e+03 -6.88e+03 -8.74e+03 -1.06e+04 -1.25e+04 -1.43e+04 -1.62e+04

Contours of Static Pressure (pascal) (Time=1.5000e-02) FLUENT 6.3 (axi, pbns, dynamesh, ske, unsteady)

12-26

## Using Dynamic Meshes

(b) Inspect the velocity vectors near the point where the valve meets the seat valve (Figure 12.6).
2.26e+02 2.15e+02 2.04e+02 1.93e+02 1.81e+02 1.70e+02 1.59e+02 1.47e+02 1.36e+02 1.25e+02 1.13e+02 1.02e+02 9.07e+01 7.93e+01 6.80e+01 5.67e+01 4.54e+01 3.41e+01 2.28e+01 1.14e+01 1.20e-01

Velocity Vectors Colored By Velocity Magnitude (m/s) (Time=1.5000e-02) FLUENT 6.3 (axi, pbns, dynamesh, ske, unsteady)

Figure 12.6: Velocity Vectors After 150 Time Steps 2. Optionally, inspect the solution at dierent intermediate time steps. (a) Read in the corresponding case and data les (e.g., valve tran-0.010000.cas.gz and valve tran-0.010000.dat.gz). File Read Case & Data... (b) Display the desired contours and vectors.

12-27

## Using Dynamic Meshes

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

(a) Select pressure from the Sequences list. The playback control buttons will become active. (b) Set the slider bar above Replay Speed about halfway in between Slow and Fast. (c) Retain 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 25.20.1 of the Users Guide for additional information on animating the solution. 4. Play back the animation of the velocity vectors. Solve Animate Playback... (a) Select vv from the Sequences list. (b) Retain the default settings in the rest of the panel and click the play button.

12-28

## Using Dynamic Meshes

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

Further Improvements
This tutorial guides you through the steps to reach an initial solution. You may be able to obtain a more accurate solution by using an appropriate higher-order discretization scheme and by adapting the grid. Grid adaption can also ensure that the solution is independent of the grid. These steps are demonstrated in Tutorial 1.

12-29

12-30