amat_x¶
-
emg3d.core.
amat_x
(rx, ry, rz, ex, ey, ez, eta_x, eta_y, eta_z, zeta, hx, hy, hz)[source]¶ Residual without or with source term.
Compute the residual as given in [Muld06] in middle of the right column on page 636, but without the source term:
\[\mathbf{r} = V \left( \mathrm{i}\omega\mu_0 \tilde{\sigma} \mathbf{E} - \nabla \times \mu_\mathrm{r}^{-1} \nabla \times \mathbf{E} \right) .\]The computation is carried out in a matrix-free manner; on said page 636 (or in the Theory of the manual) are the various steps laid out to discretise the different parts, for instance involved curls. This can also be understood as the left-hand-side of \(A x = b\), as given in Equation 2 in [Muld06] (here without the cell volumes V),
\[\mathrm{i}\omega\mu_0 \tilde{\sigma} \mathrm{E} - \nabla \times \zeta^{-1} \nabla \times \mathrm{E} = - \mathrm{i} \omega \mu_0 \mathrm{J_s} .\]It can therefore be used as matvec to create a LinearOperator, which can be passed to a solver.
It is assumed that ex, ey, and ez have PEC boundaries; otherwise the output will not have PEC boundaries.
The residuals are subtracted in-place from rx, ry, and rz. That means that if rx, ry, and rz contain the source field, they will contain the total residual afterwards; if they are empty fields, they will contain the negative partial residual afterwards.
Parameters: - rx, ry, rz : ndarray
Source field or pre-allocated zero residual field in x-, y-, and z-directions.
- ex, ey, ez : ndarray
Electric fields in x-, y-, and z-directions, as obtained from
emg3d.fields.Field
.- eta_x, eta_y, eta_z, zeta : ndarray
VolumeModel parameters (multiplied by volumes) as obtained from
emg3d.models.VolumeModel()
.- hx, hy, hz : ndarray
Cell widths in x-, y-, and z-directions.