smoothing

emg3d.solver.smoothing(grid, model, sfield, efield, nu, lr_dir)[source]

Reducing high-frequency error by smoothing.

Solves the linear equation system \(A x = b\) iteratively using the Gauss-Seidel method. This acts as smoother or, on the coarsest grid, as a direct solver.

This is a simple wrapper for the jitted computation in emg3d.core.gauss_seidel(), emg3d.core.gauss_seidel_x(), emg3d.core.gauss_seidel_y(), and emg3d.core.gauss_seidel_z() (@njit can not [yet] access class attributes). See these functions for more details and corresponding theory.

The electric fields are updated in-place.

This function is called by multigrid().

Parameters:
grid : emg3d.meshes.TensorMesh

Input grid.

model : emg3d.models.VolumeModel

Input model.

sfield : emg3d.fields.SourceField

Input source field.

efield : emg3d.fields.Field

Input electric field.

nu : int

Number of Gauss-Seidel steps; odd numbers are forward, even numbers are reversed. E.g., nu=2 is one symmetric Gauss-Seidel iteration, with a forward and a backward step.

lr_dir : int

Direction of line relaxation {0, 1, 2, 3, 4, 5, 6, 7}.