The actual multigrid solver routines. The computationally intensive parts, however, are in emg3d.core as numba-jitted functions.

The only relevant function, from an end-user perspective, is emg3d.solver.solve. The other functions and classes are not meant to be called directly, they are all used by the solver internally. It can, however, still be insightful to look at the documentation and code of these functions if you are interested in understanding how the multigrid solver works, the theory and its implementation.


solve(model, sfield[, sslsolver, …])

Solver for three-dimensional electromagnetic diffusion.

solve_source(model, source, frequency, **kwargs)

Return electric field for a given source and frequency.

multigrid(model, sfield, efield, var, **kwargs)

Multigrid solver for three-dimensional electromagnetic diffusion.

krylov(model, sfield, efield, var)

Krylov subspace solver for three-dimensional electromagnetic diffusion.

smoothing(model, sfield, efield, nu, lr_dir)

Reducing high-frequency error by smoothing.

restriction(model, sfield, residual, sc_dir)

Downsampling of grid, model, and fields to a coarser grid.

prolongation(efield, cefield, sc_dir)

Interpolating the electric field from coarse grid to fine grid.

residual(model, sfield, efield[, norm])

Computing the residual.


MGParameters(verb, sslsolver, bool], …)

Multigrid solver settings.

RegularGridProlongator(cx, cy, x, y)

Prolongate field from coarse to fine grid.