emg3d.core.restrict_weights(nodes, cell_centers, h, cnodes, ccell_centers, ch)[source]#

Restriction weights for the coarse-grid correction operator.

Corresponds to Equation 9 in [Muld06]. A generalized version of that equation is given by

\[\begin{split}w_{Q,-1}^v &= \left(v_{q-1/2}^h-v_{Q-1/2}^{2h}\right)/d_{q-1}^v ,\\ w_{Q,0}^v &= 1 ,\\ w_{Q,1}^v &= \left(v_{Q+1/2}^{2h}-v_{q+1/2}^h \right)/d_{q+1}^v ,\end{split}\]

where \(d\) are the dual grid cell widths, \(v\) is one of \(\{x, y, z\}\), and \(Q, q\) the corresponding entries of \(\{K, L, M\}, \{k, l, m\}\), respectively. The superscripts \(h, 2h\) indicate quantities defined on the coarse grid and on the fine grid, respectively. The indices \(\{K, L, M\}\) on the coarse grid correspond to \(\{k, l, m\} = 2\{K, L, M\}\) on the fine grid.

For the dual volume cell widths at the boundaries the scheme of [MoSu94] is applied, where \(d_0^x = h_{1/2}^x/2\) at \(k = 0\), \(d_{N_x}^x = h_{N_x-1/2}^x\) at \(k = N_x\), and so on.

The following parameters must all be in the same direction, hence, all must be either for the x, the y, or the z direction. The returned weights are for this direction.

nodes, cnodesndarray

Cell edges of the fine (nodes) and coarse (cnodes) grids.

cell_centers, ccell_centersndarray

Cell centers of the fine (cell_centers) and coarse (ccell_centers) grids.

h, chndarray

Cell widths of the fine (h) and coarse (ch) grids.

wl, w0, wrndarray

Left, central, and right weights in the direction provided in the input.