overlap  Script command
Returns the overlap and power coupling between two modes calculated by the FDE solver or recorded by frequency monitors from a varFDTD simulation. In FDTD, it calculates the overlap and power coupling between the field profiles (modes) recorded by two frequency monitors.
Overlap measures the fraction of electromagnetic fields that overlap between the two field profiles (modes). This is also the fraction of power from mode2 that can propagate in mode1 (for both forward and backward propagating fields). The absolute value of the entire formula is to ensure it is positive.
$$ {\text { overlap }=\left \operatorname{Re} \left[\frac{(\int \vec{E}_{1} \times \vec{H}_{2}^{*} \cdot d \vec{S}) (\int \vec{E}_{2} \times \vec{H}_{1}^{*} \cdot d \vec{S} ) }{\int \vec{E}_{1} \times \vec{H}_{1}^{*} \cdot d \vec{S} }\right] \frac{1}{ \operatorname{Re} ( \int \vec{E}_{2} \times \vec{H}_{2}^{*} \cdot d \vec{S} )} \right } $$
Syntax 
Description 

out = overlap(mode2, mode1); 

out = overlap(mode2, mode1, x, y,z); 
Mode alignment can be adjusted before overlap is calculated.
The offset is applied to the second mode listed. 
Examples
This example shows how to use the overlap command to calculate the overlap and power coupling between two modes.
copydcard("mode1","test_mode1");copydcard("mode2","test_mode2"); out = overlap("test_mode1","test_mode2"); ?out(1); # overlap?out(2); # power coupling
See Also
List of commands , copydcard , findmodes , coupling , bestoverlap , propagate , expand , expand2 , optimizeposition