You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+12-7Lines changed: 12 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,20 +27,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
27
27
- Introduced a profile-based configuration manager with TOML persistence and runtime overrides exposed via `tidy3d.config`.
28
28
- Added support of `os.PathLike` objects as paths like `pathlib.Path` alongside `str` paths in all path-related functions.
29
29
- Added configurable local simulation result caching with checksum validation, eviction limits, and per-call overrides across `web.run`, `web.load`, and job workflows.
30
+
- Added multimode support to `WavePort` in the smatrix plugin, allowing multiple modes to be analyzed per port.
31
+
32
+
### Breaking Changes
33
+
**Note: These breaking changes only affect the microwave and smatrix plugins.**
34
+
- Renamed path integral classes for improved consistency. Please see our migration guide for details on updating your code.
- 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`.
41
+
-`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.
30
42
31
43
### Changed
32
44
- Improved performance of antenna metrics calculation by utilizing cached wave amplitude calculations instead of recomputing wave amplitudes for each port excitation in the `TerminalComponentModelerData`.
33
45
- Changed hashing method in `Tidy3dBaseModel` from sha256 to md5.
34
46
- Allowing for more geometries in a ClipOperation geometry.
35
47
- Improved the speed of computing `Box` shape derivatives when used inside a `GeometryGroup`.
36
48
- All RF and microwave specific components now inherit from `MicrowaveBaseModel`.
37
-
-**[BREAKING]** Renamed path integral classes in `tidy3d.plugins.microwave` for improved consistency. Please see our migration guide for details on updating your code.
- Path integral and impedance calculator classes have been refactored and moved from `tidy3d.plugins.microwave` to `tidy3d.components.microwave`. They are now publicly exported via the top-level package `__init__.py`, so you can import them directly, e.g. `from tidy3d import ImpedanceCalculator, AxisAlignedVoltageIntegral, AxisAlignedCurrentIntegral, Custom2DVoltageIntegral, Custom2DCurrentIntegral, Custom2DPathIntegral`.
44
49
-`DirectivityMonitor` now forces `far_field_approx` to `True`, which was previously configurable.
45
50
- Unified run submission API: `web.run(...)` is now a container-aware wrapper that accepts a single simulation or arbitrarily nested containers (`list`, `tuple`, `dict` values) and returns results in the same shape.
46
51
-`web.Batch(ComponentModeler)` and `web.Job(ComponentModeler)` native support
Copy file name to clipboardExpand all lines: docs/api/microwave/microwave_migration.rst
+314-9Lines changed: 314 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,27 @@
1
1
.. _microwave_migration:
2
2
3
-
v2.10 Refactor Migration
4
-
-------------------------
3
+
v2.10 Refactor Migration Guide
4
+
-------------------------------
5
5
6
-
In version ``v2.10.0``, microwave plugin path integral classes were renamed for improved consistency and clarity. Additionally, these classes (and the impedance calculator) were refactored out of the plugin and moved into ``tidy3d.components.microwave`` and re-exported at the top-level package for convenience. This guide helps you update your scripts to use the new class names and imports.
6
+
In version ``v2.10.0``, the microwave and RF simulation capabilities underwent significant refactoring to improve consistency, clarity, and functionality. This guide covers two major sets of breaking changes:
7
7
8
-
Key Changes
9
-
~~~~~~~~~~~
8
+
1. **Path Integral Class Renames** - Classes were renamed for consistency
9
+
2. **WavePort API Changes** - WavePort was refactored to support multiple modes with cleaner impedance specification
10
+
11
+
This guide helps you update your scripts to work with v2.10+.
12
+
13
+
1. Path Integral Class Renames
14
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15
+
16
+
Path integral classes were renamed for improved consistency and clarity. Additionally, these classes (and the impedance calculator) were refactored out of the plugin and re-exported at the top-level package for convenience.
17
+
18
+
**Key changes:**
10
19
11
20
* **Renamed Classes**: Path integral classes have been renamed to follow a consistent naming pattern.
12
21
* **New Import Path (simplified)**: The path integral classes and impedance calculator are now exported at the top level. Prefer importing directly from ``tidy3d`` (e.g., ``from tidy3d import AxisAlignedVoltageIntegral, ImpedanceCalculator``). Existing plugin imports continue to work for backwards compatibility where applicable.
13
22
14
23
Class Name Changes
15
-
~~~~~~~~~~~~~~~~~~
24
+
^^^^^^^^^^^^^^^^^^
16
25
17
26
The following classes have been renamed for consistency:
18
27
@@ -31,7 +40,7 @@ The following classes have been renamed for consistency:
All functionality remains the same—only class names and preferred import paths have changed. Update your imports to the top level (``from tidy3d import ...``) and class names according to the table above, and your code will work with v2.10. For impedance calculations, import ``ImpedanceCalculator`` directly via ``from tidy3d import ImpedanceCalculator``.
140
+
141
+
2. WavePort API Changes for Multimodal Support
142
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
143
+
144
+
The ``WavePort`` class was refactored to support multiple modes and to provide cleaner integration with the microwave mode solver. This required several breaking changes to the API.
145
+
146
+
Overview of Changes
147
+
^^^^^^^^^^^^^^^^^^^
148
+
149
+
The key improvements in v2.10 include:
150
+
151
+
* **Multimodal support**: WavePorts can now excite and monitor multiple modes simultaneously
152
+
* **Cleaner impedance specification**: Voltage and current path integrals are now specified via ``MicrowaveModeSpec`` instead of directly on the port
153
+
* **Mode selection at source creation**: The mode to excite is now specified when creating a source, not when defining the port
154
+
* **Improved type safety**: Uses ``MicrowaveModeSpec`` and ``MicrowaveModeMonitor`` for clearer RF-specific behavior
155
+
156
+
Removed Fields
157
+
^^^^^^^^^^^^^^
158
+
159
+
The following fields have been **removed** from ``WavePort``:
160
+
161
+
* ``voltage_integral: Optional[VoltageIntegralType]`` - Path integral for voltage calculation
162
+
* ``current_integral: Optional[CurrentIntegralType]`` - Path integral for current calculation
163
+
164
+
Changed Fields
165
+
^^^^^^^^^^^^^^
166
+
167
+
* ``mode_index`` - The behavior has changed. Previously a required ``int`` specifying which single mode to use (default: 0). Now an optional ``Union[int, tuple[int, ...]]`` that selects which modes to monitor and excite. When ``None`` (default), all modes from ``mode_spec`` are used.
168
+
169
+
New MicrowaveModeSpec Integration
170
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
171
+
172
+
The ``mode_spec`` field now requires a ``MicrowaveModeSpec`` (instead of the generic ``ModeSpec``). This new class includes:
173
+
174
+
* ``impedance_specs``: Defines how to compute voltage, current, and characteristic impedance for each mode
For multimodal ports, ``compute_voltage()`` and ``compute_current()`` now return data for **all modes** with a ``mode_index`` dimension:
341
+
342
+
**Before (v2.9.x):**
343
+
344
+
.. code-block:: python
345
+
346
+
# Returns shape: (n_freqs,) - single mode only
347
+
voltage = port.compute_voltage(sim_data)
348
+
current = port.compute_current(sim_data)
349
+
350
+
**After (v2.10+):**
351
+
352
+
.. code-block:: python
353
+
354
+
# For single-mode port: Returns shape: (n_freqs, 1)
355
+
# For multi-mode port: Returns shape: (n_freqs, n_modes)
356
+
voltage = port.compute_voltage(sim_data)
357
+
current = port.compute_current(sim_data)
358
+
359
+
# Select specific mode using xarray selection
360
+
voltage_mode0 = voltage.sel(mode_index=0)
361
+
voltage_mode1 = voltage.sel(mode_index=1)
362
+
363
+
Using AutoImpedanceSpec for Simplified Setup
364
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
365
+
366
+
For most cases, you can use ``AutoImpedanceSpec`` which automatically computes voltage, current, and impedance from the electromagnetic fields:
367
+
368
+
.. code-block:: python
369
+
370
+
# Simplest form - let Tidy3D auto-compute everything
371
+
port = WavePort(
372
+
center=(0, 0, -5),
373
+
size=(2, 2, 0),
374
+
direction="+",
375
+
mode_spec=td.MicrowaveModeSpec(
376
+
num_modes=2,
377
+
impedance_specs=td.AutoImpedanceSpec() # Works for all modes
378
+
),
379
+
name="simple_port"
380
+
)
381
+
382
+
Breaking Changes Summary
383
+
^^^^^^^^^^^^^^^^^^^^^^^^
384
+
385
+
The following table summarizes all breaking changes to the ``WavePort`` API:
386
+
387
+
.. list-table::
388
+
:header-rows: 1
389
+
:widths: 30 30 40
390
+
391
+
* - Change
392
+
- Old (v2.9.x)
393
+
- New (v2.10+)
394
+
* - Port field: mode_index
395
+
- Required ``int``, single mode (default: 0)
396
+
- Optional ``Union[int, tuple[int, ...]]``, selects modes to monitor/excite (default: ``None`` = all modes)
397
+
* - Port field: voltage_integral
398
+
- ``voltage_integral=path``
399
+
- Removed. Use ``mode_spec.impedance_specs``
400
+
* - Port field: current_integral
401
+
- ``current_integral=path``
402
+
- Removed. Use ``mode_spec.impedance_specs``
403
+
* - mode_spec type
404
+
- ``ModeSpec``
405
+
- ``MicrowaveModeSpec``
406
+
* - Impedance method
407
+
- ``compute_port_impedance(sim_data)``
408
+
- ``get_port_impedance(sim_data, mode_index)``
409
+
* - Monitor type
410
+
- Returns ``ModeMonitor``
411
+
- Returns ``MicrowaveModeMonitor``
412
+
* - Voltage/current shape
413
+
- ``(n_freqs,)`` - single mode
414
+
- ``(n_freqs, n_modes)`` - all modes
415
+
* - Multimodal support
416
+
- Not supported
417
+
- Fully supported via ``num_modes``
418
+
419
+
Benefits of the New API
420
+
^^^^^^^^^^^^^^^^^^^^^^^^
421
+
422
+
The refactored API provides several advantages:
423
+
424
+
* **Multimodal ports**: Support for multiple modes enables more accurate modeling of multimode waveguides and transmission lines
425
+
* **Cleaner separation of concerns**: Mode selection happens at excitation time, not port definition time
426
+
* **Type safety**: ``MicrowaveModeSpec`` and ``MicrowaveModeMonitor`` make RF-specific behavior explicit
427
+
* **Flexibility**: Per-mode impedance specifications allow fine-grained control
428
+
* **Consistency**: Aligns with the general pattern of ``ModeSource`` where ``mode_index`` is a source parameter
429
+
430
+
Backward Compatibility
431
+
^^^^^^^^^^^^^^^^^^^^^^
432
+
433
+
There is **no backward compatibility** for WavePort instantiation with the old field names (``voltage_integral``, ``current_integral``). Attempting to use these fields will result in a Pydantic validation error.
434
+
435
+
The ``mode_index`` field has **changed behavior**: In v2.9, it was a required ``int`` specifying a single mode. In v2.10, it is optional and can select multiple modes via a tuple. Code using ``mode_index=0`` will work but now means "only use mode 0" rather than being the default.
0 commit comments