Releases: camlab-ethz/TensorMesh
Release list
2026.07.22 v0.2.0
TensorMesh 0.2.0 is the mixed-assembly release: multi-field block systems become first-class, three new operator families land (Bloch-Floquet, distributed, open-domain wave), and the documentation — including the Chinese translation — is fully caught up.
Highlights
Mixed multi-field assembly (MixedElementAssembler) — #38
- Declare fields once (
Field(trial="u", test="v", order=2, components=2)), write the coupled weak form as one scalar integrand, get one blockSparseMatrix. The unchangedCondenserapplies on top. assembler.layout(BlockLayout) owns the block-DOF vocabulary: boundary masks,split/cat,prolong/restrict, coordinate predicates.- Generalized order pairs: field order is decoupled from mesh order via topological Lagrange DOF maps — Taylor-Hood P2-P1 runs directly on linear gmsh imports (no re-meshing), P3-P2 pairs and 3D P2-on-P1 tets included, all verified to machine precision.
- Space-aware load vectors via
assemble_vector(+ thefield_datachannel for Picard / time stepping on generalized fields). - The entire fluid example gallery now runs on stabilization-free Taylor-Hood: Stokes convergence study (H1/L2 rates 2.0/2.0), lid-driven cavity 2D/3D, transient cylinder flow, flow past obstacles, three-field Rayleigh-Bénard, Taylor-Green (velocity L2 rate ≈ 3, up from 2 with stabilized P1-P1).
Bloch-Floquet periodic boundary conditions (BlochReducer) — #36
Ties opposite unit-cell faces with the Floquet phase and reduces assembled operators to the master DOFs — the building block of band-structure computations. Ships with three COMSOL-validated 2D phononic-crystal examples (square/triangular lattices: mean band error 0.08% / 0.51%; slab transmission mean |ΔT| 0.007). Contributed by Nicolas Cayuela.
Distributed multi-GPU FEM (tensormesh.distributed)
DistributedMesh partitioning (RCB / spectral / METIS), the @distributed decorator that turns any existing assembler into its distributed counterpart, DSparseMatrix (a torch_sla.DSparseTensor subclass), and Condenser dispatch — end-to-end multi-GPU Poisson under torchrun with NCCL. Contributed by walkerchi.
Open-domain wave operators (PML & ports) — #39
FacetBilinearAssembler— boundary bilinear forms scattered to aSparseMatrix(Robin / impedance / radiation).cartesian_pml+AnisotropicLaplaceElementAssembler/ScaledMassElementAssembler— stretched-coordinate PML with complex tensor coefficients.robin_operator/port_source— first-order absorbing / plane-wave-port boundary matrix and load.- Four validated examples: port-driven Helmholtz resonator, PML-framed optical microdisk (whispering-gallery mode), rectangular waveguide modes, cantilever vibration modes + FRF. Contributed by Nicolas Cayuela.
Other improvements
- Drucker-Prager plasticity promoted to public API (
DruckerPragerPlasticity,FrictionalMaterialpresets) with geomechanics examples — kilickursat; Allen-Cahn convex-concave splitting example — MariusZeinhofer. - Complex-valued assembly path (complex dtypes end-to-end through assemble → condense → solve) with a validated Helmholtz example.
- torch-sla alignment: requires torch-sla ≥ 0.3.0 (six verified solver backends); the
[cupy]extra is replaced by[pyamg](pip install "tensormesh-fem[gpu]"now pulls cuDSS + PyAMG). The old cuDSS SPD-only caveat is gone — general non-symmetric systems solve at machine precision. - Fix:
MeshGen.remove_sphereno longer hangs on spheres smaller than the mesh size (#40 → #47).
Documentation
New user-guide chapters (Mixed Assembly, Distributed FEM), new gallery chapters (Phononic Crystals, Open-Domain Wave, Modal Analysis, Taylor-Hood Stokes), a rewritten fluid chapter and solver-backend matrix, refreshed figures throughout — bilingual, with the zh_CN catalogs fully translated: https://docs.tensor-mesh.com
Breaking / migration notes
tensormesh-fem[cupy]no longer exists (upstream torch-sla dropped its cupy backend); use the default CPU stack,[cudss],[pyamg], or[gpu].- torch-sla < 0.3.0 is no longer supported.
Full changelog: v0.1.1...v0.2.0
2025.05.23v0.1.1
Fix: import tensormesh no longer plants a broken gmsh LazyLoader stub in sys.modules. Resolves '_LazyModule' object has no attribute 'initialize' on Python 3.12 + gmsh 4.15 (e.g. Colab). Mesh generation and python -m tensormesh.verify_install now work.
2025.05.23v0.1.0
🎉 First public release of TensorMesh!
TensorMesh is a fast, differentiable, JIT-free finite element method (FEM) library built natively on PyTorch. Write custom weak forms in pure Python and get tensorized assembly, sparse linear algebra, boundary conditions, and time integration — on CPU or GPU, with full autograd.
Install
pip install tensormesh-fem # CPU
pip install "tensormesh-fem[gpu]" # + CUDA sparse solvers (CuPy + cuDSS)The import name stays import tensormesh. Verify with python -m tensormesh.verify_install.
Highlights
- GPU-native & differentiable — move an entire FEM workflow to GPU in one line; autograd flows through assembly and solve.
- High-performance tensorized assembly — a fully tensorized Map-Reduce algorithm (TensorGalerkin
(https://arxiv.org/abs/2602.05052)) that fuses element-wise ops into monolithic GPU kernels. - JIT-free & debugging-friendly — eager execution, no compilation overhead, no opaque traces.
- Comprehensive element & mesh support — triangle / quad / tet / hex / pyramid / prism, automated mesh generation, Gmsh & VTKHDF5
I/O. - Flexible solvers via torch-sla (https://www.torchsla.com/) — linear, nonlinear, and eigenvalue solves across SciPy / native
PyTorch / CuPy / cuDSS, CPU and GPU. - Pythonic API — if you can write PyTorch, you can write FEM.
Links
- 📖 Documentation — https://docs.tensor-mesh.com/
- 🖼️ Example gallery — https://docs.tensor-mesh.com/example_gallery/index.html
- 🏠 Homepage — https://www.tensor-mesh.com/
Citation
If you use TensorMesh in your research, please cite the TensorGalerkin paper — see the Citation section
(https://github.com/camlab-ethz/TensorMesh#citation) in the README.