Skip to content

Commit fbd9302

Browse files
PR comments
1 parent 2562038 commit fbd9302

File tree

11 files changed

+159
-141
lines changed

11 files changed

+159
-141
lines changed

tests/test_components/test_absorbers.py

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,25 @@
66
import pytest
77

88
import tidy3d as td
9+
from tidy3d.exceptions import SetupError
910

1011
from ..utils import AssertLogLevel
1112

1213

1314
def test_port_absorbers_alone():
14-
_ = td.PortAbsorber(direction="+", size=(1, 1, 0), boundary_spec=td.ABCBoundary(permittivity=1))
15+
_ = td.InternalAbsorber(
16+
direction="+", size=(1, 1, 0), boundary_spec=td.ABCBoundary(permittivity=1)
17+
)
1518

1619
with pytest.raises(pydantic.ValidationError):
17-
_ = td.PortAbsorber(
20+
_ = td.InternalAbsorber(
1821
direction="+", size=(1, 1, 1), boundary_spec=td.ABCBoundary(permittivity=1)
1922
)
2023

2124
with pytest.raises(pydantic.ValidationError):
22-
_ = td.PortAbsorber(direction="+", size=(1, 1, 0), boundary_spec=td.ABCBoundary())
25+
_ = td.InternalAbsorber(direction="+", size=(1, 1, 0), boundary_spec=td.ABCBoundary())
2326

24-
absorber = td.PortAbsorber(
27+
absorber = td.InternalAbsorber(
2528
direction="-",
2629
size=(1, 1, 0),
2730
boundary_spec=td.ModeABCBoundary(plane=td.Box(size=(1, 0, 1))),
@@ -52,8 +55,8 @@ def test_port_absorbers_simulations():
5255
),
5356
sources=[],
5457
run_time=1e-20,
55-
absorbers=[
56-
td.PortAbsorber(
58+
internal_absorbers=[
59+
td.InternalAbsorber(
5760
size=(0.4, 0.5, 0), direction="-", boundary_spec=td.ABCBoundary(permittivity=1)
5861
)
5962
],
@@ -68,8 +71,8 @@ def test_port_absorbers_simulations():
6871
),
6972
sources=[],
7073
run_time=1e-20,
71-
absorbers=[
72-
td.PortAbsorber(
74+
internal_absorbers=[
75+
td.InternalAbsorber(
7376
size=(0.4, 0.5, 0),
7477
direction="-",
7578
boundary_spec=td.ModeABCBoundary.from_source(mode_source),
@@ -78,7 +81,7 @@ def test_port_absorbers_simulations():
7881
)
7982

8083
# validate no fully anisotropic mediums
81-
with pytest.raises(pydantic.ValidationError):
84+
with pytest.raises(SetupError):
8285
_ = td.Simulation(
8386
center=[0, 0, 0],
8487
size=[1, 1, 1],
@@ -89,8 +92,8 @@ def test_port_absorbers_simulations():
8992
sources=[],
9093
medium=td.FullyAnisotropicMedium(permittivity=[[2, 0, 0], [0, 1, 0], [0, 0, 3]]),
9194
run_time=1e-20,
92-
absorbers=[
93-
td.PortAbsorber(
95+
internal_absorbers=[
96+
td.InternalAbsorber(
9497
size=(0.4, 0.5, 0), direction="-", boundary_spec=td.ABCBoundary(permittivity=1)
9598
)
9699
],
@@ -107,8 +110,8 @@ def test_port_absorbers_simulations():
107110
),
108111
sources=[],
109112
run_time=1e-20,
110-
absorbers=[
111-
td.PortAbsorber(
113+
internal_absorbers=[
114+
td.InternalAbsorber(
112115
size=(0.4, 0.5, 0), direction="-", boundary_spec=td.ABCBoundary(permittivity=1)
113116
)
114117
],
@@ -125,8 +128,8 @@ def test_port_absorbers_simulations():
125128
),
126129
sources=[],
127130
run_time=1e-20,
128-
absorbers=[
129-
td.PortAbsorber(
131+
internal_absorbers=[
132+
td.InternalAbsorber(
130133
size=(0.4, 0.5, 0),
131134
direction="-",
132135
boundary_spec=td.ModeABCBoundary(plane=td.Box(size=(1, 1, 0)), frequency=freq0),
@@ -143,8 +146,8 @@ def test_port_absorbers_simulations():
143146
),
144147
sources=[mode_source],
145148
run_time=1e-20,
146-
absorbers=[
147-
td.PortAbsorber(
149+
internal_absorbers=[
150+
td.InternalAbsorber(
148151
size=(0.4, 0.5, 0),
149152
direction="-",
150153
boundary_spec=td.ModeABCBoundary(plane=td.Box(size=(1, 1, 0))),
@@ -169,8 +172,8 @@ def test_port_absorbers_simulations():
169172
),
170173
],
171174
run_time=1e-20,
172-
absorbers=[
173-
td.PortAbsorber(
175+
internal_absorbers=[
176+
td.InternalAbsorber(
174177
size=(0.4, 0.5, 0),
175178
direction="-",
176179
boundary_spec=td.ModeABCBoundary(plane=td.Box(size=(1, 1, 0))),

tests/test_components/test_source_frames.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ def test_source_absorber_frames():
3232
),
3333
sources=[mode_source],
3434
run_time=1e-20,
35-
absorbers=[
36-
td.PortAbsorber(
35+
internal_absorbers=[
36+
td.InternalAbsorber(
3737
size=(0.4, 0.5, 0), direction="-", boundary_spec=td.ABCBoundary(permittivity=1)
3838
)
3939
],
4040
)
4141

42-
_ = sim.with_port_frames
42+
_ = sim._finalized
4343

4444
# added frame will collide with projection monitor which requires uniform medium
4545
bad_sim = td.Simulation(
@@ -62,11 +62,11 @@ def test_source_absorber_frames():
6262
],
6363
sources=[mode_source],
6464
run_time=1e-20,
65-
absorbers=[
66-
td.PortAbsorber(
65+
internal_absorbers=[
66+
td.InternalAbsorber(
6767
size=(0.4, 0.5, 0), direction="-", boundary_spec=td.ABCBoundary(permittivity=1)
6868
)
6969
],
7070
)
7171
with pytest.raises(pydantic.ValidationError):
72-
_ = bad_sim.with_port_frames
72+
_ = bad_sim._finalized

tidy3d/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@
114114
DefaultAbsorberParameters,
115115
DefaultPMLParameters,
116116
DefaultStablePMLParameters,
117+
InternalAbsorber,
117118
ModeABCBoundary,
118119
PECBoundary,
119120
Periodic,
120121
PMCBoundary,
121122
PMLParams,
122123
PMLTypes,
123-
PortAbsorber,
124124
StablePML,
125125
)
126126

@@ -584,6 +584,7 @@ def set_logging_level(level: str) -> None:
584584
"IndexedTimeDataArray",
585585
"IndexedVoltageDataArray",
586586
"InsulatingBC",
587+
"InternalAbsorber",
587588
"IsothermalSteadyChargeDCAnalysis",
588589
"KerrNonlinearity",
589590
"LayerRefinementSpec",
@@ -640,7 +641,6 @@ def set_logging_level(level: str) -> None:
640641
"PolarizedAveraging",
641642
"PoleResidue",
642643
"PolySlab",
643-
"PortAbsorber",
644644
"Q_e",
645645
"QuasiUniformGrid",
646646
"RLCNetwork",

tidy3d/components/boundary.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def from_monitor(
231231
)
232232

233233

234-
class PortAbsorber(Box):
234+
class InternalAbsorber(Box):
235235
"""Internally placed plane with one-way wave equation boundary conditions for absorption of electromagnetic waves."""
236236

237237
direction: Direction = pd.Field(
@@ -240,7 +240,7 @@ class PortAbsorber(Box):
240240
description="Direction in which field is absorbed.",
241241
)
242242

243-
shift: int = pd.Field(
243+
grid_shift: int = pd.Field(
244244
0,
245245
title="Absorber Shift",
246246
description="Displacement of absorber in the normal positive direction in number of cells. "

tidy3d/components/eme/simulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,9 +209,9 @@ class EMESimulation(AbstractYeeGridSimulation):
209209
"use 'smatrix_in_basis' to use another set of modes or input field.",
210210
)
211211

212-
absorbers: tuple[()] = pd.Field(
212+
internal_absorbers: tuple[()] = pd.Field(
213213
(),
214-
title="Port Absorbers",
214+
title="Internal Absorbers",
215215
description="Planes with the first order absorbing boundary conditions placed inside the computational domain.",
216216
)
217217

tidy3d/components/mode/simulation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ class ModeSimulation(AbstractYeeGridSimulation):
168168
"simulations.",
169169
)
170170

171-
absorbers: tuple[()] = pd.Field(
171+
internal_absorbers: tuple[()] = pd.Field(
172172
(),
173-
title="Port Absorbers",
173+
title="Internal Absorbers",
174174
description="Planes with the first order absorbing boundary conditions placed inside the computational domain.",
175175
)
176176

0 commit comments

Comments
 (0)