⚡ 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

CPU · Iterative
Conjugate Gradient
Preconditioned CG method. Scales well to large models. Runs in a Web Worker — UI stays fully responsive during solve.
Browser Desktop Non-blocking
CPU · Direct
Cholesky
Direct sparse Cholesky factorization. Exact solution, no convergence tolerance needed. Best for small models (<5k nodes).
Browser Desktop Small models
GPU · Browser
WebGPU
Preconditioned CG on the GPU using WGSL compute shaders. Uses double-single f64 emulation via vec2<f32> for ~48-bit precision. Runs in 500-iteration batches.
WebGPU Chrome / Edge GPU Accelerated
GPU · Desktop
wgpu Native
Same WGSL shaders as WebGPU, but running via the native wgpu library on Vulkan (Windows/Linux), Metal (macOS), or DirectX 12 (Windows).
wgpu Tauri Desktop Vulkan / Metal / DX12

Auto-Detection

By default, ThermX selects the best available solver automatically:

  1. WebGPU (browser) or wgpu native (desktop) — if a compatible GPU is available
  2. Conjugate Gradient (CPU) — fallback if no GPU is available or WebGPU is not supported
  3. 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 availability

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

ParameterDefaultDescription
Max iterations10,000CG iteration limit (GPU: runs in 500-iter batches)
Convergence tolerance1e-8Relative residual norm for CG convergence
Solver selectionAutoAuto / CG / Cholesky / WebGPU / wgpu

Solve Progress

During a solve, the Solver panel shows:

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:

Tip

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.