Skip to content

2026.11.21 v0.3.0

Latest

Choose a tag to compare

@Shizheng-Wen Shizheng-Wen released this 21 Nov 22:46
f115e44

TensorMesh 0.3.0 adds Exodus II mesh I/O, quadrature rules of any order and per-quadrature-point data in the assemblers, and fixes several integration bugs on tetrahedra, pyramids and boundary facets. It changes numerical results in a number of places, so please read the migration notes before upgrading.

New

  • Exodus II mesh I/O. Mesh.read and Mesh.save handle .e, .exo, .ex2, .exii, .gen and .g files and keep element-block ids, node sets and side sets. Meshes carry named point_sets and side_sets, and FacetAssembler.from_mesh(boundary_mask=...) takes the name of either. A side set selects exactly its facets, interior ones included. Needs netCDF4: pip install "tensormesh-fem[exodus]". Contributed by Max Nezdyur. (#61)
  • Quadrature rules of any order. Line, triangle and tetrahedron rules beyond the tabulated ones are generated as Gauss–Jacobi conical products, and the quadrilateral, hexahedron, prism, pyramid and facet rules build on them. Contributed by Fabian Rohner. (#72)
  • Per-quadrature-point data. ElementAssembler.__call__, ElementAssembler.energy and NodeAssembler.__call__ take quadrature_data, tensors of shape [n_element, n_quadrature, ...] that reach forward by name (consistent tangents, stresses, history variables). (#70)
  • Facet normals. Facet integrands of FacetAssembler and FacetBilinearAssembler can take n, the outward unit normal at the quadrature point. (#69)
  • BlochReducer.reduce_rhs and BlochReducer.reduce_mask. (#65)
  • Examples, each with a gallery page: Helmholtz scattering with exact Dirichlet-to-Neumann boundary conditions (contributed by Yu Gao, #57, #65), phase-field fracture with AT1 / AT2 damage (#66), and J2 plasticity of a thick-walled cylinder solved by Newton's method (#71).
  • Repeated assembly reuses the cached shape gradients and JxW instead of inverting every element Jacobian again. (#68)
  • A changelog: CHANGELOG.md lists every user-visible change, with the breaking ones marked. (#76)

Fixes

  • Tetrahedron quadrature at orders 5, 6 and 7 was exact only to degrees 4, 5 and 6. (#72)
  • Pyramid elements use the conforming rational space of Bergot, Cohen & Duruflé, and the pyramid quadrature weights include the Jacobian of the collapsed-cube map. Without it every non-constant integrand on a pyramid was wrong. (#64)
  • FacetAssembler and FacetBilinearAssembler, and with them robin_operator and port_source, integrated an interior facet once from each side when all of its nodes were in the boundary mask (the diagonal of a corner cell, a chord of a curved boundary). They now select boundary facets by incidence. (#69)
  • Facet quadrature is built in the dtype of the points instead of float32, which had limited float64 boundary integrals to a relative accuracy of about 1e-7. (#69)
  • Assemblers honour new points after the geometry has been cached; before, some paths returned the result for the old coordinates. A second backward through an assembler whose points require grad no longer fails. (#68)
  • FacetAssembler runs on prism and pyramid cells. (#69)

Migration notes

  • quadrature_order is the polynomial degree the rule integrates exactly, on every shape. It used to count Gauss points per direction on lines, quadrilaterals, hexahedra and pyramids and in the height of prisms. On those shapes, and on the edge and quadrilateral facets of any cell, an order of 3 or more now selects order // 2 + 1 points per direction. To keep a rule with n points per direction, pass 2 * n - 1. Triangle and tetrahedron rules and the default order 2 are unchanged. (#73, #78)
  • Tetrahedron rules at orders 5, 6 and 7 use 15, 24 and 64 points (14, 15 and 24 before), so results and the shape of per-quadrature-point data change at these orders.
  • Results on meshes with pyramid cells change. Pyramid.get_basis_fns returns a PyramidBasisFns.
  • Boundary integrals change on meshes that have interior facets with all nodes flagged as boundary (perimeter of a 4×4 triangulated unit square: 5.414 before, 4 now). Element.get_outwards_facet_normal returns outward normals; it returned inward ones.
  • torch-sla ≥ 0.4.0 is required, also by the cudss, pyamg and gpu extras.
  • Mesh.read on an Exodus file uses the new reader instead of meshio's. It always converts to TensorMesh node ordering and ignores reorder.

Infrastructure

  • An optional CI workflow runs the CUDA tests on a simulated GPU. Contributed by Saqib Khan. (#74)

Full changelog: v0.2.1...v0.3.0