dynamic mesh

30
Tutorial 12. Using Dynamic Meshes Introduction This tutorial provides information for performing basic dynamic mesh calculations. In addition to combining the basic mesh-motion schemes, this tutorial will introduce rigid- body 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 flow-driven rigid- body motion problem. Set boundary conditions for internal flow. Use a compiled user-defined function (UDF) to specify flow-driven rigid-body mo- tion. 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. c Fluent Inc. September 21, 2006 12-1

Upload: ical0nly0ne

Post on 30-Oct-2014

124 views

Category:

Documents


7 download

DESCRIPTION

yang mau blajar meshing

TRANSCRIPT

Page 1: dynamic mesh

Tutorial 12. Using Dynamic Meshes

Introduction

This tutorial provides information for performing basic dynamic mesh calculations. Inaddition to combining the basic mesh-motion schemes, this tutorial will introduce rigid-body motion of a cell zone. This is useful for a multitude of realistic cases with movingmeshes.

This tutorial demonstrates how to do the following:

• Use the dynamic mesh capability of FLUENT to solve a simple flow-driven rigid-body motion problem.

• Set boundary conditions for internal flow.

• Use a compiled user-defined function (UDF) to specify flow-driven rigid-body mo-tion.

• Calculate a solution using the pressure-based solver.

Prerequisites

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

c© Fluent Inc. September 21, 2006 12-1

Page 2: dynamic mesh

Using Dynamic Meshes

Problem Description

The problem to be considered is shown schematically in Figure 12.1. A 2D axisymmetricvalve geometry is used, consisting of a mass flow inlet on the left, and a pressure outleton the right, driving the motion of a valve. In this case, the transient closure of the valveis 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 (sincedynamic mesh problems require that at least one layer remains in order to maintain thetopology).

wall

axis−inlet

wall:001

valvepressureoutlet

axis−move

seat valve

mass flow inlet

Figure 12.1: Problem Specification

Setup and Solution

Preparation

1. Download dynamic_mesh.zip from the Fluent Inc. User Services Center or copyit from the FLUENT documentation CD to your working folder (as described inTutorial 1).

2. Unzip dynamic_mesh.zip.

valve.msh and valve.c can be found in the dynamic mesh folder created afterunzipping the file.

A user-defined function will be used to define the rigid-body motion of the valvegeometry. This function has already been written (valve.c). You will only need tocompile it within FLUENT.

3. Start the 2D (2d) version of FLUENT.

12-2 c© Fluent Inc. September 21, 2006

Page 3: dynamic mesh

Using Dynamic Meshes

Step 1: Grid

1. Read the grid file 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.

c© Fluent Inc. September 21, 2006 12-3

Page 4: dynamic mesh

Using Dynamic Meshes

GridFLUENT 6.3 (2d, pbns, lam)

Figure 12.2: Initial Grid for the Valve

Step 2: Models

1. Enable an axisymmetric steady-state calculation.

Define −→ Models −→Solver...

12-4 c© Fluent Inc. September 21, 2006

Page 5: dynamic mesh

Using Dynamic Meshes

(a) Select Axisymmetric under Space.

(b) Click OK.

2. Turn on the standard k-ε turbulence model.

Define −→ Models −→Viscous...

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

(b) Click OK.

c© Fluent Inc. September 21, 2006 12-5

Page 6: dynamic mesh

Using Dynamic Meshes

Step 3: Materials

1. Apply the ideal gas law for the incoming air stream.

Define −→Materials...

(a) Retain the default selection of air in the Name field.

(b) Select ideal-gas for the Density.

(c) Click Change/Create.

(d) Close the Materials panel.

12-6 c© Fluent Inc. September 21, 2006

Page 7: dynamic mesh

Using Dynamic Meshes

Step 4: Boundary Conditions

Dynamic mesh motion and all related parameters are specified using the items in theDefine/Dynamic Mesh submenu, not through the Boundary Conditions panel. You will setthese conditions in a later step.

Define −→Boundary Conditions...

1. Set the conditions for the mass flow 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 flow inlet boundarytype in FLUENT.

(a) Select inlet from the Zone list and select mass-flow-inlet from the Type list inthe Boundary Conditions panel.

(b) Click Yes when FLUENT asks you if you want to change the zone type.

c© Fluent Inc. September 21, 2006 12-7

Page 8: dynamic mesh

Using Dynamic Meshes

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 Specification Method drop-down list.

iii. Select Intensity and Hydraulic Diameter from the Specification Method drop-down list under Turbulence.

iv. Enter 20 for the Hydraulic Diameter.

v. Click OK.

12-8 c© Fluent Inc. September 21, 2006

Page 9: dynamic mesh

Using Dynamic Meshes

2. Set the conditions for the exit boundary (outlet).

Define −→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 boundarytype in FLUENT.

(a) Select outlet from the Zone list and select pressure-outlet from the Type list inthe 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 followingfigure and click OK.

3. Set the boundary type to axis for both the axis-inlet and the axis-move boundaries.

Define −→Boundary Conditions...

Since the axis-inlet and the axis-move boundaries are assigned to a wall boundarytype in the original mesh, you will need to explicitly assign these boundaries to anaxis boundary type in FLUENT.

(a) Select axis-inlet from the Zone list and select axis from the Type list in theBoundary 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.

c© Fluent Inc. September 21, 2006 12-9

Page 10: dynamic mesh

Using Dynamic Meshes

(d) Select axis-move from the Zone list and select axis from the Type list in theBoundary 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 flow solution that will be used as an initialcondition for the time-dependent solution.

1. Set the solution parameters.

Solve −→ Controls −→Solution...

(a) Retain all default discretization schemes and values for under-relaxation fac-tors.

This problem has been found to converge satisfactorily with these default set-tings.

(b) Click OK to close the Solution Controls panel.

12-10 c© Fluent Inc. September 21, 2006

Page 11: dynamic mesh

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 file (valve init.cas).

File −→ Write −→Case...

5. Start the calculation by requesting 150 iterations.

Solve −→Iterate...

c© Fluent Inc. September 21, 2006 12-11

Page 12: dynamic mesh

Using Dynamic Meshes

The solution converges in approximately 100 iterations.

6. Save the case and data files, valve init.cas and valve init.dat.

File −→ Write −→Case & Data...

Step 6: Unsteady Solution Setup

1. Enable a time-dependent calculation.

Define −→ 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 first-order time ad-vancement.

(c) Click OK.

12-12 c© Fluent Inc. September 21, 2006

Page 13: dynamic mesh

Using Dynamic Meshes

Step 7: Mesh Motion

1. Select and compile the user-defined function (UDF).

Define −→ User-Defined −→ 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 defined, but it needs to be compiled within FLUENTbefore it can be used in the solver. Here you will create a library with thedefault name of libudf in your working folder. If you would like to use adifferent name, you can enter it in the Library Name field. Note that in thiscase you need to make sure that you will open the correct library in the nextstep.

A dialog box will appear warning you to make sure that the UDF source filesare in the directory that contains your case and data files. Click OK in thewarning 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. Itsname will appear as valve::libudf and may be selected in drop-down lists of variouspanels.

c© Fluent Inc. September 21, 2006 12-13

Page 14: dynamic mesh

Using Dynamic Meshes

2. Hook your model to the UDF library.

Define −→ User-Defined −→Function Hooks...

(a) Click the Edit... button next to Read Data to access the UDF that will readthe data.

This Read Data Functions panel will open.

i. Select reader::libudf from the list of Available Read Data Functions.

ii. Click Add to add the selected function to the list of Selected Read DataFunctions.

iii. Click OK to close the Read Data Functions panel.

(b) Click the Edit... button next to Write Data to access the UDF that will writethe data.

This Write Data Functions panel will open.

i. Select writer::libudf from the list of Available Write Data Functions.

ii. Click Add to add the selected function to the list of Selected Write DataFunctions.

iii. Click OK to close the Write Data Functions panel.

These two functions will read/write the position of C.G. and velocity in the Xdirection to the data file. The location of C.G. and the velocity are necessaryfor restarting a case. When starting from an intermediate case and data file,FLUENT needs to know the location of C.G. and velocity, which are the initialconditions for the motion calculation. Those values are saved in the data fileusing the writer UDF and will be read in using the reader UDF when readingthe data file.

12-14 c© Fluent Inc. September 21, 2006

Page 15: dynamic mesh

Using Dynamic Meshes

(c) Click OK to close the User-Defined Function Hooks panel.

3. Activate dynamic mesh motion and specify the associated parameters.

Define −→ Dynamic Mesh −→Parameters...

(a) Enable Dynamic Mesh under Models.

See Chapter 11 of the User’s Guide for more information the available modelsfor moving and deforming zones.

(b) Disable Smoothing and enable Layering under Mesh Methods.

FLUENT will automatically flag the existing mesh zones for use of the differentdynamic 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 Col-lapse Factor, respectively.

(d) Click OK.

c© Fluent Inc. September 21, 2006 12-15

Page 16: dynamic mesh

Using Dynamic Meshes

4. Specify the motion of the fluid region (fluid-move).

The valve motion and the motion of the fluid region are specified by means of theUDF valve.

Define −→ Dynamic Mesh −→Zones...

(a) Select fluid-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/Profile drop-downlist 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 alreadydefined by the UDF.

(e) Click Create.

12-16 c© Fluent Inc. September 21, 2006

Page 17: dynamic mesh

Using Dynamic Meshes

5. Specify the meshing options for the stationary layering interface (int-layering).

Define −→ 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-inletzone.

(d) Click Create.

6. Specify the meshing options for the stationary outlet (outlet).

Define −→ 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 ofthe fluid-move zone.

(d) Click Create.

c© Fluent Inc. September 21, 2006 12-17

Page 18: dynamic mesh

Using Dynamic Meshes

7. Specify the meshing options for the stationary seat valve (seat-valve).

Define −→ 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 ofthe fluid-move zone.

(d) Click Create.

8. Specify the motion of the valve (valve).

Define −→ 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/Profile drop-down 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 ofthe 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 proceedingany further. In this problem, the mesh motion is driven by the pressure exerted by thefluid on the valve and acting against the inertia of the valve. Hence, for this problem,mesh motion in the absence of a flow field solution is meaningless, and you will not usethis feature here.

12-18 c© Fluent Inc. September 21, 2006

Page 19: dynamic mesh

Using Dynamic Meshes

Step 8: Unsteady Solution

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.

c© Fluent Inc. September 21, 2006 12-19

Page 20: dynamic mesh

Using Dynamic Meshes

2. Request that case and data files are automatically saved every 50 time steps.

File −→ Write −→Autosave...

(a) Enter 50 for the Autosave Case File Frequency and the Autosave Data FileFrequency.

To retain all files, keep the Overwrite Existing Files inactive.

(b) Make sure that flow-time is selected in the Append File Name with drop-downlist.

(c) Enter valve tran-.gz in the Filename field.

When FLUENT saves a file, it will append the flow time value to the filename prefix (valve tran-). The gzipped standard extensions (.cas.gz and.dat.gz) will also be appended.

(d) Click OK.

12-20 c© Fluent Inc. September 21, 2006

Page 21: dynamic mesh

Using Dynamic Meshes

3. Create animation sequences for the static pressure contour plots and velocity vectorsplots in the valve.

You will use FLUENT’s solution animation feature to save contour plots of temper-ature every 5 time steps. After the calculation is complete, you will use the solutionanimation playback feature to view the animated temperature plots over time.

Solve −→ Animate −→Define...

(a) Enter 2 for the number of Animation Sequences.

(b) Enter pressure under Name for the first 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 atevery time step. For this case, this would generate a large number of files.

(e) Select Time Step in the When drop-down list for pressure and vv.

c© Fluent Inc. September 21, 2006 12-21

Page 22: dynamic mesh

Using Dynamic Meshes

(f) Click Define... to define the animation sequence for pressure.

The Animation Sequence panel will open.

i. Retain the default selection of Metafile under Storage Type.

Note: If you want to store the plots in a folder other than your workingfolder, enter the directory path in the Storage Directory field. If thisfield is blank (the default), the files 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 c© Fluent Inc. September 21, 2006

Page 23: dynamic mesh

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 Contoursof drop-down lists.

C. Click Display.

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

6.41e+025.89e+025.38e+024.86e+024.35e+023.83e+023.31e+022.80e+022.28e+021.77e+021.25e+027.38e+012.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

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

c© Fluent Inc. September 21, 2006 12-23

Page 24: dynamic mesh

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 Activecolumn next to pressure in the Solution Animation panel will be selected.

(g) Click Define... for vv to define the animation sequence for the velocity vectors.

The Animation Sequence panel will open.

i. Retain the default selection of Metafile 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.

A. Click Display in the Vectors panel.

12-24 c© Fluent Inc. September 21, 2006

Page 25: dynamic mesh

Using Dynamic Meshes

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

3.53e+013.35e+013.18e+013.00e+012.82e+012.65e+012.47e+012.30e+012.12e+011.94e+011.77e+011.59e+011.42e+011.24e+011.06e+018.89e+007.13e+005.37e+003.61e+001.85e+009.44e-02

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 Activecolumn 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 impor-tant to make sure that the solution converges at every time step to within thedesired accuracy. Here the first few time steps will only come to a reasonablyconverged solution.

(c) Click Apply.

(d) Close the Iterate panel.

This will save the time step size to the case file (the next time a case file issaved).

5. Save the initial case and data files for this transient problem (valve tran--0.000000.cas

and valve tran--0.000000.dat).

File −→ Write −→Case & Data...

c© Fluent Inc. September 21, 2006 12-25

Page 26: dynamic mesh

Using Dynamic Meshes

6. Request 150 time steps.

Solve −→Iterate...

Extra: If you decide to read in the case file that is provided for this tutorial on thedocumentation CD, you will need to compile the UDF associated with this tutorialin your working folder. This is necessary because FLUENT will expect to find thecorrect UDF libraries in your working folder when reading the case file.

The UDF (valve.c) that is provided can be edited and customized by changing theparameters as required for your case. In this tutorial, the values necessary for thiscase were preset in the source code. These values may be modified to best suit yourmodel.

Step 9: Postprocessing

1. Inspect the solution at the final time step.

(a) Inspect the contours of static pressure in the valve (Figure 12.5).

The negative absolute pressure indicates cavitating flow.

See Chapter 23.7.4 of the User’s Guide for details about the cavitation model.

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

2.11e+041.92e+041.73e+041.55e+041.36e+041.18e+049.89e+038.03e+036.16e+034.30e+032.44e+035.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

Figure 12.5: Contours of Static Pressure After 150 Time Steps

12-26 c© Fluent Inc. September 21, 2006

Page 27: dynamic mesh

Using Dynamic Meshes

(b) Inspect the velocity vectors near the point where the valve meets the seatvalve (Figure 12.6).

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

2.26e+022.15e+022.04e+021.93e+021.81e+021.70e+021.59e+021.47e+021.36e+021.25e+021.13e+021.02e+029.07e+017.93e+016.80e+015.67e+014.54e+013.41e+012.28e+011.14e+011.20e-01

Figure 12.6: Velocity Vectors After 150 Time Steps

2. Optionally, inspect the solution at different intermediate time steps.

(a) Read in the corresponding case and data files (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.

c© Fluent Inc. September 21, 2006 12-27

Page 28: dynamic mesh

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 User’s Guide for additional informa-tion 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 c© Fluent Inc. September 21, 2006

Page 29: dynamic mesh

Using Dynamic Meshes

Summary

In this tutorial you learned how to use the dynamic mesh feature of FLUENT to simulatethe rigid-body motion of a valve in a flow field, driven by the flow-generated forces, andspring and inertial forces, by means of a user defined function (UDF).

Further Improvements

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

c© Fluent Inc. September 21, 2006 12-29

Page 30: dynamic mesh

Using Dynamic Meshes

12-30 c© Fluent Inc. September 21, 2006