9. Convert Hex Mesh to Tet
In this final step, we will convert our mesh from hexahedral to tetrahedral
elements.
Create an empty mesh object, `motet`, and copy all nodes from `MONAME`
(or, `mohex_octree`) to `motet`:
```
cmo / create / motet
copypts / motet / mohex_octree
```
Next, reset the `imt` and `itp` variables and connect the nodes into
tetrahedral elements:
```
cmo / setatt / motet / imt / 1 0 0 / 1
cmo / setatt / motet / itp / 1 0 0 / 0
connect
resetpts / itp
```
Interpolate the node and cell 'colors' over the tetrahedral mesh, using
`interpolate / voronoi` for node-to-node interpolations, and
`interpolate / map` for cell-to-cell interpolations:
```
interpolate / voronoi / motet / imt / 1 0 0 / mohex_octree / imt
interpolate / map / motet / itetclr / 1 0 0 / mohex_octree / itetclr
```
Recall in step 5 that we set `imt` and `itetclr` to the value 7 for all
nodes and elements that weren't captured by the surface-created element sets.
We can use the command `rmmat / 7` to remove all nodes and elements with
`imt` and `itetclr` values of 7:
```
rmmat / 7
rmpoint / compress
resetpts / itp
```
Check the mesh that it has all positive element volumes and no bad aspect ratios.
Use the `quality` command for a report on these mesh quantities.
```
quality
epsilonl, epsilonaspect: 1.3230281E-09 2.3158330E-27
--------------------------------------------
elements with aspect ratio < .01: 0
elements with aspect ratio b/w .01 and .02: 0
elements with aspect ratio b/w .02 and .05: 0
elements with aspect ratio b/w .05 and .1 : 0
elements with aspect ratio b/w .1 and .2 : 18
elements with aspect ratio b/w .2 and .5 : 20538
elements with aspect ratio b/w .5 and 1. : 631394
min aspect ratio = 0.1613E+00 max aspect ratio = 0.9377E+00
epsilonvol: 8.8249408E-03
---------------------------------------
element volumes b/w 0.2500E+03 and 0.8706E+03: 43109
element volumes b/w 0.8706E+03 and 0.3031E+04: 273639
element volumes b/w 0.3031E+04 and 0.1056E+05: 98379
element volumes b/w 0.1056E+05 and 0.3676E+05: 63075
element volumes b/w 0.3676E+05 and 0.1280E+06: 173748
min volume = 2.5000000E+02 max volume = 1.2800000E+05
-----------------------------------------------------------
651950 total elements evaluated.
```
Finally, write the mesh object to AVS UCD file format and signal the EOF
`finish` command:
```
dump/avs/tet_mesh.inp/motet
finish
```