Tutorial 13. Using Dynamic Meshes
Tutorial 13. Using Dynamic Meshes
Tutorial 13. Using Dynamic Meshes
Introduction
In ANSYS FLUENT the dynamic mesh capability is used to simulate problems with
boundary motion, such as check valves and store separations. The building blocks for
dynamic mesh capabilities within ANSYS FLUENT are three dynamic mesh schemes,
namely, smoothing, layering, and remeshing. A combination of these three schemes
are used to tackle the most challenging dynamic mesh problems. However, for simple
dynamic mesh problems involving linear boundary motion, the layering scheme is often
sufficient. For example, flow around a check valve can be simulated using only the layering
scheme. In this tutorial, such a case will be used to demonstrate the layering feature of
the dynamic mesh capability in ANSYS FLUENT.
Check valves are commonly used to allow uni-directional flow. For instance, they are often
used to act as a pressure-relieving device by only allowing fluid to leave the domain when
the pressure is higher than a certain level. In such a case, the check valve is connected
to a spring that acts to push the valve to the valve seat and to shut the flow. But when
the pressure force on the valve is greater than the spring force, the valve will move away
from the valve seat and allow fluid to leave, thus reducing the pressure upstream. Gravity
could be another factor in the force balance, and can be considered in ANSYS FLUENT.
The deformation of the valve is typically neglected and thus allows for a rigid body Fluid
Structure Interaction (FSI) calculation, for which a UDF is provided.
This tutorial provides information for performing basic dynamic mesh calculations. This
tutorial demonstrates how to do the following:
• Use the dynamic mesh capability of ANSYS 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 is written with the assumption that you have completed Tutorial 1, and
that you are familiar with the ANSYS FLUENT navigation pane and menu structure.
Some steps in the setup and solution procedure will not be shown explicitly.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-1
Using Dynamic Meshes
Problem Description
The check valve problem to be considered is shown schematically in Figure 13.1. A 2D
axisymmetric valve geometry is used, consisting of a mass flow inlet on the left, and a
pressure outlet on the right, driving the motion of a valve. In this case, the transient
motion of the valve due to spring force, gravity, and hydrodynamic force 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
seat valve
wall pressure
mass flow inlet valve outlet
axis−inlet axis−move
2. Unzip dynamic_mesh.zip.
The files, valve.msh and valve.c can be found in the dynamic mesh folder created
after unzipping the file.
A user-defined function will be used to define the rigid-body motion of the valve
geometry. This function has already been written (valve.c). You will only need to
compile it within ANSYS FLUENT.
Step 1: Mesh
1. Read the mesh file valve.msh.
File −→ Read −→Mesh...
(a) Deselect axis-inlet, axis-move, inlet, and outlet from the Surfaces selection list.
(b) Click Display.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-3
Using Dynamic Meshes
Step 3: Models
Models
Release 12.0
c ANSYS, Inc. March 12, 2009 13-5
Using Dynamic Meshes
(a) Select k-epsilon from the Model list and retain the default selection of Standard
in the k-epsilon Model group box.
(b) Click OK to close the Viscous Model dialog box.
Step 4: Materials
Materials
1. Apply the ideal gas law for the incoming air stream.
Materials −→ Fluid −→ Create/Edit...
Release 12.0
c ANSYS, Inc. March 12, 2009 13-7
Using Dynamic Meshes
(a) Select mass-flow-inlet from the Type drop-down list in the Boundary Conditions
task page.
(b) Click Yes when ANSYS FLUENT asks you if you want to change the zone type.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-9
Using Dynamic Meshes
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 ANSYS FLUENT.
(a) Select pressure-outlet from the Type drop-down list in the Boundary Conditions
task page.
(b) Click Yes when ANSYS FLUENT asks you if you want to change the zone type.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-11
Using Dynamic Meshes
(a) Retain all default discretization schemes in the Solution Methods task page.
This problem has been found to converge satisfactorily with these default set-
tings.
(a) Retain the default values for Under-Relaxation Factors in the Solution Controls
task page.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-13
Using Dynamic Meshes
(a) Select Transient from the Time list in the General task page.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-15
Using Dynamic Meshes
(a) Retain the default selection of First Order Implicit from the Transient Formula-
tion drop-down list in the Solution Methods task page.
! Dynamic mesh simulations currently work only with first-order time ad-
vancement.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-17
Using Dynamic Meshes
(a) Click the Edit... button next to Read Data to open the Read Data Functions
dialog box.
i. Select reader::libudf from the Available Read Data Functions selection list.
ii. Click Add to add the selected function to the Selected Read Data Functions
selection list.
iii. Click OK to close the Read Data Functions dialog box.
(b) Click the Edit... button next to Write Data to open the Write Data Functions
dialog box.
i. Select writer::libudf from the Available Write Data Functions selection list.
ii. Click Add to add the selected function to the Selected Write Data Functions
selection list.
iii. Click OK to close the Write Data Functions dialog box.
These two functions will read/write the position of C.G. and velocity in the X
direction to the data file. The location of C.G. and the velocity are necessary
for restarting a case. When starting from an intermediate case and data file,
ANSYS 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 file using the writer UDF and will be read in using the reader UDF when
reading the data file.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-19
Using Dynamic Meshes
Release 12.0
c ANSYS, Inc. March 12, 2009 13-21
Using Dynamic Meshes
5. Specify the meshing options for the stationary layering interface (int-layering) in the
Dynamic Mesh Zones dialog box.
6. Specify the meshing options for the stationary outlet (outlet) in the Dynamic Mesh
Zones dialog box.
(a) Select outlet from the Zone Names drop-down list.
(b) Retain the previous selection of Stationary in the Type group box.
(c) In the Meshing Options tab and enter 1.9 mm for the Cell Height of the
fluid-move Adjacent Zone.
(d) Click Create.
7. Specify the meshing options for the stationary seat valve (seat-valve) in the Dynamic
Mesh Zones dialog box.
(a) Select seat-valve from the Zone Names drop-down list.
(b) Retain the previous selection of Stationary in the Type group box.
(c) In the Meshing Options tab and enter 0.5 mm for Cell Height of the fluid-move
Adjacent Zone.
(d) Click Create.
8. Specify the motion of the valve (valve) in the Dynamic Mesh Zones dialog box.
(a) Select valve from the Zone Names drop-down list.
(b) Select Rigid Body in the Type group box.
(c) Click the Motion Attributes tab.
i. Make sure that valve::libudf is selected from 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 mm for the Cell Height of the
fluid-move Adjacent zone.
(e) Click Create and close the Dynamic Mesh Zones dialog box.
In many MDM problems, you may want to preview the mesh motion before proceeding.
In this problem, the mesh motion is driven by the pressure exerted by the fluid 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 use this feature
here.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-23
Using Dynamic Meshes
(a) Select PISO from the Scheme drop-down list in Pressure-Velocity Coupling group
box.
(b) Enter 0 for Skewness Correction.
(c) Select PRESTO! from the Pressure drop-down list in the Spatial Discretization
group box.
(a) Enter 0.6 for Pressure in the Under-Relaxation Factors group box.
(b) Enter 0.4 for Turbulent Kinetic Energy and Turbulent Dissipation Rate in the
Under-Relaxation Factors group box.
3. Request that case and data files are automatically saved every 50 time steps.
Calculation Activities (Autosave Every (Time Steps))−→ Edit...
Release 12.0
c ANSYS, Inc. March 12, 2009 13-25
Using Dynamic Meshes
4. Create animation sequences for the static pressure contour plots and velocity vectors
plots for the valve.
Calculation Activities (Solution Animations)−→ Create/Edit...
Use the solution animation feature to save contour plots of temperature every five
time steps. After the calculation is complete, you use the solution animation play-
back feature to view the animated temperature plots over time.
i. Retain the default selection of Metafile in the Storage Type group box.
Note: If you want to store the plots in a folder other than your working
folder, enter the folder path in the Storage Directory text box. If this
field is left blank (the default), the files will be saved in your working
folder (i.e., the folder where you started ANSYS FLUENT).
ii. Set Window number to 1 and click Set.
iii. Select Contours in the Display Type group box to open the Contours dialog
box.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-27
Using Dynamic Meshes
B. Retain the default selection of Pressure... and Static Pressure from the
Contours of drop-down lists.
C. Click Display (Figure 13.3).
Release 12.0
c ANSYS, Inc. March 12, 2009 13-29
Using Dynamic Meshes
6. Save the initial case and data files for this transient problem (valve tran-0.000000.cas.gz
and valve tran-0.000000.dat.gz).
File −→ Write −→Case & Data...
7. Request 150 time steps.
Run Calculation
Extra: If you decide to read in the case file 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 ANSYS FLUENT will expect to
find the correct 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 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 modified to best suit your
model.
For details about the cavitation model, see Section 16.7.4 in the separate
Theory Guide.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-31
Using Dynamic Meshes
(b) Inspect the velocity vectors near the point where the valve meets the seat
valve (Figure 13.6).
Graphics and Animations −→ Vectors −→ Set Up...
2. You can also inspect the solution at different intermediate time steps.
(a) Read 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.
3. Play the animation of the pressure contours.
Graphics and Animations −→ Solution Animation Playback −→ Set Up...
(c) Retain the default settings in the rest of the dialog box and click the
button.
For additional information on animating the solution, see Tutorial 4 and see
Section 26.16 in the separate User’s Guide.
(b) Retain the default settings in the rest of the dialog box and click the
button.
(c) Close the Playback dialog box.
Summary
In this tutorial, a check valve is used to demonstrate the dynamic layering capability
within ANSYS FLUENT, using one of the three dynamic mesh schemes available. You
were also shown how to perform a one degree of freedom (1DOF) rigid body FSI by means
of a user-defined function (UDF). ANSYS FLUENT can also perform a more general six
degrees of freedom (6DOF) rigid body FSI using a built-in 6DOF solver.
Further Improvements
This tutorial guides you through the steps to generate an initial first-order solution. You
may be able to increase the accuracy of the solution further by using an appropriate
higher-order discretization scheme. For a more accurate solution, you can increase the
number of layers across the valve seat area. This can be achieved either by using a finer
mesh at the valve seat area and/or using a non-constant layer height instead of a constant
layer height, as demonstrated in this tutorial.
Release 12.0
c ANSYS, Inc. March 12, 2009 13-33
Using Dynamic Meshes