There are several things that need to be corrected in your script:

1) You need to put the (init-fields) line after (set! sources ...) to properly initialize the source. If (init-fields) comes before the source specification, as in your case, then the source will be effectively ignored which is why your output is all zeros (there is also an error with your amplitude function, see below). This is because the run function will only call (init-fields), which also sets up the sources, if the fields have not been initialized. You can find out exactly what (init-fields) and the run functions are doing by looking at the file libctl/meep.scm.in in the source code.

2) Note that your computational volume does not include a waveguide and is just air: the block used to define your waveguide is the same size as the geometry-lattice and has an epsilon of 1.

3) If you are interested in just the mode propagation within your waveguide, use perfectly-matched layer (PML) absorbing boundaries to absorb outgoing waves. Metallic/magnetic boundaries will produce reflections which interfere with the guided mode(s).

4) Instead of specifying your own continuous wave source which abruptly turns on and therefore excites spurious high-frequency components, use the built-in continuous-src function which has a smooth hyperbolic tangent turn on.

5) Your source amplitude function improperly combines vectors and scalars which produces an error. The source amplitude must be a complex number.

6) If you are trying to excite a single mode of the waveguide, use the eigenmode-source function which is much more efficient at coupling into a particular mode than a point/line source. For more details, see Section 4.3 of our book (arxiv.org/abs/1301.5366) as well as the following tutorial example (http://ab-initio.mit.edu/wiki/index.php/Meep_Tutorial/Optical_forces)

7) Consider exploiting any symmetries intrinsic to your source and structure to reduce the size of the computation. This is especially important in 3d.

On 10/10/2016 09:01 AM, Kapidani Bernard wrote:

Hello I'm new to MEEP. I'm trying to simulate a rectangular waveguide 5 x 2.5 x 10 in size with a PEC termination at the longitudinal end (the z direction) and PEC boundary conditions on the walls (I use millimeters as units of space). Since I don't want to deal with what the field does outside the waveguide, I made the simulation cell the size of the actual waveguide, and I use the low level functions like meep-fields-set-boundary to achieve perfect electric conductors on the boundary of the domain.

Furthermore, I want to set a source at the entrance of the waveguide so that it has the condition of a wave with frequency 5 GHz travelling through the waveguide (which should be mono-modal from 3 to 6 GHz) modulated with the TE_{10} mode spatial basis function. I try to achieve this by setting the plane at z=inf{z} to PMC and setting an y-directed electric current with a custom-src source. I'm interested in probing the tranvserse electring field at the center of the waveguide, but for some reason obscure to me, when i run meep, no field propagates and all the outputs are zero, even if I check the solution on the plane on which I've forced the sources... I attach my input scheme code and apologize for my english (not my first language, I try my best to be intelligible)


(reset-meep)

(define-param az 100)
(define-param ax  50)
(define-param ay  25)
(define-param epsr 1)
(define-param mur  1)
(define-param sigma 0)

(set! resolution (/ 5 6))

(set! geometry-lattice (make lattice (size ax ay az)))

(set! geometry (list
                (make block (center 0 0 0) (size ax ay az)
                      (material (make dielectric (epsilon epsr))))))

(init-fields)
(meep-fields-set-boundary fields Low  X Metallic)
(meep-fields-set-boundary fields High X Metallic)
(meep-fields-set-boundary fields Low  Y Metallic)
(meep-fields-set-boundary fields High Y Metallic)
(meep-fields-set-boundary fields High Z Metallic)
(meep-fields-set-boundary fields Low  Z Magnetic)

(define ( sinwt t)
   (sin (* 2 pi (/ 1 60) t)))

(define (sinx x)
   (sin (* pi (/ (vector3+ x (vector3 (/ ax 2) 0 0)) ax))))

(set! sources (list
               (make source
                 (src (make custom-src (src-func sinwt)))
                 (component Ey)
                 (center 0 0 0)
                 (size   (vector3 ax ay 0))
                 (amp-func sinx))))

(run-until 300
   (to-appended "ey-probe"
      (at-every 0
         (in-point (vector3 0 0 0 ) output-efield-y))))


Thanks in advance,
Bernard

_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to