Dear Allesio, as far as I know, the random white light sources such as a lamp are rarely used in simulations. If one wants to obtain the broadband spectra, there is nothing more convenient than exciting one ultrashort pulse, possibly even half-cycle. However, it should be also possible to generate random Planck-law radiation waveform and to define a source that emits the corresponding field. (But I cannot imagine the use case.) So I recommend launching an ultrashort pulse instead. Regards, F.
2013/5/21, alessio <alessiotie...@gmail.com>: > Dear > > I am trying to simulate an inverse opal > illuminated by a white lamp, but i can make the souce > correctly > > I try the following code: > > > > with in particular the source > > > ;sources > (define-param lam 3.3) ; wavelength = 3.3um > (define-param lam_max 0.9) ; max wavelength = 5.3um > (define-param lam_min 0.6) ; min wavelength = 1.3um > > (define-param fmin (/ 1 lam_max)) ; min frequency > (define-param fmax (/ 1 lam_min)) ; max frequency > > > (define-param wid (- fmax fmin)) ; spectral pulse width > > (set! sources (list > (make source > (src (make continuous-src (frequency fcen) (width wid))) > (component Ex) > (center 0 0 (+ pmlt (* -0.5 sz))) > (size sx sy 0)) > )) > > > the full code below > > The code work fine for gaussian beam but take long time > for continuos > > Any idea ? > > Kind Regards > > > ; transmittance/reflectance of a fcc structure > (set! eps-averaging? false); No epsilon averaging > > > ;-------------------EXTERNAL PARAMETERS----------------------------------- > (define-param r_sph 0.3536); Oxide spheres radius > (define-param r_max (/ 1 (sqrt 6))); Thickness of the Si layer grown inside > > the opal > (define-param nl 3) ; number of periods = (3 layers each) > (define-param pmlt 0.5) ; if true (1), have air, false (0), PhC > (define-param pad 10); distance between source and sample > (define-param no-phc 1) ; if true (1), have air, false (0), PhC > > (define-param a 300) ; Center-to-center distance > > ;--------------CELL DIMENSIONS----------------------------------------- > (define unitcell (sqrt 3)) ; size of the unitcell in Z > (define distz (/ 1 (sqrt 3))); distance between single layers > > (define sx (/ 1 (sqrt 2))) ; size of cell in X direction > (define sy (sqrt 1.5)) ; size of cell in Y direction > (define sz (+ (* 2 pad) (* 2 pmlt) (round (+ 0.5 (* nl unitcell))))) ; size > > of cell in Z direction > > (set! geometry-lattice (make lattice (size sx sy sz))) > > ;------------------USEFUL VALUES---------------------------------------- > (define sx_half (/ sx 2)); (1/sqrt(8)) > (define sy_half (/ sy 2)); (sqrt(3)/sqrt(8)) > (define sy_sixth (/ sy 6)); (1/sqrt(3x8)) > (define nsx_half (/ sx -2)); -(1/sqrt(8)) > (define nsy_half (/ sy -2)); -(sqrt(3)/sqrt(8)) > (define nsy_sixth (/ sy -6)); -(1/sqrt(3x8)) > (define cell_center (* unitcell (+ 0.5 (* -0.5 nl)))); z-coordinate of the > first unit cell > (define bottom_sample (+ (* unitcell (- nl 1)) cell_center distz (/ 1 (sqrt > > 8)) > )) ; Z coordinate bottom of spheres > (define substrate_centerZ (+ (/ sz 4) (/ bottom_sample 2))) > (define substrate_sizeZ (- (/ sz 2) bottom_sample)) > > ;----------------MATERIALS----------------------------------------------- > (define PMMA (make dielectric (epsilon (* 1.48 1.48)))) > (define silk (make dielectric (epsilon (* 1 1 )))) > > > ;--------------GEOMETRY------------------------------------------------- > (set! geometry > (if (= no-phc 1) > (list > (make sphere (center 0 0 0) (radius r_sph) (material air)) > (make block (center 0 0 substrate_centerZ) (material silk) > (size sx sy substrate_sizeZ)) ; substrate > ) > (append > > > ;SILK > (list (make block (center 0 0 0) (material silk) > (size sx sy sz))) ; silk > > ;OPAL OF AIR SPHERES > (geometric-objects-duplicates (vector3 0 0 unitcell) 0 (- nl 1) > (list > ;Layer A - oxide > (make sphere (center nsx_half nsy_sixth (- cell_center > distz)) > (radius r_sph) > (material air)) > (make sphere (center sx_half nsy_sixth (- cell_center > distz)) > (radius r_sph) > (material air)) > (make sphere (center 0 (+ nsy_sixth nsy_half) (- > cell_center > distz)) (radius r_sph) > (material air)) > (make sphere (center 0 (* 2 sy_sixth) (- cell_center distz)) > > (radius r_sph) > (material air)) > ;Layer B - oxide > (make sphere (center nsx_half sy_half cell_center) > (radius r_sph) > (material air)) > (make sphere (center nsx_half nsy_half cell_center) > (radius r_sph)(material air)) > (make sphere (center sx_half sy_half cell_center) (radius > r_sph) > (material air)) > (make sphere (center sx_half nsy_half cell_center) > (radius r_sph)(material air)) > (make sphere (center 0 0 cell_center) (radius r_sph) > (material air)) > ;Layer C - oxide > (make sphere (center nsx_half sy_sixth (+ cell_center > distz)) > (radius r_sph) > (material air)) > (make sphere (center sx_half sy_sixth (+ cell_center distz)) > > (radius r_sph) > (material air)) > (make sphere (center 0 (+ sy_sixth sy_half) (+ cell_center > distz)) (radius r_sph) > (material air)) > (make sphere (center 0 (* 2 nsy_sixth) (+ cell_center > distz)) > (radius r_sph) > (material air)) > )) > > ;SUBSTRATE > (list (make block (center 0 0 substrate_centerZ) (material silk) > (size sx sy substrate_sizeZ))) ; substrate > ))) > > ;--------------SOURCES------------------------------------------------- > > > (define-param fcen 0.8) ; pulse center frequency > (define-param df 2) ; pulse width (in frequency) > (define-param nfreq 500) ; number of frequencies at which to compute flux > > ; (set! sources (list > ; (make source > ; (src (make gaussian-src (frequency fcen) (fwidth df))) > ; (component Ex) > ; (center 0 0 (+ pmlt (* -0.5 sz))) > ; (size sx sy 0)) > > ; )) > > ;sources > (define-param lam 3.3) ; wavelength = 3.3um > (define-param lam_max 0.9) ; max wavelength = 5.3um > (define-param lam_min 0.6) ; min wavelength = 1.3um > > (define-param fmin (/ 1 lam_max)) ; min frequency > (define-param fmax (/ 1 lam_min)) ; max frequency > > > (define-param wid (- fmax fmin)) ; spectral pulse width > > (set! sources (list > (make source > (src (make continuous-src (frequency fcen) (width wid))) > (component Ex) > (center 0 0 (+ pmlt (* -0.5 sz))) > (size sx sy 0)) > )) > > > ;-----------RESOLUTION, PERIODICAL BOUNDARIES, PML----------------- > > (set-param! k-point (vector3 0)) > (set! pml-layers (list (make pml (direction Z) (thickness pmlt)))) > (set-param! resolution 20) > > ;--------------FLUX---------------------------------------------------- > (define-param nfreq 500) ; number of frequencies at which to compute flux > (define trans ; transmitted flux > (add-flux fcen df nfreq > (make flux-region > (center 0 0 (- (/ sz 2) 0.5 pmlt)) (size sx sy 0)))) > (define refl ; reflected flux > (add-flux fcen df nfreq > (make flux-region > (center 0 0 (+ 5 pmlt (* -0.5 sz))) (size sx sy 0)))) > > > ;-------------RUN----------------------------------------------- > > ; for normal run, load negated fields to subtract incident from refl. > fields > (if (= no-phc 0) (load-minus-flux "refl-flux" refl)) > > (run-sources+ 200 > (at-beginning output-epsilon)) > > ; for normalization run, save flux fields for refl. plane > (if (= no-phc 1) (save-flux "refl-flux" refl)) > > (display-fluxes refl trans) > > > > _______________________________________________ > meep-discuss mailing list > meep-discuss@ab-initio.mit.edu > http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss > _______________________________________________ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss