Rust · CPU/GPU · FEM/BEM · Surrogates

Optimise multi-physics problems, fast.

Sonium is a set of libraries to quickly optimise multi-physics problems. Portable and platform-agnostic across CPU and GPU, scalable, and self-contained — with classical FEM/BEM solvers and fast surrogates covering fluids, solids, thermics, acoustics, electromagnetics, and coupled problems.

Motors / Rooms / Speakers / Fans / Propellers / Structures / Reactors

Finite-element magnetic flux density in a permanent-magnet motor cross-section
sonium-sim-motor · rotating-machine FEM · Watch the solved electrical period →

From equations to engineering

See the physics in motion.

Rotating machines, heat transfer, and free-surface flow. Explore solver output across the growing simulation collection.

Sloshing water tank (turbulent)

Fluid mechanics

Sloshing water tank (turbulent) →

Two-phase Navier-Stokes + Cahn-Hilliard with WALE LES, CSF surface tension, compressible air, subgrid bubble parcels (BDF2, adaptive dt)

What Sonium is

Reusable PDE solvers and surrogates at the core, application simulators on top, and optimisation loops around them.

Portable Platform-agnostic across CPU and GPU (CUDA, Metal), scalable from laptop to cluster, and self-contained — pure Rust, no heavy external solver stack required.
Solvers Classical FEM/BEM (Burton–Miller BEM, multi-physics FEM, iterative/direct/eigen solvers) or fast surrogates when optimisation needs thousands of evaluations.
Physics Fluid and solid mechanics, thermics, acoustics, electromagnetics, and coupled problems — rooms, loudspeakers, fans, propellers, structures, motors, and jet loop reactors.
Validation Checked against analytical solutions (Mie scattering, plane waves), cross-validated backends, and a standalone QA workspace with pass/fail gates.
Performance Benchmarked against vendor libraries (Accelerate, OpenBLAS, SuperLU, cuSOLVER, cuSPARSE) with published methodology, platform details, and workload-specific results.

Physics

The physics modules under sonium-fem, condensed from the support matrix — every row below ships with tests, examples, or QA coverage in the listed dimensions.

Acoustics Pressure (Helmholtz and wave equations, PML, ports, room acoustics), aeroacoustics (convected flow, linearised Euler/Navier–Stokes, Lighthill, FW-H), electroacoustics (transducers, Thiele–Small).
Fluid Incompressible Navier–Stokes/Stokes, compressible DG Euler/NS, turbulence (Spalart–Allmaras, k–ω SST), porous, phase-field, reacting, shallow-water, lubrication, and general transport.
Solid Linear and nonlinear elasticity, J2 plasticity (Johnson–Cook, crushable foam), shells, beams, plates, contact, fracture, composites, and eigenmodes.
Thermal Conduction and transients, participating-media radiation, and thermoelectrics.
Electromagnetics Maxwell H(curl), eddy currents, magnetostatics, electrostatics, and semiconductor transport.
Coupled Fluid–structure interaction, thermoelasticity, piezoelectricity, electrothermal, MHD, electrochemistry, batteries, and 0D lumped circuits.
Shared H1/H(div)/H(curl) elements, regional assembly, PML and impedance boundaries, BDF/explicit stepping, AMG/multigrid, adjoints with shape and topology optimisation.

Full dimension-by-dimension matrix: sonium-fem/PHYSICS.md

Start here

Three ways into the project, depending on what you want.

Showcase The range of what is possible — acoustic, fluid, and solid simulations with pictures, films, and detail pages.
Perf Results — benchmark gaps vs vendor libraries and OpenCourant, with platforms and methodology.
QA Accuracy checks — analytical references, cross-backend comparisons, and manifest-backed validation cases.

Source libraries

Explore the stack by layer, from shared utilities to application simulators. Names link to source.

Base

sonium-audioAudio DSP: IIR/FIR filters, RIR analysis, analog coloration, differentiable DSP.
sonium-fastmathVectorised sincos f32/f64 (NEON, AVX2, AVX-512, WASM SIMD, scalar fallback).
sonium-waveAnalytical wave/Helmholtz solutions — the references QA validates against.
sonium-xemShared BEM/FEM types: room geometry, galleries, JSON/XEM interchange.
sonium-materialsVersioned material records with provenance, property curves, and checked adapters.
sonium-topologyMachine topology discovery, CPU placement, and bandwidth calibration.
sonium-computeCPU/CUDA/Metal backend abstraction with strict device-memory quotas.
sonium-fftBatched complex/real FFT and STFT on top of sonium-compute.

Mesh

sonium-mesherMesh generation and partitioning for FEM/BEM.
meshlang-*MeshLang geometry compiler: AST, parser, and AST → Gmsh/Python backend.

Solvers

sonium-solversFacade over the family below; high-level solve, mixed-precision, differentiable APIs.
-coreCore traits (ComplexField, LinearOperator, Preconditioner) and dense matrices.
-sysRuntime detection, NUMA topology, lane executor.
-sparseCSR/BSR/triplet formats and SpMV plans.
-directDense LU/Cholesky, sparse LU/Cholesky, multifrontal BLR.
-iterativeGMRES family, CG, BiCGSTAB, IDR(s), MINRES, TFQMR.
-preconditionersJacobi, ILU/ILUT/HILU, AMG, Schwarz, Chebyshev, saddle-point.
-eigenLOBPCG eigensolvers and adjoint sensitivities.
-optimizationBFGS, L-BFGS(-B), Nelder-Mead, SQP/SLSQP, MMA, IPM, CMA-ES, BOBYQA.
-nonlinearNewton-Raphson variants, Anderson acceleration.
-time-integrationNewmark-β, generalized-α, explicit schemes, adjoint checkpointing.

FEM

sonium-femGeneric multi-physics FEM: acoustics, elasticity, Maxwell, thermal, fluids, and more.

BEM

sonium-bemBurton–Miller BEM with FMM acceleration for acoustic scattering.
sonium-couplingInterior/exterior FEM/BEM coupling: monolithic traces, power ledgers.

Application simulators

sonium-sim-motorPermanent-magnet motor operating points, current-angle sweeps, MTPA, thermal and rotor-stress checks.
sonium-sim-jlrSingle-phase jet loop reactor simulation with lattice Boltzmann flow, CPU/CUDA paths, and paper-reference comparisons.
sonium-sim-roomRoom measurement datagen for RoomEQ testing (FEM + low-frequency TBEM).
sonium-sim-pcfanPC-fan aeroacoustic optimisation workflow.
sonium-sim-propellersShrouded, toroidal, and serrated propeller aeroacoustics.
sonium-sim-speakerLoudspeaker BEM simulation with CEA-2034 output and optimisation.
sonium-sim-speaker-modelingElectrovibroacoustic driver, enclosure, and port-flow models.
sonium-sim-structural-mechanicsBracket-first structural workflows on Sonium FEM: statics, modes, transients, harmonic response.
sonium-surrogatesChecked POD-MLP surrogate runtime for fast optimisation loops.
sonium-roomeqRoomEQ configuration types and CEA-2034 spinorama scoring.
sonium-roomsimRoom acoustic simulator for the browser (WebAssembly), in sonium-wasm.

Tooling

sonium-benchVendor-comparison and performance harnesses.
sonium-demo-workersNative compute workers behind the interactive demo labs.
sonium-qaAccuracy validation suite — see the QA section.
sonium-pyThin Python/PyO3 façade over the Rust acoustic solvers.