Ports can act as a combination of mode source, field monitor, and mode expansion monitor. Ports can be used alone or in conjunction with the S-parameter sweep tool to extract the S-parameters for a device by using the mode expansion method. See the "What is mode expansion" section at the bottom of this page for details on the mode expansion calculation. See Ring resonator FDTD (final parameter extraction) for an application example which uses ports and the S-parameter sweep tool.

Note: For information on the port objects used in the Eigenmode Expansion (EME) solver in MODE, see EME Ports. |

To add a port, click on the Port button in the main toolbar. An FDTD simulation region must be present in order to add ports. Once a port is added, a port group called “ports” is automatically added as the child of the FDTD solver region, and all port objects are contained within this group. Note that the port hierarchy is set so ports cannot be moved outside of the "ports" group, and other objects cannot be moved into the group. The name of the "ports" group also cannot be modified. However, the names of the port objects and order of the port objects inside the port group can be modified.

### Ports

Port objects are where you can select the basis modes to be used in the S-parameter calculations described in the "What is mode expansion" section.

By default when you add a new port object, it will be set up to inject in forward x-axis direction and port will span the full simulation region span. The port that is set up to be the source will have a pink arrow in the injection direction and ports that are not injecting will have a green arrow pointing in the injection direction. In the following image, the port on the left is the source port.

### Port group

The port group object is where you can select which port and mode to use as the source in the simulation as well as set the frequency range and number of frequency points to record the field profile over. Only one port mode can be used as the source at a time so only 1 port will inject in a simulation. However, note that having the ports group enabled does not automatically disable other source objects that may be present in your simulation

## Mode expansion

Consider a waveguide/fiber that supports a set of forward-propagating modes, \( \varphi_{m}^{\text{forward }}\) (with \(\mathbf{E}_{m}^{\text{forward}} \) and \( \mathbf{H}_{m}^{\text{forward}}\) ), and backward-propagating modes, \( \varphi_{m}^{\text{backward }}\) (with \(\mathbf{E}_{m}^{\text{backward}} \) and \( \mathbf{H}_{m}^{\text{backward}}\) ). If a complete basis state of modes is known, any input field can be expanded using these modes:

$$ \mathbf{E}_{in}=\sum_{m}\left(a_{m} \mathbf{E}_{m}^{forward}+b_{m} \mathbf{E}_{m}^{\text{backward}} \right) $$

$$\mathbf{H}_{in}=\sum_{m}\left(a_{m} \mathbf{H}_{m}^{forward}+b_{m} \mathbf{H}_{m}^{\text{backward}} \right) $$

\(a_{m} \) and \( b_{m} \) represent the complex transmission coefficient of the forward and backward propagating waves respectively. The forward and backward propagating modes are related by symmetry:

$$ \mathbf{E}_{m}^{ \text { backward }}=\mathbf{E}_{t, m}^{ \text{forward}}-E_{z, m}^{ \text{forward}} \hat{z} $$

$$ \mathbf{H}_{m}^{ \text { backward }}=-\mathbf{H}_{t, m}^{ \text{forward }}+H_{z, m}^{ \text{forward}} \hat{z} $$

where we decomposed \( \mathbf{E}_{m}^{ \text{forward}} \) in a transverse component \( \mathbf{E}_{t, m}^{ \text{forward}}\) and longitudinal component \( E_{z, m}^{ \text{backward}} \) (assuming the modes propagate in the z direction), and similarly for \( \mathbf{H}_{m}^{ \text{forward}} \). Thus, we can rewrite the expressions above for the input fields completely in terms of forward-propagating modes and simplify the notation by dropping the forward/backward notation and using \( \varphi_{m}\) (with \( \mathbf{E}_{m} \) and \( \mathbf{H}_{m} \) ) for the forward-propagating modes. If we assume power orthogonality of these modes according to

$$ \left\langle \varphi_{m} | \varphi_{n} \right\rangle \equiv 0.5^{*} \int \mathbf{S} \cdot \mathbf{E}_{m} \times \mathbf{H}_{n}^{*}=N_{m} \delta_{m n} $$

then the coefficients for any mode \( m \) can be determined from the overlap integrals:

$$ \ 0.5 * \int d \mathbf{S} \cdot \mathbf{E}_{input} \times \mathbf{H}_{m}^{*}=\left(a_{m}+b_{m} \right) N_{m}\ $$

$$ \ 0.5 * \int d \mathbf{S} \cdot \mathbf{E}_{m}^{*} \times \mathbf{H}_{in}=\left(a_{m}-b_{m} \right) N_{m}^{*}\ $$

This is the basic concept behind mode expansion monitors. The user can specify an arbitrary input field \( \mathbf{E}_{in} \) and \( \mathbf{H}_{in} \) (recorded by a frequency monitor), and modal fields \( \mathbf{E}_{m} \) and \( \mathbf{H}_{m} \) (by a mode expansion monitor). The mode expansion monitor will return the following results:

$$ a _{m} = 0.25 * \frac{\int d \mathbf{S} \cdot \mathbf{E} _{in} \times \mathbf{H} _{m} ^{*} }{N _{m}} + \frac{ \int d \mathbf{S} \cdot \mathbf{E} _{m} ^{*} \times \mathbf{H} _{in}}{N _{m} ^{*}} $$

$$ b _{m} = 0.25 * \left( \frac{ \int d \mathbf{S} \cdot \mathbf{E} _{in} \times \mathbf{H} _{m} ^{*} }{N_{m}} - \frac{ \int d \mathbf{S} \cdot \mathbf{E} _{m} ^{*} \times \mathbf{H}_{in}}{N _{m} ^{*} } \right) $$

$$ N_{m} = 0.5 * \int d \mathbf{S} \cdot \mathbf{E}_{m} \times \mathbf{H} _{m} ^{*} $$

$$ P_{in} = 0.5 * \int d \mathbf{S} \cdot \mathbf{E} _{in} \times \mathbf{H} _{in} ^{*} $$

where \( Re(N_{m}) \) is the power of the mode \( m \) in the waveguide, and \( Re(P_{in}) \) is the total input power (in Watt) recorded by the frequency monitor. The script function expand can also be used to perform this type of mode expansion.

Note: Grid dispersion These equations only apply to the ideal case. In practice, since an FDTD simulation uses a mesh, a correction step is necessary to account for the grid dispersion from this discrete mesh. This correction factor is taken into account in the mode expansion monitor built-in analysis. In the limit where the mesh size gets very very small, these equations will give the same results as the mode expansion monitor with the built-in correction. |

Note: Power orthogonality Strictly speaking, the power orthogonality condition using the conjugated cross product above is true for the bound modes of non-absorbing waveguides. A more general orthogonality relation, valid for both absorbing and non-absorbing waveguides, is based on the unconjugated cross product: $$ 0.5 * \int d \mathbf{S} \cdot \mathbf{E}_{m} \times \mathbf{H}_{n}=N_{m}^{\mathrm{*}} \delta_{mn} $$ This approach is implemented in the script function expand2. It happens that for bound modes of non-absorbing waveguides, E and H (transverse to the direction of propagation) are real valued. Therefore the unconjugated and conjugated expressions for non-absorbing waveguides are the same, and the modes are power orthogonal. However, the disadvantage of this approach is that without the complex conjugate of the H-field, the normalization constant cannot be associated with the power carried by the waveguide modes, eg, of absorbing waveguides. |

## Port group

- SOURCE PORT: Combo box allows user to choose from a list of the existing ports.
- SOURCE MODE: Combo box allows user to choose from the modes which have been selected in the SOURCE PORT. If port modes have been selected using the "user select" option in the port's "Modal Properties" tab, the modes are identified by the mode number in the mode list from the eigenmode solver used to select the modes.
- MONITOR FREQUENCY POINTS (OVERRIDE GLOBAL): Number of frequency points over the range to record E, H field profile data in the port monitor to be used in the mode expansion calculations. This is independent from the frequency points setting in the port object's "Modal properties" tab. By default, the number of frequency points from the global settings will be used.
- CALCULATE GROUP DELAY: The group delay of the device is calculated numerically using a finite difference approximation of the derivative of the phase with respect to frequency. The “fractional offset for group delay” is the fraction of the frequency that is used for the finite difference step size. If this setting is too low, the change in phase may be heavily impacted by noise. If it is too large it is possible that the phase will change by more than \( 2\pi\), resulting in an incorrect group delay calculation. Reducing this setting from the default may be required for very long devices ( \(10^4+\) wavelengths) where the phase changes rapidly with frequency. Otherwise, the default setting should be used.

### Frequency/wavelength settings

- SET GLOBAL SOURCE SETTINGS: This button opens the "Edit global source settings window" which can also be opened from the Source menu in the Main toolbar.

## Geometry tab

The value of the injection axis property set in the modal properties tab will control the available spatial settings below:

- X, Y, Z: The center position of the simulation region
- X MIN, X MAX: X min, X max position
- Y MIN, Y MAX: Y min, Y max position
- Z MIN, Z MAX: Z min, Z max position
- X SPAN, Y SPAN, Z SPAN: X, Y, Z span of the simulation region

## Modal Properties tab

- INJECTION AXIS: Sets the propagation axis. This setting will determine the geometry parameters that can be set under the "Geometry" tab (eg. if the injection axis is the x-axis, then the port object will have a 2D x-normal geometry).
- DIRECTION: This field specifies the direction in which the source will propagate. FORWARD corresponds to propagation in the positive axis direction, while BACKWARD corresponds to propagation in the negative direction.
- AMPLITUDE: The amplitude of the source as explained in the Units and normalization section.
- PHASE: The phase of the source, measured in units of degrees.
- MODE SELECTION: Allows users to select the modes to use for the mode expansion calculation. The "user select" option launches the eigenmode solver where the user can calculate and visualize the supported modes (see Mode analysis); use this option to select multiple modes. The eigenmode solver also provides a tool for frequency analysis (see frequency analysis).
- FREQUENCY POINTS: Set to choose the number of frequency points at which to calculate the supported modes. Note that this does not have to correspond to the frequency points where the field data is measured which can be set in the port group. Linear interpolation of the calculated mode profiles between different frequency points will be automatically performed. Since the linear interpolation is typically a good approximation, few frequency points are required for accurate results.
- SELECT MODE: If the "user select" option has been chosen, this will bring up the Mode analysis tab for the user to select from a calculated list of modes. Multiple modes can be selected at once.
- VISUALIZE MODE DATA: This will bring up the Visualizer, showing all the profiles for the selected modes.
- CLEAR MODE DATA: Clears all the mode data.

**Bent waveguide**

When this option is checked, the Bent waveguide solver is used with the following settings.

- BEND RADIUS: Bend radius measured from the center of the port region.
- BEND ORIENTATION: Orientation of the cylindrical coordinate system used for solving for modes. See Bent waveguide solver for a detailed description with illustrations.

**Rotations**

This frame allows user to apply an arbitrary rotation to the calculate modes. The rotation will be rendered in the graphical CAD views.

- THETA: In 3D simulations, this is the angle of propagation, in degrees, with respect to the injection axis of the port. In 2D simulations, it is the angle of propagation, in degrees, rotated about the global Z-axis in a right-hand context, i.e. the angle of propagation in the XY plane.
- PHI: In 3D simulations, this is the angle of propagation, in degrees, rotated about the injection axis of the port in a right-hand context. In 2D simulations, this value is not used.
- OFFSET: Allows users to set an offset to the plane where the modes are calculated. This is useful for ensuring that monitors at an angle do not intersect with unwanted structures.

Note: For best accuracy, we should place ports with rotations on a mesh cell. A useful approach is to add an override mesh region at the same position as the port, and this override region can be infinitely thin (i.e., one of the spans can be 0). |

**Advanced**

- AUTO UPDATE BEFORE ANALYSIS: If checked, the monitor will automatically update the chosen modes when "user select" in MODE SELECTION is selected. The monitor will find the best overlap between the chosen modes and the currently calculated modes, if there are a new set of modes. This allows users to keep track of the same chosen modes even the mode orders are switched, for example, when running a Parameter sweep over the waveguide width. This checkbox can be unselected but it has no effect if "fundamental mode", "fundamental TE mode" or "fundamental TM mode" is chosen in the MODE SELECTION dropdown list.
- MULTIFREQUENCY MODE INJECTION: If checked, the source profile will be calculated at multiple frequency points. This feature is recommended for broadband simulations. If this option is not checked, the same spatial field profile at all frequencies is injected. For single frequency simulations, when this option is checked the spectrum of the generated source pulse will not include a DC component, but the source pulse length may be longer compared to when this option is unchecked.
- NUMBER OF TRIAL MODES: The number of modes specified to look for in order to find a fundamental mode. This will affect the modes that the solver finds. If this number is too small, the desired modes may not be found. Often, setting this number to 100 modes will ensure that no physical modes have been missed. If more than 100 modes exist, then a larger number should be used if one is interested in higher order modes.

## Impedance tab

**Calculate characteristic impedance**

By default, this option is enabled. When enabled, the Z0 characteristic impedance result will be calculated for each of the modes selected in the "Modal Properties" tab using the specified integration region settings. For more information about the characteristic impedance calculation, see Power and impedance integration.

When the CALCULATE CHARACTERISTIC IMPEDANCE box is checked, the following settings are available:

- INTEGRATION SHAPE: Options include circular, and rectangular.
- X1, X2, Y1, Y2 (or Z1, Z2) (valid for rectangular integration): defines the vertices of a rectangle over which the characteristic impedance Z0 is integrated
- CENTER X, CENTER Y (or CENTER Z), RADIUS (valid for circular integration): defines the center and radius of a circle over which the characteristic impedance is integrated

## Results returned

Results are available from the individual port objects inside the Port Group.

** Port modes **

For the following results, the data is only available for the center freqeuncy point before running the simulation. After the simulation has been run, the data is returned as a function of wavelength or frequency.

- NEFF: Effective index of selected modes as a function of n (mode number) and wavelength or frequency.
- IMPEDANCE: Calculated characteristic impedance as a function of n (mode number) and wavelength or frequency.
- MODE PROFILES: E, H mode profiles for each selected mode and refractive index profile as a function of x, y, z position and wavelength or frequency.

** Port modal expansions **

- GROUP DELAY (if enabled): Provides the group delay vs wavelength and n.
- S: Complex S-parameter as a function of n (mode number) and frequency or wavelength.

For example, if port 1 at the left of the device injects the source mode in the forward direction and the S result is being calculated from the monitor at port 2 which is at the right of the device, then S from port 2 can be calculated using $$ \frac{a_{\text{monitor}}*\sqrt{N_{\text{monitor}}}}{a_{\text{source}}*\sqrt{N_{\text{source}}}} $$ where a and N are expansion results defined in the "What is mode expansion" section below. Note that the S-parameters are normalized by the power carried in each mode, and depending on whether the source is propagating in the forward or backward direction and the relative placement of the ports, the expansion calculation will use the appropriate a or b coefficient in the calculation of S since a and b expansion results are the forward and backward complex transmission coefficients.

- EXPANSION FOR PORT MONITOR: A set of expansion results including S (defined above), Ttotal, Tforward,Tbackward, Tnet, a,b, N, and P. Please see the "What is mode expansion" section below and the Using Mode Expansion Monitors page for more information.

** Port monitor results **

- E: Electric field data as a function of position and frequency/wavelength.
- H: Magnetic field data as a function of position and frequency/wavelength.
- P: Poynting vector as a function of position and frequency/wavelength.
- T: Transmission as a function of frequency/wavelength.
- FARFIELD: Farfield data can be obtained. For more information, see Far field projections.

### See also

**Script Commands**addport, geteigensolver, seteigensolver, updateportmodes, clearportmodedata