Re: [Meep-discuss] How to set incoherent light in meep?
On Sep 11, 2008, at 3:11 AM, phcgroup wrote: I write a part of code to generate a source which has random phase and orientation in time, (set! *random-state* (seed-random-state (current-time))); you mentioned put this at the top of the .ctl file in a former mail, I am not sure if is needed now. That's still needed, otherwise the random numbers will be the same every time you run Meep. Am I right? Well, you have a certain kind of randomness there. Whether this is right depends on whether this is the random distribution that you want. I know If I want a bunch of sources, I need to write a loop. I think I need to write the loop inside (set! sources (list...)), because (set! sources...) will replace the former source when a outside loop call (set! sources...) every time. Am I right? How to write a loop inside (set! sources (list...))? Well, in your loop body you can do (set! sources (append sources (list .))) to add new items to the previous sources list. Steven ___ meep-discuss mailing list meep-discuss@ab-initio.mit.edu http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
[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
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