Hi matt, This seems to be a problem of numerical dispersion introduced by the finite grid. When I change the parameters to
(define-param freq 5);frequency (define-param fcut 5);cutoff (define-param fw 0.1);frequency width at turning on the source (define Lpml 0.5) ;thickness of the pml (define L 2 ) ;total size of the space (define tfSize 0.9);edge length of total field area and (set! resolution 250);Set the resolution then the planewave looks nice again. Actually this TFSF works only fine for relativly small TF areas. The reason is that it requires very precise timing for turning on the sources and annihilate the outgoing waves. In the Amplitude functions along the boundary the analytic wavevectors for the given frequency are used but in reality the wavevectors are a bit different due to numerical dispersion. The bigger the TF area gets compared to your wavlength the stronger you will see this! Mybe this effect can be compensated by using slightly different wavevectors but I have not tried. Greetings, Andreas matt wrote: > > > Hi Andreas, > > I also do not understand your code, but when I run it at a different > frequency, some artifacts are visible which illustrate that the > planewave is non-ideal. In particular, the wave fronts are not > perfectly flat lines, but themselves a bit wavy. > > You can see this better by running the following code. This is the > same as the second section of code you posted in your last message, > but the frequency is a bit higher, and the output functions dump the > images directly, and I cleaned up the whitespace/formatting a bit. > > If you look at the Ez png file, you will see the problem. > > Best, > Matt > > > > (define-param phi 45);angle of incidence > (define-param freq 4);frequency > (define-param fcut 5);cutoff > (define-param fw 0.1);frequency width at turning on the source > > (define Lpml 0.5) ;thickness of the pml > (define L 5 ) ;total size of the space > (define tfSize 2);edge length of total field area > > (define sphi (sin (/ (* phi pi) 180))) > (define cphi (cos (/ (* phi pi) 180))) > (define cy (/ 1 sphi)) > (define cx (/ 1 cphi)) > (define kx (/ freq cx)) > (define ky (/ freq cy)) > > (set! resolution 50);Set the resolution > (set! Courant 0.5);Set Courant number > > (define pixel (/ 1.0 resolution));Calculate Size of one cell > (define dT (/ Courant resolution));Calculatetime step > > > (define-param normrun? true) > (define-param RCyl 0.3); Radius of the Cylinder > (define-param nCyl 2.5); Refractive index of cylinder > > (set! force-complex-fields? true) > > (set! geometry-lattice (make lattice (size L L no-size))) > > (if (not normrun?) > (set! geometry > (list > (make cylinder (center 0 0) (radius RCyl) (height infinity) > (material (make dielectric (index nCyl))))))) > > ;; Details of the TFSF source > (define-param n 1.0) ; delay for magnetic source, in time steps > (define-param Ay pixel) ; Amplitude of H source on y sides > > (do ((y (- 0 (/ tfSize 2)) (+ y pixel))) ((> y (/ tfSize 2))) > ;; Sources at -x side > ;; these have to be startet each at a different time so that they are > synchronous to the wave launched at the -x border > ;; (print "build source at y = " y " Start Time = " (/ (+ y (/ tfSize 2)) > cy) "\n") > (set! sources (append sources (list > ;;-x side > (make source > (src (make continuous-src (frequency > freq)(cutoff fcut) (fwidth fw) > (start-time (/ (+ y (/ tfSize > 2)) cy)))) > (amplitude (* (+ cphi) (exp (* 0+2i pi > ky (+ y (/ tfSize 2)))))) > (component Ez) (center (- 0 (/ tfSize > 2)) y) (size 0 0)) > > (make source > (src (make continuous-src (frequency > freq)(cutoff fcut) (fwidth fw) > (start-time (/ (+ y (/ tfSize > 2) (* n dT)) cy)))) > (amplitude (* -1 (exp (* 0+2i pi ky (+ y > (/ tfSize 2)) )) )) > (component Hy) (center (- 0 (/ tfSize > 2)) y) (size 0 0)) > > ;+x side > (make source > (src (make continuous-src (frequency > freq)(cutoff fcut) (fwidth fw) > (start-time (+ (/ (+ y (/ > tfSize 2)) cy) (/ tfSize cx))))) > (amplitude (* (- cphi) (exp (* 0+2i pi > ky (+ y (/ tfSize 2)) )) (exp (* 0+2i pi kx tfSize)) )) > (component Ez) (center (+ 0 (/ tfSize > 2)) y) (size 0 0)) > > (make source > (src (make continuous-src (frequency > freq)(cutoff fcut) (fwidth fw) > (start-time (+ (/ (+ y (/ > tfSize 2) (* n dT)) cy) (/ tfSize cx) )))) > (amplitude (* 1 (exp (* 0+2i pi ky (+ y > (/ tfSize 2)) )) (exp (* 0+2i pi kx tfSize)) )) > (component Hy) (center (+ 0 (/ tfSize > 2)) y) (size 0 0)))))) > > > (do ((x (- 0 (/ tfSize 2)) (+ x pixel))) ((> x (/ tfSize 2))) > ;; Sources at -x side > ;; these have to be startet each at a different time so that they are > synchronous to the wave launched at the -x border > ;; (print "build source at x = " x " Start Time = " (/ (+ x (/ tfSize 2)) > cx) "\n") > (set! sources (append sources (list > ;-y side > (make source > (src (make continuous-src (frequency > freq)(cutoff fcut) (fwidth fw) > (start-time (/ (+ x (/ tfSize > 2)) cx)))) > (amplitude (* (+ sphi) (exp (* 0+2i pi > kx (+ x (/ tfSize 2)) )))) > (component Ez) (center x (- 0 (/ tfSize > 2))) (size 0 0)) > > (make source > (src (make continuous-src (frequency > freq)(cutoff fcut) (fwidth fw) > (start-time (/ (+ x (/ tfSize > 2) (* n dT)) cx)))) > (amplitude (* 1 (exp (* 0+2i pi kx (+ x > (/ tfSize 2)) )) )) > (component Hx) (center x (- 0 (/ tfSize > 2))) (size 0 0)) > ;+y side > > (make source > (src (make continuous-src (frequency > freq)(cutoff fcut) (fwidth fw) > (start-time (+ (/ (+ x (/ > tfSize 2)) cx) (/ tfSize cy))))) > (amplitude (* (- sphi) (exp (* 0+2i pi > kx (+ x (/ tfSize 2)) )) (exp (* 0+2i pi ky tfSize)) )) > (component Ez) (center x (+ 0 (/ tfSize > 2))) (size 0 0)) > > (make source > (src (make continuous-src (frequency > freq)(cutoff fcut) (fwidth fw) > (start-time (+ (/ (+ x (/ > tfSize 2) (* n dT)) cx) (/ tfSize cy) )))) > (amplitude (* -1 (exp (* 0+2i pi kx (+ x > (/ tfSize 2)) )) (exp (* 0+2i pi ky tfSize)) )) > (component Hx) (center x (+ 0 (/ tfSize > 2))) (size 0 0)))))) > > (set! pml-layers (list (make pml (thickness Lpml)))) > > (run-until 20 ;(stop-when-fields-decayed 2 Ez (vector3 (- RCyl pixel) 0) 1e-8) > (at-end > (output-png Ez "-Zc dkbluered") > (output-png Hx "-Zc dkbluered") > (output-png Hy "-Zc dkbluered")) > ) > > > > > > >> Hi Matt and Anatoliy, >> >> there is actually a third way of producing a nice oblique planewave: >> >> because the field of the incident wave is known analytically it can be >> confined in a box inside the simulation area by interfering it away outside >> of this box. All that is needed are sources at all 4 sides switched on at >> the >> correct time and with the correct phase and amplitude. >> The source divides the total area in an total field (TF) area inside and a >> scattered field (SF) area outside. When you place an object in the total >> field area only its scattered field reaches the SF area. >> This reduces the load on the PML so that reflection on the imperfect PML >> does >> not matter so much and makes the scattered field of an object directly >> accessible. >> I attached some sample code for a pulsed an a continuous source of a >> s-polarized wave in 2d for demonstration! >> >> Best regards, >> Andreas >> _______________________________________________ meep-discuss mailing list [email protected] http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

