When using the Beam Envelopes or the Electromagnetic Waves, Frequency Domain interfaces, one can often have multiple Port boundary conditions that have identical structure, but are at different locations in space. It is often the case, especially for optical and photonics models, that multiple different modes are of interest at these ports, and these modes need to be numerically computed. It is possible to compute all of the modes of interest using just a single Port boundary condition, of type Numeric, and to copy and reuse these solutions to all of the other ports in the model, which will be User-Defined Ports.

The supporting example is shown below: an optical ridge waveguide that does not change shape along the length. A mode of a particular polarization is launched, but other modes can exist due to anisotropic properties that exist in part of the substrate. For this example, the first two modes of propagation are considered.

A schematic of a uniform waveguide with two ports (labeled) and the different modeling domains shown in blue and orange.

A uniform waveguide with two ports that support multiple modes.

Precomputing All of the Modes of the Waveguide

This technique begins with first defining a Numeric Port that will be used to compute all of the modes of interest. Since the Port will not be used directly in the ultimate analysis, give it a Port number of 0 to clearly differentiate it. Apply the Port boundary condition to the boundaries describing the waveguide. For optical waveguides, ensure that the width of the cladding region is large enough that the fields fall off to nearly zero.

A screenshot of the Port Settings window, with the Boundary Selection, Port Properties, and Port Mode Settings sections expanded.
Setting up a single Numeric Port.

Set up a study containing a boundary mode analysis that solves the modes of this Port. In this example, only the first two modes are of interest, so set the Desired number of modes to 2 and set the Search for modes around to an effective mode index of 3.5, which is the highest refractive index in the waveguiding structure. This will compute the first two modes supported by this waveguiding structure at this frequency.

A screenshot of the Settings window for a boundary mode analysis, with the Port name, Mode analysis frequency, Desired number of modes, and Search for modes around options in the Study Settings section highlighted.
Solver settings for computing all of the modes of interest.

Once the study is solved, it is helpful to create plots of the boundary mode electric field to verify the computed modes. It is these fields that will be used in the next step to define a set of user-defined ports.

A side-by-side visualization of the two modes of interest for the model of the waveguiding structure, visualized in a red–white color gradient with black streamline arrows.

Visualization of the two modes of interest.

Applying the Precomputed Modes to the Complete Model

Begin by defining the excitation port, Port 1, on the same set of boundaries where Port 0 was defined. Set the Type of port to User defined and, within the Port Mode Settings section, use the withsol operator to refer back to the eigenvalue solutions previously computed. The third argument to withsol sets the index of the eigenvalue, lambda, to an integer that indexes into all of the computed modes. Use parameters M1=1, M2=2 to simplify setup. Populate both the electric mode field and the propagation constant with the data computed from Study 1, which has the name 'sol1', which can be seen when the study is expanded. So, for example, the previously computed propagation constant to fill in is the expression:

withsol('sol1',ewbe.beta_0, setind(lambda,M1))

A screenshot of the Port settings with the Port Properties and Port Mode Settings sections expanded and the withsol operator highlighted.
Settings for a port to reuse previously computed electric fields and propagation constants that exist at the same boundaries. Note the sol1 name within the first study.

Repeat the above and define Port 2 on the same set of boundaries. This is an unexcited port that will monitor reflections back into the second mode. Set the wave excitation off, and increment the index used, so the expressions will be almost identical to the above, but withM2 instead of M1.

Next, copy the boundary mode data from the input boundaries to the boundaries defining the output ports. To do so, introduce a General Extrusion operator, with settings as shown in the screenshot below. The input and output ports are at identical xy-coordinates, so no change to the mapping of these is needed. The z-expression of z-Length is used here because the output boundaries are offset in the z-direction by the Global Parameter Length. This operator will make the data computed on the input boundaries available on the output boundaries. An alternative approach is to leave the z-expression entirely empty, in both the Source and Destination Map settings. This will extrude the data available on the xy-plane on the source boundaries everywhere along the z-axis.

A screenshot of the General Extrusion Settings window, with the Source Selection, Destination Map, and Source sections expanded.
Settings for the General Extrusion operator that maps data from one boundary to another.

To use this General Extrusion operator, which has the default name genext1, at the other port boundaries, wrap the previously developed expressions with the genext1() operator.

A screenshot of the Port settings with the Electric mode field option set to call a General Extrusion operator.
Screenshot showing how to call the General Extrusion operator to map data between boundaries at different locations in space.

Note that it is a requirement that the meshes on all Port boundaries be identical. When using the beam envelope method in this case, the mesh is swept along the length of this uniform structure, so this condition is automatically fulfilled. However, in the more general case, the Copy Mesh functionality needs to be used to ensure identical meshes. With regards to meshing for this case, the mesh must be sufficiently refined both in the cross-sectional plane and along the length. Since the supported modes in the anisotropic substrate region are slightly different from the isotropic substrate region, the mesh refinement along the length must be studied.

A screenshot of the Mesh Settings window for the waveguide model, with the Physics-Controlled Mesh section expanded and the beam envelope method enabled.
The number of transverse and longitudinal elements in this beam envelope model should be studied as part of the mesh refinement procedure.

When using the beam envelope method, one must enter the average wave vector as an input to the model. The screenshot below shows where the withsol operator is used to input the average propagation constant of the two computed numerical modes. It is assumed there is negligible reflection, so the unidirectional formulation is used.

A screenshot of the Settings window for the Electromagnetic Waves, Beam Envelopes feature, with the Wave Vectors section expanded.
A screenshot of the Settings window for the Electromagnetic Waves, Beam Envelopes feature, with the Wave Vectors section expanded.

When solving, an optional Study Reference can be used to recompute the Port 0 modes before solving the 3D model. Disable Port 0 within the Physics and Variables Selection section, as shown in the screenshot below.

A screenshot of the Settings window for the Wavelength Domain feature in COMSOL Multiphysics, with the Study Settings and Physics and Variables Selection sections expanded.
Screenshot showing that Port 0 is disabled when computing the fields within the model.