Skip to content

Commit 94e2936

Browse files
committed
changed default reference impedance to conjugate of the load, and fixed the calculation of voltage/current for lossy modes
1 parent bcf635f commit 94e2936

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2424
or `Absorber` classes (or when invoking `pml()`, `stable_pml()`, or `absorber()` functions)
2525
with fewer layers than recommended.
2626
- Warnings and error messages originating from `Structure`, `Source`, or `Monitor` classes now refer to problematic objects by their user-supplied `name` attribute, alongside their index.
27+
- Default reference impedance used for calculating power waves in the `TerminalComponentModeler`, which is now equal to the conjugate of the load impedance.
2728

2829
### Fixed
2930
- Arrow lengths are now scaled consistently in the X and Y directions, and their lengths no longer exceed the height of the plot window.
@@ -32,6 +33,7 @@ with fewer layers than recommended.
3233
- Fixed incorrect gradient computation in PyTorch plugin (`to_torch`) for functions returning multi-element arrays.
3334
- `MonitorData.get_amplitude()` no longers multiplies by a factor of `1j` and now directly returns the complex value of the data.
3435
- `EMESimulationData.port_modes_tuple` is now symmetry-expanded.
36+
- Calculation of voltage and current in the `WavePort` when one type of path integral is supplied and the transmission line mode is lossy.
3537

3638
## [2.9.0rc1] - 2025-06-10
3739

tidy3d/plugins/smatrix/component_modelers/terminal.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,14 @@ def s_to_z(
459459

460460
@cached_property
461461
def port_reference_impedances(self) -> PortDataArray:
462-
"""The reference impedance used at each port for definining power wave amplitudes."""
462+
"""The reference impedance used at each port for definining power wave amplitudes.
463+
464+
Note
465+
----
466+
By default, we choose reference impedances to be the conjugate of the load impedance.
467+
For wave ports, this corresponds with the conjugate of the characteristic impedance.
468+
This choice corresponds with Equation 4.64 - Pozar - Microwave Engineering 4ed.
469+
"""
463470
return self._port_reference_impedances(self.batch_data)
464471

465472
def _port_reference_impedances(self, batch_data: BatchData) -> PortDataArray:
@@ -486,7 +493,9 @@ def _port_reference_impedances(self, batch_data: BatchData) -> PortDataArray:
486493
# LumpedPorts have a constant reference impedance
487494
port_impedances.loc[{"port": port.name}] = np.full(len(self.freqs), port.impedance)
488495

489-
port_impedances = TerminalComponentModeler._set_port_data_array_attributes(port_impedances)
496+
port_impedances = TerminalComponentModeler._set_port_data_array_attributes(
497+
port_impedances.conj()
498+
)
490499
return port_impedances
491500

492501
@staticmethod

tidy3d/plugins/smatrix/ports/wave.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ def _mode_voltage_coefficients(self, mode_data: ModeData) -> FreqModeDataArray:
8282
"""
8383
mode_data = mode_data._isel(mode_index=[self.mode_index])
8484
if self.voltage_integral is None:
85+
flux_sign = 1 if mode_data.monitor.store_fields_direction == "+" else -1
8586
current_coeffs = self.current_integral.compute_current(mode_data)
86-
voltage_coeffs = 2 * np.abs(mode_data.flux) / np.conj(current_coeffs)
87+
voltage_coeffs = 2 * flux_sign * mode_data.complex_flux / np.conj(current_coeffs)
8788
else:
8889
voltage_coeffs = self.voltage_integral.compute_voltage(mode_data)
8990
return voltage_coeffs.squeeze()
@@ -94,8 +95,9 @@ def _mode_current_coefficients(self, mode_data: ModeData) -> FreqModeDataArray:
9495
"""
9596
mode_data = mode_data._isel(mode_index=[self.mode_index])
9697
if self.current_integral is None:
98+
flux_sign = 1 if mode_data.monitor.store_fields_direction == "+" else -1
9799
voltage_coeffs = self.voltage_integral.compute_voltage(mode_data)
98-
current_coeffs = (2 * np.abs(mode_data.flux) / voltage_coeffs).conj()
100+
current_coeffs = (2 * flux_sign * mode_data.complex_flux / voltage_coeffs).conj()
99101
else:
100102
current_coeffs = self.current_integral.compute_current(mode_data)
101103
return current_coeffs.squeeze()

0 commit comments

Comments
 (0)