# Cubit Mesh ## Geometry We can create the geometry directly from the brick primitive in Cubit. ## Meshing using Journal Scripts We use Cubit journal files `mesh_tet.jou` and `mesh_hex.jou` to generate tetrahedral and hexahedral meshes, respectively. Both of these journal files make use of the `geometry.jou`, and `bc.jou` files for creating the geometry and tagging boundary conditions and materials. We use the Cubit graphical user interface to play the Journal files. :::{important} We use IDless journaling in CUBIT. This allows us to reference objects in a manner that should be independent of the version of CUBIT that is being used. In the journal files, the original command used is typically commented out, and the following command is the equivalent IDless command. ::: Once you have run either the `mesh_tet.jou` or `mesh_hex.jou` journal file to construct the geometry and generate the mesh, you will have a corresponding Exodus-II file (`mesh_tet.exo` or `mesh_hex.exo`). These are NetCDF files, and they can be loaded into ParaView. This can be done by either running ParaView and loading the file, or using the script provided in the viz directory. For example, if ParaView is in your path, you can run the following command: ```{code-block} console --- caption: Start paraview and run the `viz/plot_mesh.py` Python script to view the mesh with hexahedral cells. --- paraview --script=viz/plot_mesh.py ``` :::{figure-md} fig:example:box:3d:cubit:hex Finite-element mesh with hexahedral cells generated by Cubit. Finite-element mesh with hexahedral cells generated by Cubit. ::: To load the mesh with tetrahedral cells, open the Python Shell in ParaView and set the `EXODUS_FILE` variable, and then run the `viz/plot_mesh.py` Python script. See {ref}`sec-paraview-python-scripts` for more information about running ParaView Python scripts. ```{code-block} python --- caption: Load a different Exodus file generated by Cubit by setting the `EXODUS_FILE` variable in the ParaView Python Shell. --- EXODUS_FILE = "mesh_tet.exo" ``` :::{figure-md} fig:example:box:3d:cubit:tet Finite-element mesh with tetrahedral cells generated by Cubit. Finite-element mesh with tetrahedral cells generated by Cubit. :::