Generating a Finite Element Mesh from Level-set Data

 

This documentation will describe how to generate a finite element mesh from an Exodus file that contains level-set data defined as nodal variables.  This process was developed to support mesh generation for geometric designs resulting from Adaptive Topological Optimization (ATO).  The output format from ATO in this case is an Exodus file containing a tetrahedral mesh with a scalar nodal variable defining a level-set that represents the bounding surfaces of the optimized volume.  The process below extracts the bounding surfaces of the optimized volume by evaluating the level-set at a value of zero.  These bounding surfaces are in the form of a triangulation that can then be used for generating a finite element mesh.  Three methods for generating the finite element mesh will be described using a simple example model. 

 

Hex Mesh Generation Using Sculpt

 

This section will describe the process for generating a sculpted hex mesh of the ATO design.

 

1.     This process utilizes beta capabilities in Cubit so activate the use of beta commands.

 

set dev on

 

2.     Import the ATO Exodus file called small_bracket.exo into Cubit and use the import option that tells Cubit to import the level-set nodal variable called “LSD” (level set data).

 

import mesh “small_bracket.exonodal_var “LSD” no_geom

 

3.     Extract the boundary surface triangulations from the level-set data.  Because this creates triangles we use a variation of the “create tri …” command.  We will use the “iso” option telling the command to generate the iso-surfaces from the level-set data defined by the nodal variable “LSD”.  We will specify the tets to consider when doing the extraction.  In this case we use “tet all” meaning all of the tets in the model.  When this command is complete there will be two new blocks defined in Cubit.  They will be the two blocks with the highest IDs.  One of these blocks (the larger of the two block IDs) contains triangles that represent the optimized portions of the design and the other block (the smaller of the two block IDs) contains triangles on the fixed portions of the design.

 

create tri iso tet all nodal_var “LSD”

 

4.     Look at the extracted iso-surface triangulations by drawing the two new blocks (blocks 3 & 4) created in step 2. 

 

draw block 3 4

 

5.     At this point we could smooth the new triangulations if desired but because the sculpting process will have the same effect we will skip that step here.  The smoothing will be demonstrated in the next sections.  We will now export the new blocks to an STL file that can then be used by the sculpt algorithm.  Specify only the triangles in the new blocks.  Also specify the “mesh free_mesh” options to tell the command that the triangles are not owned by geometry.

 

export stlsmall_bracket.stl” tri in block 3 4 mesh free_mesh

 

6.     Exit Cubit and start a Linux command prompt from which to run sculpt.

7.     From the command prompt load the sierra module (this will be used later).

 

module load sierra

 

8.     From the directory where your new stl file is launch the sculpt program.  See the sculpt documentation for more details on the options for running sculpt.  Here is an example of a simple sculpt command that specifies the sculpt cell size and the number of processors.  The number or processors is 8 and the cell size is 0.0007.

 

sculpt –j 8 –cs 0.1 --stl_filesmall_bracket.stl

 

9.     When sculpt finishes the resulting mesh will be spread across 8 files in our case since we used 8 processors.  In our example the files will be named something like “small_bracket.stl_results.e.8.0” where the last number in the filename refers to which processor the file came from.  To concatenate all of the files into one use the “epu” command from the Sierra suite of tools.

 

epu –auto small_bracket.stl_results.e.8.0

 

10. Start Cubit up and load the mesh file created by sculpt.

 

import mesh “small_bracket.stl_results.eno_geom

 

Tet Mesh Generation by Remeshing Mesh Based Geometry (MBG)

 

This section will describe the process for generating a tet mesh by meshing a mesh based geometry (MBG) representation of the optimized part.

 

1.     This process utilizes beta capabilities in Cubit so activate the use of beta commands.

 

set dev on

 

2.     Import the ATO Exodus file called small_bracket.exo into Cubit and use the import option that tells Cubit to import the level-set nodal variable called “LSD” (level set data).

 

import mesh “small_bracket.exonodal_var “LSD” no_geom

 

3.     Extract the boundary surface triangulations from the level-set data.  Because this creates triangles we use a variation of the “create tri …” command.  We will use the “iso” option telling the command to generate the iso-surfaces from the level-set data defined by the nodal variable “LSD”.  We will specify the tets to consider when doing the extraction.  In this case we use “tet all” meaning all of the tets in the model.  When this command is complete there will be two new blocks defined in Cubit.  They will be the two blocks with the highest IDs.  One of these blocks (the larger of the two block IDs) contains triangles that represent the optimized portions of the design and the other block (the smaller of the two block IDs) contains triangles on the fixed portions of the design.

 

create tri iso tet all nodal_var “LSD”

 

4.     Look at the extracted iso-surface triangulations by drawing the two new blocks (blocks 3 & 4) created in step 2. 

 

draw block 3 4

 

5.     Export the new blocks to an Exodus file so that they are disconnected from the original tet mesh.

 

export mesh “small_bracket_iso.e” block 3 4

 

6.     Reset Cubit.

 

reset

 

7.     Load the new file that just contains the new blocks.

 

import mesh “small_bracket_iso.eno_geom

 

8.     Smooth the optimized part of the triangulation.  This will be the triangles in the block with the larger id (4 in our case).  We will do this by first fixing the node positions of all of the nodes in the non-optimized part of the triangulation and then smoothing the triangles in the optimized portion.  When smoothing we need to use the “target free mesh” option to tell the command to project the smoothed results back to the original triangulation to try to preserve volume.  We use the “iteration” option to limit the number of iterations the smoother does.

 

node in tri in block 3 position fixed

smooth tri in block 4 target free mesh iteration 5

 

9.     Create mesh based geometry from the triangulation.  For small models this can be done immediately with the commands below (first command creates surfaces and the second command stitches them together to form a closed volume).  For larger models it may be faster to export the mesh to a file, reset Cubit, and then re-import the mesh with the “geom” option on so that mesh based geometry is generated on import.  Current limitations in Cubit result in this performance difference.

 

create mesh geom tri all

create vol surf all

 

10. Set the size and scheme on the new volume and mesh it.

 

volume all size .5

volume all scheme tetmesh

mesh volume all

 

Tet Mesh Generation Using Level-set Triangulation  

 

This section will describe the process for generating a tet mesh using the triangulation from the level-set extraction.

 

1.     This process utilizes beta capabilities in Cubit so activate the use of beta commands.

 

set dev on

 

2.     Import the ATO Exodus file called small_bracket.exo into Cubit and use the import option that tells Cubit to import the level-set nodal variable called “LSD” (level set data).

 

import mesh “small_bracket.exonodal_var “LSD” no_geom

 

3.     Extract the boundary surface triangulations from the level-set data.  Because this creates triangles we use a variation of the “create tri …” command.  We will use the “iso” option telling the command to generate the iso-surfaces from the level-set data defined by the nodal variable “LSD”.  We will specify the tets to consider when doing the extraction.  In this case we use “tet all” meaning all of the tets in the model.  When this command is complete there will be two new blocks defined in Cubit.  They will be the two blocks with the highest IDs.  One of these blocks (the larger of the two block IDs) contains triangles that represent the optimized portions of the design and the other block (the smaller of the two block IDs) contains triangles on the fixed portions of the design.

 

create tri iso tet all nodal_var “LSD”

 

4.     Look at the extracted iso-surface triangulations by drawing the two new blocks (blocks 3 & 4) created in step 2. 

 

draw block 3 4

 

5.     Export the new blocks to an Exodus file so that they are disconnected from the original tet mesh.

 

export mesh “small_bracket_iso.e” block 3 4

 

6.     Reset Cubit.

 

reset

 

7.     Load the new file that just contains the new blocks.

 

import mesh “small_bracket_iso.eno_geom

 

8.     Smooth the optimized part of the triangulation.  This will be the triangles in the block with the larger id (4 in our case).  We will do this by first fixing the node positions of all of the nodes in the non-optimized part of the triangulation and then smoothing the triangles in the optimized portion.  When smoothing we need to use the “target free mesh” option to tell the command to project the smoothed results back to the original triangulation to try to preserve volume.  We use the “iteration” option to limit the number of iterations the smoother does.

 

node in tri in block 3 position fixed

smooth tri in block 4 target free mesh iteration 5

 

9.     Sometimes we will also want to smooth the edges on the “curves” in-between the optimized and non-optimized regions.  To do this we will first “un-fix” the node positions we fixed in the previous step.  Then we will create a group with all of the edges in the optimized region and a group with all of the edges in the non-optimized region.  Then we will intersect these two groups to get the edges that are in-between these two regions.  Then we can smooth those edges.  Finally, we will smooth the surfaces in the optimized region again.  You may also wish to smooth the tris in the non-optimized region but this will require some more sophistication in fixing node positions so as not to lose sharp features in the model.  This example shows one specific smoothing sequence.  You may prefer other approaches.

 

node in tri in block 3 position free

group opt_edges” add edge in tri in block 4

group non_opt_edges” add edge in tri in block 3

group int_edges” intersect opt_edges with non_opt_edges

smooth edge in int_edges target free mesh

node in edge in int_edges position fixed

smooth tri in block 4 target free mesh iteration 5

 

10. Once we get a decent surface triangle mesh we can tet mesh the interior.

 

tetmesh  tri all