---
title: "ElementMeshRegionProduct"
language: "en"
type: "Symbol"
summary: "ElementMeshRegionProduct[mesh1, mesh2] represents the Cartesian product of the ElementMesh mesh1 and mesh2."
keywords: 
- extrude
canonical_url: "https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMeshRegionProduct.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Finite Element Method"
    link: "https://reference.wolfram.com/language/FEMDocumentation/guide/FiniteElementMethodGuide.en.md"
related_functions: 
  - 
    title: "ElementMesh"
    link: "https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMesh.en.md"
  - 
    title: "ToElementMesh"
    link: "https://reference.wolfram.com/language/FEMDocumentation/ref/ToElementMesh.en.md"
  - 
    title: "ToBoundaryMesh"
    link: "https://reference.wolfram.com/language/FEMDocumentation/ref/ToBoundaryMesh.en.md"
  - 
    title: "ToGradedMesh"
    link: "https://reference.wolfram.com/language/FEMDocumentation/ref/ToGradedMesh.en.md"
  - 
    title: "ElementMeshProjection"
    link: "https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMeshProjection.en.md"
related_tutorials: 
  - 
    title: "Element Mesh Generation"
    link: "https://reference.wolfram.com/language/FEMDocumentation/tutorial/ElementMeshCreation.en.md"
  - 
    title: "Element Mesh Visualization"
    link: "https://reference.wolfram.com/language/FEMDocumentation/tutorial/ElementMeshVisualization.en.md"
---
## NDSolve\`FEM\`

# ElementMeshRegionProduct

ElementMeshRegionProduct[mesh1, mesh2] represents the Cartesian product of the ElementMesh mesh1 and mesh2.

## Details and Options

* ``ElementMeshRegionProduct`` is also known as outer product region or region extrusion.

* ``ElementMeshRegionProduct[mesh1, mesh2]`` represents the region $\left\{\{p,q\}\left|p\in \text{\textit{mesh}}_1\land q\in \text{\textit{mesh}}_2\right.\right\}$.

[image]

* The embedding dimension of the product region is the sum of embedding dimensions, and the geometric dimension is the sum of geometric dimensions.

* The highest product dimension supported is 3.

* ``ElementMeshRegionProduct`` has the same options as ``ToElementMesh``, with the following additions and changes:

"RegionMarkerFunction" 	[`None`](https://reference.wolfram.com/language/ref/None.en.md)	specify region markers

---

## Examples (7)

### Basic Examples (2)

Load the package:

```wl
In[1]:= Needs["NDSolve`FEM`"]
```

Create an ``ElementMesh`` :

```wl
In[2]:= mesh = ToElementMesh[Line[{{0}, {1}}]]

Out[2]= ElementMesh[{{0., 1.}}, {LineElement[<20>]}]
```

Compute the ``ElementMesh`` region product:

```wl
In[3]:= productMesh = ElementMeshRegionProduct[mesh, mesh]

Out[3]= ElementMesh[{{0., 1.}, {0., 1.}}, {QuadElement[<400>]}]
```

Visualize the region product mesh:

```wl
In[4]:= productMesh["Wireframe"]

Out[4]= [image]
```

---

Create three ``ElementMesh`` instances:

```wl
In[1]:=
meshX = ToElementMesh[Line[{{0}, {2}}]];
meshY = ToElementMesh[Line[{{0}, {1}}]];
meshZ = ToElementMesh[Line[{{0}, {3}}]];
```

Compute the ``ElementMesh`` region product:

```wl
In[2]:= productMesh = ElementMeshRegionProduct[meshX, meshY, meshZ]

Out[2]= ElementMesh[{{0., 2.}, {0., 1.}, {0., 3.}}, {HexahedronElement[<8000>]}]
```

Visualize the region product mesh:

```wl
In[3]:= productMesh["Wireframe"]

Out[3]= [image]
```

### Scope (1)

Create two ``ElementMesh`` instances:

```wl
In[1]:=
meshXY = ToElementMesh[Disk[], MaxCellMeasure -> 0.1];
meshZ = ToElementMesh[Line[{{0}, {3}}]];
```

Extrude the first ``ElementMesh`` with the second by forming a region product:

```wl
In[2]:= productMesh = ElementMeshRegionProduct[meshXY, meshZ]

Out[2]= ElementMesh[{{-1., 1.}, {-1., 1.}, {0., 3.}}, {PrismElement[<3040>]}]
```

Visualize the region product mesh:

```wl
In[3]:= productMesh["Wireframe"]

Out[3]= [image]
```

### Options (2)

#### "RegionMarkerFunction" (2)

Create a marker association and a region member function:

```wl
In[1]:=
regs = <|"solid" -> 10, "fluid" -> 20|>;
rmf = RegionMember[Rectangle[{1.2, 0}, {1.8, 3}]];
```

Define a region marker function:

```wl
In[2]:= myRegionMarkerFunction = With[{rmf = rmf, rs = regs["solid"], rf = regs["fluid"]}, If[rmf[#], rs, rf]&];
```

Create ``ElementMesh`` that is used in each direction:

```wl
In[3]:= mesh = ToElementMesh[Line[{{0.}, {3.}}]];
```

Compute the ``ElementMesh`` region product:

```wl
In[4]:= mesh = ElementMeshRegionProduct[mesh, mesh, "RegionMarkerFunction" -> myRegionMarkerFunction]

Out[4]= ElementMesh[{{0., 3.}, {0., 3.}}, {QuadElement[<400>]}]
```

Inspect the ``"MeshElementMarkerUnion"`` of the generated mesh:

```wl
In[5]:= mesh["MeshElementMarkerUnion"]

Out[5]= {10, 20}
```

Visualize the region product mesh with the region markers:

```wl
In[6]:= Show[mesh["Wireframe"["MeshElementStyle" -> {Directive[FaceForm[Red]], Directive[FaceForm[Green]]}]], AspectRatio -> 1]

Out[6]= [image]
```

---

Create a marker association and a region member function:

```wl
In[1]:=
regs = <|"left" -> 1, "central" -> 3, "right" -> 2|>;
rLeft = RegionMember[Cuboid[{0, 0, 0}, {0.8, 2, 2}]];
rCentral = RegionMember[Cuboid[{0.8, 0, 0}, {1.2, 2, 2}]];
rRight = RegionMember[Cuboid[{1.2, 0, 0}, {2, 2, 2}]];
```

Define a region marker function:

```wl
In[2]:= myRegionMarkerFunction = With[{rmf = rmf, rl = regs["left"], rc = regs["central"], rr = regs["right"]}, If[rLeft[#], rl, If[rCentral[#], rc, rr]]&];
```

Create ``ElementMesh`` that is used in each direction:

```wl
In[3]:= mesh = ToElementMesh[Line[{{0.}, {2.}}]];
```

Compute the ``ElementMesh`` region product:

```wl
In[4]:= mesh = ElementMeshRegionProduct[mesh, mesh, mesh, "RegionMarkerFunction" -> myRegionMarkerFunction]

Out[4]= ElementMesh[{{0., 2.}, {0., 2.}, {0., 2.}}, {HexahedronElement[<8000>]}]
```

Inspect the ``"MeshElementMarkerUnion"`` of the generated mesh:

```wl
In[5]:= mesh["MeshElementMarkerUnion"]

Out[5]= {1, 2, 3}
```

Visualize the region product mesh with the region markers:

```wl
In[6]:=
Show[Map[mesh["Wireframe"[ElementMarker == #[[1]], "MeshElement" -> "MeshElements", "ElementMeshDirective" -> Directive[EdgeForm[], FaceForm[#[[2]]]]]]&, {{1, Green}, {2, Orange}, {3, Red}}]
	, PlotRange -> {All, {1, 2}, All}]

Out[6]= [image]
```

### Applications (2)

Create a 2D graded mesh from a product of two 1D graded meshes:

```wl
In[1]:=
mesh = ToGradedMesh[Line[{{0}, {2}}], <| "Alignment" -> "Left"|>];
productMesh = ElementMeshRegionProduct[mesh, mesh];
productMesh["Wireframe"]

Out[1]= [image]
```

---

Create a 1D graded mesh with a ``"Central"`` point distribution:

```wl
In[1]:= meshX = ToGradedMesh[Line[{{0}, {2}}], <|"Alignment" -> "Central"|>];
```

Create a second 1D graded mesh with a ``"Central"`` point distribution and 50 elements:

```wl
In[2]:= meshY = ToGradedMesh[Line[{{0}, {1}}], <|"Alignment" -> "Central", "ElementCount" -> 50|>];
```

Construct a region product:

```wl
In[3]:= productMesh = ElementMeshRegionProduct[meshX, meshY]

Out[3]= ElementMesh[{{0., 2.}, {0., 1.}}, {QuadElement[<1000>]}]
```

Visualize the region product of the anisotropic mesh:

```wl
In[4]:= productMesh["Wireframe"]

Out[4]= [image]
```

Create a third 1D graded mesh with a ``"BothEnds"`` point distribution, 50 elements and an endpoint distance of 1/200:

```wl
In[5]:= meshZ = ToGradedMesh[Line[{{0}, {1}}], <| "Alignment" -> "BothEnds", "ElementCount" -> 50,   "MinimalDistance" -> 1 / 200|>]

Out[5]= ElementMesh[{{0., 1.}}, {LineElement[<50>]}]
```

Create the region product:

```wl
In[6]:= productMesh = ElementMeshRegionProduct[productMesh, meshZ]

Out[6]= ElementMesh[{{0., 2.}, {0., 1.}, {0., 1.}}, {HexahedronElement[<50000>]}]
```

Visualize the 3D graded mesh:

```wl
In[7]:= productMesh["Wireframe"]

Out[7]= [image]
```

## See Also

* [ElementMesh](https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMesh.en.md)
* [ToElementMesh](https://reference.wolfram.com/language/FEMDocumentation/ref/ToElementMesh.en.md)
* [ToBoundaryMesh](https://reference.wolfram.com/language/FEMDocumentation/ref/ToBoundaryMesh.en.md)
* [ToGradedMesh](https://reference.wolfram.com/language/FEMDocumentation/ref/ToGradedMesh.en.md)
* [ElementMeshProjection](https://reference.wolfram.com/language/FEMDocumentation/ref/ElementMeshProjection.en.md)

## Tech Notes

* [Element Mesh Generation](https://reference.wolfram.com/language/FEMDocumentation/tutorial/ElementMeshCreation.en.md)
* [Element Mesh Visualization](https://reference.wolfram.com/language/FEMDocumentation/tutorial/ElementMeshVisualization.en.md)

## Related Guides

* [Finite Element Method](https://reference.wolfram.com/language/FEMDocumentation/guide/FiniteElementMethodGuide.en.md)