# FEM: how to choose FEM element type

I am asking myself if there is any simple option for choosing the element type for the mesh generation WITHOUT explicitly creating coordinates and then the mesh.

Minimal example: here I would like to mesh to cuboid with hexahedral elements

DiscretizeRegion[Cuboid[{0, 0, 0}, {1, 1, 1}], MaxCellMeasure -> 1/4^3]

but, well, the output is a mesh with tetrahedral elements

I have searched for an option within the commands but I have not been very succesful. Does anybody happend to know what option I have to use? Or do I really have to create the list of positions and then create the mesh? I know its not that hard, but before I begin doing that for complicated geometries I just wanted to asked. Thanks!

• consider every single example in the docs is either 3d tets or 2d triangles... Commented Mar 13, 2015 at 17:20

## 1 Answer

There is good news and bad news. So right now there is no option to make MeshRegion use Hex elements. However, you can use ElementMesh to do that:

Needs["NDSolveFEM"]
em = ToElementMesh[Cuboid[{0, 0, 0}, {1, 1, 1}],
MaxCellMeasure -> 1/4^3]

(* ElementMesh[{{0., 1.}, {0., 1.}, {0., 1.}}, {HexahedronElement[
"<" 64 ">"]}] *)

The bad news is that the conversion of the ElementMesh to a MeshRegion only works for first order element meshes.

MeshRegion[
ToElementMesh[Cuboid[{0, 0, 0}, {1, 1, 1}], MaxCellMeasure -> 1/4^3,
"MeshOrder" -> 1]]

Which may be OK, since DiscretizeRegion gives a first order mesh anyways. I filed the not converting issue as a bug.

Hex elements only work for rectangular regions. In case you decide otherwise and want to tetrahedralize such a region you could specify the "MeshElementType" option to ToElementMesh.