Repository navigation
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.readandMesh.savehandle.e,.exo,.ex2,.exii,.genand.gfiles and keep element-block ids, node sets and side sets. Meshes carry namedpoint_setsandside_sets, andFacetAssembler.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.energyandNodeAssembler.__call__takequadrature_data, tensors of shape[n_element, n_quadrature, ...]that reachforwardby name (consistent tangents, stresses, history variables). (#70) - Facet normals. Facet integrands of
FacetAssemblerandFacetBilinearAssemblercan taken, the outward unit normal at the quadrature point. (#69) BlochReducer.reduce_rhsandBlochReducer.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
JxWinstead of inverting every element Jacobian again. (#68) - A changelog:
CHANGELOG.mdlists 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)
FacetAssemblerandFacetBilinearAssembler, and with themrobin_operatorandport_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
pointsafter the geometry has been cached; before, some paths returned the result for the old coordinates. A secondbackwardthrough an assembler whose points require grad no longer fails. (#68) FacetAssemblerruns on prism and pyramid cells. (#69)
Migration notes
quadrature_orderis 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 selectsorder // 2 + 1points per direction. To keep a rule withnpoints per direction, pass2 * 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_fnsreturns aPyramidBasisFns. - 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_normalreturns outward normals; it returned inward ones. - torch-sla ≥ 0.4.0 is required, also by the
cudss,pyamgandgpuextras. Mesh.readon an Exodus file uses the new reader instead of meshio's. It always converts to TensorMesh node ordering and ignoresreorder.
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