########################################################## # LC_optical_switch.lsf # # Used with LC_optical_swtich.fsp # This script sets up a liquid crystal with orientation # varying along the x-direction based on whether the # cross state or bar state is desired. # # Copyright 2016 Lumerical Solutions Inc. ########################################################## # delete existing attribute select('LC attribute'); delete; # User input properties state=-1; # 1 for cross state, -1 for bar state ac=13.75; # theta at y=0 in degrees theta_max=16; # maximum amplitude of deviation of theta from ac in degrees # define x/y/z x = 0; y = linspace(-2.5e-6,2.5e-6,100); z = 0; X = meshgrid3dx(x,y,z); Y = meshgrid3dy(x,y,z); Z = meshgrid3dz(x,y,z); n = matrix(length(x),length(y),length(z),3); # define the orientation function for(i=1:100) { if(y(i) > 0) { theta=(ac+state*(-theta_max/2.5e-6*y(i)+theta_max))*pi/180; n(1:length(x),i,1:length(z),1) = cos(theta); n(1:length(x),i,1:length(z),3) = sin(theta); } else { theta=(ac+state*(theta_max/2.5e-6*y(i)+theta_max))*pi/180; n(1:length(x),i,1:length(z),1) = cos(theta); n(1:length(x),i,1:length(z),3) = sin(theta); } } n(1:length(x),1:length(y),1:length(z),2) = 0; # add LC import grid attribute LC=rectilineardataset("LC",x,y,z); LC.addattribute("u",n); addgridattribute("lc orientation",LC); setnamed("LC attribute","nx",10); # set resolution setnamed("LC attribute","ny",10); # set resolution setnamed("LC attribute","nz",10); # set resolution