gauss_seidel¶

emg3d.core.gauss_seidel(ex, ey, ez, sx, sy, sz, eta_x, eta_y, eta_z, zeta, hx, hy, hz, nu)[source]

Gauss-Seidel method.

Solves the linear equation system $$A x = b$$ iteratively using the following method:

$\mathbf{x}^{(k+1)} = L_*^{-1} \left(\mathbf{b} - U \mathbf{x}^{(k)} \right) \ ,$

where $$L_*$$ is the lower triangular component, and $$U$$ the strictly upper triangular component, $$A = L_* + U$$, with

$\begin{split}L_* = \left[ \begin{array} {cccc} a_{11} & 0 & \cdots & 0 \\ a_{21} & a_{22} & \cdots & 0 \\ \vdots & \vdots & \ddots & \vdots \\ a_{n1} & a_{n2} & \cdots & a_{nn} \end{array} \right] \ , \quad U = \left[ \begin{array} {cccc} 0 & a_{12} & \cdots & a_{1n} \\ 0 & 0 & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ 0 & 0 & \cdots & 0 \end{array} \right] \ .\end{split}$

On the coarsest grid it acts as a direct solver, whereas on the fine grid it acts as a smoother with only few iterations, defined by $$\nu$$ (nu). Odd numbers of nu use forward ordering, even numbers use backwards ordering; nu=2 is therefore one symmetric Gauss-Seidel iteration, one forward ordered iteration followed by one backward ordered iteration.

From [Muld06]: «The method proposed by [ArFW00] is chosen as a smoother. It selects one node of the grid and simultaneously solves for the six degrees of freedom on the six edges attached to the node. If node $$(x_k, y_l, z_m)$$ is selected, the six equations, $$r_{x;k\pm1/2,l,m} = 0$$, $$r_{y;k,l\pm1/2,m} = 0$$, and $$r_{z;k,l,m\pm1/2} = 0$$, are solved for $$e_{x;k\pm1/2,l,m}$$, $$e_{y;k,l\pm1/2,m}$$, and $$e_{z;k,l,m\pm1/2}$$. Here, this smoother is applied in a symmetric Gauss-Seidel fashion, following the lexicographical ordering of the nodes $$(x_k, y_l, z_m)$$, with fastest index $$k=1, \dots, N_x-1$$, intermediate index $$l=1, \dots, N_y-1$$, and slowest index $$m=1, \ldots, N_z-1$$

To actually solve the system of six equations a non-standard Cholesky factorisation is used implemented in solve. Tangential components at the boundaries are assumed to be zero (PEC boundaries).

The result is stored in the provided electric field components ex, ey, and ez.

Parameters
ex, ey, ezndarray

Electric fields in x-, y-, and z-directions (emg3d.fields.Field).

sx, sy, szndarray

Source fields in x-, y-, and z-directions (emg3d.fields.Field).

eta_x, eta_y, eta_z, zetandarray

Volume-averaged model parameters (emg3d.models.VolumeModel).

hx, hy, hzndarray

Cell widths in x-, y-, and z-directions (emg3d.meshes.TensorMesh).

nuint

Number of Gauss-Seidel iterations.