15
15
PlotParams ,
16
16
plot_params_absorber ,
17
17
)
18
- from tidy3d .constants import CONDUCTIVITY , EPSILON_0 , MU_0 , PML_SIGMA
18
+ from tidy3d .constants import C_0 , CONDUCTIVITY , EPSILON_0 , MU_0 , PML_SIGMA
19
19
from tidy3d .exceptions import DataError , SetupError , ValidationError
20
20
from tidy3d .log import log
21
21
@@ -124,7 +124,62 @@ def _conductivity_only_with_float_permittivity(cls, val, values):
124
124
"simultaneously with 'permittivity'."
125
125
)
126
126
return val
127
+
127
128
129
+ class BroadbandModeABCSpec (Tidy3dBaseModel ):
130
+ """Specifies the broadband mode absorption boundary conditions. The mode propagation index is approximated by a sum of pole-residue pairs.
131
+
132
+ Example
133
+ -------
134
+ >>> broadband_mode_abc_spec = BroadbandModeABCSpec(fmin=100e12, fmax=120e12, num_freqs=3)
135
+ """
136
+
137
+ fmin : pd .PositiveFloat = pd .Field (
138
+ ...,
139
+ title = "Lower Frequency Bound" ,
140
+ description = "Lower frequency bound for the broadband mode absorption." ,
141
+ )
142
+
143
+ fmax : pd .PositiveFloat = pd .Field (
144
+ ...,
145
+ title = "Upper Frequency Bound" ,
146
+ description = "Upper frequency bound for the broadband mode absorption." ,
147
+ )
148
+
149
+ num_freqs : pd .PositiveInt = pd .Field (
150
+ 3 ,
151
+ title = "Number of Frequencies" ,
152
+ description = "Number of frequencies to use to approximate the mode propagation index. "
153
+ "The frequencies are evenly spaced between ``fmin`` and ``fmax``." ,
154
+ )
155
+
156
+ num_poles : pd .PositiveInt = pd .Field (
157
+ 1 ,
158
+ title = "Number of Poles" ,
159
+ description = "Number of poles to use to approximate the mode propagation index." ,
160
+ )
161
+
162
+ @classmethod
163
+ def from_wvl_range (cls , wvl_min : float , wvl_max : float , num_freqs : int = 3 , num_poles : int = 1 ) -> BroadbandModeABCSpec :
164
+ """Instantiate from a wavelength range.
165
+
166
+ Parameters
167
+ ----------
168
+ wvl_min : float
169
+ Minimum wavelength.
170
+ wvl_max : float
171
+ Maximum wavelength.
172
+ num_freqs : int = 3
173
+ Number of frequencies to use to approximate the mode propagation index.
174
+ num_poles : int = 1
175
+ Number of poles to use to approximate the mode propagation index.
176
+
177
+ Returns
178
+ -------
179
+ :class:`BroadbandModeABCSpec`
180
+ Broadband mode absorption boundary conditions.
181
+ """
182
+ return cls (fmin = C_0 / wvl_max , fmax = C_0 / wvl_min , num_freqs = num_freqs , num_poles = num_poles )
128
183
129
184
class ModeABCBoundary (AbstractABCBoundary ):
130
185
"""One-way wave equation absorbing boundary conditions for absorbing a waveguide mode."""
@@ -144,7 +199,7 @@ class ModeABCBoundary(AbstractABCBoundary):
144
199
"``num_modes`` in the solver will be set to ``mode_index + 1``." ,
145
200
)
146
201
147
- frequency : Optional [pd .PositiveFloat ] = pd .Field (
202
+ frequency : Optional [Union [ pd .PositiveFloat , BroadbandModeABCSpec ] ] = pd .Field (
148
203
None ,
149
204
title = "Frequency" ,
150
205
description = "Frequency at which the absorbed mode is evaluated. If ``None``, then the central frequency of the source is used." ,
0 commit comments