restrict¶
- emg3d.core.restrict(crx, cry, crz, rx, ry, rz, wx, wy, wz, sc_dir)[source]¶
Restriction of residual from fine to coarse grid.
Corresponds to Equation 8 in [Muld06]. The equation for the x-direction, using the notation \(\{x,y,z\}\) instead of \(\{1,2,3\}\), is given by
\[\begin{split}r_{x,K+1/2,L,M}^{2h} = &\sum_{j_y=-1}^1\sum_{j_z=-1}^1 w_{L,j_y}^y w_{M,j_z}^z \\ &\times \left(r_{x,k+1/2,l+j_y,m+j_z}^h+r_{x,k+3/2,l+j_y,m+j_z}^h\right) .\end{split}\]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. The weights \(w\) are obtained from
restrict_weights
.The restrictions of
rx
,ry
, andrz
are stored directly incrx
,cry
, andcrz
.- Parameters
- crx, cry, crzndarray
Coarse grid {x,y,z}-directed residual (pre-allocated empty arrays).
- rx, ry, rzndarray
Fine grid {x,y,z}-directed residual.
- wx, wy, wz: (ndarray, ndarray, ndarray)
Tuples containing the weights (
wl
,w0
,wr
) as returned fromrestrict_weights
for the {x,y,z}-directions.- sc_dirint
Direction of semicoarsening; 0 for no semicoarsening.