residual

emg3d.solver.residual(model, sfield, efield, norm=False)[source]

Computing the residual.

Returns the complete residual as given in [Muld06], page 636, middle of the right column. This is a simple wrapper for the jitted computation in emg3d.core.amat_x (consult that function for more details and corresponding theory).

This function is called by emg3d.solver.multigrid.

Parameters
modelVolumeModel

Input model; a emg3d.models.Model instance.

sfieldField

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

efieldField

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

normbool, default: False

If True, the error (l2-norm) of the residual is returned, not the residual.

Returns
residualField, returned if norm=False

The residual field; emg3d.fields.Field instance.

normfloat, returned if norm=True

The error (l2-norm) of the residual.