Returns the overlap between the respective mode profiles (modes) of two FEEM calculations, if given two FEEM solver result structs. The command result is a matrix where each row corresponds to a mode in the struct with the highest polynomial order or highest number of elements, and each column corresponds to a mode in the other struct. Suppose the polynomial order and number of elements are identical in both FEEM calculations. In that case, each row corresponds to a mode in the first struct, whereas each column corresponds to the second struct. Note that the FEEM simulation regions must have the same orientation.
Returns the overlap between all modes found in a FEEM calculation and the Fouriertransformed (frequencydomain) field of a DGTD calculation for all frequencies, if given two structs containing a FEEM solver result and a DGTD frequency monitor result, respectively. The command result is a matrix where each row corresponds to a mode in the FEEM struct and each column corresponds to a frequency in the DGTD struct, independent of the order of the input. Note that the FEEM simulation region and the DGTD frequency monitor must have the same orientation apart from the sign.
To construct the input structs, the FEEM solver results of rawFeemFields, rawFeemMesh, and modeproperties are required for a FEEM/FEEM mode overlap. To calculate a FEEM/DGTD mode overlap the frequency monitor results rawDgtdFields and rawDgtdMesh are required in addition. Furthermore, the FEEM simulation region orientation needs to be specified as a vector. The same applies to the DGTD monitor orientation, if in use.
Syntax 
Description 

out = modeoverlap(struct1, struct2); 

out = modeoverlap(struct1, struct2, conjugated); 

Example
The following example shows how to construct the input structs:
rawFeemFields = getresult("FEEM","rawFeemFields");
rawFeemMesh = getresult("FEEM","rawFeemMesh");
modeproperties = getresult("FEEM","modeproperties");
feem_struct = {
"E": rawFeemFields.E,
"H": rawFeemFields.H,
"order": rawFeemMesh.order,
"connectivity": rawFeemMesh.connectivity,
"vertices": rawFeemMesh.vertices,
"normal vector": [0,0,1],
"DoFt": rawFeemFields.DoFt,
"DoFz": rawFeemFields.DoFz,
"kz": modeproperties.kz
};
dgtd_struct = {
"E": rawDgtdFields.E,
"H": rawDgtdFields.H,
"order": rawDgtdMesh.order,
"connectivity": rawDgtdMesh.connectivity,
"vertices": rawDgtdMesh.vertices,
"normalvector": [0,0,1]
};
Using the two structs from above, one can calculate the overlap between the FEEM mode profiles and the frequencydomain DGTD fields:
?modeoverlap(feem_struct, dgtd_struct);
?modeoverlap(feem_struct, dgtd_struct, false);
DGTD Raw Fields/Mesh Data
For a given DGTD calculation the 2D frequency monitor now records the raw Fouriertransformed i.e., frequency domain fields rawDgtdFields as well as the raw mesh data rawDgtdMesh.
rawDgtdFields 
Description 
Dimensions 
Units 

E 
Electric field 
1. number of components 2. number of frequencies 3. number of elements 4. number of DG nodes 
Internal electric field unit 
H 
Magnetic field 
1. number of components 2. number of frequencies 3. number of elements 4. number of DG nodes 
Internal magnetic field unit 
rawDgtdMesh 
Description 
Dimensions 
Units 

vertices 
Mesh vertices of the 2D elements lying on the 2D frequency monitor 
1. number of vertices on the 2D mesh 2. Simulation domain dimension 
Internal length unit 
connectivity 
Map connecting each 2D element to its respective vertices, which are marked by their row number in the rawDgtdMesh.vertices data set 
1. number of 2D elements 2. number of vertices per 2D DG element i.e. 3 
 
FEEM Raw Fields/Mesh Data
For a given FEEM calculation raw i.e., unprocessed mode data rawFeemFields as well as the raw mesh data rawDgtdMesh is now recorded
rawFeemFields 
Description 
Dimensions 
Units 

E 
Electric field 
1. number of components 2. number of modes 3. number of elements 4. number of barycentric FEEM points 
Internal electric field unit 
H 
Magnetic field 
1. number of components 2. number of modes 3. number of elements 4. number of barycentric FEEM points 
Internal magnetic field unit 
rawFeemMesh 
Description 
Dimensions 
Units 

vertices 
Mesh vertices of the 2D elements lying on the 2D frequency monitor 
1. number of vertices on the 2D mesh 2. Simulation domain dimension i.e., 2 
Internal length unit 
connectivity 
Map connecting each 2D element to its respective vertices, which are marked by their row number in the rawDgtdMesh.vertices data set 
1. number of 2D elements 2. number of vertices per 2D FEEM element i.e., 3 
 
See Also
modeexpansion , struct, FEEM solver  Simulation object, DGTD solver  Simulation object