This tutorial includes:
In this tutorial you will learn about:
Applying a profile boundary using data stored in a file.
Visualizing the velocity on a boundary in CFX-Pre.
Using the CFX Expression Language (CEL) to describe temperature-dependent fluid properties in CFX-Pre.
Using the k-epsilon turbulence model.
Using streamlines in CFD-Post to track flow through the domain.
Component |
Feature |
Details |
---|---|---|
CFX-Pre |
User Mode |
General mode |
Analysis Type |
Steady State | |
Fluid Type |
General Fluid | |
Domain Type |
Single Domain | |
Turbulence Model |
k-Epsilon | |
Heat Transfer |
Thermal Energy | |
Boundary Conditions |
Boundary Profile Visualization | |
Inlet (Profile) | ||
Inlet (Subsonic) | ||
Outlet (Subsonic) | ||
Wall: No-Slip | ||
Wall: Adiabatic | ||
CEL (CFX Expression Language) | ||
Timestep |
Physical Time Scale | |
CFD-Post |
Plots |
Default Locators |
Outline Plot (Wireframe) | ||
Slice Plane | ||
Streamline | ||
Other |
Changing the Color Range | |
Expression Details View | ||
Legend | ||
Viewing the Mesh |
The goal of this tutorial is to understand the general approach taken when working with an existing mesh. In this tutorial, you will go through the three main steps when solving a problem, which are defining a simulation using General mode in CFX-Pre, obtaining a solution using CFX-Solver Manager and viewing the results in CFD-Post.
The injection mixing pipe, common in the process industry, is composed of two pipes: one with a larger diameter than the other. Analyzing and optimizing the mixing process is often critical for many chemical processes. CFD is useful not only in identifying problem areas (where mixing is poor), but also in testing new designs before they are implemented.
The geometry for this example consists of a circular pipe of diameter 1.0 m with a 90° bend, and a smaller pipe of diameter 0.3 m which joins with the main pipe at an oblique angle. Water at 315.0 K enters in the 0.3 m diameter pipe at a rate of 5.0 m/s while water at 285.0 K enters in the 1.0 m diameter pipe at a rate of 0.5 m/s.
In this tutorial, you will establish a general workflow for analyzing the flow of the water fluid into and out of an injection pipe. First, a simulation will be created and an existing mesh will be imported in CFX-Pre. A viscosity expression will also be created, and will be used to modify the water properties later on in this tutorial to increase the solution accuracy. Finally, initial values will be set and a solution will be found using CFX-Solver Manager. The results will then be viewed in CFD-Post. Streamlines originating from the main inlet will be generated to show the flow of the water into and out of the injection pipe.
If this is the first tutorial you are working with, it is important to review the following topics before beginning:
Create a working directory.
Ansys CFX uses a working directory as the default location for loading and saving files for a particular session or project.
Download the
inject_mixer.zip
file here .Unzip
inject_mixer.zip
to your working directory.Ensure that the following tutorial input files are in your working directory:
InjectMixerMesh.gtm
InjectMixer_velocity_profile.csv
Set the working directory and start CFX-Pre.
For details, see Setting the Working Directory and Starting Ansys CFX in Stand-alone Mode.
The tutorial follows this general workflow for setting up the case in CFX-Pre:
- 6.4.1. Importing a Mesh
- 6.4.2. Setting Temperature-Dependent Material Properties
- 6.4.3. Plotting an Expression
- 6.4.4. Evaluating an Expression
- 6.4.5. Modify Material Properties
- 6.4.6. Creating the Domain
- 6.4.7. Creating the Side Inlet Boundary
- 6.4.8. Creating the Main Inlet Boundary
- 6.4.9. Creating the Main Outlet Boundary
- 6.4.10. Setting Initial Values
- 6.4.11. Setting Solver Control
- 6.4.12. Writing the CFX-Solver Input (.def) File
In CFX-Pre, select File > New Case.
Ensure that General is selected and click .
Select File > Save Case As.
Under File name, type
InjectMixer
.Click
.
The following steps will demonstrate how to import a mesh.
Right-click
Mesh
and select Import Mesh > CFX Mesh.The Import Mesh dialog box appears.
Configure the following setting(s):
Setting
Value
File name
InjectMixerMesh.gtm
Click Open.
Right-click a blank area in the viewer and select Predefined Camera > Isometric View (Y up) from the shortcut menu.
Viscosity varies with temperature, which implies that the water
will behave differently when coming through the 1.0 m and the 0.3
m diameter pipes. In the following steps, you will create an expression
for viscosity as a function of temperature. This expression will then
be used to modify the properties of the library material: Water
to increase the accuracy of the solution. By setting
temperature-dependent material properties, Viscosity will be made
to vary linearly with temperature between the following conditions:
=1.8E-03 N s m-2 at T=275.0 K
=5.45E-04 N s m-2 at T=325.0 K
The variable T
(Temperature) is a CFX System
Variable recognized by CFX-Pre, denoting static temperature. All
variables, expressions, locators, functions, and constants can be
viewed by double-clicking the appropriate entry (such as Additional Variables
or Expressions
) in the tree view.
All expressions must have consistent units. You should be careful
if using temperature in an expression with units other than [K]
.
The Expressions tab lets you define, modify, evaluate, plot, copy, delete and browse through expressions used within CFX-Pre.
From the main menu, select Insert > Expressions, Functions and Variables > Expression.
In the New Expression dialog box, type
Tupper
.Click
.The details view for the
Tupper
equation is displayed.Under Definition, type
325
[K]
.Click Apply to create the expression.
The expression is added to the list of existing expressions.
Ensure that no expression is highlighted, then right-click in the Expressions workspace and select Insert > Expression.
In the New Expression dialog box, type
Tlower
.Click
.Under Definition, type
275
[K]
.Click Apply to create the expression.
The expression is added to the list of existing expressions.
Create expressions for
Visupper
,Vislower
andVisT
using the following values.Name
Definition
Visupper
5.45E-04 [N s m^-2]
Vislower
1.8E-03 [N s m^-2]
VisT
Vislower+(Visupper-Vislower)*(T-Tlower)/(Tupper-Tlower)
Right-click
VisT
in the Expressions tree view, and then select Edit.The Expressions details view for
VisT
appears.Tip: Alternatively, double-clicking the expression also opens the Expressions details view.
Click the Plot tab and configure the following setting(s):
Tab
Setting
Value
Plot
Number of Points
10
T
(Selected)
Start of Range
275 [K]
End of Range
325 [K]
Click Plot Expression.
A plot showing the variation of the expression
VisT
with the variableT
is displayed.
Click the Evaluate tab.
In
T
, type300 [K]
.This is between the start and end range defined in the last module.
Click Evaluate Expression.
A value of around 0.0011[kg m^-1 s^-1] for
VisT
at the given value ofT
appears in the Value field.
As mentioned earlier in this tutorial, the default material
properties of Water
will be modified using the
Viscosity expression to increase the accuracy of the solution.
Click the Outline tab.
Double-click
Water
underMaterials
to display the Basic Settings tab.Click the Material Properties tab.
Expand Transport Properties.
Select Dynamic Viscosity.
Under Dynamic Viscosity, click in Dynamic Viscosity.
Click Enter Expression .
Enter the expression
VisT
into the data box.Click
.
The domain will be set to use the thermal energy heat transfer model, and the (k-epsilon) turbulence model.
Both Basic Settings and Fluid Models are changed in this module. The Initialization tab is for setting domain-specific initial conditions, which are not used in this tutorial. Instead, global initialization is used to set the starting conditions.
Select Insert > Domain from the main menu or click Domain .
In the Insert Domain dialog box, type
InjectMixer
.Click
.Configure the following setting(s):
Tab
Setting
Value
Basic Settings
Location and Type
> Location
B1.P3
Fluid and Particle Definitions
Fluid 1
Fluid and Particle Definitions
> Fluid 1
> Material
Water
Domain Models
> Pressure
> Reference Pressure
0 [atm]
Click Fluid Models.
Configure the following setting(s):
Setting
Value
Heat Transfer
> Option
Thermal Energy
Turbulence
> Option
k-Epsilon
Click
.
The side inlet boundary must be defined.
Select Insert > Boundary from the main menu or click Boundary .
Set Name to
side inlet
.Note: A boundary named after a region will use that region as its location by default.
Click
.Configure the following setting(s):
Tab
Setting
Value
Basic Settings
Boundary Type
Inlet
Location
side inlet
Boundary Details
Mass and Momentum
> Option
Normal Speed
Mass and Momentum
> Normal Speed
5 [m s^-1]
Heat Transfer
> Option
Static Temperature
Heat Transfer
> Static Temperature
315 [K]
Click
.
The main inlet boundary for the large pipe must be defined. This inlet is defined using a velocity profile. Profile data must be initialized before the boundary can be created.
You will create a plot showing the velocity profile data, marked by higher velocities near the center of the inlet, and lower velocities near the inlet walls.
Select Tools > Initialize Profile Data.
The Initialize Profile Data dialog box appears.
Beside Profile Data File, click Browse .
The Select Profile Data File dialog box appears.
From your working directory, select
InjectMixer_velocity_profile.csv
.Click Open.
Click
.The profile data is read into memory.
Note: After profile data has been initialized from a file, the profile data file should not be deleted or otherwise removed from its directory. By default, the full file path to the profile data file is stored in CFX-Pre, and the profile data file is read directly by CFX-Solver each time the solver is started or restarted.
Select Insert > Boundary from the main menu or click Boundary .
Set name Name to
main inlet
.Click
.Configure the following setting(s):
Click Generate Values.
This causes the profile values of U, V, W to be applied at the nodes on the main inlet boundary, and U, V, W entries to be made in Boundary Details. In order to later reset the velocity values at the main inlet to match those that were originally read from the boundary condition profile file, revisit Basic Settings for this boundary and click Generate Values.
Configure the following setting(s):
Tab
Setting
Value
Boundary Details
Flow Regime
> Option
Subsonic
Mass And Momentum
> Option
Cart. Vel. Components
Turbulence
> Option
Medium (Intensity = 5%)
Heat Transfer
> Option
Static Temperature
Heat Transfer
> Static Temperature
285 [K]
Plot Options
Boundary Contour
(Selected)
Boundary Contour
> Profile Variable
W
Click
.Zoom into the main inlet to view the inlet velocity contour.
In this module you create the outlet boundary. All other surfaces
that have not been explicitly assigned a boundary will remain in the InjectMixer Default
object, which is shown in the tree
view. This boundary uses a No-Slip Adiabatic Wall
by default.
Select Insert > Boundary from the main menu or click Boundary .
Set Name to
outlet
.Click
.Configure the following setting(s):
Tab
Setting
Value
Basic Settings
Boundary Type
Outlet
Location
outlet
Boundary Details
Flow Regime
> Option
Subsonic
Mass and Momentum
> Option
Average Static Pressure
Relative Pressure
0 [Pa]
Click
.
For this tutorial, the initial values will be set automatically. An automatic guess is sufficient for this particular problem.
Click Global Initialization and review, but do not change, the current settings.
Click Close.
Click Solver Control .
Configure the following setting(s):
Tab
Setting
Value
Basic Settings
Advection Scheme
> Option
High Resolution
Convergence Control
> Max. Iterations
50
Convergence Control
> Fluid Timescale Control
> Timescale Control
Physical Timescale
Convergence Control
> Fluid Timescale Control
> Physical Timescale
2 [s] [ a ]
Convergence Criteria
> Residual Type
RMS
Convergence Criteria
> Residual Target
1.E-4 [ b ]
Click
.
Once the problem has been defined you move from General mode into CFX-Solver.
Click Define Run .
Configure the following setting(s):
Setting
Value
File name
InjectMixer.def
Click
.The CFX-Solver input file (
InjectMixer.def
) is created. CFX-Solver Manager automatically starts and, on the Define Run dialog box, Solver Input File is set.When you are finished, select File > Quit in CFX-Pre.
Click Save & Quit if prompted, to save
InjectMixer.cfx
You will now generate a solution for the CFD simulation that you just prepared.
At this point, CFX-Solver Manager is running, and the Define Run dialog box is displayed, with the CFX-Solver input file set.
Click Start Run.
When the run ends, ensure that the check box next to Post-Process Results is cleared and click to close the dialog box.
When CFD-Post starts, the viewer and Outline workspace display by default.
The tutorial follows this general workflow for viewing results in CFD-Post:
- 6.6.1. Modifying the Outline of the Geometry
- 6.6.2. Creating and Modifying Streamlines Originating from the Main Inlet
- 6.6.3. Modifying Streamline Color Ranges
- 6.6.4. Coloring Streamlines with a Constant Color
- 6.6.5. Creating Streamlines Originating from the Side Inlet
- 6.6.6. Examining Turbulence Kinetic Energy
- 6.6.7. Quitting CFD-Post
Throughout this and the following examples, use your mouse and the Viewing Tools toolbar to manipulate the geometry as required at any time.
In the tree view, double-click
Wireframe
.Set the Edge Angle to
15 [degree]
.Click Apply.
When you complete this module you will see streamlines (mainly blue and green) starting at the main inlet of the geometry and proceeding to the outlet. Above where the side pipe meets the main pipe, there is an area where the flow re-circulates rather than flowing roughly tangent to the direction of the pipe walls.
Select Insert > Streamline from the main menu or click Streamline .
Under Name, type
MainStream
.Click
.Configure the following setting(s):
Tab
Setting
Value
Geometry
Type
3D Streamline
Definition
> Start From
main inlet
Click Apply.
Right-click a blank area in the viewer, select Predefined Camera from the shortcut menu, then select Isometric View (Y up).
The pipe is displayed with the main inlet in the bottom right of the viewer.
You can change the appearance of the streamlines using the Range setting on the Color tab.
Under User Locations and Plots, modify the streamline object MainStream by applying the following settings
Tab
Setting
Value
Color
Range
Local
Click Apply.
The color map is fitted to the range of velocities found along the streamlines. The streamlines therefore collectively contain every color in the color map.
Configure the following setting(s):
Tab
Setting
Value
Color
Range
User Specified
Min
0.2 [m s^-1]
Max
2.2 [m s^-1]
Note: Portions of streamlines that have values outside the range shown in the legend are colored according to the color at the nearest end of the legend. When using tubes or symbols (which contain faces), more accurate colors are obtained with lighting turned off.
Click Apply.
The streamlines are colored using the specified range of velocity values.
Configure the following setting(s):
Tab
Setting
Value
Color
Mode
Constant
Color
(Green)
Color can be set to green by selecting it from the color pallet, or by repeatedly clicking on the color box until it cycles through to the default green color.
Click Apply.
The following steps illustrate using this feature to add a streamline object that originates at the side inlet.
Right-click
MainStream
and select Duplicate from the shortcut menu.In the Name window, type
SideStream
.Click
.Double-click the newly created streamline,
SideStream
.Configure the following setting(s):
Tab
Setting
Value
Geometry
Definition
> Start From
side inlet
Color
Mode
Constant
Color
(Red)
Click Apply.
Red streamlines appear, starting from the side inlet.
For better view, select Isometric View (Y up).
Away from walls, turbulence kinetic energy has an influence on the level of mixing. A plane will be created to view the Turbulence Kinetic Energy variable within the domain.
Note: This module has multiple changes compiled into single steps in preparation for other tutorials that provide fewer specific instructions.
Turn off the visibility of both the
MainStream
and theSideStream
objects.Create a plane named
Plane 1
that is normal to X and passing through the X = 0 Point. To do so, specific instructions follow.From the main menu, select Insert > Location > Plane and click .
In the details view, set Definition > Method to
YZ Plane
and X to0 [m]
.Click Apply.
Color the plane using the variable
Turbulence Kinetic Energy
, to show regions of high turbulence. To do so, apply the settings below.Tab
Setting
Value
Color
Mode
Variable
Variable
Turbulence Kinetic Energy
Click Apply.
Experiment with other variables to color this plane (for example,
Temperature
to show the temperature mixing of the two streams).Commonly used variables are in the drop-down menu. A full list of available variables can be viewed by clicking next to the Variable data box.