Far-Field Calculations Theory
The far electromagnetic field from, for example, antennas can be calculated from the near field using the Stratton-Chu formula. In 3D, this is:
and in 2D it looks slightly different:
In both cases the integration is performed on a closed boundary. In the scattered field formulation, where the total electric field is the sum of the background field and the scattered field, the far-field only gets contributions from the scattered field, since the contributions from the background field cancel out when integrated over all parts of the closed boundary.
For scattering problems, the far field in COMSOL Multiphysics is identical to what in physics is known as the “scattering amplitude”.
The antenna is located in the vicinity of the origin, while the far-field point p is taken at infinity but with a well-defined angular position . 
In the above formulas,
E and H are the fields on the “aperture”—the surface S enclosing the antenna.
r0 is the unit vector pointing from the origin to the field point p. If the field points lie on a spherical surface S', r0 is the unit normal to S'.
n is the unit normal to the surface S.
η is the impedance:
k is the wave number.
λ is the wavelength.
r is the radius vector (not a unit vector) of the surface S.
Ep is the calculated far field in the direction from the origin towards point p.
Thus the unit vector r0 can be interpreted as the direction defined by the angular position and Ep is the far field in this direction.
Because the far field is calculated in free space, the magnetic field at the far-field point is given by
The Poynting vector gives the power flow of the far field:
Thus the relative far-field radiation pattern is given by plotting |Ep|2.