There are a series of ICEMCFD scripts to automate grid generation for a simple wing. These generate 128 block grids over a "typical" wing. Using the scripts is a three stage process:
Geometry processing
Blocking
Meshing
Launch ICEMCFD in a terminal, which will then yield the prompt
med>>
where commands can be passed to ICEM. A initialization script is available which sets default input file names and aliases. Set it with
med>> source init
Then the scripts can be run, for example for the geometry script, with
med>> geom
which will take in the default geometry input file, geometry.params, or a differently named input file can be specified at runtime with
med>> geom input_file
A sample case, including a recent (summer 2019) version of the scripts and input files is here:
~thomas/ICEMCFD/CRM/wing/Grids/G1
The geometry script, geometry.rpl, takes in a geometry file (.tin format) which has 6 spanwise surface segments, with a LS/US pair. These are all named s.W<n>.LS/US. This layout is illustrated in the figure below. The surfaces should be relatively evenly distributed along the span, while the tip segment is the smallest to allow for tip node clustering. No points or curves are needed in the geometry model. Note that no tip cap is required (and in fact must not be present). The scripts will create a new one.
The scripts are quite sensitive. The geometry script must run successfully for the subsequent steps (blocking and meshing) to work. Nothing can be removed from the geometry file. However, in some cases it may be beneficial to modify it. The subsequent scripts rely on point/curve/surface names, so these can be changed slightly if needed. Typically only the points should be moved - manually modifying curves/surfaces has not been tested and is likely to cause problems. Typically, the points to be moved are those off of the geometry which are used by subsequent scripts to set the off-wall block sizes or edge bending. Moving these points allows the user to have more refined control for non-typical geometries while still using the blocking and meshing scripts.
Required surface naming convention for geometry script. (Surface 3-6 appear the same in this image, but they are different surfaces)
The geometry script takes in an input file, geometry.params, an example of which is below
###########################################################
################ GEOMETRY INPUT PARAMETERS ################
#
# Input file names:
set base_geometry_file crm_base.tin
#
# Output file names:
set geometry_file crm.tin
#
# Farfield distance:
set farfield_dist 50.00 ;# In absolute units
#
# Block size
set chord_splits {0.02 0.15 0.55 0.95} ;# In fraction of chord
set normal_block_size 0.03 ;# In fraction of chord
set block_scaling 0.50 ;# Power
###########################################################
where the input parameters are:
base_geometry_file: The starting geometry file containing the surfaces named as described above
geometry_file: The output file name
farfield_dist: Distance at which to create the farfield
chord_splits: A list of chord fractions at which to create block splits along the chord. The first will be the LE cap.
normal_block_size: The size, normal to the surface, of the first block. In root chord units.
block_scaling: Scale the normal_block_size with the local chord, i.e. block_size = normal_block_size * (c/c_root)^block_scaling
Running the geometry script with
med>> geom
will create the geometry_file required by the blocking script.
The blocking script, blocking.rpl, takes in the geometry generated by the geometry script and blocks it. The input file, blocking.params, sets the blocking parameters.
########################################################
################ BLOCK INPUT PARAMETERS ################
#
# Input file names:
set geometry_file crm.tin
#
# Output file names:
set blocking_file crm.blk
#
# Edge shape matching
set shape_factor 1.00 ;# Factor by which blocks follow geometry
#
########################################################
where:
geoemtry_file: The name of the geometry file created by the geometry script
blocking_file: The name of the output blocking file to be read by the meshing script in the next step.
shape_factor: A shape following factor which determines how the shape of the off-wall block splits follow the geometry. Typically 1.
The meshing script, meshing.rpl, takes in the previously generated geometry and blocking files and sets the mesh parameters. A sample input file is:
#######################################################
################ MESH INPUT PARAMETERS ################
#
# Input file names:
set geometry_file crm.tin
set original_blocking_file crm.blk
#
# Output file names:
set meshed_blocking_file rans-fineoffwall.blk
set grid_file rans-fineoffwall.g
#
# Grid export options:
set export_grid True
set scale_grid 1.0
#
# Mesh dimension information
# (For good load balancing, set n_chord <= n_span)
set n_chord 29
set n_span 21
set n_normal 49
#
# Fluid mesh information
set farfield_spacing 8.00 ;# In absolute geometry units
set farfield_interface_spacing 1.00 ;# Fraction of uniform spacing
set farfield_bunching hyperbolic ;# Meshing law
#
# Wing mesh information
#-- chordwise
set chord_interface_spacing 0.80 ;# Fraction of uniform spacing
set chord_bunching hyperbolic ;# Meshing law
set chord_link_spacings True ;# Link spacings at chord interfaces
#-- spanwise
set span_interface_spacing 0.80 ;# Fraction of uniform spacing
set span_bunching hyperbolic ;# Meshing law
set span_link_spacings True ;# Link spacints at span interfaces
#-- normal
set normal_surface_spacing 0.25E-6 ;# Fraction of root chord
set normal_surface_scaling 0.00 ;# Influence of chord length on normal spacings
set normal_interface_spacing 5.00E-3 ;# Fraction of root chord
set normal_interface_scaling 0.50 ;# Influence of chord length on normal spacings
set normal_bunching hyperbolic ;# Meshing law
#
#######################################################
where:
geometry_file: Name of previously generated geometry file
original_blocking_file: Name of previously generated blocking file
meshed_blocking_file: Name of output file with mesh parameters set, meshed_blocking_file.blk
grid_file: Name of output Plot3D grid if export_grid = True
export_grid: Export the Plot3D file. True/False. If false the meshed blocking file is written and saved. Manual changes can then be made if desired and the Plot3D file manually exported.
scale_grid: Scale the Plot3D grid on export.
n_chord/n_span/n_normal: Number of nodes in each direction on each block.
farfield_spacing: Node spacing at the farfield
farfield_interface_spacing: Spacing at the interface between the wall-adjacent block and the farfield block. As a fraction of a uniform spacing of the wall-adjacent block
farfield_bunching: Bunching law for the block extending to the farfield
chord_interface_spacing: Spacing at block interfaces in the chordwise direction. In fraction of uniform spacing.
chord_bunching: Bunching law in the chordwise direction.
chord_interface_linking: Link spacings across interfaces.
span*: Same as for the above three chord inputs, but in the spanwise direction.
normal_surface_spacing: Offwall spacing. Fraction of root chord.
normal_surface_scaling: Power to scale the offwall spacing with the local chord. I.e. offwall spacing = normal_surface_spacing * (c/c_root)^normal_surface_scaling. 0 makes a constant spacing equal to normal_surface_spacing
normal_interface_spacing: Normal spacing at the interface of the wall-adjacent and farfield block. In fraction of root chord.
normal_interface_scaling: Same as normal_surface_scaling, but for the interface spacing
normal_bunching: Normal direction bunching law in the wall-adjacent block
A different input file can be created for each type of mesh required, i.e. rans.params, ncpts.params, fit.params, with the number of nodes, spacings, and output names specific to that mesh and then run with, for e.g. to get the RANS grid,
med>> mesh rans.params
which will create a meshed_blocking_file.blk and, if requested, a grid_file.g Plot3D grid. The grids can also be modified as much as you want after this script is run, and you can then export manually.