You are on page 1of 34

Tutorial: 2D Car Using Hexa Meshing

Introduction
In this tutorial, you will generate a mesh for external ow over a simple 2D car residing in a wind tunnel. A replay will be employed for recording all the blocking steps. This replay (script) le will be run to model a modied geometry. Figure 1 shows the 2D car geometry.

Figure 1: The Parts of 2D Car

This tutorial demonstrates how to do the following: Applying mesh parameters. Blocking the geometry. Fitting the body to blocking. Associating to geometry. Aligning the vertices. Generating the mesh. Creating an O-Grid. Adjusting the edge distribution and rening the mesh.

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Matching the edges. Saving the replay le. Using replay for the design iteration.

Prerequisites
This tutorial assumes that you are familiar with the menu structure in ANSYS ICEM CFD and that you have read about this functionality. Some of the steps in setup and the 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 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 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.

Blocking Strategy
For an external ow model in a wind tunnel, the following steps are usually taken when blocking the model to obtain the desired results. The split function is a common technique when beginning blocking by carving a Cartesian set of blocks around the object.

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

The vertices are then moved onto the geometry in order to t the shape of the car with all its features: front bumper, hood, etc. An O-Grid block is created around the car to give an orthogonal grid. The following Parts are dened in the geometry: CAR: Vehicle geometry GROUND: Ground surface of the wind tunnel INLET: Inlet face of the wind tunnel OUTLET: Outlet face of the wind tunnel PNTS: Prescribed points associated with the car TOP: Top surface of the wind tunnel Use the replay le for the modied geometry, hexa 2dcar mod.tin. The parts are same in both the base and modied geometries, allowing the replay le to be run on each identically.

Preparation
1. Download the ICEM hexa 2dcar FILES.zip le from the ANSYS Customer Portal. It contains the necessary input geometry les (hexa 2dcar base.tin and hexa 2dcar mod.tin). 2. Start ANSYS ICEM CFD and open the geometry (hexa 2dcar base.tin). File > Geometry > Open Geometry... Note: Ensure that the names of Parts that are listed are located in the display tree. 3. Activate the Replay control. The replay function allows you to record the steps necessary to complete the mesh. File > Replay Scripts > Replay Control This opens the Replay control window. Notes: The option of loading is not recorded in the replay script. Record (after current) is enabled by default. It will record all the commands until you select Done. The Replay control window may be moved aside or minimized while recording, but the window should be kept active until recording is complete. 4. Select Settings > Selection > Auto Pick Mode to enable or disable this mode. Note: If it gets enabled by default, you have to exit the selection mode (right or middle-mouse key) in order to change some options. Keep this enabled for this tutorial.

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Step 1: Applying Mesh Parameters


Mesh > Curve Mesh Setup > Select curve(s)

1. Click

in the Select Geometry toolbar that appears.

You can also type Shift P. The Select part dialog box will open.

Figure 2: Select the Car Part (a) Set the curve mesh size for CAR. i. Enable CAR and click Accept. ii. Set Maximum size to 25 in the Curve Mesh Setup DEZ. iii. Click Apply. (b) Set the curve mesh size for INLET, OUTLET, TOP, and GROUND. i. Enable INLET, OUTLET, TOP, and GROUND. ii. Click Accept. iii. Set Maximum size to 500 in the Curve Mesh Setup DEZ. iv. Click Apply.

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Step 2: Blocking the Geometry


1. Create initial block. Blocking > Create Block > Initialize Blocks

(a) Enter FLUID in the Part eld. (b) Change the Type to 2D Planar. (c) Click Apply.

Figure 3: Initial FLUID Block 2. Associate the four sides of the initial block to the four sides of the wind tunnel. When using hexa for 2D, boundary line elements are created only if the edges are associated with the boundary curves. You can apply boundary conditions only because of these boundary line elements. It is very important to associate all perimeter edges with the perimeter curves before the edges are split. When they are split, the resulting edges will retain the association. Blocking > Associate > Associate Edge to Curve

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

(a) Select the edge, 11-13 and click middle-mouse button to accept the selection. (b) Select the curve (INLET) that lay on the top of edge. (c) Click the middle-mouse button or Apply. (d) Similarly, associate the remaining edges (13-21, 21-19, and 19-11) to the boundaries (TOP, OUTLET, and GROUND). See Figure 4.

Figure 4: Boundaries of Car Geometry Disable the display of curves and ensure that all boundaries are turned green. 3. Split the initial block into sub-blocks. Ensure Curves are enabled (default) in the display tree. Edges should also be displayed (default) showing the initial block as shown in Figure 3. (a) Enable the display of Points. Geometry
LMB

Points

(b) Select Show Point Names. Geometry


RMB

Points

LMB

Show Point Names

The name of the Points will appear on the screen. Zoom in to the bumper. (c) Change Split Method to Prescribed point in the Split Block DEZ. The default Screen select split method is less parametric because it uses a command that split the edges based on a percentage rather than based on a specic point selection. Blocking > Split Block > Split Block

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

(d) Split the block vertically. i. Click (Select edge(s)).

ii. Select any horizontal edge (top or bottom edge). iii. Select PNTS/10 at the rear of the bumper. The new edge will automatically be created as shown in Figure 5. Note: At any point in time while in selection mode, you can toggle on dynamic mode by selecting F9. This may be necessary in order to zoom in to get a closer view of the points. Toggling F9 again will return to selection mode.

Figure 5: First Split (e) Similarly, make one more vertical split at the front of the car (choose points PNTS/1).

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

(f) Make two horizontal splits at the bottom and top of the vehicle (PNTS/12 and PNTS/5) as in shown in Figure 6.

Figure 6: Additional Splits (g) Split the block using index control. By default, splits propagate only through the displayed blocks. Blocks can be blanked by setting Index control values. The index control panel will appear in the lower right hand corner. This panel has two columns, Min and Max. All block edges and vertices are assigned an I, J, K value. For example, in Figure 7, the rst edge perpendicular to the x- axis of the global co-ordinate system has an index of I = 1, while the rst edge perpendicular to the y- axis has an index of J=1. For 2D cases, such as this, the K index is undened.

Figure 7: Index Control Notes: To change the range, toggle the arrows or enter an integer value in the appropriate eld. Only the blocks within this range are displayed. Select Reset to select all of the block indices. i. Select Index Control. Blocking
LMB

Index Control

ii. Change the Index range to I: 2-3, J: 1-3 to display only the blocks containing the vehicle and those underneath the vehicle.

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Note: This only restricts the display of the splits. Implied splits are still propagated behind the scenes in order to maintain structured block continuity. You can expose these implied splits using Extend Splits. iii. Select any horizontal edge and create a vertical split through PNTS/7. iv. Create a vertical split through PNTS/4. v. Change the Index range to I: 2-5, J: 2-4. vi. Select any vertical edge and create a horizontal split through PNTS/1. vii. Change the Index range to I: 2-5, J: 3-4. See Figure 8.

Figure 8: Additional Splits viii. Create a horizontal split through PNTS/4. See Figure 9.

Figure 9: Horizontal Split at PNTS/4 ix. Create a vertical split through PNTS/8.

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

x. Create a vertical split through PNTS/2. xi. Click Reset. xii. Disable the display of points. See Figure 10.

Figure 10: The Block Indices You can see the recording of the commands in the Replay control window. The Undo grouping is not important and can be removed clicking the Clean button. The important lines are those start with ic hex split grid. The next two numbers (11 19) are the vertices at the ends of the split edge. The next item (PNTS/1) is the name of the point controlling the split.

10

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

4. Delete unnecessary blocks. Blocking > Delete Block All of the blocks are in the FLUID volume part. For ow analysis, only the blocks outside of the car should be retained. The blocks representing the interior of the cars must be reassigned into a dierent volume part. (a) Enable the display of Blocks. Blocking
LMB

Blocks

This will show the blocks by their numbers. (b) Select the block to be deleted as shown in Figure 11. The blocks selected for deletion are 17, 28, 26, 36, 30, 31, 33.

Figure 11: Blocks to be Deleted (c) Click middle-mouse button or Apply in the Delete Block DEZ. These blocks will actually be put in the VORFN part since Delete Permanent is disabled (default). (d) Save the blocking. File > Blocking > Save Blocking As... (e) Provide a lename (car-geometry-1.blk) so that the le can be reloaded at a later time, using File > Blocking > Open Blocking....

c ANSYS, Inc. June 14, 2010

11

2D Car Using Hexa Meshing

Step 3: Fitting the Body to Block


To ensure proper projection of the blocking edges onto the geometry, project block vertices to the prescribed points and block edges to the curves. 1. Enable the display of Points and Vertices. Geometry Blocking
LMB

Points

LMB

Vertices

2. Select Numbers. Blocking


RMB

Vertices

LMB

Numbers

This will show all the vertices by their numbers. 3. Associate the vertices to the points. Blocking > Associate > Associate Vertex

(a) Ensure that Entity selected is Point in the Blocking Associations DEZ. (b) Select a vertex (55). (c) Select the nearest corner point (PNTS/6) to that vertex. See Figure 12.

12

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Figure 12: Associating Vertex to Point The vertex will immediately move to the selected point. Make sure you associate the vertices that are right on top of their respective points. The vertices will turn red indicating they are xed to the prescribed point. The blocks should now better represent the geometry of the car. (d) Similarly, associate the following Vertex to the Points: Vertex 61 76 84 43 54 42 91 83 92 Associated Point PNTS/5 PNTS/7 PNTS/8 PNTS/11 PNTS/12 PNTS/14 PNTS/2 PNTS/9 PNTS/3

Figure 13 shows the blocking.

c ANSYS, Inc. June 14, 2010

13

2D Car Using Hexa Meshing

Figure 13: The Blocking Fit to Car

Step 4: Associating to Geometry


1. Disable the display of Points. Geometry
LMB

Points

2. Disable the display of Internal Edges. This is an optional step. Blocking


RMB

Edges

LMB

Internal Edges

3. Associate the edges to the curves. Blocking > Associate > Associate Edge to Curve

(a) Select all the edges that lie on the car body by dragging a selection box with the left-mouse button. (b) Click middle-mouse button to accept the selection of edges. (c) Select all curves making up the car body individually or by dragging a selection box. (d) Click middle-mouse button to accept the selection of curves. 4. Select the Internal Edges. Blocking
RMB

Edges

LMB

Internal Edges

5. Disable the display of Curves to conrm that all the edges around the car body are associated and colored green. Geometry
LMB

Curves

14

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

6. Verify that the correct associations have been set. Blocking


RMB

Edges

LMB

Show association

7. Enable the display of Curves. Geometry


LMB

Curves

The projection on the front bumper will resemble Figure 14.

Figure 14: Display of Edge Projection

Step 5: Aligning the Vertices


In this step, line up the vertices of the three blocks underneath the car to obtain optimal mesh quality. Note: Similar to Split Blocks command, Align Vertices only acts upon the blocks displayed. Therefore, it is important to use the index control to isolate those blocks. 1. Isolate the blocks using index control. The index control panel is at the bottom right hand corner. (a) Click Select corners. (b) Select the two diagonally opposite vertices (corners) as shown in the Figure 15. Note: This changes the index control values.

c ANSYS, Inc. June 14, 2010

15

2D Car Using Hexa Meshing

Figure 15: Adjusting the Index Control from Corners 2. Select Indices. Blocking
RMB

Vertices

LMB

Indices

3. Select Align Vertices. Blocking > Move Vertex > Align Vertices

(a) Select one vertical (J) edge to dene the index align direction.

16

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

The program assumes the alignment to be along Y of the active coordinate system, so only the X and Z (in this case Z is undened) co-ordinates will be adjusted. (b) Select any of the top four vertices (e.g. 5 2 1) as shown in Figure 16. All J=2 vertices will be xed and all other visible vertices will be adjusted. Observe that XZ under Move in plane is automatically toggled on.

Figure 16: Edge and Reference Vertices Selection (c) Click Apply. The bottom vertices are adjusted to line up with those at the top. See Figure 17.

Figure 17: Lined up Vertices

4. Click Reset in the index control panel to display all blocks. 5. Enable the display of Points. Geometry
LMB

Points

6. Disable the display of Vertices. Blocking


LMB

Vertices

Vertex positions can also be adjusted by setting location of co-ordinates. In this case, you will line up one of the vertices near the front bumper.

c ANSYS, Inc. June 14, 2010

17

2D Car Using Hexa Meshing

7. Set the location for the moved vertex. Blocking > Move Vertex > Set Location

(a) Select a reference vertex, PNTS/3, as shown in Figure 18.

Figure 18: Using Set Location to Align Vertices

18

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

(b) Enable Modify Y only. (c) Click for Vertices to Set.

(d) Select the vertex corresponding to 0 and click Apply. The vertex will line up with the other one based on the y-coordinate as shown in Figure 19.

Figure 19: Lined up Vertex After Performing Set Location

You can see the recording of the commands in the Replay control window. The Undo grouping is not important and can be removed clicking the Clean button.

c ANSYS, Inc. June 14, 2010

19

2D Car Using Hexa Meshing

Two important commands are as follows: The command, ic hex get node location, used vertex 84 to create three variables, tempx tempy tempz. Note: The location of vertex 84 was set earlier when you associated that vertex to geometry point, PNTS/3 which parametrically links it back to the geometry. The command, ic hex set node location, adjusts the y value using the variable, tempy,to align the selected vertices in the globalco-ordinate system. The adjusted vertices are listed at the end of the command, node numbers 66.

Step 6: Generating the Mesh


Blocking > Pre Mesh Params 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 and recompute as shown in Figure 20. Blocking
LMB

> Update Sizes

Pre-Mesh

This creates a body-tted blocking that is aligned with indices I and J. This is known as a Cartesian or H-Grid type of blocking.

20

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Figure 20: The H-Grid Blocking

3. Set the edge parameters. Blocking > Pre-Mesh Params (a) Disable Pre-Mesh. Blocking
LMB

> Edge Params

Pre-Mesh

(b) Enable the display of Vertices. Blocking (c) Click


LMB

Vertices

and select edge 11-37.

(d) Set number of Nodes to 50. (e) Click Apply. (f) Click and select edge 48-38.

(g) Set number of Nodes to 50. (h) Enter 1.2 for Ratio1 and Ratio2. (i) Click Apply. (j) Click and select edge 49-50.

(k) Set number of Nodes to 75. (l) Enter 1.2 for Ratio1 and Ratio2. (m) Click Apply.

c ANSYS, Inc. June 14, 2010

21

2D Car Using Hexa Meshing

(n) Enable Pre-Mesh. See Figure 21. Blocking


LMB

Pre-Mesh

Figure 21: 2D Car Mesh

Step 7: Creating an O-Grid


In this step, you will create an O-Grid, where the mesh radially propagates from the surface of the car towards the outer domain. This will result in an orthogonal mesh to better capture near-wall or boundary layer ow. 1. Disable Pre-Mesh. Blocking
LMB

Pre-Mesh

2. Enable the VORFN part to enable you to select the interior blocks. Parts
LMB

VORFN

3. Create an O-Grid around the car. Blocking > Split Block (a) Click > Ogrid Block

(Select block(s)).

(b) Select the blocks inside the car and below the car as shown in Figure 22.

22

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Figure 22: Blocks to be Selected for the O-Grid (c) Press the middle-mouse button to accept the blocks. (d) Click (Select edge(s)).

(e) Select the edges along the ground under the car. (f) Press the middle-mouse button. See Figure 23.

Figure 23: Selecting the Blocks and Edges for the O-Grid (g) Enable Around block(s). (h) Ensure that Oset is set to 1 and click Apply.

c ANSYS, Inc. June 14, 2010

23

2D Car Using Hexa Meshing

(i) Disable VORFN. Parts


LMB

VORFN

Figure 24 shows the O-Grid passing through the oor.

Figure 24: External O-Grid of the Car

Step 8: Adjusting the Edge Distribution and Rening the Mesh


1. Set the edge meshing parameters. Blocking > Pre-Mesh Params > Edge Params

24

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

(a) Select one of the radial edges of the O-Grid as shown in Figure 25.

Figure 25: Setting the Meshing Parameters on the Edge

c ANSYS, Inc. June 14, 2010

25

2D Car Using Hexa Meshing

(b) Increase Nodes to 7 in the Pre-Mesh Params DEZ. (c) Select Geometric2 from Mesh law drop-down list. (d) Enter 1 for Spacing 2. (e) Enter 1.5 for Ratio 2. This will bunch the elements close to the car. (f) Enable Copy Parameters. (g) Set Method to To All Parallel Edges (default) and click Apply. This node distribution will be applied throughout the O-Grid. (h) Click and select one of the vertical edges between the car and the ground.

(i) Increase Nodes to 15. (j) Ratain the other default settings. (k) Click Apply. The ratios presented in the second column (actual) were not attained. 2. Enable Pre-Mesh and recompute. See Figure 26.

Figure 26: Mesh Before Matching the Edges

26

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Step 9: Matching the Edges


1. Disable Pre-Mesh. Blocking
LMB

Pre-Mesh

2. Set the index control values as shown.

3. Match the edge spacing of a Reference Edge to a connecting Target Edge. Blocking > Pre-Mesh Params (a) Enable Link spacing. (b) Select the Reference Edge and Target Edge as shown in Figure 27. > Match Edges

Figure 27: Match the Edges (c) Click the middle-mouse button. (d) Set the edge parameters for the target edge. Spacing 2 is now linked to the end spacing of the reference edge (linked 98 42). Changes to the reference edge distribution will automatically aect the edge distribution for this target edge.

c ANSYS, Inc. June 14, 2010

27

2D Car Using Hexa Meshing

Blocking > Pre-Mesh Params

> Edge Params

(e) Select the earlier target edge. (f) Ensure that Copy Parameters is enabled. (g) Select To Visible Parallel Edges from the Method drop-down list. Copy distribution To All Parallel Edges includes adjusting the distribution at the ceiling of the tunnel. As the index control is set to specic value, you can limit the copy To Visible Parallel Edges so that just the edges near the car are aected and not the ceiling of the tunnel which is not visible. (h) Click Apply. 4. Repeat step 2 for edge behind the car. See Figure 28. In this case, it is spacing one of the target edges that is linked during match edges.

28

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

Figure 28: Match Edges Behind the Car

5. Enable Pre-Mesh and recompute the mesh. Figure 29 shows the nal mesh of the baseline model.

Figure 29: Final Mesh of the Baseline Model

Step 10: Saving the Replay File


1. Bring the Replay control window to the foreground. 2. Right-click on the Replay control window (above the text) and select Edit lter. It shows the list of the sort of commands those can be cleaned.

c ANSYS, Inc. June 14, 2010

29

2D Car Using Hexa Meshing

Note: The replay le can contain all steps for outputting the mesh and can be used in batch mode from the command line using icemcfd-batch-script replay-file.rpl. 3. Right-click again to go back to the replay script. 4. Click Clean to remove the undo group commands. 5. Click Renumber to number the commands properly. 6. Disable Record (after current). 7. Click Save and enter the lename replay file.rpl.

Step 11: Using Replay for the Design Iteration


You can rebuild the block topology on a similar geometry, or design iteration. Instead of repeating the same commands manually, run the replay le. 1. Start a new ANSYS ICEM CFD session and open the geometry (hexa 2dcar mod.tin). File > Geometry > Open Geometry... In hexa 2dcar mod.tin, the trunk or deck-lid is extended rearward, the rear windshield (backlight) angle is changed and the windshield is moved slightly rearward. See Figure 30.

Figure 30: The Modied Car Model Geometry

2. Load the replay le, replay-file.rpl. File > Replay Scripts > Load script le 3. In the Replay control window, highlight line no. 1. 4. Click Do all. If the Always update option is enabled, you can see each step. Disabling that option will be faster (without display delays). This is the real power of replay. The blocking le is parametric and you can load the saved blocking le from the other conguration and update it to get a similar result.

30

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

5. Enable Pre-Mesh and recompute. This mesh will be generated using exactly the same parameters as earlier, so the dierences in solutions may be attributed to the changes in the geometry, rather than to any dissimilarity in the grids. See Figure 31.

Figure 31: Final Mesh

6. Save the unstructured mesh. Blocking


RMB

Pre-Mesh

LMB

Convert to Unstruct

7. Save the project le (hexa-2Dcar-final.prj). File > Save Project As... 8. Export the mesh to the solver. Output > Select solver (a) Select Fluent V6 from the Output Solver drop-down list. (b) Click Apply. 9. Set the boundary conditions. Output > Boundary conditions

c ANSYS, Inc. June 14, 2010

31

2D Car Using Hexa Meshing

(a) Set velocity-inlet as a boundary condition for INLET. (b) Set pressure-outlet, exhaust-fan, outlet-vent as a boundary condition for OUTLET. (c) Set wall as a boundary condition for TOP and GROUND. (d) Click Accept to set the boundary conditions. 10. Write the input le for ANSYS FLUENT. Output > Write input (a) Open .uns le. The Fluent V6 window will appear.

32

c ANSYS, Inc. June 14, 2010

2D Car Using Hexa Meshing

(b) Select 2D for Grid dimension. (c) Enter appropriate name for the Output le. (d) Click Done. You can use this .msh le in ANSYS FLUENTto set up and solve.

c ANSYS, Inc. June 14, 2010

33

2D Car Using Hexa Meshing

34

c ANSYS, Inc. June 14, 2010

You might also like