################################################ # Filename: usr_calc_absorption.lsf # Description: This file shows how to calculate # loss per unit volume with a set # of power and index monitors. # It also shows how to integrate the # loss function, and compares the # results with an alternate loss # calculation technique. # Copyright 2009 Lumerical Solutions, Inc. ################################################ clear; closeall; # get monitor data runanalysis("Pabs"); E2 =getresult("Pabs::field","E"); n =getresult("Pabs::index","index"); Pabs=getresult("Pabs","Pabs"); #visualize(Pabs); #visualize(E2); #visualize(n); ################################################ # image a cross section of the field # and index data at y=0, second frequency point image(E2.x*1e6,E2.y*1e6,pinch(E2.E2 ,4,2),"x (um)","y (um)","E^2"); image(n.x*1e6,n.y*1e6,pinch(real(n.index_z),4,2),"x (um)","y (um)","real(n)"); # plot cross section of absorption at y=0, second frequency point image(Pabs.x*1e6,Pabs.y*1e6,pinch(Pabs.Pabs,4,2),"x (um)","y (um)","Absorption"); # get total absorbed power as a function of frequency Pabs_total = getresult("Pabs","Pabs_total"); ?"Wavelength (nm): "+num2str(transpose(c/Pabs_total.f)*1e9); ?"Integrate absorption technique (%): "+num2str((Pabs_total.Pabs_total)*100); ################################################ # check accuracy of total power absorption by comparing with # a box of transmission monitors. Assume no power flows out the sides, # so only two monitors are required. T1=-transmission("T1"); T2=-transmission("T2"); ?"Net transmission technique (%): "+num2str(transpose(T1-T2)*100);