/ concept-collection / numbl-distmesh
Sign in
concept-collection / numbl-distmesh
numbl-distmesh / README.md
61 lines · 2.3 KBPreviewCodeBlameHistoryRaw
1# DistMesh examples
3An interactive companion to
4[DistMesh](https://github.com/popersson/DistMesh) — Per-Olof Persson and
5Gilbert Strang's simple mesh generator in MATLAB. Every example from the
6DistMesh README, runnable in your browser through [numbl](https://numbl.org):
7pick a script on the left and click **Run**.
9DistMesh describes a domain by a *signed distance function* (negative inside,
10positive outside) and grows a well-shaped triangular mesh by Delaunay
11retriangulation plus force-based smoothing of the node positions.
13Each script begins with
15```matlab
16mip load --install distmesh
17```
19which fetches DistMesh on first use.
21## 2-D meshes (`distmesh2d`)
23- [`ex01_unit_circle.m`](ex01_unit_circle.m) — uniform mesh on the unit circle.
24- [`ex02_rectangle_hole.m`](ex02_rectangle_hole.m) — rectangle with a circular
25 hole, refined at the hole.
26- [`ex03_polygon.m`](ex03_polygon.m) — a polygon from its vertices.
27- [`ex04_ellipse.m`](ex04_ellipse.m) — uniform mesh on an ellipse.
28- [`ex05_square_nonuniform.m`](ex05_square_nonuniform.m) — square with point and
29 line size sources.
30- [`ex06_naca_airfoil.m`](ex06_naca_airfoil.m) — NACA0012 airfoil in a circular
31 far field.
33## Surface meshes (`distmeshsurface`)
35- [`ex07_sphere.m`](ex07_sphere.m) — uniform mesh on the unit sphere.
36- [`ex08_sphere_graded.m`](ex08_sphere_graded.m) — graded mesh on the sphere.
37- [`ex09_torus.m`](ex09_torus.m) — uniform mesh on a torus.
38- [`ex10_ellipsoid.m`](ex10_ellipsoid.m) — uniform mesh on an ellipsoid.
40## Volume meshes (`distmeshnd`)
42- [`ex11_unit_ball.m`](ex11_unit_ball.m) — uniform tetrahedral mesh filling the
43 solid 3-D unit ball, using the general N-D generator.
45## Notes
47All examples animate as the mesh relaxes; drag to rotate the surface meshes.
48The geometries use the helper distance functions `dcircle`, `drectangle`,
49`dpoly`, `dsphere`, `ddiff`, ... that ship with DistMesh.
51## Reference
53P.-O. Persson, G. Strang, *A Simple Mesh Generator in MATLAB*, SIAM Review
5446(2), 329–345, 2004.
56## How it's deployed
58On every push to `main`, the workflow in
59[`.github/workflows/deploy.yml`](.github/workflows/deploy.yml) bundles these
60files with the numbl browser IDE and publishes the result to GitHub Pages. Edit
61`numbl-project.json` to change the title or which file opens first.
moveopenescclose