MGEN Extrude
MGEN is a tool in the meshing workflow that takes a 2D source mesh and extrudes it in the third dimension based off of user input. The tool was originally created for use on structured grids on the Boeing bump, but has since been generalized for use in unstructured setups.
Basic Overview
MGEN code is stored in tm3Extrude.f
and written in FORTRAN. The code takes in a source 2D mesh, z-coordinates to extrude between, the number of elements to populate the extrusion with, and the number of partitions to write the mesh to.
Partitioning in MGEN is simply a method to reduce the cost of initial runs of Chef, but is not a replacement for the initial configuring that Chef does (via 1-1-Chef). Parting in MGEN simply allows the first run of Chef to be in parallel (i.e. 8-8-Chef). Starting Chef from parallel is most important on large grids that would take prohibitively long to run though Chef in serial.
The most current copy of the code is available at /nobackup/uncompressed/Models/GustWing/2dOTS/SymmetricRoom/Mesh/MGEN_NR
as of January 2023. This version can read in model tags, handle multiple model regions, and arbitrary domain widths.
Basic Usage
Once a suitable version of tm3Extrude.f
has been located and moved to a working directory, it first needs to be complied if this has not already been done. The FORTRAN compiler to compile tm3Extrude.f
should be the same version that was/will be used to compile the version of Chef to be used later in the meshing pipeline in order to reduce the risk of complications.
Once a compiler version is selected and added using soft add
or module load
(depending on the system), it can be compiled. As an example, if using gcc-6.3.0
on Cooley compiling would look like:
soft add +gcc-6.3.0
gfortran -03 tm3Extrude.f -o tm3Extrude
Once the code is compiled, the working directory needs to be prepared to run MGEN. MGEN needs the source 2D mesh in the form of geom.crd
and geom.cnn
files in the same directory as the compiled code. These source files can be produced from scratch with MATLAB for structured grids, or through the use of Simmetrix and the Convert tool for unstructured grids.
Once the mesh files are in place, MGEN can be run with ./tm3Extrude
as usual. The code will ask for inputs for zmin, zmax, numelz, and npart. These should be entered in a single string with spaces in between the values before hitting in order to continue code execution.
Advanced Usage
For more complex geometries, complete information about the model cannot be assumed and must instead be given to MGEN. In order to prepare for this, we will need an additional form of the mesh and to make changes to the MGEN code itself in order to tell the program where geometric features are.
A model first needs to be converted into a .dmg
file. This can be created with mdlConvert
. Example usage of this is /projects/tools/SCOREC-core/build-14-190604dev_omp110/test/mdlConvert <simmetixMesh>.xmt_txt outModel.dmg
. This captures only information about model points, edges, and faces and their relationships to each other but does not capture information about physical location.
Outputs
MGEN will write its outputs to the same working directory that the executable and source mesh files are in. There are multiple file types written, most with a suffix of a number to denote the part number of that file. The different parted files and their purposes are as follows:
- geom3D.class
- Classification file describing what type of geometric entity each point lies on (vertex, edge, face, volume)
- geom3D.cnndt
- Connectivity of the elements
- geom3D.coord
- Node coordinates
- geom3D.fathr
- Parent vertex from the 2D source mesh
- geom3D.match
- Contains periodic partners
There is also one more file:
- geom3DHead.cnn
Which lists the headers containing information on the size of the file each of the above connectivity files.
Using the outputted files
The outputted files from MGEN now need to be prepared for Chef, this is done via matchedNodeElmReader
. The provided example will be for a build on Cooley.
First, the environment needs to be prepared via setting SIM_LICENSE_FILE
and LD_LIBRARY_PATH
. Examples of this are:
export SIM_LICENSE_FILE=/eagle/PHASTA_aesp/SCOREC-CORE/deps/Simmetrix/UCBoulder
export LD_LIBRARY_PATH=/eagle/PHASTA_aesp/SCOREC-CORE/deps/16.0-220326/lib/x64_rhel_gcc48/psKrnl/:$LD_LIBRARY_PATH
From here, matchedNodeElmReader
can be run with:
mpirun -f /var/tmp/cobalt.2137783 -np <np> -genvall /eagle/PHASTA_aesp/SCOREC-CORE/build_gtvertCorruption/test/matchedNodeElmReader ../geom3D.cnndt ../geom3D.coord ../geom3D.match ../geom3D.class ../geom3D.fathr NULL ../geom3DHead.cnn outModel.dmg outModel/
Where <np> should be replaced by the same number as used for npart when running MGEN.