Skip to content

Commit 9d1f519

Browse files
dmarek-flexdaquinteroflex
authored andcommitted
docs(rf): add documentation for the new (and moved) microwave components for many new RF features, e.g., mode impedance
update rf namespace usage in smatrix plugin and improved discussion of photonic and RF modelers
1 parent 76644d8 commit 9d1f519

File tree

16 files changed

+915
-157
lines changed

16 files changed

+915
-157
lines changed

docs/api/microwave/component_modeler.rst

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ TerminalComponentModeler
77
:toctree: ../_autosummary/
88
:template: module.rst
99

10-
tidy3d.plugins.smatrix.TerminalComponentModeler
11-
tidy3d.plugins.smatrix.TerminalComponentModelerData
12-
tidy3d.plugins.smatrix.MicrowaveSMatrixData
13-
tidy3d.plugins.smatrix.TerminalPortDataArray
14-
tidy3d.plugins.smatrix.PortDataArray
10+
tidy3d.rf.TerminalComponentModeler
11+
tidy3d.rf.TerminalComponentModelerData
12+
tidy3d.rf.MicrowaveSMatrixData
13+
tidy3d.rf.TerminalPortDataArray
14+
tidy3d.rf.PortDataArray
1515

16-
The :class:`.TerminalComponentModeler` is the core simulation object for 3D RF/microwave simulations in Tidy3D. Its primary function is to simulate the system over ``N`` number of ports and ``M`` number of frequency points, with the end result being a ``MxNxN`` S-parameter matrix.
16+
The :class:`~tidy3d.rf.TerminalComponentModeler` is the core simulation object for 3D RF/microwave simulations in Tidy3D. Its primary function is to simulate the system over ``N`` number of ports and ``M`` number of frequency points, with the end result being a ``MxNxN`` S-parameter matrix.
1717

1818
.. code-block:: python
1919
@@ -24,45 +24,52 @@ The :class:`.TerminalComponentModeler` is the core simulation object for 3D RF/m
2424
...
2525
)
2626
27-
The key parts of a :class:`.TerminalComponentModeler` are:
27+
The key parts of a :class:`~tidy3d.rf.TerminalComponentModeler` are:
2828

29-
* The :class:`.Simulation` field defines the underlying Tidy3D `Simulation object <../simulation.html>`_. This base :class:`.Simulation` object contains information about the simulation domain such as structures, boundary conditions, grid specifications, and monitors. Note that sources should not be included in the base simulation, but rather in the ``ports`` field instead.
30-
* The ``ports`` field defines the list of source excitations. These are commonly of type :class:`LumpedPort` or :class:`.WavePort`. The number of ports determines the number of batch jobs in the :class:`.TerminalComponentModeler` and the dimensionality of the S-parameter matrix.
29+
* The :class:`~tidy3d.Simulation` field defines the underlying Tidy3D `Simulation object <../simulation.html>`_. This base :class:`~tidy3d.Simulation` object contains information about the simulation domain such as structures, boundary conditions, grid specifications, and monitors. Note that sources should not be included in the base simulation, but rather in the ``ports`` field instead.
30+
* The ``ports`` field defines the list of source excitations. These are commonly of type :class:`~tidy3d.rf.LumpedPort` or :class:`~tidy3d.rf.WavePort`. The number of ports determines the number of batch jobs in the :class:`~tidy3d.rf.TerminalComponentModeler` and the dimensionality of the S-parameter matrix. **Note:** Port names cannot contain the '@' symbol (reserved for internal indexing).
3131
* The ``freqs`` field defines the list of frequency points for the simulation.
3232

33-
More information and explanation for additional fields can be found in the documentation page for the :class:`.TerminalComponentModeler`. In order to submit the simulation, use ``tidy3d.web.upload()``, ``tidy3d.web.start()``, ``tidy3d.web.monitor()``, and ``tidy3d.web.load()``.
33+
More information and explanation for additional fields can be found in the documentation page for the :class:`~tidy3d.rf.TerminalComponentModeler`.
34+
35+
Workflow
36+
~~~~~~~~
37+
38+
In order to submit the simulation, use ``web.upload()``, ``web.start()``, ``web.monitor()``, and ``web.load()``.
3439

3540
.. code-block:: python
41+
import tidy3d.web as web
3642
3743
# Upload simulation and get cost estimate
38-
my_task_id = tidy3d.web.upload(my_tcm, task_name='my_task_name')
44+
my_task_id = web.upload(my_tcm, task_name='my_task_name')
3945
4046
# Run simulation
41-
tidy3d.web.start(my_task_id)
47+
web.start(my_task_id)
4248
4349
# Monitor simulation
44-
tidy3d.web.monitor(my_task_id)
50+
web.monitor(my_task_id)
4551
4652
# Load results after completion
47-
my_tcm_data = tidy3d.web.load(my_task_id)
53+
my_tcm_data = web.load(my_task_id)
4854
4955
50-
Alternatively, use the ``tidy3d.web.run()`` method to perform all of the above in one single step.
56+
Alternatively, use the ``web.run()`` method to perform all of the above in one single step.
5157

5258

5359
.. code-block:: python
60+
import tidy3d.web as web
5461
5562
# Upload, run simulation, and download data
56-
my_tcm_data = tidy3d.web.run(my_tcm, task_name='my_task_name', path='my/local/download/path')
63+
my_tcm_data = web.run(my_tcm, task_name='my_task_name', path='my/local/download/path')
5764
58-
To get the S-matrix from the results, use the ``smatrix()`` method of the :class:`.TerminalComponentModelerData` object.
65+
To get the S-matrix from the results, use the ``smatrix()`` method of the :class:`~tidy3d.rf.TerminalComponentModelerData` object.
5966

6067
.. code-block:: python
6168
6269
# Get S-matrix from results
6370
my_s_matrix = my_tcm_data.smatrix()
6471
65-
The S-matrix is stored as a :class:`.MicrowaveSMatrixData` whose ``data`` property contains a :class:`.TerminalPortDataArray` instance. To obtain a specific ``S_ij`` value, use the ``port_in`` and ``port_out`` coordinates with the corresponding port name. To obtain a specific frequency, use the ``f`` coordinate.
72+
The S-matrix is stored as a :class:`~tidy3d.rf.MicrowaveSMatrixData` whose ``data`` property contains a :class:`~tidy3d.rf.TerminalPortDataArray` instance. To obtain a specific ``S_ij`` value, use the ``port_in`` and ``port_out`` coordinates with the corresponding port name. To obtain a specific frequency, use the ``f`` coordinate.
6673

6774
.. code-block:: python
6875
@@ -71,19 +78,7 @@ The S-matrix is stored as a :class:`.MicrowaveSMatrixData` whose ``data`` proper
7178
7279
.. note::
7380

74-
At this moment, Tidy3D uses the physics phase convention :math:`e^{-i\omega t}`. Other RF simulation software and texts may use the electrical engineering convention :math:`e^{i\omega t}`. This affects the calculated S-parameters and impedance values. To convert between the two, simply use the complex conjugation operation, e.g. ``np.conjugate()``.
75-
76-
To access simulation data for a given port excitation, use the ``data`` attribute of the :class:`.TerminalComponentModelerData`.
77-
78-
.. code-block:: python
79-
80-
# Get simulation data for a given port "my_port"
81-
sim_data = my_tcm_data.data["my_port"]
82-
83-
# Get monitor data from a given monitor "my_monitor"
84-
my_monitor_data = sim_data["my_monitor"]
85-
86-
The ``data`` attribute holds the simulation data in a dictionary with the respective port name as keys. The data for each monitor can then be accessed from the simulation data object using the monitor name as the dictionary key.
81+
At this moment, Tidy3D uses the physics phase convention :math:`e^{-i\omega t}`. Other RF simulation software and texts may use the electrical engineering convention :math:`e^{i\omega t}`. This affects the sign of the imaginary part of calculated S-parameters and impedance values. To convert between the two, simply use the complex conjugation operation, e.g. ``np.conjugate()``.
8782

8883
.. seealso::
8984

@@ -97,7 +92,7 @@ The ``data`` attribute holds the simulation data in a dictionary with the respec
9792
+ `Performing visualization of simulation data <../../notebooks/VizData.html>`_
9893
+ `Advanced monitor data manipulation and visualization <../../notebooks/XarrayTutorial.html>`_
9994

100-
Please refer to the following example models to see the :class:`.TerminalComponentModeler` in action:
95+
Please refer to the following example models to see the :class:`~tidy3d.rf.TerminalComponentModeler` in action:
10196

10297
+ `Differential stripline benchmark <../../notebooks/DifferentialStripline.html>`_
10398
+ `Edge feed patch antenna benchmark <../../notebooks/EdgeFeedPatchAntennaBenchmark.html>`_
Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
.. _impedance_calculator:
2+
3+
Impedance Calculator
4+
--------------------
5+
6+
.. autosummary::
7+
:toctree: ../_autosummary/
8+
:template: module.rst
9+
10+
tidy3d.ImpedanceCalculator
11+
12+
The :class:`~tidy3d.ImpedanceCalculator` computes characteristic impedance from electromagnetic field data using voltage and current path integrals. It supports three calculation methods depending on which integrals are provided:
13+
14+
* **V and I method**: :math:`Z_0 = V / I` (when both voltage and current integrals are provided)
15+
* **P and V method**: :math:`Z_0 = |V|^2 / (2P^*)` (when only voltage integral is provided)
16+
* **P and I method**: :math:`Z_0 = 2P / |I|^2` (when only current integral is provided)
17+
18+
where :math:`P = \frac{V I^*}{2}` is the complex power flow through the cross-section.
19+
20+
**Basic Usage**
21+
22+
.. code-block:: python
23+
24+
import tidy3d as td
25+
26+
# Define voltage integration path
27+
voltage_integral = td.AxisAlignedVoltageIntegral(
28+
center=(0, 0, 0),
29+
size=(0, 0, 2), # Vertical line
30+
sign="+",
31+
extrapolate_to_endpoints=True,
32+
snap_path_to_grid=True
33+
)
34+
35+
# Define current integration contour
36+
current_integral = td.AxisAlignedCurrentIntegral(
37+
center=(0, 0, 0),
38+
size=(4, 2, 0), # Rectangular loop
39+
sign="+",
40+
snap_contour_to_grid=True
41+
)
42+
43+
# Create impedance calculator
44+
# Note: The impedance calculator can also accept "None" for either the "voltage_integral" or the "current_integral",
45+
# which determines the method for computing the impedance. This alternative method is detailed below.
46+
Z_calculator = td.ImpedanceCalculator(
47+
voltage_integral=voltage_integral,
48+
current_integral=current_integral
49+
)
50+
51+
# Compute impedance from mode data
52+
mode_data = # ... obtain from ModeSimulation or ModeSolver
53+
impedance = Z_calculator.compute_impedance(mode_data)
54+
55+
**Using with Mode Solver Data**
56+
57+
The impedance calculator is commonly used with mode solver results to determine the characteristic impedance of transmission line modes:
58+
59+
.. code-block:: python
60+
61+
import tidy3d.web as web
62+
63+
# Run mode simulation
64+
mode_sim = td.ModeSimulation(
65+
size=(10, 10, 0),
66+
grid_spec=td.GridSpec.auto(wavelength=0.3),
67+
structures=[...],
68+
monitors=[mode_monitor],
69+
freqs=[1e9, 2e9, 3e9]
70+
)
71+
72+
mode_sim_data = web.run(mode_sim, task_name='mode_solver')
73+
# Calculate impedance for each mode
74+
Z0 = Z_calculator.compute_impedance(mode_sim_data.modes)
75+
76+
**Obtaining Voltage and Current**
77+
78+
You can also retrieve the voltage and current values along with impedance:
79+
80+
.. code-block:: python
81+
82+
# Get impedance, voltage, and current
83+
Z, V, I = Z_calculator.compute_impedance(
84+
mode_data,
85+
return_voltage_and_current=True
86+
)
87+
88+
print(f"Impedance: {Z} Ω")
89+
print(f"Voltage: {V} V")
90+
print(f"Current: {I} A")
91+
92+
**Single Integral Calculation**
93+
94+
When only voltage or current integral is specified, the complex power flow is automatically used:
95+
96+
.. code-block:: python
97+
98+
# Calculator with only voltage integral
99+
Z_calc_V = td.ImpedanceCalculator(
100+
voltage_integral=voltage_integral,
101+
current_integral=None
102+
)
103+
104+
# Computes: Z = V^2 / (2*P)
105+
Z_from_V = Z_calc_V.compute_impedance(mode_data)
106+
107+
# Calculator with only current integral
108+
Z_calc_I = td.ImpedanceCalculator(
109+
voltage_integral=None,
110+
current_integral=current_integral
111+
)
112+
113+
# Computes: Z = 2*P / I^2
114+
Z_from_I = Z_calc_I.compute_impedance(mode_data)
115+
116+
.. note::
117+
118+
For detailed information on path integral classes (voltage integrals, current integrals, composite integrals, custom paths, etc.), see :ref:`path_integrals`.
119+
120+
**Field Data Compatibility**
121+
122+
The impedance calculator and path integral classes work with various types of field data:
123+
124+
* :class:`~tidy3d.ModeSolverData`: Mode field profiles from 2D mode solver
125+
* :class:`~tidy3d.FieldData`: Frequency-domain field data from monitors
126+
* :class:`~tidy3d.FieldTimeData`: Time-domain field data from monitors
127+
* :class:`~tidy3d.MicrowaveModeSolverData`: Microwave mode solver data (includes pre-computed integrals)
128+
129+
.. code-block:: python
130+
131+
# Works with different data types
132+
Z_from_mode = Z_calculator.compute_impedance(mode_solver_data)
133+
Z_from_monitor = Z_calculator.compute_impedance(field_monitor_data)
134+
Z_from_time = Z_calculator.compute_impedance(field_time_data)
135+
136+
**Phase Convention**
137+
138+
.. note::
139+
140+
Tidy3D uses the physics phase convention :math:`e^{-i\omega t}`. Some RF simulation software and textbooks use the electrical engineering convention :math:`e^{i\omega t}`. This affects calculated S-parameters and impedance values.
141+
142+
To convert between conventions, use complex conjugation:
143+
144+
.. code-block:: python
145+
146+
import numpy as np
147+
148+
# Convert from physics to engineering convention
149+
Z_engineering = np.conjugate(Z_physics)
150+
151+
# Convert from engineering to physics convention
152+
Z_physics = np.conjugate(Z_engineering)
153+
154+
.. seealso::
155+
156+
Related documentation:
157+
158+
+ :ref:`path_integrals`
159+
+ :ref:`microwave_mode_solver`
160+
161+
Tutorials and examples:
162+
163+
+ `Computing the characteristic impedance of transmission lines <../../notebooks/CharacteristicImpedanceCalculator.html>`_
164+
165+
~~~~

docs/api/microwave/index.rst

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,26 @@
11
Microwave & RF |:satellite:|
22
==============================
33

4+
.. toctree::
5+
:hidden:
6+
7+
component_modeler
8+
material
9+
rf_material_library
10+
path_integrals
11+
impedance_calculator
12+
mode_solver
13+
ports/lumped
14+
ports/wave
15+
radiation_scattering
16+
output_data
17+
418
Overview
519
--------
620

721
.. warning::
822

9-
RF simulations will be subject to new license requirements in the future.
23+
RF simulations and functionality will require new license requirements in an upcoming release. All RF-specific classes are now available within the sub-package 'tidy3d.rf'.
1024

1125
.. warning::
1226

@@ -22,9 +36,13 @@ The following sections discuss:
2236
* `RF Materials Models`_: Typical material types in microwave/RF simulation
2337
* `RF Materials Library`_: The RF material library contains various dispersive models for real-world RF materials.
2438
* `Layer-based Grid Refinement`_: Automated grid refinement strategy for planar structures (e.g. printed circuit boards)
39+
* `Path Integrals`_: Tools for computing voltage and current from electromagnetic fields
40+
* `Impedance Calculator`_: Post-processing tool for impedance calculation from electromagnetic fields
41+
* `RF Mode Analysis`_: Performing RF-specific mode analysis, like computing the characteristic impedance of transmission line modes
2542
* `Lumped Port & Elements`_: Lumped excitations and circuit elements
2643
* `Wave Port`_: Port excitation based on modal fields
2744
* `Radiation & Scattering`_: Useful features for antenna and scattering problems
45+
* `RF Output Data`_: Data containers for microwave simulation results
2846

2947
.. seealso::
3048

@@ -38,6 +56,10 @@ The following sections discuss:
3856
.. include:: /api/microwave/material.rst
3957
.. include:: /api/microwave/rf_material_library.rst
4058
.. include:: /api/discretization/layer.rst
59+
.. include:: /api/microwave/path_integrals.rst
60+
.. include:: /api/microwave/impedance_calculator.rst
61+
.. include:: /api/microwave/mode_solver.rst
4162
.. include:: /api/microwave/ports/lumped.rst
4263
.. include:: /api/microwave/ports/wave.rst
4364
.. include:: /api/microwave/radiation_scattering.rst
65+
.. include:: /api/microwave/output_data.rst

docs/api/microwave/material.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ RF Materials Models
99

1010
tidy3d.PECMedium
1111
tidy3d.PMCMedium
12-
tidy3d.LossyMetalMedium
13-
tidy3d.SurfaceImpedanceFitterParam
14-
tidy3d.HammerstadSurfaceRoughness
15-
tidy3d.HuraySurfaceRoughness
12+
tidy3d.rf.LossyMetalMedium
13+
tidy3d.rf.SurfaceImpedanceFitterParam
14+
tidy3d.rf.HammerstadSurfaceRoughness
15+
tidy3d.rf.HuraySurfaceRoughness
1616

17-
The :class:`.PECMedium` and :class:`.LossyMetalMedium` classes can be used to model metallic materials.
17+
The :class:`~tidy3d.PECMedium` and :class:`~tidy3d.rf.LossyMetalMedium` classes can be used to model metallic materials.
1818

1919
.. code-block:: python
2020
@@ -24,11 +24,11 @@ The :class:`.PECMedium` and :class:`.LossyMetalMedium` classes can be used to mo
2424
# lossy metal (conductivity in S/um)
2525
my_lossy_metal = LossyMetalMedium(conductivity=58, freq_range=(1e9, 10e9))
2626
27-
Note that the unit of ``conductivity`` is ``S/um`` and the unit of ``freq_range`` is ``Hz``. The :class:`.LossyMetalMedium` class implements the surface impedance boundary condition (SIBC). It can accept surface roughness specifications using the Hammerstad or Huray models. Please refer to their respective documentation pages for details. Edge singularity correction is also available but turned off by default at this time.
27+
Note that the unit of ``conductivity`` is ``S/um`` and the unit of ``freq_range`` is ``Hz``. The :class:`~tidy3d.rf.LossyMetalMedium` class implements the surface impedance boundary condition (SIBC). It can accept surface roughness specifications using the Hammerstad or Huray models. Please refer to their respective documentation pages for details. Edge singularity correction is also available but turned off by default at this time.
2828

2929
.. note::
3030

31-
When modeling lossy metals, always be sure to check the skin depth --- if the skin depth is significant compared to the geometry size, then :class:`.LossyMetalMedium` may be not accurate. In that case, use a regular dispersive medium instead.
31+
When modeling lossy metals, always be sure to check the skin depth --- if the skin depth is significant compared to the geometry size, then :class:`~tidy3d.rf.LossyMetalMedium` may be not accurate. In that case, use a regular dispersive medium instead.
3232

3333

3434
.. autosummary::
@@ -38,7 +38,7 @@ Note that the unit of ``conductivity`` is ``S/um`` and the unit of ``freq_range`
3838
tidy3d.Medium
3939
tidy3d.plugins.dispersion.FastDispersionFitter
4040

41-
To model lossless dielectrics, use the regular :class:`.Medium`.
41+
To model lossless dielectrics, use the regular :class:`~tidy3d.Medium`.
4242

4343
.. code-block:: python
4444

0 commit comments

Comments
 (0)