# Tutorial: 2D Pipe Junction Using Hexa Meshing

```Tutorial: 2D Pipe Junction Using Hexa Meshing
Introduction
In this tutorial, you will generate a mesh for a two-dimensional pipe junction, composed
of two inlets and one outlet. After generating an initial mesh, you will check the quality
of the mesh and refine it for a Navier-Stokes solution.
Figure 1: 2D Pipe Geometry
This tutorial demonstrates how to do the following:
• Blocking the geometry.
• Associating to geometry.
• Moving the vertices.
• Applying mesh parameters.
• Generating the mesh.
• Adjusting the edge distribution and refining the mesh.
• Matching the edges.
• Verifying and saving the mesh.
c ANSYS, Inc. February 11, 2010
1
2D Pipe Junction Using Hexa Meshing
Prerequisites
This tutorial assumes that you are familiar with the menu structure in ANSYS ICEM
procedure will not be shown explicitly.
For details about hexa mesh generation, refer to the Chapter, Hexa, in ANSYS ICEM
CFD user manual.
Conventions
Some of the basic conventions used in this tutorial are:
• The icon to the left of the text (here, Blocking) suggests that you have to select the
option from the display tree.
Blocking
• The arrow mark with the text LMB in the box the suggests that you have to click
the left-mouse button to enable or disable an option (here, Vertices).
LMB
−→ Vertices
• The arrow mark with the text RMB in the box the suggests that you have to click
the right-mouse button to enable or disable an option (here, Numbers).
RMB
−→ Numbers
For detailed information about GUI and text conventions, refer to the document, Getting
Started with ANSYS ICEM CFD.
Preparation
1. Download the ICEM hexa 2dpipe FILES.zip file from the ANSYS Customer Portal. It contains the necessary input geometry file (hexa 2dpipe.tin).
2. Start ANSYS ICEM CFD and open the geometry (hexa 2dpipe.tin).
File > Geometry > Open Geometry...
2
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Blocking Strategy
Decide the blocking strategy to generate a mesh with blocking.
Figure 2: The Mesh and Topologies
Note: The geometry is equivalent to a T shape. You need to bend the right side of the
blocking crossbar upward to resemble the geometry. See Figure 2.
To fit the T shaped blocking material to the geometry do the following:
1. Create associations between the Edges of the blocks and the Curves in the geometry.
2. Move the Vertices of the blocks to the corners of the geometry.
Now, the mesh sizes is set and the mesh is computed. The program will automatically
project the edge nodes onto the curves of the geometry and the internal 2D volume mesh
will be interpolated.
c ANSYS, Inc. February 11, 2010
3
2D Pipe Junction Using Hexa Meshing
Step 1: Blocking the Geometry
1. Create initial block.
(a) Initialize the 2D blocking.
Blocking > Create Block
> Initialize Blocks
i. Enter LIVE in the Part field.
ii. Change the Type to 2D Planar.
iii. Click Apply.
(b) Enable Vertices under Blocking.
Blocking
LMB
−→ Vertices
(c) Select Numbers under Vertices.
Blocking
RMB
−→ Vertices
LMB
−→ Numbers
Figure 3: Numbering the Vertices
4
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
The white block encloses the geometry as shown in Figure 4. This initial block
will be used to create the topology of the model.
Figure 4: Initial FLUID Block
The curves are now colored separately instead of by part. This is done so that
the individual curve entities can be distinguished from each other, which is
necessary for some of the blocking operations. You can enable or disable the
color coding by doing the following:
i. Select Curves in the Model display control tree.
ii. Select/deselect Show Composite.
Geometry
RMB
−→ Curves
LMB
−→ Show Composite
2. Split the initial block into sub-blocks.
Blocking > Split Block
> Split Block
In this case, you will first do two vertical splits and one horizontal split.
(a) Create verticle split.
i. Ensure that Curves under Geometry is enabled.
Geometry
LMB
−→ Curves
ii. Retain default selection of Screen select from the Split Method drop-down
list in Split Block DEZ.
c ANSYS, Inc. February 11, 2010
5
2D Pipe Junction Using Hexa Meshing
Figure 5: The Split Window
Note: In this case, the split may be done by approximation because only
the topology of the T shape is essential, the exact proportion is not.
iii. Click
(Select edge(s)).
You will be prompted to select an edge (red text at the bottom of the view
screen).
iv. Select the edge defined by vertices 11 and 19 or 13 and 21.
v. To position the new edge, click the left-mouse button, slide the new edge
to the desired location and click middle-mouse button.
The split is shown in Figure 6. Check the color of the edge—blue (cyan)
designates an internal edge.
6
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Figure 6: First Split Edge 11-19
Note: To cancel the previous selection, click the right-mouse button while
in selection mode.
vi. Similarly, select the edge defined by vertices 33 and 19 or 34 and 21. See
Figure 7.
Figure 7: Second Split Edge 33-19
c ANSYS, Inc. February 11, 2010
7
2D Pipe Junction Using Hexa Meshing
(b) Create horizontal split.
i. Change Split Method to Relative in Split Block DEZ.
ii. Enter 0.5 for the value of Parameter (mid-point of selected edge).
iii. Select any one of the four vertical edges in the graphics window and click
Apply.
The horizontal split is shown in Figure 8.
Figure 8: Curves and FLUID Block After Three Splits
3. Delete unnecessary blocks.
The next step in this “top down” approach is to remove/delete the blocks those are
not required.
Blocking > Delete Block
(a) Disable Delete permanently.
(b) Click
(Select block(s)).
(c) Select the blocks to be deleted as shown in Figure 9 and click the middle-mouse
button to accept the selection.
8
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Figure 9: Blocks to be Deleted
(d) Click Apply in the Delete Block DEZ.
Note: The deleted blocks with Delete permanently disabled (default) are actually put into the VORFN part, a default dead zone that is usually deactivated.
The geometry and blocking of the model now resemble Figure 10.
Figure 10: Final T Shape Topology
c ANSYS, Inc. February 11, 2010
9
2D Pipe Junction Using Hexa Meshing
Step 2: Associating to Geometry
In this step, you will associate edges of the blocking to the curves of the CAD geometry.
You should first select edges and then curves to which you want to associate the edges. If
two or more curves are selected per operation, those curves will automatically be grouped
(concatenated).
For reference, select Show Curve Names. See Figure 11.
Geometry
RMB
−→ Curves
LMB
−→ Show Curve Names
This is not required for edge to curve association, but it helps to illustrate the fact that
each blocking edge is associated to named curve(s).
Figure 11: Vertex Numbers and Curve Names
1. Associate the inlet, the leftmost end of the large pipe.
Blocking > Associate
> Associate Edge to Curve
(a) Select the required edges.
i. Ensure that Project vertices are disabled (default).
ii. Click
(Select edge(s)).
iii. Select edge 13-41.
iv. Click the middle-mouse button to accept the selection.
10
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
(b) Select the appropriate curves.
i. Click
(Select compcurve(s)).
ii. Select the curve, CURVES/1.
iii. Click the middle-mouse button to accept the selection.
(c) Click Apply in the Associate Edge -> Curve DEZ.
The associated edge will turn green.
Note: Associate edge to curve operation runs in continuation mode, allowing you
to select the next set of edges and curves without reinvoking the function. The
function will be cancelled, if you click the middle-mouse button or click Dismiss,
without selecting entities.
2. Similarly, associate the following edge/curve combinations to make the T fit the
geometry:
• For small pipe, associate the following:
– Edge 33-42 to curve CURVES/10.
– Edge 33-37 to CURVES/11.
– Edge 37-43 to CURVES/9.
• For outlet (top horizontal end of large pipe), associate the following:
– Edge 21-44 to CURVES/7.
This vertical edge will eventually be moved to capture the horizontal curve.
Note: When the entities are overlapped with other entities, disable the
entity types. This will enable you to identify the right entity. For
example, disable Vertices and Edges to verify the curve names. Enable
the Edges to proceed with the selection.
c ANSYS, Inc. February 11, 2010
11
2D Pipe Junction Using Hexa Meshing
• For large pipe, associate the following:
(a) Select all three edges (13-34, 34-38, and 38-21) and click the middle-mouse
button to confirm the selection.
(b) Select the three curves (CURVES/2, CURVES/5, and CURVES/6) and click
the middle-mouse button.
The three curves will automatically be grouped as one logical composite
entity. Geometrically, they are still three separate curves.
(c) Click Apply in the Associate Edge -> Curve DEZ.
3. Similarly, associate the edges 41-42, 43-44 to CURVES 3, 4, and 8.
The blue (cyan) edges 42-43, 34-42, 38-43 do not have to be associated. They are
internal and will interpolate on the geometry when the mesh is computed.
4. Verify that the correct associations have been set (Figure 12).
Blocking
RMB
−→ Edges
LMB
−→ Show association
Figure 12: Projection of Edges to Curve
The green arrows in the display point from an edge to its associated curve. Nodes
and vertices of these edges will project on to the associated geometry.
12
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Note: After completion, if the associations do not appear correctly, you can associate the edges to the correct curves again. It is not necessary to disassociate
and then re-associate. Associating the edge to a new curve will overwrite the
previous association. The steps of operation can also be retraced using Undo
and Redo buttons.
5. Deselect Show association.
Blocking
RMB
−→ Edges
LMB
−→ Show association
Step 3: Moving the Vertices
1. Manually move the vertices of inlets and outlet (ends of large pipe).
Blocking > Move Vertex
> Move Vertex
Note: Selecting Move Vertex from the function tabs will prompt you to select from
the screen. It is usually not necessary to select Move Vertex from the DEZ
unless another option was previously selected.
(a) Click
(Select vert(s)) and move the vertices. (Figure 13).
Select the Vertex. Keeping the left-mouse button pressed, drag the vertex along
the curve.
c ANSYS, Inc. February 11, 2010
13
2D Pipe Junction Using Hexa Meshing
Figure 13: Moving Vertices
Notes:
• Due to the associations made between the edges and curves, many of these
vertices will snap to the correct position. Vertices can also be moved along
the curve by dragging the mouse. To capture the ends of the curves:
i. Select the vertex.
ii. Keep left-mouse button pressed and drag the vertex along the curve
until the vertex can be moved no further.
iii. Position the cursor beyond the end of the curve so that the end is
surely captured.
You may also prefer to associate the vertex with the points at the ends of
the curves as described later in step 3.
• The ends of the pipe are straight and it is possible to block this example
without using the curve associations. However, the curve associations
also create line elements on curves they are associated to. If you skip
performing the curve associations, the boundary line elements will not be
created. This will make it impossible to apply boundary conditions to that
edge (such as inlet or wall). Hence, most CFD solvers give errors if any
of the perimeter edges are not associated with perimeter curves.
2. Move the remaining vertices to their appropriate positions on the geometry. See
Figure 14.
Try to make the blocks as orthogonal (good internal angles) as possible.
14
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Figure 14: Moving Rest of the Vertices to Their Position
3. Associate the vertices to the points.
This is an optional step.
(a) Select Show Point Names.
Geometry
RMB
−→ Points
LMB
−→ Show Point Names
(b) Enable Associate Vertex.
Blocking > Associate
> Associate Vertex
The Point option is enabled by default.
(c) Select the Vertex and select the Point to which you want to associate the vertex.
(d) Associate the vertices 13, 21, 41, 42, 33, 37, 43, 44 to points POINTS/2,
POINTS/5, POINTS/1, POINTS/10, POINTS/9, POINTS/8, POINTS/11, POINTS/6.
(e) Deselect Show Point Names.
Geometry
RMB
−→ Points
LMB
−→ Show Point Names
4. Save the blocking.
File > Blocking > Save Blocking As...
5. Provide a filename (2D-pipe-geometry.blk) so that the file can be reloaded at a
later time, using File > Blocking > Open Blocking....
c ANSYS, Inc. February 11, 2010
15
2D Pipe Junction Using Hexa Meshing
Step 4: Applying Mesh Parameters
Set Mesh parameters (sizes) on the geometry (curves in this 2D case). This is done at
the geometry level and can be done before or after the blocking.
Mesh > Curve Mesh Setup
> Select curve(s)
1. Select Select all appropriate visible objects
from the selection tool bar.
You can enter v for visible or a for all.
2. Set Maximum size to 1.
• Maximum size determines the length of the edges on the curve (or surface for
3D).
• Height determines the length of the edge of the first layer normal to the curve.
• Ratio (Ratio 1 and Ratio 2) determines the normal heights of the subsequent
layers.
In this case, height and ratio are determined by the perpendicular curves whose
Maximum size will override any height or ratio settings.
3. Ignore all other parameters and click Apply.
16
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Step 5: Generating the Mesh
In this step, you will generate an initial mesh.
Blocking > Pre Mesh Params
> Update Sizes
1. Enable Update Sizes.
(a) Select Update All.
This will automatically determine the number of nodes on the edges from the
mesh sizes set on the curves.
(b) Click Apply.
2. Enable Pre-Mesh.
Blocking
LMB
−→ Pre-Mesh
The Mesh dialog box will appear, asking if you want to recompute the mesh. Click
Yes.
3. Disable Edges and Vertices.
Blocking
LMB
−→ Edges
Blocking
LMB
−→ Vertices
The initial mesh is shown in Figure 15.
c ANSYS, Inc. February 11, 2010
17
2D Pipe Junction Using Hexa Meshing
Figure 15: The Initial Mesh
Note: The number of elements in initial mesh is sensitive to exact vertex placement
(longest edge length in an index divided by max size found along that index).
Hence, it may vary slightly from Figure 15.
Step 6: Adjusting the Edge Distribution and Refining the Mesh
In this step, you will use advanced edge meshing features to re-distribute grid points to
resolve the salient features of the flow.
1. Disable Pre-Mesh.
Blocking
LMB
−→ Pre-Mesh
2. Re-display Curves and Edges.
3. See the distribution of grid points along the edges (Figure 16).
Blocking
18
RMB
−→ Edges
LMB
−→ Bunching
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Figure 16: Bunching the Edges
4. Reduce the number of nodes along the length of the large pipe.
Blocking
RMB
−→ Vertices
LMB
−→ Numbers
(a) Display the edge meshing parameters.
Blocking > Pre-Mesh Params
(b) Select Select edge(s)
prompted.
> Edge Params
or Edge Params
and select edge 13-34 when
(c) In the Pre-Mesh Params DEZ, change the number of Nodes to 27. Click Apply.
c ANSYS, Inc. February 11, 2010
19
2D Pipe Junction Using Hexa Meshing
5. Similarly, re-select
Apply.
or
, select edge 21-38, change Nodes to 27, and click
6. Enable Pre-Mesh and recompute to view the new mesh.
Figure 17: Edges Parameter
Note: Figure 17 shows a structured grid. When the number of nodes is changed on
one edge, all parallel opposing edges will automatically have the same number
of nodes. In this case, edges 41-42 and 43-44 will have the same number of
nodes as edges 13-34 and 38-21 respectively.
7. Disable Pre-Mesh and Curves to view the bunching on the edges. See Figure 18.
Blocking
Geometry
20
LMB
−→ Pre-Mesh
LMB
−→ Curves
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Figure 18: Bunching on Edges After Changing the Number of Nodes
8. Bias the nodes closer to the wall boundaries of the large pipe.
(a) Click
and select edge 13-41.
i. In the Pre-Mesh Params DEZ, enter 0.5 for Spacing 1 and Spacing 2.
Note: Spacing 1 refers to the node spacing at the beginning of the edge,
and Spacing 2 refers to the spacing at the end of the edge. The beginning of the edge is shown by the white arrow after the edge is selected.
ii. Enter 1.2 for Ratio 1 and Ratio 2.
iii. Click Apply.
Requested values for spacing and ratio are entered in the first column. Actual values are displayed in the second column. The requested ratios cannot
be attained due to the number of Nodes, Mesh law, Spacing1, and Spacing2.
Increase the number of Nodes using the arrow until the ratios are close to the
entered value, 1.2.
Note: The Mesh law is by default set to BiGeometric. This allows the nodes to
be biased towards both ends of the edge. The expansion rate from the end
is a linear progression. Several other mathematical progression functions
(laws) are available.
(b) Ensure that the parallel edges 34-42, 38-43, and 21-44 have the same spacing.
i. Enable Copy Parameters in the Pre-Mesh Params DEZ.
ii. Ensure that To All Parallel Edges is selected from Method drop-down list.
iii. Click Apply.
c ANSYS, Inc. February 11, 2010
21
2D Pipe Junction Using Hexa Meshing
(c) Select edge 21-38 and enter 0.5 for Spacing 1 and Spacing 2 and click Apply.
This will concentrate grid points toward the outlet and toward the small pipe.
To have these changes reflected in edge 43-44 as well, ensure that To All Parallel
Edges is selected from Method drop-down list.
9. Copy the same distribution to the other section of the large pipe.
(a) Select To Selected Edges Reversed from the Method drop-down list.
(b) Select the Select edge(s)
icon immediately underneath the Method field.
(c) Select the edge 13-34.
(d) Click the middle-mouse button or click Apply.
10. Refine the nodes along the small pipe.
(a) Click Select edge(s)
edge 33-42.
(icon toward the top of the menu) and select the
(b) Enter 9 for the Nodes in the DEZ.
(c) Enter 1.0 and 0.5 for Spacing 1 and Spacing 2 respectively.
(d) Select To All Parallel Edges from the Method drop-down list.
(e) Click Apply.
11. Select edge 34-38 and enter 9 for the Nodes. Click Apply.
12. Enable Pre-Mesh and recompute to view the refined mesh shown in Figure 19.
Blocking
22
LMB
−→ Pre-Mesh
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
Figure 19: The Refined Mesh
Step 7: Matching the Edges
In this step, you will match the edge spacing of a Reference Edge to a connecting Target
Edge(s). You will modify the node spacing on the end of the target edge that connects to
the reference edge to match the node spacing on the reference edge.
Blocking > Pre-Mesh Params
> Match Edges
1. Match the edge spacing manually.
(a) Select Selected from the Method drop-down list.
(b) Click
for the Reference Edge.
(c) Select the edge, 42-43 and click middle-mouse button to accept the selection.
(d) Click
c ANSYS, Inc. February 11, 2010
for the Target Edge(s).
23
2D Pipe Junction Using Hexa Meshing
(e) Select the edges, 41-42 and 42-33 and click middle-mouse button to accept the
selection.
(f) Click Apply in the Match Edge spacing DEZ.
(g) Enable Pre-Mesh.
Blocking
LMB
−→ Pre-Mesh
The Mesh dialog box will appear, asking if you want to recompute the mesh.
Click Yes.
2. Match the edge spacing automatically.
(a) Select Automatic from the Method drop-down list.
(b) Ensure that the Spacing is Minimum.
24
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
(c) Click
Vertices.
(d) Select Select all appropriate visible objects
from the selection tool bar.
You can also enter v for all visible vertices or drag a box to select all vertices.
(e) Click middle-mouse button to accept the selection.
(f) Click
for the Ref. Edges.
(g) Select the edges, 13-34 and 34-42 and click middle-mouse button to accept the
selection.
This selection chooses the i and j index at each vertex for matching.
(h) Click Apply.
(i) Disable Pre-Mesh and re-enable it.
Blocking
LMB
−→ Pre-Mesh
The Mesh dialog box will appear, asking if you want to recompute the mesh.
Click Yes.
Figures 20 and 21 show the comparison of mesh before and after matching the
edges.
Figure 20: Mesh Before Edge Matching
c ANSYS, Inc. February 11, 2010
25
2D Pipe Junction Using Hexa Meshing
Figure 21: Final Mesh After Edge Matching
3. Check the quality of the mesh.
Blocking > Pre-Mesh Quality Histograms
(a) Retain the default settings.
(b) Click Apply.
(c) Select the worst two bars from the histogram.
The selected bars will be highlighted in pink (Figure 22).
Figure 22: Histogram
26
c ANSYS, Inc. February 11, 2010
2D Pipe Junction Using Hexa Meshing
The highlighted elements are shown in Figure 23.
Figure 23: Worst Quality Elements Highlighted
Step 8: Verifying and Saving the Mesh
1. Save the mesh in unstructured format.
Pre-Mesh > Convert to Unstruct Mesh
2. Save the blocking file (2D-pipe-geometry-final.blk).
File > Blocking > Save Blocking As...
This block file can be loaded in a future session (File > Blocking > Open Blocking)
for additional modification or to mesh a similar geometry. Save each blocking to a
separate file instead of overwriting a previous one. In more complex models, you
may have to back track and load a previous blocking.
3. Save the project file (2D-pipe-geometry-final.prj).
File > Save Project As...
This will save all the files—tetin, blocking, and unstructured mesh.
4. Exit the current session.
File > Exit
c ANSYS, Inc. February 11, 2010
27
2D Pipe Junction Using Hexa Meshing
28
c ANSYS, Inc. February 11, 2010
```