Tutorials#
These tutorials are structured as a software-demo book. Each chapter starts
from a runnable script in python/demo, states the geometry and the exact
values it is checked against, then follows the CutCells workflow used in the
code: a background mesh, level sets, cut, selections, and quadrature rules,
visualisation meshes or VTU files of the selected parts.
The figures are the PyVista views of the demos themselves, rendered off
screen; the 3D chapters add views you can turn and zoom. The demos need NumPy
only; PyVista and matplotlib draw the views and plots, and --no-plot skips
them:
pip install cutcells pyvista matplotlib
python python/demo/demo_disk.py
One Level Set#
The first three chapters show the workflow. The next four are measurements: what each choice costs and what it buys, for one level set. The last two cover what comes after the rule.
Start with Disk in a square for the whole workflow in 2D: a level set, the three parts it makes, areas, lengths and an integral of a function.
Use Convergence to compare straight pieces, curved pieces of an interpolated level set, and exact geometry under refinement.
Move to 3D with Ball in a tetrahedral mesh: exact and interpolated level sets, curved Lagrange output.
Degree and order turns the two dials separately: which error each one controls, and what a higher degree costs.
Cell shapes cuts one ball on triangles, quadrilaterals, tetrahedra, hexahedra, prisms and pyramids, with both backends.
Points and accuracy compares lookup tables, quadrays and Algoim by the error they reach for a number of points.
Compression reduces a rule to the moments you need, and measures when that pays and what it gives up.
Integrating functions uses a rule on an ellipsoid: physical points, moments, normals and the divergence theorem.
Plane on mesh facets covers surfaces that lie on the mesh, integrated once, and the cells that take them.
Several Level Sets#
Several level sets per cell are under active development: expect their rules and costs to change more than those of a single level set.
Ball and plane selects volumes, surfaces and curves with conditions on two level sets.
Napkin ring gives a shape with sharp edges as a level set made of level sets.
Gyroid cuts a triply periodic minimal surface on hexahedra, and selects a sheet between two level sets.