We have an exciting announcement about badges coming in May 2025. Until then, we will temporarily stop issuing new badges for course completions and certifications. However, all completions will be recorded and fulfilled after May 2025.

Ansys Learning Forum Forums Discuss Simulation Photonics Metalens-Optical Power Reply To: Metalens-Optical Power

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.