Photonics

Photonics

Topics related to Lumerical and more.

Some problems in the case base(“Diffuse Scattering Film for Automotive Display”)

    • jie li
      Subscriber

      When simulating the case ("Diffuse Scattering Film for Automotive Display") in the case base, I found that some of the script commands as as follows. What is the meaning of " norm_calc = exp( -(Theta/beam_width)^2 ); "

      norm_calc = exp( -(Theta/beam_width)^2 ); # Where Theta_out is the matrix of reflection angles,and Theta =                                                                                                meshgridx(theta_out,phi_out); beam_width=2

      beam_norm = integrate(norm_calc*sin(Theta*pi/180),1:2,theta_out*pi/180,phi_out*pi/180);

      beam_norm = 1/beam_norm;

      BTDF(fc,1,1,:,:) = pinch(BTDF(fc,1,1,:,:)) + beam_norm*Ttotal(fc)*order_T(n,m,fc)*exp( -(ThetaDiff/beam_width)^2 );

      The complete code is as follows:

      theta_out = linspace(0, 90, n_theta_out);

      phi_out = linspace(0, 360, n_phi_out);

       

      monitor_nameT = "T";

      monitor_nameR = "R";

       

      f = getdata(monitor_nameT,"f");

      lambda = c/f;

       

      # Get refractive indices

      dim = getdata("R", "dimension");

      if ( (dim==2) & (%polarization angle% == 90) ) {

      index_R = real(getdata("index_R", "index_z"));

      index_T = real(getdata("index_T", "index_z"));

      } else {

      index_R = real(getdata("index_R", "index_x"));

      index_T = real(getdata("index_T", "index_x"));

      }

      # calculate Theta and Phi grids

      Theta = meshgridx(theta_out,phi_out);

      Phi = meshgridy(theta_out,phi_out);

      Ux = sin(Theta*pi/180)*cos(Phi*pi/180);

      Uy = sin(Theta*pi/180)*sin(Phi*pi/180);

      Uz = cos(Theta*pi/180);

      norm_calc = exp( -(Theta/beam_width)^2 );

      beam_norm = integrate(norm_calc*sin(Theta*pi/180),1:2,theta_out*pi/180,phi_out*pi/180);

      beam_norm = 1/beam_norm;

       

      Ttotal = abs(transmission(monitor_nameT));

      if (dist>0) {

      Rtotal = 1 - abs(transmission(monitor_nameR));

      } else {

      Rtotal = abs(transmission(monitor_nameR));

      }

       

      # T

      BTDF = matrix(length(lambda),1,1,length(theta_out),length(phi_out));

      Ttest = matrix(length(lambda));

      order_T = grating(monitor_nameT, 1:length(f), index_T, direction);

      order_T_ux = gratingu1(monitor_nameT, 1:length(f), index_T, direction);

      order_T_uy = gratingu2(monitor_nameT, 1:length(f), index_T, direction);

      for(fc = 1:length(f)) {

      for(n=1:length(order_T_ux(:,fc))) {

      for(m=1:length(order_T_uy(:,fc))) {

      order_uz = sqrt( 1 - order_T_ux(n,fc)^2 - order_T_uy(m,fc)^2 );

      if( (order_T(n,m,fc)!= 0) & (imag(order_uz) == 0.) ) {

      Tux = cos(-phi_in*pi/180)*order_T_ux(n, fc) - sin(-phi_in*pi/180)*order_T_uy(m, fc);

      Tuy = sin(-phi_in*pi/180)*order_T_ux(n, fc) + cos(-phi_in*pi/180)*order_T_uy(m, fc);

      ThetaDiff = real(acos( Ux*Tux + Uy*Tuy + Uz*order_uz ) * 180/pi);

      BTDF(fc,1,1,:,:) = pinch(BTDF(fc,1,1,:,:)) + beam_norm*Ttotal(fc)*order_T(n,m,fc)*exp( -(ThetaDiff/beam_width)^2 );

      }

      }

      }

      }

      Ttest = real(integrate(pinch(BTDF)*sin(Theta*pi/180),1:2, theta_out*pi/180, phi_out*pi/180));

    • Greg Baethge
      Ansys Employee

      Hi Jie Li, thanks for posting your question. In this workflow, the BSDF is calculated using grating projection. The number of grating orders will depend on the width of the simulation region. In our initial example, this width was used to control the "resolution" of the BSDF.

      For the export to Speos, the BSDF is calculated on a fixed grid. To do so, we map each grating order with a Gaussian beam of fixed width (beam_width). "beam_norm" is used as a normalisation factor to make sure power is conserved in the process. 

Viewing 1 reply thread
  • You must be logged in to reply to this topic.