Difference between revisions of "BLMesher"
(→Start) |
(Added a pitfalls section) |
||
(24 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category:Software]] | |
− | |||
− | [[Category: | ||
− | |||
How to create the mesh '''using script''' | How to create the mesh '''using script''' | ||
Line 8: | Line 5: | ||
== Start == | == Start == | ||
* To begin, we need a geometry model. It can be created using commercial softwares such as Solid Work and saved as *.x_t | * To begin, we need a geometry model. It can be created using commercial softwares such as Solid Work and saved as *.x_t | ||
+ | * You need the BLMesher code which is available on svn: | ||
+ | svn co https://redmine.scorec.rpi.edu/svn/phasta/BLMesher | ||
+ | * If you have read only access to phasta project on redmine, then use: | ||
+ | svn co https://redmine.scorec.rpi.edu/anonsvn/phasta/BLMesher | ||
==Files needed == | ==Files needed == | ||
Line 14: | Line 15: | ||
* Mesh generation attribution file (Attributes.inp) | * Mesh generation attribution file (Attributes.inp) | ||
* exe file (Run.sh) | * exe file (Run.sh) | ||
− | |||
File Attributes.inp is the script that defines the mesh generation characteristics for different entities of the model. | File Attributes.inp is the script that defines the mesh generation characteristics for different entities of the model. | ||
− | |||
Run.sh is an exe file including commands as below: | Run.sh is an exe file including commands as below: | ||
− | PATH=/users/ | + | PATH=/users/chitak/develop/Meshing/BLMesher |
− | $PATH/bin/x86_64_linux/BLMesher geom.xmt_txt geom.sms 1 0.1 | + | $PATH/bin/x86_64_linux/BLMesher-0 geom.xmt_txt geom.sms 1 0.1 BLAttr.inp |
It defines the proper path for mesh generator. It also defines that geom.xmt_txt is the model file and the mesh must be created using the attributes defined in Attributes.inp and the mesh data must be written into geom.sms | It defines the proper path for mesh generator. It also defines that geom.xmt_txt is the model file and the mesh must be created using the attributes defined in Attributes.inp and the mesh data must be written into geom.sms | ||
− | In the second line of the Run.sh file, the value before attributes.inp (in this case, 0.1) is the size of the boxes that are created before the the final mesh generation. (In fact, BLMesher tries to divide the whole domain into small boxes and then divide these boxes to create the mesh) | + | In the second line of the Run.sh file, the value before attributes.inp (in this case, 0.1) is the size of the boxes that are created before the the final mesh generation. (In fact, BLMesher tries to divide the whole domain into small boxes and then divide these boxes to create the mesh). |
− | + | Lets call the characteristic size of the domain, d, and the size of the boxes E. | |
You must choose E as below and use it in Run.sh: | You must choose E as below and use it in Run.sh: | ||
Line 31: | Line 30: | ||
m is an integer. | m is an integer. | ||
− | . | + | Other flags like optimization and smoothing can also be given in this line. Use -h option with the executable to view the complete list of the options and their meaning. Note that the order of these flags is extremely important. Other than the executable, there are 11 other command line inputs which can be given. These can be given in Run.sh with the executable. |
== Edit the script == | == Edit the script == | ||
Line 52: | Line 51: | ||
== Visualize the mesh == | == Visualize the mesh == | ||
To see the generated mesh, you can use simapps: | To see the generated mesh, you can use simapps: | ||
− | / | + | /usr/local/simapps/<simapps version>/simapps ThreeDViewer & |
. | . | ||
Line 185: | Line 184: | ||
(2): Entity dimension, 2-D. it's a face. | (2): Entity dimension, 2-D. it's a face. | ||
(173): Face tag | (173): Face tag | ||
− | (1): Size type on entity. 1 for absolute mesh size | + | (1): Size type on entity. 1 for absolute mesh size, 2 for relative |
− | (1): Attribute type on entity. 1 | + | (1): Attribute type on entity. A value of 1 selects the boundary layer meshing option. |
(0): Boundary layer orientation (FaceSide/useDir) | (0): Boundary layer orientation (FaceSide/useDir) | ||
(0): NumEndEnts. 0 for layers with fixed heights | (0): NumEndEnts. 0 for layers with fixed heights | ||
Line 192: | Line 191: | ||
(3.e-4): Total height of boundary layer | (3.e-4): Total height of boundary layer | ||
(5): Number of layers | (5): Number of layers | ||
− | (0): Boundary layer Mixed topology | + | (0): Boundary layer Mixed topology |
− | (0): Boundary layer blending. 0 for no BL blending | + | - 0 for tetrahedra only |
− | (0): Boundary Layer propagation | + | - 1 for a wedge / hex dominant BL |
+ | (0): Boundary layer blending. | ||
+ | - 0 for no BL blending | ||
+ | - 1 to enable BL blending | ||
+ | (0): Anisotropic Boundary Layer size gradation / propagation | ||
+ | - 0 disable size gradation | ||
+ | - 1 enable size gradation | ||
(1.61e-4): mesh size on the surface (This value is in the second line) | (1.61e-4): mesh size on the surface (This value is in the second line) | ||
+ | |||
+ | |||
+ | If you are specifying a 2D BL on a model edge, then at the end of the line, you have to give a target face tag, to which face you want that BL attribute applied. | ||
+ | |||
+ | For more details, see the the appropriate documentation such as /usr/local/simmetrix/simmodsuite/8.0-121129/html/MeshSimAdv/group__BLAttrib.html#BLParamChart for attribute type and /usr/local/simmetrix/simmodsuite/8.0-121129/html/MeshSimAdv/group__BLAttrib.html#BLAnisoOption for Anisotropic Size Gradation. | ||
. | . | ||
Line 226: | Line 236: | ||
(0): Boundary Layer propagation. 0 for no propogation | (0): Boundary Layer propagation. 0 for no propogation | ||
(0.1): mesh size on the surface (This value is in the second line) | (0.1): mesh size on the surface (This value is in the second line) | ||
+ | |||
+ | == Example 8: Global BL attributes == | ||
+ | |||
+ | These can be set globally as follows. Only 1 attribute can be set at a time. | ||
+ | |||
+ | -1 7 attribute_type | ||
+ | value | ||
+ | |||
+ | The above lines can be divided as below: | ||
+ | (-1) (7) (attribute_type) | ||
+ | (value) | ||
+ | |||
+ | (-1): Entity dimension. -1 for setting global attributes | ||
+ | (7): for setting BL global attribute | ||
+ | (attribute_type): type of BL attribute you want to set. It can be one of the following: | ||
+ | 1: smoothing distance | ||
+ | 2: layer edge aspect ratio | ||
+ | 3: exposed aspect ratio (opposite of aspect ratio, look at the documentation MS_minExposedAspectRatio for more info) | ||
+ | 10: Global gradation rate (not for BLs) | ||
+ | (value): value for the above attribute | ||
+ | |||
+ | == Example 9: Refinement Along an Edge == | ||
+ | |||
+ | For uniform refinement along an edge with tag 333 | ||
+ | 1 333 1 0 | ||
+ | 2e-4 | ||
+ | |||
+ | The above lines can be divided as below: | ||
+ | (1) (333) (1) (0) | ||
+ | (2e-4) | ||
+ | |||
+ | (1): Entity dimension. It's a 1-D line. | ||
+ | (333): Entity tag | ||
+ | (1): Size type on entity. 1 for absolute mesh size | ||
+ | (0): Attribute type on entity. 0 just imposes the size on entity. | ||
+ | (2e-4): Mesh size (This is in the second line) | ||
+ | |||
+ | == Pitfalls == | ||
+ | |||
+ | -Some versions of BLMesher will die if tabs are present in the attribute file. The error message is quite unhelpful and will look something like: | ||
+ | ERROR : attribute info. [attribute number : 9] - NOT compatible [model entity of dim.:0 NOT found with tag:1] |
Latest revision as of 17:03, 14 May 2014
How to create the mesh using script
Contents
- 1 Start
- 2 Files needed
- 3 Edit the script
- 4 Create the mesh
- 5 Visualize the mesh
- 6 Define the mesh characteristics in attribute file
- 7 Example 1: Uniform mesh
- 8 Example 2: Refinement in a cylindrical region
- 9 Example 3: Refinement in a box region
- 10 Example 4: Refine the mesh along 3 lines on face with tag 5
- 11 Example 5: Periodic mesh
- 12 Example 6: Boundary layer mesh , constant thickness
- 13 Example 7: Boundary layer mesh, ramped thickness
- 14 Example 8: Global BL attributes
- 15 Example 9: Refinement Along an Edge
- 16 Pitfalls
Start
- To begin, we need a geometry model. It can be created using commercial softwares such as Solid Work and saved as *.x_t
- You need the BLMesher code which is available on svn:
svn co https://redmine.scorec.rpi.edu/svn/phasta/BLMesher
- If you have read only access to phasta project on redmine, then use:
svn co https://redmine.scorec.rpi.edu/anonsvn/phasta/BLMesher
Files needed
Create a folder and copy all these files into it.
- Geometry model file (geom.xmt_txt or geom.x_t)
- Mesh generation attribution file (Attributes.inp)
- exe file (Run.sh)
File Attributes.inp is the script that defines the mesh generation characteristics for different entities of the model.
Run.sh is an exe file including commands as below:
PATH=/users/chitak/develop/Meshing/BLMesher $PATH/bin/x86_64_linux/BLMesher-0 geom.xmt_txt geom.sms 1 0.1 BLAttr.inp
It defines the proper path for mesh generator. It also defines that geom.xmt_txt is the model file and the mesh must be created using the attributes defined in Attributes.inp and the mesh data must be written into geom.sms
In the second line of the Run.sh file, the value before attributes.inp (in this case, 0.1) is the size of the boxes that are created before the the final mesh generation. (In fact, BLMesher tries to divide the whole domain into small boxes and then divide these boxes to create the mesh). Lets call the characteristic size of the domain, d, and the size of the boxes E.
You must choose E as below and use it in Run.sh:
<math> E=\frac{d}{2^{(m+1)}} </math> or <math> E=\frac{d}{2^m} </math>
m is an integer.
Other flags like optimization and smoothing can also be given in this line. Use -h option with the executable to view the complete list of the options and their meaning. Note that the order of these flags is extremely important. Other than the executable, there are 11 other command line inputs which can be given. These can be given in Run.sh with the executable.
Edit the script
- The first line is the version number (for future use). For eg.: version 1
- Use "#" to comment a line or disable it.
- To create attributes for each model entity, two lines in the following format are being used.
<entity dimension> <entity tag> <size type> <attribute type> <extra> <value or expression for mesh size on this entity>
- Note that a blank line between these two lines is not allowed.
.
Create the mesh
- After preparing the script, execute the file Run.sh. It creates the mesh and write the data to geom.sms (as you defined in Run.sh).
- Note that after executing the Run.sh, you must use command "top" to check the memory usage. If you find out that memory usage is huge and is increasing, you must kill the job before the machine crashes
.
Visualize the mesh
To see the generated mesh, you can use simapps:
/usr/local/simapps/<simapps version>/simapps ThreeDViewer &
.
Define the mesh characteristics in attribute file
The parameters in the first line, respectively are:
- Entity dimension: 2 for 2-D cases and 3 for 3-D cases - Entity tag: You can find the entity tag using simapps - Size type on entity: 1 for absolute mesh size and 2 for relative mesh size - Attribute type on entity: 0 just imposes the size on entity. <extra> field is NULL 1 for entity with boundary layers. <extra> field is explained below. 2 for periodic entity: In this case, <extra> field is followed with slave entity tag 3 for refinement source. Specify entity dimension as -1 in this case. <extra> field is explained below.
<extra> field:
For Boundary layer: is followed with (a) faceSide/useDir (BL orientation), (b) numEndEnts (==0, layers with fixed heigths), (c) firstLayerHeight, (d) totalHeight, (e) nLayers, (f) blMixed, (g) blBlends, (h) blPropagate and (i) edgeBLFaceTag (only if 2D BL on edge) is followed with (a) faceSide/useDir (BL orientation), (b) numEndEnts (==2, to vary height linearly between two end/bounding entities), (c) varyDirection, (d) endEntTag1 , (e) firstLayerHeight1, (f) totalHeight1, (g) endEntTag2, (h) firstLayerHeight2, (i) totalHeight2, (j) nLayers, (k) blMixed, (l) blBlends, (m) blPropagate and (n) edgeBLFaceTag (only if 2D BL on edge)
For refinement: is followed with (a) ref. source type (1-cube, 2-cylinder etc.), (b) source info. as Simmetrix APIs (like radius, length, center and normal in case of cylinder, and center, wdir, hdir and ddir in case of cube/parallelepiped)
- Note if entity dimension is -1, (in case of refinement) do not specify the entity tag and size type.
.
Example 1: Uniform mesh
Simple uniform mesh on region with tag 205
3 205 1 0 2e-4
The above lines can be divided as below:
(3) (205) (1) (0) (2e-4)
(3): Entity dimension. It's a 3-D region. (205): Entity tag (1): Size type on entity. 1 for absolute mesh size (0): Attribute type on entity. 0 just imposes the size on entity. <extra> field is NULL (2e-4): Mesh size (This is in the second line)
Note: The second line (Mesh size) can be a value or an expression such as:
0.0125+0.1*(1.0-exp(-3.0*sqrt(($x-0.0)^2+($y-0.0)^2+($z-0.5)^2)))
.
Example 2: Refinement in a cylindrical region
-1 3 1 1.5e-3 1 2 0.3 0 0 0 1 2.5e-4
The above lines can be divided as below:
(-1) (3) (1) (1.5e-3) (1) (2 0.3 0) (0 0 1) (2.5e-4)
(-1): Entity dimension, for refinement cases (3): Attribute type. in this case, refinement. (1): For refinement in a cylindrical region (1.5e-3 ): Radius (1): Length of the Cylinder (Half) (2 0.3 0): The center of the circle (0 0 1): Axis (2.5e-4): mesh size (This is in the second line)
.
Example 3: Refinement in a box region
-1 3 2 6e-3 5e-3 0.0 1.5e-3 0.0 0.0 0.0 5.0e-4 0.0 0.0 0.0 5.0e-4 2.5e-4
The above lines can be divided as below:
(-1) (3) (2) (6e-3 5e-3 0.0) (1.5e-3 0.0 0.0) (0.0 5.0e-4 0.0) (0.0 0.0 5.0e-4) (2.5e-4)
(-1): Entity dimension. -1 only for refinement cases. (3): Attribute type. in this case, refinement. (2): For refinement in a box region (6e-3 5e-3 0.0): The center of the box (1.5e-3 0.0 0.0): x-Half length (0.0 5.0e-4 0.0): y-Half length (0.0 0.0 5.0e-4): z-Half length (2.5e-4): mesh size (This is in the second line)
.
Example 4: Refine the mesh along 3 lines on face with tag 5
3 5 1 0 (0.5e-03) +0.1*(1.0-exp(-2.0*sqrt(($x-1.9)^2+($y-0.36)^2)))*(1.0-exp(-10.0*sqrt(($x-1.77)^2+($y-0.42)^2)))*(1.0-exp(-6.0*sqrt(($x-1.8)^2+($y-0.43)^2)))
The first line can be divided as below:
(3) (5) (1) (0)
(3): Entity dimension, 3-D (5): Entity tag (1): Size type on entity. 1 for absolute mesh size (0): Attribute type on entity. 0 just imposes the size on entity. <extra> field is NULL
This is an example of an expression that will make the mesh fine in three lines. e.g., x=1.9 y=0.36 on model entity number 5.
.
Example 5: Periodic mesh
If periodic BC is used at two faces, the mesh must be identical in both of them.
In this case, faces 1 and 81 are periodic
2 1 1 2 81 2.1e-4
The above lines can be divided as below:
(2) (1) (1) (2) (81) (2.1e-4)
(2): Entity dimension, 2-D. it's a face. (1): Entity tag (1): Size type on entity. 1 for absolute mesh size (2): Attribute type on entity. 2 for periodic entity. <extra> field is followed with a slave entity tag (81): Slave entity tag (2.1e-4):mesh size (This is in the second line)
.
Example 6: Boundary layer mesh , constant thickness
On face with tag 173
2 173 1 1 0 0 0.4e-4 3.e-4 5 0 0 0 1.61e-4
The above lines can be divided as below:
(2) (173) (1) (1) (0) (0) (0.4e-4) (3.e-4) (5) (0) (0) (0) (1.61e-4)
(2): Entity dimension, 2-D. it's a face. (173): Face tag (1): Size type on entity. 1 for absolute mesh size, 2 for relative (1): Attribute type on entity. A value of 1 selects the boundary layer meshing option. (0): Boundary layer orientation (FaceSide/useDir) (0): NumEndEnts. 0 for layers with fixed heights (0.4e-4): First layer height (3.e-4): Total height of boundary layer (5): Number of layers (0): Boundary layer Mixed topology - 0 for tetrahedra only - 1 for a wedge / hex dominant BL (0): Boundary layer blending. - 0 for no BL blending - 1 to enable BL blending (0): Anisotropic Boundary Layer size gradation / propagation - 0 disable size gradation - 1 enable size gradation (1.61e-4): mesh size on the surface (This value is in the second line)
If you are specifying a 2D BL on a model edge, then at the end of the line, you have to give a target face tag, to which face you want that BL attribute applied.
For more details, see the the appropriate documentation such as /usr/local/simmetrix/simmodsuite/8.0-121129/html/MeshSimAdv/group__BLAttrib.html#BLParamChart for attribute type and /usr/local/simmetrix/simmodsuite/8.0-121129/html/MeshSimAdv/group__BLAttrib.html#BLAnisoOption for Anisotropic Size Gradation.
.
Example 7: Boundary layer mesh, ramped thickness
On face with tag 27
2 27 1 1 0 2 0 22 1.e-3 2.e-2 20 2.e-3 10.e-2 5 1 0 0 0.1
The above lines can be divided as below:
(2) (27) (1) (1) (0) (2) (0) (22) (1.e-3) (2.e-2) (20) (2.e-3) (10.e-2) (5) (1) (0) (0) (0.1)
(2): Entity dimension, 2-D. it's a face. (27): Face tag (1): Size type on entity. 1 for absolute mesh size (1): Attribute type on entity. 1 for entity with boundary layers. (0): Boundary layer orientation (FaceSide/useDir) (2): For Layers with linearly varying height (NumEndEnts) (0): Direction of variation (pos. x-dir.) (22): Edge tag at pos. 1 (1.e-3): First layer height at pos. 1 (2.e-2): Total height of all layers at pos. 1 (20): Edge tag at pos. 2 (2.e-3): First layer height at pos. 2 (10.e-2): Total height of all layers at pos. 2 (5): Number of layers (1): Boundary layer Mixed topology (1 for triangles and quads) (0): Boundary layer blending. 0 for no BL blending (0): Boundary Layer propagation. 0 for no propogation (0.1): mesh size on the surface (This value is in the second line)
Example 8: Global BL attributes
These can be set globally as follows. Only 1 attribute can be set at a time.
-1 7 attribute_type value
The above lines can be divided as below:
(-1) (7) (attribute_type) (value)
(-1): Entity dimension. -1 for setting global attributes (7): for setting BL global attribute (attribute_type): type of BL attribute you want to set. It can be one of the following: 1: smoothing distance 2: layer edge aspect ratio 3: exposed aspect ratio (opposite of aspect ratio, look at the documentation MS_minExposedAspectRatio for more info) 10: Global gradation rate (not for BLs) (value): value for the above attribute
Example 9: Refinement Along an Edge
For uniform refinement along an edge with tag 333
1 333 1 0 2e-4
The above lines can be divided as below:
(1) (333) (1) (0) (2e-4)
(1): Entity dimension. It's a 1-D line. (333): Entity tag (1): Size type on entity. 1 for absolute mesh size (0): Attribute type on entity. 0 just imposes the size on entity. (2e-4): Mesh size (This is in the second line)
Pitfalls
-Some versions of BLMesher will die if tabs are present in the attribute file. The error message is quite unhelpful and will look something like:
ERROR : attribute info. [attribute number : 9] - NOT compatible [model entity of dim.:0 NOT found with tag:1]