Working with the finite element solvers can present challenges, particularly around the unstructured mesh. Graphical tools such as the dataset builder utility overview can help construct and understand results on a finite element mesh. Alternatively, scripted methods such as unstructureddataset and interptri\interptet can help work with these dataset. One simple case that presents a particular challenge is interpolating between results returned on the vertices and those on the elements.

FEEM returns the optical material properties at the center of the element triangles while the fields are returned on the vertices. This is an important case as many post processing calculations require the permittivity and fields, to be multiplied together which should be done at the exact same points. The attached script interpolates index data onto a higher resolution visualization grid. It then produces results where the material indices and fields are both given on the vertices * F *, and another result where the fields and indices are returned on the elements

*.*

**G**An analogous problem arises in FDTD where the fields are interpolated back to the center of the Yee cell - Calculating absorbed optical power - Higher accuracy. In FEEM and DGTD it is straightforward to preserve interfaces so it is not exactly the same issue; however, this absorption calculation is a good example of the type of post-processing calculations that requires interpolating fields and indices to the same points.

### Example

This example includes a copy of the Feem_Rib_waveguide.ldev, modified to operate at 800nm where absorbtion is significant. The attached script that re-interpolates the results onto a set of common meshes. This then demonstrates how to perform absorbed power calculations in FEEM using either the vertices or elements.

*functions*

*map_index2fields* - Takes the grid and fields datasets, and returns the fields dataset with optical indices interpolated onto the higher resolution mesh elements and vertices.

*map_fields2index* - Takes the grid and fields result from map_index2fields. Additionally requires you to specify the mode and frequency number which is a limitation of the dataset structure for properties returned on the elements. It returns the fields results and optical indices interpolated onto the higher resolution mesh elements.

The Power absorbtion calculations on the elements, and vertices agree very well as we would expect. Although the results on the vertices will always be more resolved, there is some ambiguity, about which index to choose for vertices along the material interfaces, and the fields can be discontinuous here. These two issues, may lead to some systematic errors. On the other hand taking the fields at the center of the elements will reduce the spatial resolution, but the indices and fields are both well defined at these points.

We have included both methods to allow users to compare, and find the correct method for them.