You can easily apply spectral filters between subsequent components (in your code different objects of the chi3d class).
For example, the spectral field returned by one object, e.g.
[~,Eftfxfy]=run(SHG,{'pulse1'});
is a matrix with the dimensions [Nt,Nx,Ny].
Spectrum_alpha0 = abs(Eftfxfy(:,end/2,end/2) ).^2;
subplot(2,1,1)
plot(SHG.constVect.lambda,Spectrum_alpha0),xlim([490e-9 510e-9]); %use getSpectrum for the accurate intensity distribution
shows the spectrum of all k-vectors pointing exactly along the z-direction (alpha=0 -> fx and fy = end/2).
The easiest way to filter optical frequencies could be a simple square function applied to the ft dimension of the matrix:
Eftfxfy(SHG.constVect.lambda<499e-9 | SHG.constVect.lambda>500.5e-9,:,:)=0;
Spectrum_alpha0 = abs(Eftfxfy(:,end/2,end/2) ).^2;
subplot(2,1,2)
plot(SHG.constVect.lambda,Spectrum_alpha0), xlim([490e-9 510e-9]);
You can also multiply a complex filter function to the original electrical field in the spectral domain, e.g.
Eftfxfy = meshgrid(spectralFilter,1:Nx,1:Ny).*Eftfxfy;
In this case spectralFilter can be a one dimensional complex vector, e.g.
spectralFilter= Transmission_ft .* exp(i * phase_ft);
The transparency during the simulation is defined by the chosen material (obj.simProp.material) and the data in Materials/medium_transmission.dat.
Tino Lang