amat_x¶
- emg3d.core.amat_x(rx, ry, rz, ex, ey, ez, eta_x, eta_y, eta_z, zeta, hx, hy, hz)[source]¶
Residual with or without 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 Background Theory of the manual) are the various steps laid out to discretize the different parts such as the 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} \mathbf{E} - \nabla \times \mu_\mathrm{r}^{-1} \nabla \times \mathbf{E} = - \mathrm{i} \omega \mu_0 \mathbf{J_\mathrm{s}} .\]It can therefore be used as a
matvec
to create aLinearOperator
, which can be passed to a solver.It is assumed that the PEC boundary condition is applied to the electric field \(\mathbf{E}\) (
ex
,ey
, andez
).The residuals are subtracted in-place from
rx
,ry
, andrz
. That means that ifrx
,ry
, andrz
contain the source field, they will contain the total residual afterwards; if they are empty fields, they will contain the negative partial residuals afterwards.- Parameters
- rx, ry, rzndarray
Source field or pre-allocated zero residual field in x-, y-, and z-directions (
emg3d.fields.Field
).- ex, ey, ezndarray
Electric 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
).