[Meep-discuss] How to set incoherent light in meep?
Dear Steven and other meep user, In a simulation mentioned by a paper, the dipoles were driven by sinusoidal functions with a single frequency, but with random phase factors, while the electric field direction of each dipole was random within the device plane. Could you tell me how to set this? Thank you in advance. sincerely, Li ___ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
[Meep-discuss] calculation won't divergent
Good morning Meep user. I just have a problem with simulation of photonic crystal/photonic wire. I make the periodic structure with some holes with same distance each other but different radius. I put line source in the right edge of computational cell and measure the decay at the left edge. I am confused because the calculation did not show the expected covergence (1e-3), so the simulation could not stop. This is my code ; Some parameters to describe the geometry: (define-param eps 11.9) ; dielectric constant of waveguide (define-param w 1.43) ; width of waveguide (define-param r 0.26) ; radius of holes (define-param d 1.214) ; defect spacing (ordinary spacing = 1) (define-param N 5) ; number of holes on periodic mirror (define-param Ni 4) ; number of holes on inside cavity (define-param No 3) ; number of holes on outside defect ; The cell dimensions (define-param sy 6) ; size of cell in y direction (perpendicular to wvg.) (define-param pad 2) ; padding between last hole and PML edge (define-param dpml 1) ; PML thickness (define sx (+ (* 2 (+ pad dpml N Ni No)) d -1)) ; size of cell in x direction (set! geometry-lattice (make lattice (size sx sy no-size))) (set! geometry (append ; combine lists of objects: (list (make block (center 0 0) (size infinity w infinity) (material (make dielectric (epsilon eps) (geometric-object-duplicates (vector3 1 0) 0 (- N 1) (make cylinder (center (+ (/ d 2) Ni) 0) (radius r) (height infinity) (material air))) (geometric-object-duplicates (vector3 -1 0) 0 (- N 1) (make cylinder (center (- (/ d -2) Ni) 0) (radius r) (height infinity) (material air))) (geometric-objects-duplicates (vector3 (* d -1) 0 0) 0 1 (list (make cylinder (center (/ d 2) 0) (radius 0.187) (height infinity) (material air (geometric-objects-duplicates (vector3 (* (+ d 2) -1) 0 0) 0 1 (list (make cylinder (center (+ (/ d 2) 1) 0) (radius 0.237) (height infinity) (material air (geometric-objects-duplicates (vector3 (* (+ d 4) -1) 0 0) 0 1 (list (make cylinder (center (+ (/ d 2) 2) 0) (radius 0.257) (height infinity) (material air (geometric-objects-duplicates (vector3 (* (+ d 6) -1) 0 0) 0 1 (list (make cylinder (center (+ (/ d 2) 3) 0) (radius 0.242) (height infinity) (material air (geometric-objects-duplicates (vector3 (* (+ d (* 2 N) (* 2 Ni)) -1) 0 0) 0 1 (list (make cylinder (center (+ (/ d 2) N Ni) 0) (radius 0.264) (height infinity) (material air (geometric-objects-duplicates (vector3 (* (+ d (* 2 N) (* 2 Ni) 2) -1) 0 0) 0 1 (list (make cylinder (center (+ (/ d 2) N Ni 1) 0) (radius 0.237) (height infinity) (material air (geometric-objects-duplicates (vector3 (* (+ d (* 2 N) (* 2 Ni) 4) -1) 0 0) 0 1 (list (make cylinder (center (+ (/ d 2) N Ni 2) 0) (radius 0.187) (height infinity) (material air)) (set! pml-layers (list (make pml (thickness dpml (set-param! resolution 20) (define-param fcen 0.5) ; pulse center frequency (define-param df 0.5) ; pulse width (in frequency) (define-param nfreq 50) ; number of frequencies at which to compute flux (set! sources (list (make source (src (make gaussian-src (frequency fcen) (fwidth df))) (component Ey) (center (+ (/ d 2) N Ni 2 1.187) 0) (size 0 w (set! symmetries (list (make mirror-sym (direction Y (define trans ; transmitted flux (add-flux fcen df nfreq (make flux-region (center (+ (/ d 2) N Ni 2 0.187) 0) (size 0 (* w 2) (define trans2 ; transmitted flux (add-flux fcen df nfreq (make flux-region (center 0 0) (size 0 (* w 2) (define trans3 ; transmitted flux (add-flux fcen df nfreq (make flux-region (center (* (+ (/ d 2) N Ni 2 0.187) -1) 0) (size 0 (* w 2) (run-until 500 (at-beginning output-epsilon) (during-sources (to-appended hz (at-every 0.4 output-hfield-z (display-fluxes trans trans2 trans3) ; print out the flux spectrum
[Meep-discuss] transmission larger than 1
Good night meep user I encountered a problem about meep simulation about periodic dielectric, sequence of hole at a block of silicon. I calculate flux at 3 points, the left edge (near the source) , center, and right edge. I calcuate transmission by divide the value of flux at center and left edge with the right edgeI got the surprising result because I saw there some frequencies with transmission value larger than 1. I hope some one can tell me what my mistake is Thank you so much for the help. I provide my code as following ; Some parameters to describe the geometry: (define-param eps 11.9) ; dielectric constant of waveguide (define-param w 1.43) ; width of waveguide (define-param r 0.26) ; radius of holes (define-param d 1.4) ; defect spacing (ordinary spacing = 1) (define-param N 5) ; number of holes on periodic mirror (define-param Ni 4) ; number of holes on inside cavity (define-param No 3) ; number of holes on outside defect ; The cell dimensions (define-param sy 6) ; size of cell in y direction (perpendicular to wvg.) (define-param pad 2) ; padding between last hole and PML edge (define-param dpml 1) ; PML thickness (define sx (+ (* 2 (+ pad dpml N Ni No)) d -1)) ; size of cell in x direction (set! geometry-lattice (make lattice (size sx sy no-size))) (set! geometry (append ; combine lists of objects: (list (make block (center 0 0) (size infinity w infinity) (material (make dielectric (epsilon eps) (geometric-object-duplicates (vector3 1 0) 0 (- N 1) (make cylinder (center (+ (/ d 2) Ni) 0) (radius r) (height infinity) (material air))) (geometric-object-duplicates (vector3 -1 0) 0 (- N 1) (make cylinder (center (- (/ d -2) Ni) 0) (radius r) (height infinity) (material air))) (geometric-object-duplicates (vector3 1 0) 0 (- Ni 1) (make cylinder (center (/ d 2) 0) (radius r) (height infinity) (material air))) (geometric-object-duplicates (vector3 -1 0) 0 (- Ni 1) (make cylinder (center (/ d -2) 0) (radius r) (height infinity) (material air))) (geometric-object-duplicates (vector3 1 0) 0 (- No 1) (make cylinder (center (+ (/ d 2) Ni N) 0) (radius r) (height infinity) (material air))) (geometric-object-duplicates (vector3 -1 0) 0 (- No 1) (make cylinder (center (- (/ d -2) Ni N) 0) (radius r) (height infinity) (material air) (set! pml-layers (list (make pml (thickness dpml (set-param! resolution 20) (define-param fcen 0.25) ; pulse center frequency (define-param df 0.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 Ey) (center (+ (/ d 2) Ni N No r 1) 0) (size 0 w (set! symmetries (list (make mirror-sym (direction Y) (phase -1 (define trans ; transmitted flux (add-flux fcen df nfreq (make flux-region (center (+ (/ d 2) Ni N No r) 0) (size 0 (* w 2) (define trans2 ; transmitted flux (add-flux fcen df nfreq (make flux-region (center 0 0) (size 0 (* w 2) (define trans3 ; transmitted flux (add-flux fcen df nfreq (make flux-region (center (* (+ (/ d 2) Ni N No r) -1) 0) (size 0 (* w 2) (run-sources+ (stop-when-fields-decayed 50 Ey (vector3 (* (+ (/ d 2) Ni N No r) -1) 0) 1e-3) (at-beginning output-epsilon) (during-sources (to-appended hz (at-every 0.4 output-hfield-z (display-fluxes trans trans2 trans3) ; print out the flux spectrum with regard Andika Asyuda - Dapatkan alamat Email baru Anda! Dapatkan nama yang selalu Anda inginkan sebelum diambil orang lain!___ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
[Meep-discuss] shift in fft of meep data
I have a simple gaussian line source between 60 and 300 THz launched into vacuum. I save the field data in an X slice at each time step, then import the data for a point of the slice into matlab. I then plot the FFT of the data, and find that the center frequency is not 180 THz, but something a bit higher (188 THz). I'm pretty certain that the matlab script is correct. Is there something in meep which could be causing the frequency shift? Kind Regards, Matt complete meep script: http://pastebin.com/f40f6a200 matlab fft script: file = hdf5info('pulsetest2-refl-slice.noscat.h5'); refl_noscat = hdf5read(file.GroupHierarchy.Datasets); file = hdf5info('pulsetest2-trans-slice.noscat.h5'); trans_noscat = hdf5read(file.GroupHierarchy.Datasets); a = refl_noscat(:,2); L = length(a); c = 299792458; dt = (1/80)*1e-6/c; NFFT = 2^nextpow2(L); % Next power of 2 from length of data A = fft(a,NFFT)/L; f = (1/dt)/2*linspace(0,1,NFFT/2); y=plot(f,2*abs(A(1:NFFT/2))); grid on; line([180e12 180e12],[0 0.05]); % line representing center freq axis([0 400e12 0 0.05]); ___ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
Re: [Meep-discuss] shift in fft of meep data
On Sep 3, 2008, at 1:19 PM, matt wrote: I'm pretty certain that the matlab script is correct. Is there something in meep which could be causing the frequency shift? No, I can't think of anything in Meep that could cause a frequency shift of that sort, assuming all your units are consistent and correct. However, your Matlab script is slightly off. The number of data points from the DC frequency to the Nyquist frequency, inclusive, is NFFT/2+1, not NFFT/2. So, you should have: f = (1/dt)/2*linspace(0,1,NFFT/2+1); y=plot(f,2*abs(A(1:NFFT/2+1))); if I'm reading your code correctly. (The DC frequency is bin 0 of the DFT, and Nyquist is the N/2-th bin, but because Matlab's indices are 1-based these become 1 and N/2+1, respectively.) Regards, Steven G. Johnson ___ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
Re: [Meep-discuss] How to set incoherent light in meep?
On Sep 3, 2008, at 3:12 AM, phcgroup wrote: In a simulation mentioned by a paper, the dipoles were driven by sinusoidal functions with a single frequency, but with random phase factors, while the electric field direction of each dipole was random within the device plane. Could you tell me how to set this? Thank you in advance. Just add a bunch of sources, one for every point where you want a dipole, with random phases. e.g. (exp (* 0+2i pi (random:uniform))) returns a random complex phase factor. If you need the phases to be varying randomly in time as well, then you would need to use the custom-src object to specify the time- dependence (see the reference manual). Steven ___ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
Re: [Meep-discuss] imaginary part of Dielectric constant for CPP interface in the 0.20 version
On Sep 2, 2008, at 10:41 AM, Yu Liu wrote: I just defined the conductivity function in a similar way as the epsilon function. For the metal part, return the conductivity; for the other part, return 0. Then use the structure::set_conductivity(Dielectric, conductivity) to set the imaginary part. Is it correct? No, you should call set_conductivity(Dx, ...), set_conductivity(Dy, ...), and set_conductivity(Dz, ...) to set an isotropic conducivity. (See the manual for precisely how this relates to the imaginary part of epsilon.) The reason for the three calls is that Meep supports diagonal anisostropic conductivity tensors, so you are setting it along the X, Y, and Z, directions. Also, it supports magnetic conductivities, which are set via Hx, etc. I checked the meep.hpp file, it seems the default averaging option is turned off this time. Averaging was never on by default in the C++ interface. As the real part of the dielectric constant will be a big negative number when using a complex value, This sentence doesn't make any sense. Setting a conductivity, or an imaginary part of epsilon, has no effect on the real part of epsilon in Meep. Steven ___ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
Re: [Meep-discuss] how can I define a time-varying source in meep
On Sep 2, 2008, at 6:25 AM, wxiewen wrote: I want to simulate a non-linear structure that I have to set a source whose amplitude is time-varying. The form I want to set is as folllowing |\ amplitude | /\ | / \ | /\ |/ \ | /\ | / \ | __\ time I use custom-src, but I have no idea about how to define a source with two section via one function . Use an if statement if you want to define your function piecewise. e.g. (define (my-source t) (if ( t 100) ... first function otherwise, second function)) ___ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss