Inside material-response
magpylib-material-response 0.10.2 · main at c8f97ff · 6 November 2026

Inside material-response

How a magpylib model with soft parts becomes a solved one, in each of the three solvers. solve_cells cuts the parts into cells, solve_face_charge puts a charge on their surfaces, and solve_fem hands them to NGSolve. Pick a model to light up its path, and click any box for what happens inside it and the papers it rests on.

step decision path of the selected model refused References

Models and the paths they take

Pick a model: its path lights up in the map. The chart under the map sets the validated ones against finite elements.
Showing the path of one model

The interaction matrix, block by block

T has one 3×3 block per pair of cells. The code never treats it as one matrix: it splits the cells into clusters and builds each cluster pair the cheapest exact way. Here a soft plate (a grid of 4,096 cuboids), a magnet (a grid of 1,728) and a pole piece of 1,500 tetrahedra. Click a block.

Solver Rule

Which solver does auto pick?

The same count as _auto_solver: the share of T's entries that FFT products cover. Each uniform grid covers its own block, m². Two grids of one spacing also cover their mutual blocks, 2·mₐ·m_b, once a block passes 10⁶ entries. From 10 % on, GMRES; below, the dense direct solve.

FFT share of the interaction matrix

One GMRES iteration

What the iterative solver repeats until the residual is small enough. The heavy step is the product with T; everything else is per cell or on a small Krylov basis.

References

The methods material-response builds on, and the sources of the use cases. Each box in the map names the ones it rests on. DOIs checked against Crossref on 6 November 2026.