Farfield3dIntegrate function not working in optimization sweep

    • Mike Neville

      Hi all, I am trying to use the farfield3dintegrate function as part of a figure of merit for the FDTD optimasation feature, but am getting a message saying this is not a valid function despite it working fine in the script environment. The code i am using is below.


      E = farfield.E2;


      ux = farfield.ux;


      uy =;



      acceptangle = asin(NA) *360/(2*pi);


      out =1;# farfield3dintegrate(E, ux, uy, acceptangle);

      out1 = farfield3dintegrate(E, ux, uy, 90);


      powernorm= abs(power);


      fom = powernorm * (out/out1);


      Farfield is defined as a result in the optimization fom environment. Can anyone suggest why this function may not be working?

    • Guilin Sun
      Ansys Employee

      Did you use those script inside Optimization ? it only holds certain script to work there. The best way to do this is in the "model".  Then you choose its output as the FOM during the optimization. Please try.

Viewing 1 reply thread
  • You must be logged in to reply to this topic.