NanoComp / meep

free finite-difference time-domain (FDTD) software for electromagnetic simulations
GNU General Public License v2.0
1.25k stars 626 forks source link

Normalizing power output with flux monitors #1752

Open cmaurer73 opened 3 years ago

cmaurer73 commented 3 years ago

We are trying to use the meep adjoint optimization to maximize power coupling of two orthogonal dipole sources to two orthogonal waveguides. We are calculating the power in the fundamental mode by taking the square of the first eigenmode coefficient (this is what we use for our optimization objective function). We would like to normalize the power by the total power output by the source by placing six planar flux monitors around it and dividing the squared eigenmode coefficients by the magnitude of the sum of each flux monitor. I have seen examples (on the simpetus website, for example) where this method has been used, but each time the power in the waveguide and the source has been calculated by the same method (i.e. both eigenmode monitors, or both flux monitors). Is it possible to normalize the power calculated by an eigenmode coefficient by the power calculated by the flux? We have made several attempts, but each time our values have been entirely non-physical. If it is possible, are there any caveats like: all the flux monitors must fall within the same material? Any input is appreciated.

oskooi commented 2 years ago

Is it possible to normalize the power calculated by an eigenmode coefficient by the power calculated by the flux?

Yes. Currently, there are only three available objective function classes: EigenModeCoefficient, FourierFields, and Near2FarField. To compute the power radiated by your dipole source and include it as part of your objective function, you would need to compute the Poynting flux manually as EH from the FourierFields using a closed box of monitors surrounding your source. If the power radiated by your source is a constant (because the local density of states is not changing from one run to the next), you can instead use add_flux to create the monitors (similar to the OLED example).