Photonics_TM_FDFD#
- class Photonics_TM_FDFD(omega, geometry, chi=None, des_mask=None, ji=None, ei=None, chi_background=None, sparseQCQP=True, A0=None, s0=None, c0=0.0)[source]#
Bases:
Photonics_FDFDTM polarization FDFD photonics problem (Cartesian or Polar).
- Parameters:
omega (complex)
geometry (CartesianFDFDGeometry | PolarFDFDGeometry)
chi (complex | None)
des_mask (ndarray[tuple[int, ...], dtype[bool]] | None)
ji (ndarray[tuple[int, ...], dtype[complexfloating]] | None)
ei (ndarray[tuple[int, ...], dtype[complexfloating]] | None)
chi_background (ndarray[tuple[int, ...], dtype[complexfloating]] | None)
sparseQCQP (bool)
A0 (ndarray[tuple[int, ...], dtype[complexfloating]] | csc_array | None)
s0 (ndarray[tuple[int, ...], dtype[complexfloating]] | None)
c0 (float)
- EM_solver#
Electromagnetic field solver.
- Type:
dolphindes.maxwell.TM_FDFD| None
- QCQP#
QCQP instance for optimization.
- Ginv#
Inverse Green’s function (sparse QCQP).
- Type:
csc_array or None
- G#
Green’s function (dense QCQP).
- Type:
ndarray of complex or None
- M#
Maxwell operator.
- Type:
csc_array or None
- EM_solver#
Electromagnetic field solver.
- Type:
TM_FDFD or TM_Polar_FDFD or None
- structure_objective#
Function for structure optimization objective.
- Type:
Callable
Methods Summary
Get the inferred susceptibility from the QCQP dual solution.
Set up electromagnetic operators for the design region and background.
setup_EM_solver([geometry])Set up the FDFD electromagnetic solver with given geometry.
structure_objective_dense(dof, grad)Structural optimization objective and gradient when sparseQCQP=False.
structure_objective_sparse(dof, grad)Structural optimization objective and gradient when sparseQCQP=True.
Methods Documentation
- get_chi_inf()[source]#
Get the inferred susceptibility from the QCQP dual solution.
- Return type:
ndarray[tuple[int, …], dtype[complexfloating]]
- setup_EM_operators()[source]#
Set up electromagnetic operators for the design region and background.
Notes
This method creates the appropriate operators based on whether sparse or dense QCQP formulation is used: - For sparse QCQP: Creates Ginv (inverse Green’s function) and M operators - For dense QCQP: Creates G (Green’s function) operator
Requires self.des_mask to be defined.
- Raises:
AttributeError – If des_mask is not defined.
- Return type:
None
- setup_EM_solver(geometry=None)[source]#
Set up the FDFD electromagnetic solver with given geometry.
- Parameters:
geometry (CartesianFDFDGeometry or PolarFDFDGeometry) – Geometry specification. If None, uses self.geometry.
- Return type:
None
Notes
Creates a TM_FDFD or TM_Polar_FDFD solver instance and stores it in self.EM_solver.
- structure_objective_dense(dof, grad)[source]#
Structural optimization objective and gradient when sparseQCQP=False.
Specifications exactly the same as structure_objective_sparse.
- Parameters:
dof (ndarray of float) – Pixel-wise structure degrees of freedom.
grad (ndarray of float) – Gradient storage array.
- Returns:
obj – Design objective value.
- Return type:
float
- structure_objective_sparse(dof, grad)[source]#
Structural optimization objective and gradient when sparseQCQP=True.
Follows convention of the optimization package NLOPT: returns objective value and stores gradient with respect to objective in the input argument grad.
- Parameters:
dof (ndarray of float) – Pixel-wise structure degrees of freedom over the design region as specified by self.des_mask. dof[j] is a linear interpolation between dof[j] = 0 (self.chi_background) and dof[j] = 1 (self.chi_background + self.chi)
grad (ndarray of float) – Adjoint gradient of the design objective with respect to dof. Specify grad = [] if only the objective is needed. Otherwise, grad should be an array of the same size as dof; upon method exit grad will store the gradient.
- Returns:
obj – The design objective for the structure specified by dof.
- Return type:
float