tidy3d.ModeSpec#
- class ModeSpec[source]#
Bases:
Tidy3dBaseModelStores specifications for the mode solver to find an electromagntic mode.
- Parameters:
attrs (dict = {}) – Dictionary storing arbitrary metadata for a Tidy3D object. This dictionary can be freely used by the user for storing data without affecting the operation of Tidy3D as it is not used internally. Note that, unlike regular Tidy3D fields,
attrsare mutable. For example, the following is allowed for setting anattrobj.attrs['foo'] = bar. Also note that Tidy3D` will raise aTypeErrorifattrscontain objects that can not be serialized. One can check ifattrsare serializable by callingobj.json().num_modes (PositiveInt = 1) – Number of modes returned by mode solver.
target_neff (Optional[PositiveFloat] = None) – Guess for effective index of the mode.
num_pml (Tuple[NonNegativeInt, NonNegativeInt] = (0, 0)) – Number of standard pml layers to add in the two tangential axes.
filter_pol (Optional[Literal['te', 'tm']] = None) – The solver always computes the
num_modesmodes closest to the giventarget_neff. Iffilter_pol==None, they are simply sorted in order of decreasing effective index. If a polarization filter is selected, the modes are rearranged such that the firstn_polmodes in the list are the ones with the selected polarization fraction larger than or equal to 0.5, while the nextnum_modes - n_polmodes are the ones where it is smaller than 0.5 (i.e. the opposite polarization fraction is larger than 0.5). Within each polarization subset, the modes are still ordered by decreasing effective index.te-fraction is defined as the integrated intensity of the E-field component parallel to the first plane axis, normalized to the total in-plane E-field intensity. Conversely,tm-fraction uses the E field component parallel to the second plane axis.angle_theta (float = 0.0) – [units = rad]. Polar angle of the propagation axis from the injection axis.
angle_phi (float = 0.0) – [units = rad]. Azimuth angle of the propagation axis in the plane orthogonal to the injection axis.
precision (Literal['auto', 'single', 'double'] = double) – The solver will be faster and using less memory under single precision, but more accurate under double precision. Choose
'auto'to apply double precision if the simulation contains a good conductor, single precision otherwise.bend_radius (Optional[float] = None) – [units = um]. A curvature radius for simulation of waveguide bends. Can be negative, in which case the mode plane center has a smaller value than the curvature center along the tangential axis perpendicular to the bend axis.
bend_axis (Optional[Literal[0, 1]] = None) – Index into the two tangential axes defining the normal to the plane in which the bend lies. This must be provided if
bend_radiusis notNone. For example, for a ring in the global xy-plane, and a mode plane in either the xz or the yz plane, thebend_axisis always 1 (the global z axis).angle_rotation (bool = False) – Defines how modes are computed when angle_theta is not zero. If ‘False’, a coordinate transformation is applied through the permittivity and permeability tensors.If ‘True’, the structures in the simulation are first rotated to compute a mode solution at a reference plane normal to the structure’s azimuthal direction. Then, the fields are rotated to align with the mode plane, using the ‘n_eff’ calculated at the reference plane. The second option can produce more accurate results, but more care must be taken, for example, in ensuring that the original mode plane intersects the correct geometries in the simulation with rotated structures. Note: currently only supported when ‘angle_phi’ is a multiple of ‘np.pi’.
track_freq (Optional[Literal['central', 'lowest', 'highest']] = central) – Parameter that turns on/off mode tracking based on their similarity. Can take values
'lowest','central', or'highest', which correspond to mode tracking based on the lowest, central, or highest frequency. IfNoneno mode tracking is performed.group_index_step (Union[PositiveFloat, bool] = False) – Control the computation of the group index alongside the effective index. If set to a positive value, it sets the fractional frequency step used in the numerical differentiation of the effective index to compute the group index. If set to True, the default of 0.005 is used.
Notes
The
angle_thetaandangle_phiparameters define the injection axis as illustrated in the figure below, with respect to the axis normal to the mode plane (xin the figure). Note thatangle_thetamust be smaller than \(\frac{pi}{2}\). To inject in the backward direction, we can still use thedirectionparameter as also shown in the figure. Similarly, the mode amplitudes computed in mode monitors are defined w.r.t. theforwardandbackwarddirections as illustrated. Note, the planar axes are found by popping the injection axis from{x,y,z}. For example, if injection axis isy, the planar axes are ordered{x,z}.
The
bend_axisis the axis normal to the plane in which the bend lies, (zin the diagram below). In the mode specification, it is defined locally for the mode plane as one of the two axes tangential to the plane. In the case of bends that lie in thexy-plane, the mode plane would be either inxzor inyz, so in both cases the correct setting isbend_axis=1, selecting the globalz. Thebend_radiusis counted from the center of the mode plane to the center of the curvature, along the tangential axis perpendicular to the bend axis. This radius can also be negative, if the center of the mode plane is smaller than the center of the bend.
Example
>>> mode_spec = ModeSpec(num_modes=3, target_neff=1.5)
See also
Attributes
Methods
angle_rotation_with_phi(val, values)Currently
angle_rotationis only supported withangle_phi % (np.pi / 2) == 0.Assign the default fractional frequency step value if not provided.
bend_axis_given(val, values)Check that
bend_axisis provided ifbend_radiusis notNonebend_radius_not_zero(val, values)Check that
bend_raidusmagnitude is not close to zero.`Ensure a reasonable group index step is used.
check_precision(values)Verify critical ModeSpec settings for group index calculation.
glancing_incidence(val)Warn if close to glancing incidence.
Inherited Common Usage
- num_modes#
- target_neff#
- num_pml#
- filter_pol#
- angle_theta#
- angle_phi#
- precision#
- bend_radius#
- bend_axis#
- angle_rotation#
- track_freq#
- group_index_step#
- classmethod bend_axis_given(val, values)[source]#
Check that
bend_axisis provided ifbend_radiusis notNone
- classmethod bend_radius_not_zero(val, values)[source]#
Check that
bend_raidusmagnitude is not close to zero.`
- classmethod assign_default_on_true(val)[source]#
Assign the default fractional frequency step value if not provided.
- classmethod check_precision(values)[source]#
Verify critical ModeSpec settings for group index calculation.
- classmethod angle_rotation_with_phi(val, values)[source]#
Currently
angle_rotationis only supported withangle_phi % (np.pi / 2) == 0.
- __hash__()#
Hash method.