Skip to content

Commit 2d485ce

Browse files
wip
1 parent 6582824 commit 2d485ce

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

tidy3d/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
from tidy3d.components.boundary import BroadbandModeABCSpec
56
from tidy3d.components.material.multi_physics import MultiPhysicsMedium
67
from tidy3d.components.material.tcad.charge import (
78
ChargeConductorMedium,
@@ -428,6 +429,7 @@ def set_logging_level(level: str) -> None:
428429
"ABCBoundary",
429430
"Absorber",
430431
"AbsorberParams",
432+
"BroadbandModeABCSpec",
431433
"AbstractFieldProjectionData",
432434
"AbstractMedium",
433435
"AdmittanceNetwork",

tidy3d/components/boundary.py

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
PlotParams,
1616
plot_params_absorber,
1717
)
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
1919
from tidy3d.exceptions import DataError, SetupError, ValidationError
2020
from tidy3d.log import log
2121

@@ -124,7 +124,62 @@ def _conductivity_only_with_float_permittivity(cls, val, values):
124124
"simultaneously with 'permittivity'."
125125
)
126126
return val
127+
127128

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)
128183

129184
class ModeABCBoundary(AbstractABCBoundary):
130185
"""One-way wave equation absorbing boundary conditions for absorbing a waveguide mode."""
@@ -144,7 +199,7 @@ class ModeABCBoundary(AbstractABCBoundary):
144199
"``num_modes`` in the solver will be set to ``mode_index + 1``.",
145200
)
146201

147-
frequency: Optional[pd.PositiveFloat] = pd.Field(
202+
frequency: Optional[Union[pd.PositiveFloat, BroadbandModeABCSpec]] = pd.Field(
148203
None,
149204
title="Frequency",
150205
description="Frequency at which the absorbed mode is evaluated. If ``None``, then the central frequency of the source is used.",

0 commit comments

Comments
 (0)