Back to Finite Element (MFEM)
mfem.mesh.makeCartesian2D
Creates a 2D Cartesian (rectangular) mesh.
Syntax
mfem.mesh.makeCartesian2D(nx, ny, type?, sx?, sy?)
Description
Creates a 2D Cartesian (rectangular) mesh. Generates a structured mesh on the rectangular domain [0, sx] × [0, sy] with the specified number of elements in each direction.
Parameters
| Name | Description |
|---|---|
| nx | - Number of elements in the x-direction (must be ≥ 1) |
| ny | - Number of elements in the y-direction (must be ≥ 1) |
| type(optional) | - Element type: `'quad'` for quadrilaterals (default), `'tri'` for triangles |
| sx(optional) | - Domain size in x-direction (default 1.0) |
| sy(optional) | - Domain size in y-direction (default 1.0) |
Returns
Promise<Mesh>