Skip to content

Commit

Permalink
fix: use cartesian fields in power calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
yaugenst-flex committed Aug 1, 2024
1 parent 514a6cf commit 86d7626
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions tidy3d/components/data/monitor_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2225,9 +2225,11 @@ def power(self) -> xr.DataArray:
``xarray.DataArray``
Power at points relative to the local origin.
"""
power_theta = 0.5 * np.real(self.Etheta.values * np.conj(self.Hphi.values))
power_phi = 0.5 * np.real(-self.Ephi.values * np.conj(self.Htheta.values))
power = power_theta + power_phi
fc = self.fields_cartesian
Sx = 0.5 * np.real(fc.Ey * np.conj(fc.Hz) - fc.Ez * np.conj(fc.Hy))
Sy = 0.5 * np.real(fc.Ez * np.conj(fc.Hx) - fc.Ex * np.conj(fc.Hz))
Sz = 0.5 * np.real(fc.Ex * np.conj(fc.Hy) - fc.Ey * np.conj(fc.Hx))
power = Sx + Sy + Sz

return self.make_data_array(data=power)

Expand Down

0 comments on commit 86d7626

Please sign in to comment.