Hello Oliver,
Thanks for the question. This is an area where I admittedly don't understand all the details. In particular I am bit unclear on the constants and normalization, and haven't worked these out rigouously. That being said I can maybe help you pick up the thread for what is happening here.
The get_fom() function returns the phase prefactor from the the compex transmission coefficient. The magnitude of this complex coefficient squared is proportional to the power in the specified mode and is used in the fom calculation. Therfore the phase prefactor is proportional to the fields amplitude at the FOM monitor. The imaginary component (phase) of the scaling factor is then multiplied by the angular frequency.
In the optimization.py 'master script' get adjoin_field_scaling is called at line 841. The phase prefactor is then used in the gradient calculation to scale the adjoint fields, as you would expect - see gradients.py.Â
I hope this helps.