This section provides some further information about the overlap calculation of MODE. The overlap function is typically used to measure the field overlap and power coupling between an input mode from one waveguide and all of the modes of a second waveguide.
The arbitrary input fields, labeled \(\mathbf{E_{in}}\) and \(\mathbf{H_{in}}\) are incident upon a surface and give rise to the output fields \(\mathbf{E}_{out}\) and \(\mathbf{H_{out}}\). The input power is given by \(P_{in} = \frac{1}{2} Re[\int d\mathbf{S}\cdot\mathbf{E_{in}}\times\mathbf{H_{in}^{*}}]\) while the output power is given by \(P_{out} = \frac{1}{2} Re[\int d\mathbf{S}\cdot\mathbf{E_{out}}\times\mathbf{H_{out}^{*}}]\). Any fields can be decomposed into a basis of orthogonal modes (see Marcuse or Snyder and Love Waveguide book)
$$\mathbf{E} = \sum_i a_{i} \mathbf{e_{i}}$$
$$\mathbf{H} = \sum_i b_{i} \mathbf{h_{i}}$$
The basis modes are orthogonal in the sense
$$ \delta_{ij} = \frac{\int \mathbf{e}_{i}\times\mathbf{h}_{j}^{*}\cdot d\mathbf{S}}{\int \mathbf{e}_{i}\times\mathbf{h}_{i}^{*}\cdot d\mathbf{S}} $$
and, for propagating modes, \(\int d\mathbf{S}\cdot\mathbf{e}_{i}\times\mathbf{h}_{i}^{*}\) is real.
At the interface, the tangential components of the electric and magnetic fields are continuous:
$$\mathbf{E}_{in}^{\perp}+\mathbf{E}_{refl}^{\perp} =\mathbf{E}_{out}^{\perp}$$
$$\mathbf{H}_{in}^{\perp} - \mathbf{H}_{refl}^{\perp}=\mathbf{H}_{out}^{\perp}$$
If we assume that the reflected field is small, we can simply decompose the input (or output) field onto the basis state of the output waveguide:
$$\mathbf{E}_{in} = \mathbf{E}_{out} =\sum_i a_{i} \mathbf{e}_{i}$$
$$\mathbf{H}_{in} = \mathbf{H}_{out} = \sum_i b_{i} \mathbf{h}_{i}$$
where the ai and bi coefficients can be calculated from
$$ a_{i} = \frac{\int \mathbf{E}_{in}\times\mathbf{h}_{i}^{*}\cdot d\mathbf{S}}{\int \mathbf{e}_{i}\times\mathbf{h}_{i}^{*}\cdot d\mathbf{S}} $$
$$ b_{i}^{*} = \frac{\int \mathbf{e}_{i}\times\mathbf{H}_{in}^{*}\cdot d\mathbf{S}}{\int \mathbf{e}_{i}\times\mathbf{h}_{i}^{*}\cdot d\mathbf{S}} $$
The total power propagating in the output fields is
$$P_{out} = 0.5\cdot Re\left\{\int \mathbf{E}_{out}\times\mathbf{H}_{out}^{*}\cdot d\mathbf{S}\right\}$$
$$= 0.5\cdot Re\left\{\int (\sum_ia_{i}\mathbf{e}_{i})\times(\sum_jb_{j}\mathbf{h}_{j})\cdot d\mathbf{S}\right\}$$
$$= 0.5\cdot \sum_i Re\left\{a_{i}b_{i}^{*}\int \mathbf{e}_{i}\times\mathbf{h}_{i}^{*}\cdot d\mathbf{S}\right\}$$
and therefore, the power coupling coefficient propagating in the the ith mode over the total input power is
$$\frac{P_{i}}{P_{in}} = \frac{Re\left\{a_{i}b_{i}^{*}\int \mathbf{e}_{i}\times\mathbf{h}_{i}^{*}\cdot d\mathbf{S}\right\}}{Re\left\{\int \mathbf{E}_{in}\times\mathbf{H}_{in}^{*}\cdot d\mathbf{S}\right\}}$$
$$\frac{P_{i}}{P_{in}} = Re\left\{ \frac{(\int \mathbf{e}_{i}\times\mathbf{H}_{in}^{*}\cdot d\mathbf{S})(\int \mathbf{E}_{in}\times\mathbf{h}_{i}^{*}\cdot d\mathbf{S})}{\int \mathbf{e}_{i}\times\mathbf{h}_{i}^{*}\cdot d\mathbf{S}}\right\} \frac{1}{Re(\int \mathbf{E}_{in}\times\mathbf{H}_{in}^{*}\cdot d\mathbf{S})}$$
This result tells us how much power can propagate in the ith mode from a given input field. However, the above calculation assumed that the reflected fields were negligible. In reality there is some reflected field and this leads to different ai and bi coefficients. Indeed, when the ai and bi coefficients are different, it means that some of the field must be reflected because the relative amplitudes of E and H cannot be decomposed into forward propagating modes only. A better result can be found by assuming that the reflected field has the same profile as the incoming field, and this is what is done by MODE to calculate the power coupling. The simplest case to be considered is a plane wave incident on a dielectric interface (air to an index of n). There is obviously a perfect "overlap" between plane waves on both sides of the interface. However, if the ai coefficient for the decomposition of Ein is 1, then the bi coefficient will be n. (For plane waves H = n*sqrt(eps0/mu0)). For the plane wave this leads to the well known results that r=(n-1)/(n+1)), making it possible to calculate the power coupling between an incident field into the forward propagating ith mode. For an exact result, it is necessary to know the complete set of waveguide modes on both the input and output sides.
Note: The overlap calculation that is described here may not be accurate for waveguides or fibers with loss.