Guilin Sun
Ansys Employee

Sorry to reply you late. Somehow your reply is passed without notification.

First, you need to get H field from farfieldexact https://optics.ansys.com/hc/en-us/articles/360034930733-farfieldexact3d-Script-command by following the example. Once you have the field components, the integration is relatively easy. When it is in the xy plane:

Poyn=Ex*conj(Hy)-Ey*conj(Hx);

Pf=0.5*real(integrate(Poyn,[1:2],x,y);

integrate - Script command

You may need to pinch some singuletones: pinch - Script command 

Please try and let me know if you have questions in scripting.