# Geometry and Mesh

Unified finite element analysis workflow uses an `fegeometry`

object to define a geometry. You can simply assign
a geometry to the `Geometry`

property of `femodel`

.

Define a geometry using one of these sources:

STL or STEP file. See

`fegeometry`

and`importGeometry`

.Mesh nodes and elements. See

`fegeometry`

and`geometryFromMesh`

.Decomposed geometry matrix or a handle to a geometry function. See

`geometryFromEdges`

.Triangulation or Delaunay triangulation. See

`fegeometry`

and Geometry from polyshape.Basic volumes. See Cuboids, Cylinders, and Spheres.

`alphaShape`

object. See Geometry from alphaShape.`PDE Modeler`

app for 2-D geometries. See PDE Modeler.

The general PDE workflow, as well as the domain-specific workflows, use a
`DiscreteGeometry`

and `AnalyticGeometry`

objects.
Typically, you can define these objects using the same sources as for
`fegeometry`

.

Mesh a geometry using the `generateMesh`

function. The
toolbox uses the finite element method (FEM) to solve PDEs. For details
about meshing, see Mesh Data.

For details about the components of geometries and meshes and the relationships between them, see Geometry and Mesh Components.

## Functions

## Objects

`fegeometry` | Geometry object for finite element analysis (Since R2023a) |

`DiscreteGeometry` | Discrete 2-D or 3-D geometry description |

`AnalyticGeometry` | Analytic 2-D geometry description |

## Properties

FEMesh Properties | Mesh object |

PDEVisualization Properties | PDE visualization of mesh and nodal results (Since R2021a) |

## Apps

PDE Modeler | Create complex 2-D geometries by drawing, overlapping, and rotating basic shapes |

## Topics

### Geometry

**Geometry and Mesh Components**

Learn about the components of geometries and meshes and the relationships between them within a model object.**STL File Import**

Import a 2-D or 3-D geometry from an STL file.**STEP File Import**

Import a 3-D geometry from a STEP file.**Geometry from Triangulated Mesh**

Reconstruct a geometry from a tetrahedral mesh and from a planar multidomain mesh.**Geometry from polyshape**

Reconstruct a geometry from a triangulated mesh created by the MATLAB^{®}`polyshape`

function.**Geometry from alphaShape**

Reconstruct a geometry from a triangulated surface mesh created by the MATLAB`alphaShape`

function.**2-D Geometry Creation at Command Line**

Use constructive solid geometry (CSG) modeling approach to combine basic shapes at the command line.**Parametrized Function for 2-D Geometry Creation**

Create a 2-D geometry by using a parametrized function.**Cuboids, Cylinders, and Spheres**

Create a 3-D geometry by stacking or nesting three basic volumes.**3-D Multidomain Geometry from 2-D Geometry**

Extrude a 2-D geometry imported as an STL file into a 3-D geometry.**Multidomain Geometry Reconstructed from Mesh**

Split a single-domain block geometry into two domains.**Sphere in Cube**

Create a nested multidomain geometry consisting of a unit sphere and a cube.**Battery Module Geometry**

Create a battery module geometry consisting of nine cells, connectors at both ends, the casing, and an air gap between the cells and the casing.

### Mesh

**Mesh Data**

Recommended workflow uses`FEMesh`

objects to represent meshes.**Generate Mesh**

Adjust a mesh by using additional arguments of the`generateMesh`

function.**Find Mesh Elements and Nodes by Location**

Find mesh elements and nodes by their geometric location or proximity to a particular point or node.**Assess Quality of Mesh Elements**

Evaluate the shape quality of mesh elements.

### Legacy Mesh

**Mesh Data as [p,e,t] Triples**

Legacy workflow uses [p,e,t] triples to represent meshes.**Poisson's Equation with Point Source and Adaptive Mesh Refinement**

Solve a Poisson's equation with a delta-function point source on the unit disk using the`adaptmesh`

function.