TM_FDFD#
- class TM_FDFD(omega, geometry)[source]#
Bases:
Maxwell_FDFDFinite-difference frequency-domain solver for TM fields in 2D, with PMLs.
- Parameters:
omega (complex)
geometry (CartesianFDFDGeometry)
- All of the attributes of the parent class Maxwell_FDFD, plus
- M0#
Maxwell operator in sparse matrix format, representing the operator ∇x∇x - omega^2 I in 2D for TM fields.
- Type:
sp.csc_array
Methods Summary
get_GaaInv(A_mask[, chigrid])Compute the inverse Green's function on region A, G_{AA}^{-1}.
get_TM_Gba(A_mask, B_mask)Compute the vacuum Green's function G_{BA}.
get_TM_dipole_field(cx, cy[, chigrid])Get the field of a TM dipole source at position (cx, cy).
get_TM_field(sourcegrid[, chigrid])Get the field of a TM source at positions in sourcegrid.
Methods Documentation
- get_GaaInv(A_mask, chigrid=None)[source]#
Compute the inverse Green’s function on region A, G_{AA}^{-1}.
Utilizes the Woodbury identity to perform inversion. We partition the full Maxwell operator M into blocks corresponding to region A (design) and its complement B (background):
- M = [[A, B],
[C, D]]
Then G_{AA}^{-1} = D - C A^{-1} B, up to a multiplicative constant MU_0 / k^2.
- Parameters:
A_mask (np.ndarray of bool, shape (Nx, Ny)) – Mask for the design region A.
chigrid (np.ndarray of complex, optional) – Material susceptibility distribution. If provided, M = M0 + diag(ω² χ).
- Returns:
GaaInv (sp.csc_array of shape (n_A, n_A)) – The inverse Green’s function on region A.
M (sp.csc_array) – The full Maxwell operator used in the computation.
- Return type:
tuple[csc_array, csc_array]
- get_TM_Gba(A_mask, B_mask)[source]#
Compute the vacuum Green’s function G_{BA}.
This function maps sources in region A to fields in region B.
This routine exploits translational symmetry by embedding two copies of the non-PML domain into a larger “big” grid. A single dipole solve at the center of the big grid produces a field map Ezfield. For each source location in the design (A_mask), we extract the corresponding window of size (nonpmlNx × nonpmlNy) and sample at the observation mask B_mask.
- Parameters:
A_mask (np.ndarray of bool, shape (Nx, Ny)) – Mask specifying the source/design region in the full grid.
B_mask (np.ndarray of bool, shape (Nx, Ny)) – Mask specifying the observation region in the full grid.
- Returns:
Gba – Green’s function matrix where each column is the field at B_mask due to a unit dipole at a location in A_mask.
- Return type:
np.ndarray of complex, shape (n_B, n_A)
- get_TM_dipole_field(cx, cy, chigrid=None)[source]#
Get the field of a TM dipole source at position (cx, cy).
- Parameters:
cx (int) – x-coordinate of the dipole source.
cy (int) – y-coordinate of the dipole source.
chigrid (np.ndarray (dtype complex), optional) – spatial distribution of material susceptibility. The default is None, corresponding to vacuum.
- Returns:
Ez – Field of the dipole source at position (cx, cy).
- Return type:
np.ndarray (dtype complex)
- get_TM_field(sourcegrid, chigrid=None)[source]#
Get the field of a TM source at positions in sourcegrid.
- Parameters:
sourcegrid (np.ndarray (dtype complex)) – spatial distribution of the source.
chigrid (np.ndarray (dtype complex), optional) – spatial distribution of material susceptibility. The default is None, corresponding to vacuum.
- Returns:
Ez – Field of the dipole source.
- Return type:
np.ndarray (dtype complex)