Hi Anatoliy,

There are a few problems in the code you sent.

One fundamental issue is PML thickness.  If you want nice results, your 
PML should be at least one wavelength thick.  In your code, the 
frequency corresponds to a wavelength five times thicker than your PML. 
This means waves are not properly matched by the pml layer, which will 
cause undesirable reflections.  Your two options are to increase the 
frequency, or increase the PML thickness.

Second, there are two ways to make nice continuous plane waves:

1) Periodic boundary conditions in one direction, PML in the other 
direction, and a source plane along one PML boundary.

2) PML in all directions, and a source plane along a PML boundary in 
each direction (if 2d, then two source planes along two PML boundaries, 
if 3d, then three source planes along three PML boundaries).


Prof. Johnson explains how to do the latter somewhere on the mailing 
list.  To do the former, I modified your code as follows:


(define-param sy 6) ; the size of the computational cell NOT including PML 
inthe y direction
(define-param sx 6) ; the size of the computational cell including PML inthe x 
direction
(define-param dpml 4) ; the thickness of PML layer
(define-param svert (+ sy (* 2 dpml)))
(define-param frec 1)
(define-param res 25)
(define-param theta (/ pi 4))

(define kx (* frec (sin theta)))
(define (my-amp-func p)(exp (* 0+2i pi kx (vector3-x p))))

(set! k-point (vector3 kx 0 0))
(set! geometry-lattice (make lattice (size sx svert no-size)))
(set! sources (list
             (make source
              (src (make continuous-src (frequency frec)))
              (component Hz)
              (center 0 (/ sy -2))
              (size sx 0)
              (amp-func my-amp-func))))

(set! pml-layers (list (make pml (thickness dpml) (direction Y))))
(set! resolution res)

(run-until 100
             (at-end (output-png Ex "-Zc dkbluered"))
             (at-end (output-png Ey "-Zc dkbluered")))

I changed some numbers, just to make it run faster.  The important thing 
to note is that there is no PML in the X direction, and the boundary of 
computatation is adjusted accordingly.  The source plane extends from 
the left to the right of the cell.

Also, it may be more convenient for you to use output-png instead of 
h5topng at the command line.

Best,
Matt






On Fri, 14 Dec 2007, Anatoliy Goncharenko wrote:

> Dear Meep users,
>
>
>
> Because the problem of scattering of the plane wave appears to be the
> classical problem, I expect that many people deal with it. Earlier, there
> was a broad discussion on signifying the plane wave source in Meep (see the
> subject oblique plane wave scattering) and some codes were developed.
> However, I am not sure that everything is correct in these codes. For
> checking, I have considered the plane wave in the empty 2d box following the
> way suggested earlier by Steven Johnson and Matt,
>
> http://ab-initio.mit.edu/pipermail/meep-discuss/2007-February/000704.html
>
> http://ab-initio.mit.edu/pipermail/meep-discuss/2007-February/000705.html
>
> (see my file below). Instead of the s-polarized wave, when the electric
> field is normal to the scattering (xy) plane, i.e., when there is the only
> (Ez) component of the electric field, I have dealt with the p-polarized
> wave, when the electric field is in the scattering plane. So, there are two
> components of the electric field, Ex and Ey, and correspondingly the only
> (Hz) component of the magnetic field. For simplicity, I have considered the
> plane wave incident at an angle of 45 degrees. Thus, I have signified Hz and
> computed Ex and Ey. It is clear, that both components, Ex and Ey, must be
> the same due to symmetry. It is easy to see, however, that it is not so: the
> field distribution is different for Ex and Ey. Who can tell me, where is a
> bug?
>
>
>
> Best regards,
>
> Anatoliy
>
>
>
> (define-param sy 10) ; the size of the computational cell including PML in
> the y direction
>
> (define-param sx 10) ; the size of the computational cell including PML in
> the x direction
>
> (define-param dpml 1) ; the thickness of PML layer
>
> (define-param frec 0.2)
>
> (define-param res 25)
>
> (define-param theta (/ pi 4))
>
> (define kx (* frec (sin theta)))
>
> (define (my-amp-func p)(exp (* 0+2i pi kx (vector3-x p))))
>
> (set! k-point (vector3 kx 0 0))
>
> (set! geometry-lattice (make lattice (size sx sy no-size)))
>
> (set! sources (list
>
>            (make source
>
>             (src (make continuous-src (frequency frec)))
>
>             (component Hz)
>
>             (center 0 -4)
>
>             (size 8 0)
>
>             (amp-func my-amp-func))))
>
> (set! pml-layers (list (make pml (thickness dpml))))
>
> (set! resolution res)
>
> (run-until 1000
>
>            (at-end output-efield-x)
>
>            (at-end output-efield-y))
>
>
>
>

_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to