⚡ Solving
Four solver backends — from CPU to GPU — with intelligent auto-detection and non-blocking execution.
Overview
Once geometry, materials, boundary conditions, and mesh are ready, ThermX assembles and solves the FEM linear system K·T = f. ThermX offers four solver backends to handle models of all sizes, with automatic selection based on hardware availability.
Available Solvers
Auto-Detection
By default, ThermX selects the best available solver automatically:
- WebGPU (browser) or wgpu native (desktop) — if a compatible GPU is available
- Conjugate Gradient (CPU) — fallback if no GPU is available or WebGPU is not supported
- Cholesky — auto-selected for very small models regardless of GPU availability
The active solver is displayed in the Solver panel. You can override the automatic selection and force a specific solver from the dropdown.
WebGPU requires Chrome 113+ or Edge 113+. Firefox has experimental WebGPU support but it may not be enabled by default. On older browsers, ThermX automatically falls back to the CPU solver.
GPU Precision: Double-Single Emulation
GPU shaders natively operate in 32-bit float (f32), which provides only ~24 bits of mantissa precision. For FEM heat transfer, this is insufficient — small temperature differences in large models would be swallowed by rounding error.
ThermX solves this by implementing double-single (DS) arithmetic: each f64 value is represented as a pair of f32 values (vec2<f32>), giving approximately 48 bits of effective precision. This is implemented entirely in WGSL compute shaders and runs transparently on any WebGPU-capable GPU.
Solver Parameters
| Parameter | Default | Description |
|---|---|---|
| Max iterations | 10,000 | CG iteration limit (GPU: runs in 500-iter batches) |
| Convergence tolerance | 1e-8 | Relative residual norm for CG convergence |
| Solver selection | Auto | Auto / CG / Cholesky / WebGPU / wgpu |
Solve Progress
During a solve, the Solver panel shows:
- Current iteration count (for iterative solvers)
- Residual norm (convergence indicator) — should decrease steadily
- Elapsed time
- Active solver backend
The solve can be cancelled at any time without affecting the model. The UI remains fully responsive while solving runs in the background.
Convergence Issues
If the solver fails to converge within the iteration limit:
- Check that all regions have materials assigned
- Check that all outer edges have boundary conditions
- Verify there are no isolated disconnected regions
- Try increasing the max iterations or decreasing the convergence tolerance slightly
- Consider switching from GPU to CPU solver for debugging (CPU solver is more numerically stable)
For large or complex models, the GPU solver can be 10–50× faster than the CPU CG solver. If you have a discrete GPU, keep the Auto setting — ThermX will use it automatically.