########################################################################### # Scriptfile: far_field_projecion.lsf # # Description: # This file will perform far field projection and the projected far foield data # will be written in far_field_projection.fld file. # This fld file will be impored to overlap.lms and/or mode_expansion.fsp # to perform overlap and/or power coupling calculation. # Copyright 2012, Lumerical Solutions, Inc. ########################################################################### num=25; # resolution # define far field plane to image fields x=linspace(-20e-6,20e-6,num); y=x; z=1.5e-3; # compute far field E=farfieldexact3d("far",x,y,z); # select component Ex=pinch(E,4,1); Ey=pinch(E,4,2); Ez=pinch(E,4,3); # image intensity E2= abs(Ex)^2 + abs(Ey)^2 + abs(Ez)^2; image(x*1e6,y*1e6,E2,"x (micron)","y (micron)","Electric field at z=1.5mm from source"); lambda = 650e-9; refractive_index = 1; z = 0; # this is z z-normal source # now we creat a 2d surface X = meshgridx(x,y); Y = meshgridy(x,y); # don't modify the following commands dx = x(2)-x(1); dy = y(2)-y(1); # fill in the variables needed for createsource.lsf include_H = 0; # 1: H fields are defined, 0: H fields defined from E fields wavelength = lambda; power = 1; index = refractive_index; axis1 = 1; # x axis axis2 = 2; # y axis min1 = x(1)-dx/2; max1 = x(length(x)) + dx/2; min2 = y(1)-dy/2; max2 = y(length(y)) + dy/2; depth = z; n1 = length(x); n2 = length(y); sourcefilename = "ff_sourcefile"; #create the source by calling usr_create_fld.lsf usr_create_fld;