pub fn distributed_gs_solve(
psi: &Array2<f64>,
source: &Array2<f64>,
r_axis: &[f64],
z_axis: &[f64],
dr: f64,
dz: f64,
cfg: &DistributedSolverConfig,
) -> FusionResult<DistributedSolveResult>Expand description
Distributed Grad-Shafranov solver using additive Schwarz domain decomposition with Rayon thread-parallelism.
Each Schwarz iteration:
- Splits the global Ψ into 2D tiles (with halo overlap).
- Runs
inner_sweepslocal Red-Black SOR sweeps on each tile in parallel via Rayon. - Injects tile cores back into the global array.
- Exchanges halos (serial reference — MPI-ready interface).
- Computes global residual; checks convergence.
The 5-point GS stencil: R d/dR(1/R dΨ/dR) + d²Ψ/dZ² = -μ₀ R J_φ
discretises to the same operator as fusion_math::sor::sor_step,
but applied independently on each tile with local boundary from
halo data.