emg3d.solver.multigrid(model, sfield, efield, var, **kwargs)[source]

Multigrid solver for three-dimensional electromagnetic diffusion.

Multigrid solver as presented in [Muld06], including semicoarsening and line relaxation as presented in [Muld07].

  • The electric field is stored in-place in efield.

  • The number of multigrid cycles is stored in

  • The current error (l2-norm) is stored in var.l2.

  • The reference error (l2-norm of sfield) is stored in var.l2_refe.

This function is the “heart” of the multigrid method, cycling through different grids, restricting and prolonging accordingly the grids, models, and fields.

This function is called by emg3d.solver.solve.


Input model; a emg3d.models.Model instance.


The source field; a emg3d.fields.Field instance.


The electric field; a emg3d.fields.Field instance.


A multigrid parameter instance used within emg3d.solver.multigrid.

level, new_cycmaxint, default: 0

Parameters internally used for recursion (do not use):

  • level: current coarsening level;

  • new_cycmax: new maximum of multigrid cycles, takes care of V/W/F-cycling.