I worked this out a few weeks ago. I found some help in the archives of the meep-discuss mailing list, but you wanted working code.
;first, you define a function - this is a 3D Gaussian approximation to the electric field in a single mode fiber (define (my-amp-func p) (exp (- (/ (+ (sqr (vector3-x p)) (sqr (vector3-y p))) (sqr w))))); Gaussian approximation to the spatial field in SMF ;next, use the function in your source defination (set! sources (list (make source (src(make gaussian-src (wavelength lam-center) (width lam-width))) (component Ey) (center 0 0 (- (- (/ lattice-length 2) pml-thickness .5))) (size lattice-size lattice-size 0) (amp-func my-amp-func) ;here is the function defined above ); End Make source ); End list );End set sources ; Source summary: Gaussian frequency distribution centered on 1550 nm. ; Gaussian approximation to SM mode field. ; Located near PML on negative side of Z axis. Good luck! Neal On Mon, Jan 21, 2013 at 12:42 PM, Stecher, Fred <fred.stec...@atk.com>wrote: > Hi,**** > > I recently tried to use the user defined field function following the > example at > http://ab-initio.mit.edu/wiki/index.php/Meep_field-function_examples . > This example is not part of a complete running example. I tried > implementing it in a 3D Meep ctl input that runs and the output was null. > Don’t know what I am doing wrong but a good running example would point me > in the right direction.**** > > ** ** > > Thanks,**** > > ** ** > > Fred**** > > ** ** > > ** ** > > Fred Stecher, Ph.D.**** > > ATK Tactical Propulsion and Ordnance**** > > Engineer VI**** > > ** ** > > E-mail : fred.stec...@atk.com**** > > Phone: 763-744-5117**** > > Mail: ATK Missile Products Division**** > > Tactical Propulsion and Ordnance**** > > MS: MN07-LW58**** > > 4700 Nathan lane N**** > > Plymouth, MN 55442-2512**** > > ** ** > > _______________________________________________ > 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