Tutorial 9
Tutorial 9
Tutorial 9 Features Overview of the Problem to Solve Defining a Simulation in ANSYS CFX-Pre Obtaining a Solution using ANSYS CFX-Solver Manager Viewing the Results in ANSYS CFX-Post
If this is the first tutorial you are working with, it is important to review the following topics before beginning:
Unless you plan on running a session file, you should copy the sample files used in this tutorial from the installation folder for your software (<CFXROOT>/examples/) to your working directory. This prevents you from overwriting source files provided with your installation. If you plan to use a session file, please refer to Playing a Session File. Sample files referenced by this tutorial include:
PipeValve.pre PipeValve_inlet.F PipeValveMesh.gtm PipeValveUserF.pre
Tutorial 9 Features
This tutorial addresses the following features of ANSYS CFX.
Feature Simulation Type Fluid Type Domain Type Turbulence Model Heat Transfer Particle Tracking
Details General Mode Steady State General Fluid Single Domain k-Epsilon None
Component
Feature
Details Inlet (Profile) Inlet (Subsonic) Outlet (Subsonic) Symmetry Plane Wall: No-Slip Wall: Rough
Boundary Conditions
CEL (CFX Expression Language) User Fortran Timestep ANSYS CFX-Solver Manager Power-Syntax Animation Default Locators Plots Particle Track Point ANSYS CFX-Post Slice Plane Changing the Color Range MPEG Generation Other Particle Track Animation Quantitative Calculation Symmetry In this tutorial you will learn about:
using a rough wall boundary condition in ANSYS CFX-Pre to simulate the pipe wall creating a fully developed inlet velocity profile using either the CFX Expression Language or a User CEL Function setting up a Particle Tracking simulation in ANSYS CFX-Pre to trace sand particles animating particle tracks in ANSYS CFX-Post to trace sand particles through the domain quantitative calculation of average static pressure in ANSYS CFX-Post on the outlet boundary
Flows can also contain particulates that affect the flow and cause erosion to pipe and valve components. The particle tracking capability of ANSYS CFX can be used to simulate these effects. In this example, water flows through a 20 mm radius pipe with a rough internal surface. The equivalent sand grain roughness is 0.2 mm. The flow is controlled by a butterfly valve, which is set at an angle of 55 to the vertical axis. The velocity profile is assumed to be fully developed at the pipe inlet. The flow contains sand particles ranging in size from 50 to 500 microns.
sets the inlet velocity profile using a CEL (ANSYS CFX Expression Language) expression. PipeValveUserF.pre sets the inlet velocity profile using a User CEL Function that is defined by a Fortran subroutine. This session file requires that you have the required Fortran compiler installed and set in your system path. For details on which Fortran compiler is required for your platform, see the applicable ANSYS, Inc. installation guide. If you are not sure which Fortran compiler is installed on your system, try running the cfx5mkext command (found in <CFXROOT>/bin) from the command line and read the output messages.
PipeValve.pre
If you choose to run a session file do so using the procedure described in earlier tutorials under Playing the Session File and Starting ANSYS CFX-Solver Manager, and then proceed to Obtaining a Solution using ANSYS CFX-Solver Manager once the simulation setup is complete.
1. Start ANSYS CFX-Pre. 2. Select File > New Simulation. 3. Select General and click OK. 4. Select File > Save Simulation As. 5. Under File name, type PipeValve. 6. Click Save.
Value PipeValveMesh.gtm
3. Click Open.
Setting
Value Particle Solids (Selected) 2300 [kg m^3] (Selected) 0 [J kg^-1 K^1]
[a]
Thermodynamic Properties > Equation of State > Density Thermodynamic Properties >Specific Heat Capacity Material Properties Thermodynamic Properties >Specific Heat Capacity > Specific Heat Capacity Thermodynamic Properties > Reference State Thermodynamic Properties > Reference State > Option Thermodynamic Properties > Reference State > Ref. Temperature
[a]
This value is not used because heat transfer is not modeled in this tutorial.
3. Click OK. 4. Under Materials, right-click Sand Fully Coupled and select Duplicate from the shortcut menu. 5. Name the duplicate Sand One Way Coupled. 6. Click OK.
Sand One Way Coupled
Setting Basic Settings > Fluids List Basic Settings > Particle Tracking Water (Selected)
Value
Tab
Domain Models > Pressure > Reference Pressure 1 [atm] Fluid Models Heat Transfer > Option Turbulence > Option Sand Fully Coupled Sand Fully Coupled > Morphology > Option Sand Fully Coupled > Morphology > Particle Diameter Distribution Sand Fully Coupled > Morphology > Particle Diameter Distribution > Option Sand Fully Coupled > Morphology > Particle Diameter Distribution > Minimum Diameter Sand Fully Coupled > Morphology > Particle Diameter Distribution > Maximum Diameter Sand Fully Coupled > Morphology > Particle Diameter Distribution > Mean Diameter Sand Fully Coupled > Morphology > Particle Diameter Distribution > Std. Deviation Sand Fully Coupled > Erosion Model Sand Fully Coupled > Erosion Model > Option Sand Fully Coupled > Erosion Model > Vel. Power Factor Sand Fully Coupled > Erosion Model > Reference Velocity
[a]
None k-Epsilon[a] (Selected) Solid Particles (Selected) Normal in Diameter by Mass 50e-6 [m]
500e-6 [m]
Fluid Details
250e-6 [m]
1 [m s^-1]
The turbulence model only applies to the continuous phase and not the particle phases. 3. Apply the following settings
Setting
Value (Selected) Solid Particles (Selected) Normal in Diameter by Mass 50e-6 [m]
Sand One Way Coupled > Morphology > Option Sand One Way Coupled > Morphology > Particle Diameter Distribution Sand One Way Coupled > Morphology > Particle Diameter Distribution > Option Sand One Way Coupled > Morphology > Particle Diameter Distribution > Minimum Diameter Sand One Way Coupled > Morphology > Particle Diameter Distribution > Maximum Diameter Sand One Way Coupled > Morphology > Particle Diameter Distribution > Mean Diameter Sand One Way Coupled > Morphology > Particle Diameter Distribution > Std. Deviation Sand One Way Coupled > Erosion Model Sand One Way Coupled > Erosion Model > Option Sand One Way Coupled > Erosion Model > Vel. Power Factor Sand One Way Coupled > Erosion Model > Reference Velocity 4. Apply the following settings
Fluid Details
500e-6 [m]
250e-6 [m]
1 [m s^-1]
Setting
Tab
Setting Fluid Pairs > Water | Sand Fully Coupled > Particle Coupling
Fluid Pairs > Water | Sand Fully Coupled > Momentum Schiller Naumann Transfer > Drag Force > Option Fluid Pairs Water | Sand One Way Coupled
Fluid Pairs > Water | Sand One Way Coupled > Particle One-way Coupling Coupling Fluid Pairs > Water | Sand One Way Coupled > Momentum Transfer > Drag Force > Option 5. Click OK. Schiller Naumann
Equation 1.
Creating a User CEL Function which uses a user subroutine (linked to the ANSYS CFXSolver during execution) to describe the inlet profile. OR
Profiles created from data files are not used in this tutorial, but are used in the tutorial Tutorial 3: Flow in a Process Injection Mixing Pipe. In this tutorial, you use one of the first two methods listed above to define the velocity profile for the inlet boundary condition. The results from each method will be identical. Using a CEL expression is the easiest way to create the profile. The User CEL Function method is more complex but is provided as an example of how to use this feature. For more complex profiles, it may be necessary to use a User CEL Function or a BC profile file. To use the User CEL Function method, continue with this tutorial from User CEL Function Method for the Inlet Velocity Profile. Note that you will need access to a Fortran compiler to be able to complete the tutorial by the User CEL Function method. To use the expression method, continue with the tutorial from this point. Expression Method for the Inlet Velocity Profile 1. Create the following expressions. Name Rmax 20 [mm] Wmax 5 [m s^-1] Wprof Wmax*(abs(1-r/Rmax)^0.143) 2. In the definition of Wprof, the variable r (radius) is a ANSYS CFX System Variable defined as: Equation 2. 3. In this equation, and are defined as directions 1 and 2 (X and Y for Cartesian coordinate frames) respectively, in the selected reference coordinate frame. You should now continue with the tutorial from Creating the Boundary Conditions. User CEL Function Method for the Inlet Velocity Profile The Fortran subroutine has already been written for this tutorial. Definition
Important
You must have the required Fortran compiler installed and set in your system path in order to run this part of the tutorial. If you do not have a Fortran compiler, you should use the expression method for defining the inlet velocity, as described in Expression Method for the Inlet Velocity Profile. For details on which Fortran compiler is required for your platform, see the applicable
ANSYS, Inc. installation guide. If you are not sure which Fortran compiler is installed on your system, try running the cfx5mkext command (found in <CFXROOT>/bin) from the command line and read the output messages.
Compiling the Subroutine
1. Copy the subroutine PipeValve_inlet.F to your working directory. It is located in the <CFXROOT>/examples/ directory. 2. Examine the contents of this file in any text editor to gain a better understanding of this subroutine. This file was created by modifying the ucf_template.F file, which is available in the <CFXROOT>/examples/ directory. You can compile the subroutine and create the required library files used by the ANSYS CFX-Solver at any time before running the ANSYS CFX-Solver. The operation is performed at this point in the tutorial so that you have a better understanding of the values you need to specify in ANSYS CFX-Pre when creating a User CEL Function. The cfx5mkext command is used to create the required objects and libraries as described below. 3. From the main menu, select Tools > Command Editor. 4. Type the following in the Command Editor dialog box (make sure you do not miss the semi-colon at the end of the line):
The ! indicates that the following line is to be interpreted as power syntax and not CCL. Everything after the ! symbol is processed as Perl commands. system is a Perl function to execute a system command. The < 1 or die will cause an error message to be returned if, for some reason, there is an error in processing the command.
5. Click Process to compile the subroutine. The output produced when this command is executed will be printed to your terminal window.
Note
You can use the -double option (that is, cfx5mkext -double PipeValve_inlet.F) to compile the subroutine for use with double precision. A subdirectory will have been created in your working directory whose name is system dependent (for example, on IRIX it is named irix). This subdirectory contains the shared object library.
Note
If you are running problems in parallel over multiple platforms then you will need to create these subdirectories using the cfx5mkext command for each different platform.
You can view more details about the cfx5mkext command by running
cfx5mkext -help
You can set a Library Name and Library Path using the -name and -dest options respectively. If these are not specified, the default Library Name is that of your Fortran file and the default Library Path is your current working directory.
Next, you will create some values that will be used as input arguments when the subroutine is called. 1. Click Expression . 2. Set Name to Wmax, and then click OK. 3. Type 5 [m s^-1] into the Definition box, and then click Apply. The expression will be listed in the Expressions tree view. 4. Use the same method to create an expression named Rmax defined to be 20 [mm].
Creating the User CEL Function
Two steps are required to define a User CEL Function that uses the compiled Fortran subroutine. First, a User Routine that points to the Fortran subroutine will be created. Then a User CEL Function that points to the User Routine will be created. 1. From the main toolbar, click User Routine . 2. Set Name to WprofRoutine, and then click OK. The User Routine details view appears. 3. Set Option to User CEL Function. 4. Set Calling Name to inlet_velocity.
This is the name of the subroutine within the Fortran file. Always use lower case letters for the calling name, even if the subroutine name in the Fortran file is in upper case.
This is the name passed to the cfx5mkext command by the -name option. If the -name option is not specified, a default is used. The default is the Fortran file name without the .F extension.
6. Set Library Path to the directory where the cfx5mkext command was executed (usually the current working directory). For example:
UNIX: /home/user/cfx/tutorials/PipeValve. Windows: c:\user\cfx\tutorials\PipeValve. This can be accomplished quickly by clicking Browse (next to Library Path), browsing to the appropriate folder in Select Directory (not necessary if selecting the working directory), and clicking OK (in Select Directory).
7. Click OK to complete the definition of the user routine. 8. Click User Function .
9. Set Name to WprofFunction, and then click OK. The Function details view appears.
Important
You must not use the same name for the function and the routine. 10. Set Option to User Function. 11. Set User Routine Name to WprofRoutine. 12. Set Argument Units to [m s^-1], [m], [m]. These are the units for the three input arguments: Wmax, r, and Rmax. Set Result Units to [m s^-1], since the result will be a velocity for the inlet. 1. Click OK to complete the User Function specification. You can now use the user function (WprofFunction) in place of a velocity value by entering the expression WprofFunction(Wmax, r, Rmax) (although it only makes sense for the W component of the inlet velocity in this tutorial). In the definition of WprofFunction, the variable r (radius) is a system variable defined as: Equation 3. In this equation, x and y are defined as directions 1 and 2 (X and Y for Cartesian coordinate frames) respectively, in the selected reference coordinate frame.
Value
Mass And Momentum > Option Mass And Momentum > U Boundary Details Mass And Momentum > V Mass And Momentum > W Boundary Conditions
Cart. Vel. Components 0 [m s^-1] 0 [m s^-1] Wprof -ORWprofFunction(Wmax, r, Rmax)[a] Sand Fully Coupled
Sand Fully Coupled > Particle Behavior (Selected) > Define Particle Behavior Sand Fully Coupled > Mass and Momentum > Option Sand Fully Coupled > Mass And Momentum > U Fluid Values[b] Sand Fully Coupled > Mass And Momentum > V Sand Fully Coupled > Mass And Momentum > W Cart. Vel. Components[c]
0 [m s^-1]
Sand Fully Coupled > Particle Position > Uniform Injection Option Sand Fully Coupled > Particle Position > Direct Specification Number of Positions > Option
Tab
Setting Sand Fully Coupled > Particle Position > 200 Number of Positions > Number Sand Fully Coupled > Particle Mass Flow > Mass Flow Rate Boundary Conditions Sand One Way Coupled > Particle Behavior > Define Particle Behavior Sand One Way Coupled > Mass and Momentum > Option Sand One Way Coupled > Mass And Momentum > U Sand One Way Coupled > Mass And Momentum > V 0.01 [kg s^-1]
Value
0 [m s^-1]
Fluid Values Sand One Way Coupled > Mass And Momentum > W Sand One Way Coupled > Particle Position > Option
Sand One Way Coupled > Particle Direct Specification Position > Number of Positions > Option Sand One Way Coupled > Particle Position > Number of Positions > Number Sand One Way Coupled > Particle Position > Particle Mass Flow Rate > Mass Flow Rate
[a]
5000
Use the Expressions details view to enter either Wprof if using the expression method, or WprofFunction(Wmax, r, Rmax) if using the User CEL Function method.
[b]
Do NOT select Particle Diameter Distribution. The diameter distribution was defined when creating the domain; this option would override those settings for this boundary only.
Tab
[c]
Setting
Value
Instead of manually specifying the same velocity profile as the fluid, you can also select the Zero Slip Velocity option.
[d]
[e]
Instead of manually specifying the same velocity profile as the fluid, you can also select the Zero Slip Velocity option.
[f]
3. Click OK. One-way coupled particles are tracked as a function of the fluid flow field. The latter is not influenced by the one-way coupled particles. The fluid flow will therefore be influenced by the 0.01 [kg s^-1] flow of two-way coupled particles, but not by the 0.01 [kg s^-1] flow of one-way coupled particles. Outlet Boundary 1. Create a new boundary condition named outlet. 2. Apply the following settings
Value
Flow Regime > Option Boundary Details Mass and Momentum > Option
Mass and Momentum > Relative Pressure 0 [Pa] 3. Click OK. Symmetry Plane Boundary 1. Create a new boundary condition named symP. 2. Apply the following settings
Tab
Setting
Value
Boundary Type Symmetry Basic Settings Location 3. Click OK. Pipe Wall Boundary 1. Create a new boundary condition named pipe wall. 2. Apply the following settings symP
Tab Boundary Type Basic Settings Location Boundary Details Fluid Values
Setting Wall
Value
pipe wall Rough Wall 0.2 [mm][a] Sand Fully Coupled Restitution Coefficient 0.8
Wall Roughness > Option Roughness Height Boundary Conditions Boundary Conditions > Sand Fully Coupled > Velocity > Option Boundary Conditions > Sand Fully Coupled > Velocity > Perpendicular Coeff. Boundary Conditions > Sand Fully Coupled > Velocity > Parallel Coeff. Boundary Conditions Boundary Conditions > Sand One Way Coupled > Velocity > Option Boundary Conditions > Sand One Way Coupled > Velocity > Perpendicular Coeff. Boundary Conditions > Sand One Way Coupled >
Tab
Value
[a]
Make sure that you change the units to millimetres. The thickness of the first element should be of the same order as the roughness height. 3. Click OK. Editing the Default Boundary Condition 1. In the Outline tree view, edit the boundary condition named Default Domain Default. 2. Apply the following settings
Setting
Fluid Values
Boundary Conditions > Sand Fully Coupled > Velocity > 0.9 Perpendicular Coeff. Boundary Conditions Boundary Conditions > Sand One Way Coupled > Velocity > Perpendicular Coeff. Sand One Way Coupled 0.9
3. Click OK.
Setting
Value
Initial Conditions > Cartesian Velocity Automatic with Value Components > Option Initial Conditions > Cartesian Velocity 0 [m s^-1] Components > Option > U
Tab
Setting Initial Conditions > Cartesian Velocity 0 [m s^-1] Components > Option > V
Value
Initial Conditions > Cartesian Velocity Wprof -OR- WprofFunction(Wmax, Components > Option > W r, Rmax)[a] Initial Conditions > Turbulence Eddy (Selected) Dissipation
[a]
to enter Wprof if using the Expression method; enter WprofFunction(Wmax, r, Rmax) if using the User CEL Function method. 3. Click OK.
Tab
Basic Settings Advection Scheme > Blend Factor Particle Control Particle Integration > Maximum Tracking Time Particle Integration > Maximum Tracking Time > Value
Particle Integration > Maximum Tracking Distance (Selected) Particle Integration > Maximum Tracking Distance 10 [m] > Value Particle Integration > Max. Num. Integration Steps (Selected) Particle Integration > Max. Num. Integration Steps > 10000 Value
Tab
Setting
Value
Particle Integration > Max. Particle Intg. Time Step (Selected) Particle Integration > Max. Particle Intg. Time Step 1e+10 [s] > Value 3. Click OK.
If using ANSYS CFX-Pre in Standalone Mode. 3. Ensure Start Solver Manager is selected and click Save. 4. If using Standalone Mode, quit ANSYS CFX-Pre, saving the simulation (.cfx) file at your discretion.
Note
If you followed the User CEL Function method, and you wish to run this tutorial in distributed parallel on machines with different architectures, you must first compile the PipeValve_inlet.F subroutine on all architectures. 1. Ensure the Define Run dialog box is displayed and click Start Run. 2. Click Yes to post-process the results when the completion message appears at the end of the run. 3. If using Standalone Mode, quit ANSYS CFX-Solver Manager.
In this section, you will first plot erosion on the valve surface and side walls due to the sand particles. You will then create an animation of particle tracks through the domain.
Tab
Value
Sand One Way Coupled.Erosion Rate Density[a] User Specified 0 [kg m^-2 s^-1] 25 [kg m^-2 s^-1][b]
Color
[a]
This is statistically better than Sand Fully Coupled.Erosion Rate Density since many more particles were calculated for Sand One Way Coupled.
[b]
This range is used to gain a better resolution of the wall shear stress values around the edge of the valve surfaces. 3. Click Apply. As can be seen, the highest values occur on the edges of the valve where most particles strike. Erosion of the low Z side of the valve would occur more quickly than for the high Z side.
Particle Tracks
Default particle track objects are created at the start of the session. One particle track is created for each set of particles in the simulation. You are going to make use of the default object for Sand Fully Coupled. The default object draws 10 tracks as lines from the inlet to outlet. Info shows information about the total number of tracks, index range and the track numbers which are drawn. 1. Edit the object named Res PT for Sand Fully Coupled. 2. Apply the following settings
Tab
Setting
Value
Value
Variable Sand One Way Coupled.Erosion Rate Density Color Range Min Max 5. Click Apply. User Specified 0 [kg m^-2 s^-1] 25 [kg m^-2 s^-1]
Setting Variable
Value
Tab
Setting Draw Symbols Draw Symbols > Max Time Draw Symbols > Min Time (Selected) 0 [s] 0 [s] 0.07 [s] Fish3D
Value
Draw Symbols > Symbol Size 0.5 4. Clear Draw Tracks. 5. Click Apply. Symbols are placed at the start of each track.
Note
The arrow pointing downward in the bottom right corner of the Animation Window will reveal the Options button if it is not immediately visible. 5. Select Loop. 6. Deselect Repeat forever 7. Select Save MPEG. 8. Click Browse and enter tracks.mpg as the file name. and ensure Repeat is set to 1.
10. If prompted to overwrite an existing movie, click Overwrite. The animation plays and builds an .mpg file. 11. Close the Animation dialog box.
Note
You should use Conservative variable values when performing calculations and Hybrid values for visualization purposes. Conservative values are set by default in ANSYS CFXPost but you can manually change the setting for each variable in the Variables Workspace, or the settings for all variables by using the Function Calculator. 2. Set Function to maxVal. 3. Set Location to outlet. 4. Set Variable to Pressure. 5. Click Calculate. The result is the maximum value of pressure at the outlet. 6. Perform the calculation again using minVal to obtain the minimum pressure at the outlet. 7. Select areaAve, and then click Calculate.
This calculates the area weighted average of pressure. The average pressure is approximately zero, as specified by the boundary condition.
Other Features The geometry was created using a symmetry plane. You can display the other half of the geometry by creating a YZ Plane at X = 0 and then editing the Default Transform object to use this plane as a reflection plane. 1. When you have finished viewing the results, quit ANSYS CFX-Post.