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
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
39
39
-`web.Batch(ComponentModeler)` and `web.Job(ComponentModeler)` native support
40
40
- Simulation data of batch jobs are now automatically downloaded upon their individual completion in `Batch.run()`, avoiding waiting for the entire batch to reach completion.
41
41
- Edge singularity correction at PEC and lossy metal edges defaults to `True`.
42
+
-**[BREAKING]**`WavePort` in `tidy3d.plugins.smatrix` now supports multiple modes and has been refactored to use `MicrowaveModeSpec`. The fields `mode_index`, `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.
42
43
43
44
### Fixed
44
45
- More robust `Sellmeier` and `Debye` material model, and prevent very large pole parameters in `PoleResidue` material model.
Copy file name to clipboardExpand all lines: docs/api/microwave/microwave_migration.rst
+308-9Lines changed: 308 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 and moved to ``tidy3d.components.microwave``
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 moved into ``tidy3d.components.microwave`` 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
+
* ``mode_index: int`` - Previously specified which mode to excite (default: 0)
162
+
* ``voltage_integral: Optional[VoltageIntegralType]`` - Path integral for voltage calculation
163
+
* ``current_integral: Optional[CurrentIntegralType]`` - Path integral for current calculation
164
+
165
+
New MicrowaveModeSpec Integration
166
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
167
+
168
+
The ``mode_spec`` field now requires a ``MicrowaveModeSpec`` (instead of the generic ``ModeSpec``). This new class includes:
169
+
170
+
* ``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:
337
+
338
+
**Before (v2.9.x):**
339
+
340
+
.. code-block:: python
341
+
342
+
# Returns shape: (n_freqs,) - single mode only
343
+
voltage = port.compute_voltage(sim_data)
344
+
current = port.compute_current(sim_data)
345
+
346
+
**After (v2.10+):**
347
+
348
+
.. code-block:: python
349
+
350
+
# For single-mode port: Returns shape: (n_freqs, 1)
351
+
# For multi-mode port: Returns shape: (n_freqs, n_modes)
352
+
voltage = port.compute_voltage(sim_data)
353
+
current = port.compute_current(sim_data)
354
+
355
+
# Select specific mode using xarray selection
356
+
voltage_mode0 = voltage.sel(mode_index=0)
357
+
voltage_mode1 = voltage.sel(mode_index=1)
358
+
359
+
Using AutoImpedanceSpec for Simplified Setup
360
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
361
+
362
+
For most cases, you can use ``AutoImpedanceSpec`` which automatically computes voltage, current, and impedance from the electromagnetic fields:
363
+
364
+
.. code-block:: python
365
+
366
+
# Simplest form - let Tidy3D auto-compute everything
367
+
port = WavePort(
368
+
center=(0, 0, -5),
369
+
size=(2, 2, 0),
370
+
direction="+",
371
+
mode_spec=td.MicrowaveModeSpec(
372
+
num_modes=2,
373
+
impedance_specs=td.AutoImpedanceSpec() # Works for all modes
374
+
),
375
+
name="simple_port"
376
+
)
377
+
378
+
Breaking Changes Summary
379
+
^^^^^^^^^^^^^^^^^^^^^^^^
380
+
381
+
The following table summarizes all breaking changes to the ``WavePort`` API:
382
+
383
+
.. list-table::
384
+
:header-rows: 1
385
+
:widths: 30 30 40
386
+
387
+
* - Change
388
+
- Old (v2.9.x)
389
+
- New (v2.10+)
390
+
* - Port field: mode_index
391
+
- ``mode_index=0``
392
+
- Removed. Use ``to_source(mode_index=0)``
393
+
* - Port field: voltage_integral
394
+
- ``voltage_integral=path``
395
+
- Removed. Use ``mode_spec.impedance_specs``
396
+
* - Port field: current_integral
397
+
- ``current_integral=path``
398
+
- Removed. Use ``mode_spec.impedance_specs``
399
+
* - mode_spec type
400
+
- ``ModeSpec``
401
+
- ``MicrowaveModeSpec``
402
+
* - Impedance method
403
+
- ``compute_port_impedance(sim_data)``
404
+
- ``get_port_impedance(sim_data, mode_index)``
405
+
* - Monitor type
406
+
- Returns ``ModeMonitor``
407
+
- Returns ``MicrowaveModeMonitor``
408
+
* - Voltage/current shape
409
+
- ``(n_freqs,)`` - single mode
410
+
- ``(n_freqs, n_modes)`` - all modes
411
+
* - Multimodal support
412
+
- Not supported
413
+
- Fully supported via ``num_modes``
414
+
415
+
Benefits of the New API
416
+
^^^^^^^^^^^^^^^^^^^^^^^^
417
+
418
+
The refactored API provides several advantages:
419
+
420
+
* **Multimodal ports**: Support for multiple modes enables more accurate modeling of multimode waveguides and transmission lines
421
+
* **Cleaner separation of concerns**: Mode selection happens at excitation time, not port definition time
422
+
* **Type safety**: ``MicrowaveModeSpec`` and ``MicrowaveModeMonitor`` make RF-specific behavior explicit
423
+
* **Flexibility**: Per-mode impedance specifications allow fine-grained control
424
+
* **Consistency**: Aligns with the general pattern of ``ModeSource`` where ``mode_index`` is a source parameter
425
+
426
+
Backward Compatibility
427
+
^^^^^^^^^^^^^^^^^^^^^^
428
+
429
+
There is **no backward compatibility** for WavePort instantiation with the old field names (``mode_index``, ``voltage_integral``, ``current_integral``). Attempting to use these fields will result in a Pydantic validation error. All code using ``WavePort`` must be updated to the new API when upgrading to v2.10.
0 commit comments