Skip to content

Path Integrals

Path integrals compute voltage and current from electromagnetic field data by integrating electric and magnetic fields along specified paths. They are used to characterize transmission lines and to compute characteristic impedance.

Voltage path integrals compute voltage by integrating the electric field along a line path.

V = - integral(E dot dl)

Use AxisAlignedVoltageIntegral for a simple axis-aligned path.

from flex_rf import web
from flex_rf.tidy3d import AxisAlignedVoltageIntegral
voltage_integral = AxisAlignedVoltageIntegral(
center=(0, 0, 0),
size=(0, 0, 2.0),
sign="+",
extrapolate_to_endpoints=True,
snap_path_to_grid=True,
)
mode_data = web.run(mode_solver, task_name="mode_solver")
voltage = voltage_integral.compute_voltage(mode_data)

Use Custom2DVoltageIntegral for a path defined by vertices in a 2D plane.

import numpy as np
from flex_rf.tidy3d import Custom2DVoltageIntegral
vertices = np.array([
[0, 0],
[0, 1],
[1, 1],
])
custom_voltage = Custom2DVoltageIntegral(
axis=2,
position=0.0,
vertices=vertices,
)
voltage = custom_voltage.compute_voltage(mode_data)

The sign parameter determines integration direction. Use "+" to integrate toward the positive axis and "-" to integrate toward the negative axis.

Current path integrals compute current using Ampere’s circuital law by integrating the magnetic field around a closed contour.

I = contour_integral(H dot dl)

Use AxisAlignedCurrentIntegral for a rectangular loop.

from flex_rf.tidy3d import AxisAlignedCurrentIntegral
current_integral = AxisAlignedCurrentIntegral(
center=(0, 0, 0),
size=(3, 2, 0),
sign="+",
snap_contour_to_grid=True,
)
current = current_integral.compute_current(mode_data)

Use Custom2DCurrentIntegral for an arbitrary closed contour. For positive current in the positive axis direction, order vertices counterclockwise when viewed from the positive axis.

import numpy as np
from flex_rf.tidy3d import Custom2DCurrentIntegral
vertices = np.array([
[0, 0],
[2, 0],
[2, 1],
[0, 1],
[0, 0],
])
custom_current = Custom2DCurrentIntegral(
axis=2,
position=0.0,
vertices=vertices,
)
current = custom_current.compute_current(mode_data)

Use CompositeCurrentIntegral to combine multiple current paths for geometries such as differential lines.

from flex_rf.tidy3d import AxisAlignedCurrentIntegral, CompositeCurrentIntegral
path_1 = AxisAlignedCurrentIntegral(
center=(-2, 0, 0),
size=(1, 1, 0),
sign="+",
)
path_2 = AxisAlignedCurrentIntegral(
center=(2, 0, 0),
size=(1, 1, 0),
sign="+",
)
composite_current = CompositeCurrentIntegral(
path_specs=(path_1, path_2),
sum_spec="sum",
)
current = composite_current.compute_current(mode_data)

sum_spec="sum" adds all currents together. sum_spec="split" keeps phase-separated contributions, which is useful when identifying dominant current directions.

Path integrals are commonly passed to ImpedanceCalculator to compute characteristic impedance.

from flex_rf.tidy3d import ImpedanceCalculator
z_calculator = ImpedanceCalculator(
voltage_integral=voltage_integral,
current_integral=current_integral,
)
z0 = z_calculator.compute_impedance(mode_data)
z0, voltage, current = z_calculator.compute_impedance(
mode_data,
return_voltage_and_current=True,
)

The integral classes above compute directly on field data. For MicrowaveModeSpec configuration, use the corresponding specification classes:

SpecUse
AxisAlignedVoltageIntegralSpecAxis-aligned voltage path for mode impedance.
Custom2DVoltageIntegralSpecCustom 2D voltage path for mode impedance.
AxisAlignedCurrentIntegralSpecAxis-aligned current contour for mode impedance.
Custom2DCurrentIntegralSpecCustom 2D current contour for mode impedance.
CompositeCurrentIntegralSpecComposite current contour for mode impedance.
IntegralRecommendation
VoltageFollow the electric field path between conductors.
CurrentEnclose the current-carrying region.
Grid alignmentUse snap_path_to_grid=True or snap_contour_to_grid=True when available.
EndpointsUse extrapolate_to_endpoints=True when voltage endpoints lie on conductor boundaries.
DirectionKeep sign consistent with the desired power-flow direction.
PageWhy open it
RF Mode AnalysisUse path integral specs with MicrowaveModeSpec.
Impedance CalculatorConvert path-integral voltage and current into impedance.