Code covered by the BSD License  

Highlights from
A CUDA accelerated Beam Propagation Method [BPM] Solver using the Parallel Computing Toolbox

image thumbnail
from A CUDA accelerated Beam Propagation Method [BPM] Solver using the Parallel Computing Toolbox by Patrick Kano
A beam propagation method solver using the CUDA capabilities in the parallel computing toolbox.

FunPlotSim(zidx, PosZ, MeshX, MeshY, nMatrix, Efield, MeshkX, MeshkY, MeshSquarekxy)
function FunPlotSim(zidx, PosZ, MeshX, MeshY, nMatrix, Efield, MeshkX, MeshkY, MeshSquarekxy)
%FUNPLOTSIM A function to plot and save the simulation results at 
% intermediate steps
% Author: Patrick Kano, Paul Lundquist
% Applied Energetics, Inc.
% Modification Dates [M/D/Y]: 10/10/10 - Initial function definition

 if(zidx==1)
  figure(1000);
  pcolor(MeshkX,MeshkY,ifftshift(MeshSquarekxy));
  axis square;
  shading interp;
  xlabel('kx'); 
  ylabel('ky');
  title('kx.^2 + ky.^2');
  colorbar;
 end

 if(mod(zidx,100)~=0) return; end
 
 %%%%%%%%%
 hrefract = figure(1002);
 subplot(1,2,1)
 pcolor(MeshX*1000,MeshY*1000,real(nMatrix));
 shading flat;
 axis square;
 xlabel('mm');
 ylabel('mm');
 title('real(n)');
 colorbar;
 
 subplot(1,2,2)
 pcolor(MeshX*1000,MeshY*1000,imag(nMatrix));
 shading flat;
 axis square;
 xlabel('mm');
 ylabel('mm');
 title('imaginary(n)');
 colorbar;
  
 %%%%%%%%%
 hfield = figure(1003);
 title(['Z = ',num2str(PosZ)]);
 subplot(1,2,1);

 pcolor(MeshX*1000,MeshY*1000,angle(Efield));
 shading flat;
 axis square;
 colorbar;
 title('Angle');
 xlabel('mm');
 ylabel('mm');
 %caxis([-pi pi]);
 
 subplot(1,2,2);
 pcolor(MeshX*1000,MeshY*1000,abs(Efield));
 shading interp;
 axis square;
 colorbar;
 title('Magnitude');
 xlabel('mm');
 ylabel('mm');
 %caxis([0 1]);
 drawnow;
  
 %Save outputs
 StringName = sprintf('Refract_Output_%d',floor(zidx/100));
 saveas(hrefract,StringName,'fig');
 saveas(hrefract,StringName,'jpg');   
  
 StringName = sprintf('Efield_Output_%d',floor(zidx/100));
 saveas(hfield,StringName,'fig');
 saveas(hfield,StringName,'jpg');   

end %function definition

Contact us