Vous êtes sur la page 1sur 28

Tutorial: Simulating a 2D Check Valve Using Dynamic Mesh Model And Spring Smoothing

Introduction
The purpose of this tutorial is to demonstrate how to simulate a check valve with small displacement using the dynamic mesh model in FLUENT. This tutorial uses the workbench workflow for solving the problem. As the displacement of the check valve ball in this case is small, the spring smoothing approach is suitable for this problem. A pure hex mesh is used for this case since only smoothing is used. Two dynamic mesh UDFs are used, one for the valve motion specification and one for the axis deformation specification. This tutorial demonstrates how to do the following: Set up a problem using the dynamic mesh model. Specify dynamic mesh modeling parameters. Specify a rigid body motion zone. Specify a deforming zone. Preview the dynamic mesh before starting the calculation. Perform the calculation with residual plotting. Post process using CFD-Post

Prerequisites
This tutorial assumes that you are familiar with the FLUENT interface and have completed Tutorial 1 from the FLUENT 13.0 Tutorial Guide. You should also be familiar with the dynamic mesh model. Refer to Section 11.7: Steps in Using Dynamic Meshes in the FLUENT 13.0 User's Guide for more information on the use of the dynamic mesh model.

ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Problem Description
The problem considered is shown schematically in Figure 1. A 2D axi-symmetric check valve geometry is used. A velocity inlet and pressure outlet are used. The valve is not driven by the flow in this case. Instead, a prescribed motion is used. The motion of the check valve ball is limited to a small distance and hence, the spring smoothing approach is suitable. The motion of the ball is prescribed by a user defined function (UDF). The mesh axis is set to deforming to prevent formation of skewed cells at the intersection of the check valve ball and the axis.

Figure 1:

Problem schematic

Preparation
1. Open Workbench 13.0 2. Unzip the project check_valve_2d.wbpz by File -> Restore Archive 3. Double click on the Fluent Setup Cell

ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 2:

Workbench project page

4. From the FLUENT launcher, start FLUENT. Right click on the geometry cell and click on properties. The analysis type is set to 2D in the project already. The Fluent version that is launched will correspond to the analysis type.

Setup and Solution


Step 1: Mesh 1. The mesh is automatically read into Fluent and displayed in the graphics window. 2. Note that if you are using standalone Fluent, you can read in the mesh from the File menu: File -> Read -> Mesh. The mesh file for this project can be accessed by navigating the project files to "check_valve_2d_files\dp0\FFF\MECH". The mesh file is named FFF.msh.

ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 3:

Fluent window and mesh display

3. Check the mesh by clicking on Mesh -> Check 4. FLUENT will perform various checks on the mesh and report the progress in the console. Make sure that the minimum volume reported is a positive number. 5. Note that Most of the Fluent settings can be accessed by navigating the setup tree on the left in the Fluent Window Step 2: General Settings Problem Setup -> General Settings 1. Enable axisymmetric, time-dependent calculations. (a) Select Axisymmetric from the 2D Space list. (b) Select Transient from the Time list.
ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 4:

General settings

Step 3: Models Problem Setup -> Models -> Viscous 1. Enable the standard k-epsilon model with standard wall functions.

ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 5:

Models options

Figure 6:
ANSYS, Inc. November 11, 2010

Viscous models window 6

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Step 4: Materials Problem Setup -> Materials 1. Retain the default properties of air. 2. Close the Materials panel.

Figure 7: Step 5: Cell Zone Conditions Problem Setup -> Cell Zone Conditions 1. Retain the default settings for all

Materials panel

ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Step 6: Boundary Conditions Problem Setup -> Boundary Conditions In this step, you will set the inlet conditions. 1. Define boundary conditions for the inlet zone. (a) Enter 2 m/s for the Velocity Magnitude. (b) Retain the selection of Magnitude, Normal to Boundary in the Velocity Specification (c) Select Intensity and Viscosity Ratio from the Specification Method drop-down list (d) In the Turbulence group box, retain the default settings for Turbulent Intensity and Turbulent Viscosity Ratio. (e) Click OK to close the Velocity Inlet panel. 2. The rest of the boundaries can be left at default settings 3. Close the Boundary Conditions panel.

Figure 8:

Inlet boundary conditions panel 8

ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Step 7: Compile the UDF Two UDFs are used in this example. The DEFINE_CG_MOTION macro is used to describe the velocity of the valve. The DEFINE_GEOM macro is used for the axis. Without this UDF, the nodes on the axis will be stationary and will cause skewed elements. To allow for smoothing, you will define a deforming zone. The DEFINE_GEOM macro used for the deforming zone defines the projection of the nodes on the deforming zones back to the axis. You will need a c-compiler installed on your machine to be able to compile UDFs. Define -> User Defined -> Functions -> Compiled 1. Click the Add... button in the Source Files group box. 2. The Select File dialog will open. 3. Browse to the folder "check_valve_2d_files\dp0\FFF\Fluent". Select the file check-valve-2d.c and click OK to close the Select File dialog. 4. 5. Click Build to build the library. FLUENT will set up the directory structure and compile the code. The compilation will be displayed in the console. 6. Click Load to load the library.

7. Close the Compiled UDFs panel.

ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 9: Step 8: Mesh Motion Setup

Compiled UDF panel

1. Enable dynamic mesh motion and specify the associated parameters. (a) Problem Setup -> Dynamic Mesh (b) Enable Dynamic Mesh in the Models group box. (c) Enable Smoothing in the Mesh Methods group box. (d) Make sure that the Layering and Remeshing options are disabled. (e) Click on Settings to open the Mesh Method Settings panel. Enter 0.1 for the Spring Constant Factor. (f) Enter 50 for Number of Iterations. (g) Click OK to close the Dynamic Mesh Parameters panel.

ANSYS, Inc. November 11, 2010

10

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 10: Dynamic mesh settings 2. Specify the motion of the check valve ball (a) Click on Create/Edit in the Dynamic Mesh Panel. (b) Select valve from the Zone Names drop-down list. (c) Retain the selection of Rigid Body in the Type list. (d) Select valve::libudf from the Motion UDF/Profile drop-down list. (e) Retain the default value of 0 m for Cell Height in the Meshing Options tab. (f) Click Create.

ANSYS, Inc. November 11, 2010

11

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 11: Defining the dynamic mesh zones (g) FLUENT will create the dynamic zone valve which will be available in the Dynamic Zones list. 3. Specify the motion of the deforming axis 1. (a) Select axis1 from the Zone Names drop-down list. (b) Select Deforming from the Type list. (c) Click the Geometry Definition tab and set the following parameters: (d) Select user-defined from the Definition drop-down list. (e) Select axis1::libudf from the Geometry UDF drop-down list. (f) Click the Meshing Options tab and set the following parameters: (g) Enable Smoothing and disable remeshing in the Methods group box. (h) Retain the default settings for the remaining parameters.
ANSYS, Inc. November 11, 2010

12

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

(i) Click Create. (j) FLUENT will create the dynamic zone axis1 which will be available in the Dynamic Zones list.

Figure 12: Dynamic mesh setup for axis zone

ANSYS, Inc. November 11, 2010

13

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 13: Dynamic mesh setup for axis zone 4. Specify the motion of the deforming axis 2. (a) Select axis2 from the Zone Names drop-down list. (b) Retain the selection of Deforming in the Type list. (c) Click the Geometry Definition tab and set the following parameters: (d) Select user-defined from the Definition drop-down list. (e) Select axis2::libudf from the Geometry UDF drop-down list. (f) Click the Meshing Options tab and set the following parameters: (g) Enable Smoothing and disable Remeshing in the Methods group box. (h) Retain the default settings for the remaining parameters. (i) Click Create. (j) FLUENT will create the dynamic zone axis2 which will be available in the Dynamic Zones list. 5. Close the Dynamic Mesh Zones panel.
ANSYS, Inc. November 11, 2010

14

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

6. By default, only tet-mesh cells will be smoothed by the algorithm. To enable hex-mesh smoothing use the TUI commands shown in the box. (a) You may need to press the <Enter> key to get the > prompt. > define/dynamic-mesh/controls/smoothing-parameters <Enter> spring-based smoothing for all cell types [no] yes <Enter>

Figure 14: Text commands entered in the Fluent GUI 7. Save the project.

8. Display the mesh Results -> Graphics and Animations -> Mesh -> Setup (a) Select all the surfaces and click Display. (b) Zoom in to the area of interest. (c) Close the Mesh Display panel.

ANSYS, Inc. November 11, 2010

15

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 15: Mesh display panel 9. Preview the mesh motion. (a) Problem Setup -> Dynamic Mesh -> Preview Mesh Motion (b) Enter 0.02 s for Time Step Size. (c) Enter 200 for Number of Time Steps. (d) Click Preview. (e) Make sure that the grid does not get too skewed. (f) Close the Mesh Motion panel.

Figure 16: Previewing the mesh motion

ANSYS, Inc. November 11, 2010

16

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Step 9: Solution Before starting the solution, you need to revert the mesh back to the original settings. The mesh is in a deformed state after pre-viewing mesh motion in the previous step. To revert the mesh back to original settings, close Fluent and click on the Settings cell again in the project page. This will re-launch Fluent with the original mesh but with all the saved settings. 1. Request saving of case and data files every 50 time steps. (a) Solution -> Calculation Activities -> Autosave (b) Enter 50 for both Autosave Case File Frequency and Autosave Data File Frequency. Clicking on Edit makes more options available. (c) Click OK to close the Autosave panel.

Figure 17: Enabling autosave of files Note: Fluent case and data files can also be read by CFD-Post for post processing but in the interests of minimizing hard disk space , you have the option to write out light weight files of only the variables that you are interested in for Post processing by following these steps:Calculation Activities > Automatic Export > Create > Solution Data Export. Choose file type to be CFD-Post compatible. Select Frequency, give a file name, select variables to post process

ANSYS, Inc. November 11, 2010

17

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

2. Retain the default solution control parameters. (a) Solution -> Solution Methods (b) Solution -> Solution Controls 3. Enable the plotting of residuals during the calculation. (a) Solution -> Monitors -> Residual (b) Enable Plot in the Options group box. (c) Click OK to close the Residual Monitors panel. 4. Initialize the flow field using the boundary conditions set at the inlet. (a) Solution-> Solution Initialization -> Initialize (b) Select inlet from the Compute From drop-down list. (c) Click Initialize and close the Solution Initialization panel.

ANSYS, Inc. November 11, 2010

18

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 18: Solution initialization 5. Save the project. Saving the project after initialization saves the settings file and the first case file. Any subsequent changes to the settings during the run will write out case files appended with an integer number corresponding to the change in settings you make. Resetting any cell in the Workbench project will clear all the corresponding files from the directory. 6. Run the calculation for 200 time steps. (a) Solution -> Run Calculation -> Iterate (b) Enter 0.02 s for Time Step Size. (c) Enter 200 for Number of Time Steps. (d) Click Iterate. (e) Close the Iterate panel.

Figure 19: Starting the calculation

ANSYS, Inc. November 11, 2010

19

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 20: Residual plot

Postprocessing
You have two options for post processing. One is to use the Fluent post processor Results -> Graphics and Animations/ Plots/ Reports. The other is to use CFD-Post. When you are dealing with transient data and wish to create animations/ plots, CFD-Post offers features that may not be available in Fluent Post. So long as you have written out data files at a frequency, CFD-Post can read in those files and create animations, transient monitors without pre-setting these at the beginning of your simulation. For details on using Fluent Post, please refer tutorial X. Step 1: Close Fluent and double click on the Results cell in workbench. This launches CFD-Post with the last .cas and .dat file read in automatically. 1. Click on "z-axis" in the display window to see front view of geometry.

2. Click on the clock icon has been loaded.

on the menu. This will show the transient sequence of files that

ANSYS, Inc. November 11, 2010

20

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

(a) Double click on any Step to display results at that time step.

Figure 21: Time step selector to display results at any saved simulation time Step 2: Display velocity contours: 1. Insert Contour from the menu. Insert -> Contour 2. Give a name to the contour 3. In the contour details, select location to be periodic 1. 4. Select variable to be velocity 5. Click apply. This displays the velocity contours in the display window. 6. To save a hard copy of any figure generated in the viewer, go to File -> Note: Other variable contours (e.g Static Pressure and Stream function) can be set up in similar fashion. As further practice, please try setting up velocity vectors by Insert -> Vector. The Insert menu has also different options such as inserting text, legends and so on. New planes or surfaces for display of data can be created by Insert -> Location. Any feature (contours, vectors, particle tracks) that have been inserted can be turned on or off in the display by clicking on the check box next to the feature.
ANSYS, Inc. November 11, 2010

21

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 22: Pressure contours at 4s of flow time

Figure 23: Velocity contours at 4s of flow time


ANSYS, Inc. November 11, 2010

22

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Step 3: Creating animations (a) Display the mesh on periodic 1. For this, check the box next to periodic 1 in the loaded data file boundaries displayed in the tree view on the left. (b) Double click on periodic 1. This brings up the details panel on the left bottom corner of CFD-Post. (c) In the "Render" tab check the box next to "Show Mesh Lines". This displays the mesh in periodic 1. (d) Click on the animation icon. This brings up the animation panel.

(e) Select Timesteps as the object to animate. (f) You can adjust the slider to make the animation fast or slow. (g) Clicking on the downfacing arrow brings up a few more details. (h) Check the box next to "Save Movie". (i) Browse to the required folder and give a name. (j) Then click on the play button. (k) This animates the mesh motion and save it into a wmv file. The animation file format is flexible and many options are available.

Figure 24: Animation panel in CFD-Post

ANSYS, Inc. November 11, 2010

23

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

(l) Contours, iso-surfaces, streamlines etc. can be animated. 7. Creating transient XY plots (a) Create a point on a node attached to the check valve (b) Insert -> Location -> Point (c) Check the box adjacent to the boundary called "Valve" in the tree view of the loaded data file on the left

Figure 25: Displaying the valve (d) In the point details window, set method to be "XYZ" and click on the co-ordinates window You can now pick your XYZ location with your mouse pointer on the 3D viewer. Select a point on the Valve close to the top (e) Clicking "Apply" in the point details displays the nearest node location to the selected XYZ location

ANSYS, Inc. November 11, 2010

24

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

(f) Now, switch the method to Node Number and enter the node number obtained from previous step. This will ensure that the point is hooked to the mesh node. If the node is displaced by mesh motion, the point is displaced as well. Click "Apply"

Figure 26: Point details menu (g) From the Insert menu, select Insert -> Chart. (h) In the details of the chart, set type to be "XY-Transient or sequence" . Enter a title for the chart. (i) Go to the "Data Series" tab. Under Data Source, pick Point 1 as the location. (j) Under "Y Axis" tab, pick X as the plot variable and click apply (k) The transient variation of the node location defined by Point 1 is plotted on a chart in the chart window.

ANSYS, Inc. November 11, 2010

25

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 27: Tracking the motion of the valve (point attachhed to node on valve) in xdirection Note: Instead of a point, create a line location. XY solution data can be plotted on the line to analyze your result. 8. Automatic Reports (a) Right click on the 3D viewer and select "Copy to New Figure". The figure is automatically inserted into the automatically generated report. (b) Any charts that were created are also inserted automatically into the report. (c) Click on the Report viewer tab on the bottom to access the automatically generated report. 9. Expressions CFD-Post allows creation of expressions to evaluate quantitative data from flow results. The expressions can also be used to create XY plot and creating tables. (a) Select the Expression tab on the top left. (b) Right click on Expressions and click on "New"

ANSYS, Inc. November 11, 2010

26

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

Figure 28: Creating expressions (c) Enter a name for the Expression (d) Right click on the blank details panel that opens up

Figure 29: Writing CEL expressions 27

ANSYS, Inc. November 11, 2010

Tutorial: Simulating a 2D Check Valve using Dynamic Mesh Model and Spring Smoothing

(e) This opens up the CEL expressions drop down list. All the accessible functions, expressions, variables, boundary locations and constants are listed (f) Choose functions -> CFD-Post -> massFlow (g) The CEL syntax for massFlow is inserted as massFlow()@ (h) With the mouse pointer resting after the @ symbol, Choose Locations -> outlet (i) The entire syntax for calculation mass flow at the boundary named as the outlet is massFlow()@outlet (j) Click Apply to see the calculated value in the box (k) Expressions can be used in XY plots, tables and in creating custom variables.

Summary
In this tutorial, you used the spring smoothing option for the dynamic mesh feature in FLUENT. The motion was limited to small distances. The spring smoothing option was activated using the TUI since the grid used is a pure hex mesh. The motion was prescribed by a user-defined function (UDF) which was compiled and loaded into FLUENT. The axis was also set to deforming to prevent formation of skewed cells at the intersection of the check valve ball and the axis. Post processing is shown using CFD-Post to detail some of the features of the post processing tool.

ANSYS, Inc. November 11, 2010

28

Vous aimerez peut-être aussi