diff --git a/CHANGELOG.md b/CHANGELOG.md index 397e7ada2c..f833172607 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -41,19 +41,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added `interp_spec` in `EMEModeSpec` to enable faster multi-frequency EME simulations. Note that the default is now `ModeInterpSpec.cheb(num_points=3, reduce_data=True)`; previously the computation was repeated at all frequencies. - Added `smoothed_projection` for topology optimization of completely binarized designs. - Added more RF-specific mode characteristics to `MicrowaveModeData`, including propagation constants (alpha, beta, gamma), phase/group velocities, wave impedance, and automatic mode classification with configurable polarization thresholds in `MicrowaveModeSpec`. +- Introduce `tidy3d.rf` namespace to consolidate all RF classes. ### Breaking Changes - Edge singularity correction at PEC and lossy metal edges defaults to `True`. - `angle_threshold` in `CornerFinderSpec` now defaults to `pi/4`. -**Note: These breaking changes only affect the microwave and smatrix plugins.** -- Renamed path integral classes for improved consistency. Please see our migration guide for details on updating your code. +- `WavePort` has been refactored to use `MicrowaveModeSpec`. The fields `voltage_integral`, and `current_integral` have been removed. Impedance specifications are now defined in `MicrowaveModeSpec.impedance_specs`. Please see our migration guide for details on updating your code. + +### Planned Deprecation +**Note: These changes only affect the microwave and smatrix plugins.** +- Renamed path integral classes for improved consistency. Please see our migration guide for details on updating your code. Old class naming is aliased to the new classes for 2.10. - `VoltageIntegralAxisAligned` → `AxisAlignedVoltageIntegral` - `CurrentIntegralAxisAligned` → `AxisAlignedCurrentIntegral` - `CustomPathIntegral2D` → `Custom2DPathIntegral` - `CustomVoltageIntegral2D` → `Custom2DVoltageIntegral` - `CustomCurrentIntegral2D` → `Custom2DCurrentIntegral` - Path integral and impedance calculator classes have been refactored and moved from the microwave plugin into Tidy3D components. They are now publicly exported via the top-level package `__init__.py`. -- `WavePort` has been refactored to use `MicrowaveModeSpec`. The fields `voltage_integral`, and `current_integral` have been removed. Impedance specifications are now defined in `MicrowaveModeSpec.impedance_specs`. Please see our migration guide for details on updating your code. ### Changed - Improved performance of antenna metrics calculation by utilizing cached wave amplitude calculations instead of recomputing wave amplitudes for each port excitation in the `TerminalComponentModelerData`. diff --git a/tests/rf/test_rf_import.py b/tests/rf/test_rf_import.py new file mode 100644 index 0000000000..6aeb5d2ebf --- /dev/null +++ b/tests/rf/test_rf_import.py @@ -0,0 +1,10 @@ +"""Test that the rf namespace is correctly populated.""" + +from __future__ import annotations + +import tidy3d.rf + + +def test_rf_import(): + """Test that tidy3d.rf can be imported.""" + assert tidy3d.rf is not None diff --git a/tidy3d/__init__.py b/tidy3d/__init__.py index afa81b60ff..18f7d99047 100644 --- a/tidy3d/__init__.py +++ b/tidy3d/__init__.py @@ -484,6 +484,12 @@ def set_logging_level(level: str) -> None: ClipOperation.update_forward_refs() GeometryGroup.update_forward_refs() +# Backwards compatibility: Remove 2.11 renamed integral classes +VoltageIntegralAxisAligned = AxisAlignedVoltageIntegral +CurrentIntegralAxisAligned = AxisAlignedCurrentIntegral +CustomVoltageIntegral2D = Custom2DVoltageIntegral +CustomCurrentIntegral2D = Custom2DCurrentIntegral + __all__ = [ "C_0", "DATA_TYPE_MAP", @@ -549,12 +555,14 @@ def set_logging_level(level: str) -> None: "Coords1D", "CornerFinderSpec", "CurrentBC", + "CurrentIntegralAxisAligned", # Backwards compatibility alias "Custom2DCurrentIntegral", "Custom2DCurrentIntegralSpec", "Custom2DVoltageIntegral", "Custom2DVoltageIntegralSpec", "CustomAnisotropicMedium", "CustomChargePerturbation", + "CustomCurrentIntegral2D", # Backwards compatibility alias "CustomCurrentSource", "CustomDebye", "CustomDoping", @@ -570,6 +578,7 @@ def set_logging_level(level: str) -> None: "CustomSampling", "CustomSellmeier", "CustomSourceTime", + "CustomVoltageIntegral2D", # Backwards compatibility alias "Cylinder", "DCCurrentSource", "DCVoltageSource", @@ -830,6 +839,7 @@ def set_logging_level(level: str) -> None: "VerticalNaturalConvectionCoeffModel", "VisualizationSpec", "VoltageBC", + "VoltageIntegralAxisAligned", # Backwards compatibility alias "VoltageSourceType", "VolumeMeshData", "VolumeMeshMonitor", diff --git a/tidy3d/plugins/microwave/__init__.py b/tidy3d/plugins/microwave/__init__.py index 8431c18fd3..0c9061c2e8 100644 --- a/tidy3d/plugins/microwave/__init__.py +++ b/tidy3d/plugins/microwave/__init__.py @@ -40,9 +40,14 @@ from .lobe_measurer import LobeMeasurer from .rf_material_library import rf_material_library -# Backwards compatibility +# Backwards compatibility: Remove 2.11 renamed integral classes CurrentIntegralTypes = CurrentIntegralType VoltageIntegralTypes = VoltageIntegralType +VoltageIntegralAxisAligned = AxisAlignedVoltageIntegral +CurrentIntegralAxisAligned = AxisAlignedCurrentIntegral +CustomPathIntegral2D = Custom2DPathIntegral +CustomVoltageIntegral2D = Custom2DVoltageIntegral +CustomCurrentIntegral2D = Custom2DCurrentIntegral __all__ = [ "AxisAlignedCurrentIntegral", @@ -52,10 +57,14 @@ "BlackmanWindow", "ChebWindow", "CompositeCurrentIntegral", + "CurrentIntegralAxisAligned", # Backwards compatibility alias "CurrentIntegralTypes", "Custom2DCurrentIntegral", "Custom2DPathIntegral", "Custom2DVoltageIntegral", + "CustomCurrentIntegral2D", # Backwards compatibility alias + "CustomPathIntegral2D", # Backwards compatibility alias + "CustomVoltageIntegral2D", # Backwards compatibility alias "HammingWindow", "HannWindow", "ImpedanceCalculator", @@ -65,6 +74,7 @@ "RectangularAntennaArrayCalculator", "RectangularTaper", "TaylorWindow", + "VoltageIntegralAxisAligned", # Backwards compatibility alias "VoltageIntegralTypes", "models", "path_integrals_from_lumped_element", diff --git a/tidy3d/rf.py b/tidy3d/rf.py new file mode 100644 index 0000000000..0c2b6c453c --- /dev/null +++ b/tidy3d/rf.py @@ -0,0 +1,211 @@ +from __future__ import annotations + +import warnings + +# Boundary +from tidy3d.components.boundary import InternalAbsorber + +# Directivity monitor +from tidy3d.components.data.monitor_data import DirectivityData + +# Frequency extrapolation +from tidy3d.components.frequency_extrapolation import LowFrequencySmoothingSpec + +# Grid spec +from tidy3d.components.grid.grid_spec import CornerFinderSpec, LayerRefinementSpec + +# Lumped elements +from tidy3d.components.lumped_element import ( + AdmittanceNetwork, + CoaxialLumpedResistor, + LinearLumpedElement, + LumpedResistor, + RectangularLumpedElement, + RLCNetwork, +) + +# Material +from tidy3d.components.medium import ( + HammerstadSurfaceRoughness, + HuraySurfaceRoughness, + LossyMetalMedium, + SurfaceImpedanceFitterParam, +) + +# Microwave data +from tidy3d.components.microwave.data.monitor_data import ( + AntennaMetricsData, + MicrowaveModeData, + MicrowaveModeSolverData, +) + +# Impedance calculator +from tidy3d.components.microwave.impedance_calculator import ( + CurrentIntegralType, + ImpedanceCalculator, + VoltageIntegralType, +) + +# Microwave mode spec +from tidy3d.components.microwave.mode_spec import MicrowaveModeSpec + +# Microwave monitors +from tidy3d.components.microwave.monitor import MicrowaveModeMonitor, MicrowaveModeSolverMonitor + +# Path integrals (actual integrals, not specs) +from tidy3d.components.microwave.path_integrals.integrals.auto import ( + path_integrals_from_lumped_element, +) +from tidy3d.components.microwave.path_integrals.integrals.base import ( + AxisAlignedPathIntegral, + Custom2DPathIntegral, +) +from tidy3d.components.microwave.path_integrals.integrals.current import ( + AxisAlignedCurrentIntegral, + CompositeCurrentIntegral, + Custom2DCurrentIntegral, +) +from tidy3d.components.microwave.path_integrals.integrals.voltage import ( + AxisAlignedVoltageIntegral, + Custom2DVoltageIntegral, +) + +# Path integral specs +from tidy3d.components.microwave.path_integrals.specs.current import ( + AxisAlignedCurrentIntegralSpec, + CompositeCurrentIntegralSpec, + Custom2DCurrentIntegralSpec, +) +from tidy3d.components.microwave.path_integrals.specs.impedance import ( + AutoImpedanceSpec, + CustomImpedanceSpec, +) +from tidy3d.components.microwave.path_integrals.specs.voltage import ( + AxisAlignedVoltageIntegralSpec, + Custom2DVoltageIntegralSpec, +) +from tidy3d.components.monitor import DirectivityMonitor + +# Source frame +from tidy3d.components.source.frame import PECFrame + +# Subpixel spec +from tidy3d.components.subpixel_spec import SurfaceImpedance +from tidy3d.plugins.microwave import models +from tidy3d.plugins.microwave.array_factor import ( + BlackmanHarrisWindow, + BlackmanWindow, + ChebWindow, + HammingWindow, + HannWindow, + KaiserWindow, + RadialTaper, + RectangularAntennaArrayCalculator, + RectangularTaper, + TaylorWindow, +) +from tidy3d.plugins.microwave.lobe_measurer import LobeMeasurer +from tidy3d.plugins.microwave.rf_material_library import rf_material_library +from tidy3d.plugins.smatrix.component_modelers.base import ( + AbstractComponentModeler, +) +from tidy3d.plugins.smatrix.component_modelers.terminal import ( + DirectivityMonitorSpec, + ModelerLowFrequencySmoothingSpec, + TerminalComponentModeler, +) +from tidy3d.plugins.smatrix.component_modelers.types import ComponentModelerType +from tidy3d.plugins.smatrix.data.data_array import ( + PortDataArray, + TerminalPortDataArray, +) +from tidy3d.plugins.smatrix.data.terminal import ( + MicrowaveSMatrixData, + TerminalComponentModelerData, +) +from tidy3d.plugins.smatrix.data.types import ComponentModelerDataType +from tidy3d.plugins.smatrix.ports.coaxial_lumped import CoaxialLumpedPort +from tidy3d.plugins.smatrix.ports.rectangular_lumped import LumpedPort +from tidy3d.plugins.smatrix.ports.wave import WavePort + +# Backwards compatibility +CurrentIntegralTypes = CurrentIntegralType +VoltageIntegralTypes = VoltageIntegralType +# Instantiate on plugin import till we unite with toplevel +warnings.filterwarnings( + "once", + message="ℹ️ ⚠️ RF simulations are subject to new license requirements in the future. You have instantiated at least one RF-specific component.", + category=FutureWarning, +) + + +__all__ = [ + "AbstractComponentModeler", + "AdmittanceNetwork", + "AntennaMetricsData", + "AutoImpedanceSpec", + "AxisAlignedCurrentIntegral", + "AxisAlignedCurrentIntegralSpec", + "AxisAlignedPathIntegral", + "AxisAlignedVoltageIntegral", + "AxisAlignedVoltageIntegralSpec", + "BlackmanHarrisWindow", + "BlackmanWindow", + "ChebWindow", + "CoaxialLumpedPort", + "CoaxialLumpedResistor", + "ComponentModelerDataType", + "ComponentModelerType", + "CompositeCurrentIntegral", + "CompositeCurrentIntegralSpec", + "CornerFinderSpec", + "CurrentIntegralTypes", + "Custom2DCurrentIntegral", + "Custom2DCurrentIntegralSpec", + "Custom2DPathIntegral", + "Custom2DVoltageIntegral", + "Custom2DVoltageIntegralSpec", + "CustomImpedanceSpec", + "DirectivityData", + "DirectivityMonitor", + "DirectivityMonitorSpec", + "HammerstadSurfaceRoughness", + "HammingWindow", + "HannWindow", + "HuraySurfaceRoughness", + "ImpedanceCalculator", + "InternalAbsorber", + "KaiserWindow", + "LayerRefinementSpec", + "LinearLumpedElement", + "LobeMeasurer", + "LossyMetalMedium", + "LowFrequencySmoothingSpec", + "LumpedPort", + "LumpedResistor", + "MicrowaveModeData", + "MicrowaveModeMonitor", + "MicrowaveModeSolverData", + "MicrowaveModeSolverMonitor", + "MicrowaveModeSpec", + "MicrowaveSMatrixData", + "ModelerLowFrequencySmoothingSpec", + "PECFrame", + "PortDataArray", + "RLCNetwork", + "RadialTaper", + "RectangularAntennaArrayCalculator", + "RectangularLumpedElement", + "RectangularTaper", + "SurfaceImpedance", + "SurfaceImpedanceFitterParam", + "TaylorWindow", + "TerminalComponentModeler", + "TerminalComponentModelerData", + "TerminalPortDataArray", + "VoltageIntegralTypes", + "WavePort", + "models", + "path_integrals_from_lumped_element", + "rf_material_library", +]