Tutorial: 2D Car Using Hexa Meshing Introduction In this tutorial, you will generate a mesh for external flow over a simple 2D car residing in a wind tunnel. A replay will be employed for recording all the blocking steps. This replay (script) file will be run to model a modified 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 refining the mesh. c ANSYS, Inc. June 14, 2010 1
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Tutorial: 2D Car Using Hexa Meshing
Introduction
In this tutorial, you will generate a mesh for external flow over a simple 2D car residingin a wind tunnel. A replay will be employed for recording all the blocking steps. Thisreplay (script) file will be run to model a modified geometry. Figure 1 shows the 2D cargeometry.
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 refining the mesh.
This tutorial assumes that you are familiar with the menu structure in ANSYS ICEMCFD and that you have read about this functionality. Some of the steps in setup and theprocedure will not be shown explicitly.
For details about hexa mesh generation, refer to the Chapter, Hexa, in ANSYS ICEMCFD 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 theoption from the display tree.
Blocking
• The arrow mark with the text LMB in the box suggests that you have to click theleft-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 theright-mouse button to enable or disable an option (here, Numbers).
RMB −→ Numbers
For detailed information about GUI and text conventions, refer to the document, GettingStarted with ANSYS ICEM CFD.
Blocking Strategy
For an external flow model in a wind tunnel, the following steps are usually taken whenblocking the model to obtain the desired results.
• The split function is a common technique when beginning blocking by carving aCartesian set of blocks around the object.
• The vertices are then moved onto the geometry in order to fit the shape of the carwith 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 defined 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 file for the modified geometry, hexa 2dcar mod.tin. The parts aresame in both the base and modified geometries, allowing the replay file to be runon each identically.
Preparation
1. Download the ICEM hexa 2dcar FILES.zip file from the ANSYS Customer Por-tal. It contains the necessary input geometry files (hexa 2dcar base.tin andhexa 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 ormiddle-mouse key) in order to change some options. Keep this enabled forthis tutorial.
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 as-sociated with the boundary curves. You can apply boundary conditions only becauseof these boundary line elements. It is very important to associate all perimeteredges with the perimeter curves before the edges are split. When they are split, theresulting edges will retain the association.
(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 theboundaries (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 dis-played (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 com-mand that split the edges based on a percentage rather than based on a specificpoint selection.
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 ondynamic mode by selecting F9. This may be necessary in order to zoomin to get a closer view of the points. Toggling F9 again will return toselection mode.
Figure 5: First Split
(e) Similarly, make one more vertical split at the front of the car (choose pointsPNTS/1).
(f) Make two horizontal splits at the bottom and top of the vehicle (PNTS/12and 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 beblanked by setting Index control values. The index control panel will appearin 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, inFigure 7, the first edge perpendicular to the x- axis of the global co-ordinatesystem has an index of I = 1, while the first edge perpendicular to the y- axishas an index of J=1. For 2D cases, such as this, the K index is undefined.
Figure 7: Index Control
Notes:
• To change the range, toggle the arrows or enter an integer value in theappropriate field. 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 contain-ing the vehicle and those underneath the vehicle.
Note: This only restricts the display of the splits. Implied splits are stillpropagated behind the scenes in order to maintain structured blockcontinuity. 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.
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. TheUndo grouping is not important and can be removed clicking the Clean button. Theimportant 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) isthe name of the point controlling the split.
All of the blocks are in the FLUID volume part. For flow analysis, only the blocksoutside of the car should be retained. The blocks representing the interior of thecars must be reassigned into a different 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 isdisabled (default).
(d) Save the blocking.
File > Blocking > Save Blocking As...
(e) Provide a filename (car-geometry-1.blk) so that the file can be reloaded ata later time, using File > Blocking > Open Blocking....
The vertex will immediately move to the selected point. Make sure you asso-ciate the vertices that are right on top of their respective points. The verticeswill turn red indicating they are fixed to the prescribed point. The blocks shouldnow better represent the geometry of the car.
(d) Similarly, associate the following Vertex to the Points:
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 optimalmesh 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.
The program assumes the alignment to be along Y of the active coordinatesystem, so only the X and Z (in this case Z is undefined) co-ordinates will beadjusted.
(b) Select any of the top four vertices (e.g. 5 2 1) as shown in Figure 16.
All J=2 vertices will be fixed 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 thiscase, you will line up one of the vertices near the front bumper.
(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 shownin 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 Undogrouping is not important and can be removed clicking the Clean button.
• The command, ic hex get node location, used vertex 84 to create three vari-ables, tempx tempy tempz.
Note: The location of vertex 84 was set earlier when you associated that vertex togeometry 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 > Update Sizes
1. Enable Update Sizes.
(a) Select Update All.
This will automatically determine the number of nodes on the edges from themesh sizes set on the curves.
(b) Click Apply.
2. Enable Pre-mesh and recompute as shown in Figure 20.
Blocking LMB −→ Pre-Mesh
This creates a body-fitted blocking that is aligned with indices I and J. This is knownas a Cartesian or H-Grid type of blocking.
In this step, you will create an O-Grid, where the mesh radially propagates from thesurface of the car towards the outer domain. This will result in an orthogonal mesh tobetter capture near-wall or boundary layer flow.
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 > Ogrid Block
(a) Click (Select block(s)).
(b) Select the blocks inside the car and below the car as shown in Figure 22.
3. Match the edge spacing of a Reference Edge to a connecting Target Edge.
Blocking > Pre-Mesh Params > Match Edges
(a) Enable Link spacing.
(b) Select the Reference Edge and Target Edge as shown in Figure 27.
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 affect the edgedistribution for this target edge.
(g) Select To Visible Parallel Edges from the Method drop-down list.
Copy distribution To All Parallel Edges includes adjusting the distribution atthe ceiling of the tunnel. As the index control is set to specific value, you canlimit the copy To Visible Parallel Edges so that just the edges near the car areaffected 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.
Note: The replay file can contain all steps for outputting the mesh and can beused 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 filename 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 ofrepeating the same commands manually, run the replay file.
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 rearwindshield (backlight) angle is changed and the windshield is moved slightly rear-ward. See Figure 30.
Figure 30: The Modified Car Model Geometry
2. Load the replay file, replay-file.rpl.
File > Replay Scripts > Load script file
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 op-tion will be faster (without display delays). This is the real power of replay. Theblocking file is parametric and you can load the saved blocking file from the otherconfiguration and update it to get a similar result.
This mesh will be generated using exactly the same parameters as earlier, so thedifferences in solutions may be attributed to the changes in the geometry, ratherthan 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 file (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.