| Crates.io | math-fem |
| lib.rs | math-fem |
| version | 0.3.5 |
| created_at | 2025-12-21 13:13:00.727267+00 |
| updated_at | 2026-01-09 21:41:13.135046+00 |
| description | Multigrid FEM solver for the Helmholtz equation |
| homepage | |
| repository | https://github.com/pierreaubert/math-audio |
| max_upload_size | |
| id | 1997942 |
| size | 479,173 |
Multigrid Finite Element Method (FEM) solver for the Helmholtz equation, optimized for acoustics.
Add to your Cargo.toml:
[dependencies]
math-fem = { version = "0.3" }
HelmholtzAssembler for efficient frequency sweeps without CSR topology reconstructionuse math_audio_fem::{mesh, basis::PolynomialDegree};
use math_audio_fem::assembly::HelmholtzAssembler;
use num_complex::Complex64;
// Create a 3D mesh for a room
let mesh = mesh::box_mesh_tetrahedra(0.0, 5.0, 0.0, 4.0, 0.0, 2.5, 10, 8, 5);
// Create an efficient assembler
let assembler = HelmholtzAssembler::new(&mesh, PolynomialDegree::P1);
// Assemble system for a specific frequency (wavenumber k)
let k = Complex64::new(1.5, 0.01); // k = omega/c + i*damping
let system_matrix = assembler.assemble(k, &std::collections::HashMap::new());
A high-performance room acoustics simulator. It supports:
Documentation: Room Simulator Guide | JSON Schema
cargo run --release --bin roomsim-fem --features "cli native" -- --config room.json
Mesh generators for common domains:
use math_audio_fem::mesh::*;
// 3D box mesh with tetrahedra
let box_tet = box_mesh_tetrahedra(0.0, 1.0, 0.0, 1.0, 0.0, 1.0, 5, 5, 5);
Lagrange polynomial basis functions (P1, P2, P3).
Boundary condition handling including Robin (Impedance) conditions for acoustics.
High-performance matrix assembly:
f64 for memory efficiency.Geometric multigrid solver for large systems.
| Element | Dimension | Nodes (P1) | Nodes (P2) |
|---|---|---|---|
| Triangle | 2D | 3 | 6 |
| Quadrilateral | 2D | 4 | 9 |
| Tetrahedron | 3D | 4 | 10 |
| Hexahedron | 3D | 8 | 27 |
native (default) - Enables rayon parallelism and hardware-specific BLASparallel - Enables rayon for parallel assemblycli - Enables CLI dependencies for roomsim-femmath-solvers - Iterative solvers (GMRES, AMG, Schwarz)math-xem-common - Shared room acoustics types and configurationsndarray - N-dimensional arrays for numerical computingnum-complex - Complex number support for Helmholtz systems