113
113
Ax ,
114
114
Axis ,
115
115
CoordinateOptional ,
116
+ Direction ,
116
117
FreqBound ,
117
118
InterpMethod ,
118
119
PermittivityComponent ,
@@ -368,7 +369,7 @@ class AbstractYeeGridSimulation(AbstractSimulation, ABC):
368
369
absorbers : tuple [PortAbsorber , ...] = pydantic .Field (
369
370
(),
370
371
title = "Port Absorbers" ,
371
- description = "Absorbers based on the first order boundary conditions placed inside the computational domain." ,
372
+ description = "Planes with the first order absorbing boundary conditions placed inside the computational domain." ,
372
373
)
373
374
374
375
@pydantic .validator ("simulation_type" , always = True )
@@ -558,6 +559,10 @@ def plot(
558
559
Opacity of the monitors. If ``None``, uses Tidy3d default.
559
560
lumped_element_alpha : float = None
560
561
Opacity of the lumped elements. If ``None``, uses Tidy3d default.
562
+ absorber_alpha : float = None
563
+ Opacity of the port absorbers. If ``None``, uses Tidy3d default.
564
+ absorber_actual_placement : bool = False
565
+ Use the exact placement of port absorbers which take into account their ``shift`` values.
561
566
ax : matplotlib.axes._subplots.Axes = None
562
567
Matplotlib axes to plot on, if not specified, one is created.
563
568
hlim : Tuple[float, float] = None
@@ -660,6 +665,10 @@ def plot_eps(
660
665
Opacity of the monitors. If ``None``, uses Tidy3d default.
661
666
lumped_element_alpha : float = None
662
667
Opacity of the lumped elements. If ``None``, uses Tidy3d default.
668
+ absorber_alpha : float = None
669
+ Opacity of the port absorbers. If ``None``, uses Tidy3d default.
670
+ absorber_actual_placement : bool = False
671
+ Use the exact placement of port absorbers which take into account their ``shift`` values.
663
672
ax : matplotlib.axes._subplots.Axes = None
664
673
Matplotlib axes to plot on, if not specified, one is created.
665
674
hlim : Tuple[float, float] = None
@@ -2080,8 +2089,15 @@ def _invalidate_solver_cache(self) -> None:
2080
2089
"""Clear cached attributes that become stale when subpixel changes."""
2081
2090
self ._cached_properties .pop ("_mode_solver" , None )
2082
2091
2083
- def _shift_value_signed (self , obj , direction , shift ) -> float :
2084
- """How far (signed) to shift the source from the monitor."""
2092
+ def _shift_value_signed (
2093
+ self , obj : Box , direction : Direction , shift : int , name : Optional [str ] = None
2094
+ ) -> float :
2095
+ """Calculate the signed distance corresponding to moving the object by ``shift`` number
2096
+ of cells in the positive or negative ``direction`` along the dimension given by
2097
+ ``obj._normal_axis``.
2098
+ """
2099
+ if name is None :
2100
+ name = f"A '{ obj .type } '"
2085
2101
2086
2102
# get the grid boundaries and sizes along port normal from the simulation
2087
2103
normal_axis = obj ._normal_axis
@@ -2103,7 +2119,7 @@ def _shift_value_signed(self, obj, direction, shift) -> float:
2103
2119
shifted_index = port_index + signed_shift
2104
2120
if shifted_index < 0 or grid_centers [shifted_index ] <= self .bounds [0 ][normal_axis ]:
2105
2121
raise SetupError (
2106
- # f"Port {port. name} normal is less than 2 cells to the boundary "
2122
+ f" { name } normal is less than 2 cells to the boundary "
2107
2123
f"on -{ 'xyz' [normal_axis ]} side. "
2108
2124
"Please either increase the mesh resolution near the port or "
2109
2125
"move the port away from the boundary."
@@ -2117,7 +2133,7 @@ def _shift_value_signed(self, obj, direction, shift) -> float:
2117
2133
or grid_centers [shifted_index ] >= self .bounds [1 ][normal_axis ]
2118
2134
):
2119
2135
raise SetupError (
2120
- # f"Port {port. name} normal is tless than 2 cells to the boundary "
2136
+ f" { name } normal is less than 2 cells to the boundary "
2121
2137
f"on +{ 'xyz' [normal_axis ]} side."
2122
2138
"Please either increase the mesh resolution near the port or "
2123
2139
"move the port away from the boundary."
0 commit comments