Comsol farfield computation software
Annoyingly there is a pretty big bug in the way comsol computes the far field of EM models. Comsol have been aware of this for a _long_ time but the bug persists.
Basically it assume that the medium around the model has refractive index = 1. Often this is not the case and if n~=1 then the calculation of the farfield is garbage.

We use a neat trick to keep the incident field regardless of the source term - the field is apodized using a Gaussian wrap-around function that effectively eliminates the cancellation of the terms on opposite sides of the FF source zone. -- Make sure your ff source is away from anything "interesting" in the model!

This package contains an implementation of the Stratton-Chu formulation for computing the farfield from a comsol model in matlab.

calc_farfield_v2.13.tar.gz (2010)

Contains:

calculate_farfield.m ff_example.m nanto0.m shift_aperture.m

Usage: down load and unpack in your matlab / comsol path (or the directory where your model is) - then follow the example given.

A new example with data is given - ff_example.m - this shows the far field distribution as a resonator is scanned in size from "large" to evanescant scale. It takes a few minutes to run but produces a pretty picture.

Sorry for the awful documentation - there is an example! It is only valid for 2d models. I don't maintain this much unless I need it. Ideally comsol will have fixed this before you need it but we waited years and there is no sign that they're going to do owt about it. GPL (c) Matt Clark.