Dear Steven,
I am a new user to meep and quite liking it.
SO far, I succeeded to plot the band diagram of the first 2D photonic
crystal mentioned in the Photonic Book by your group ( Cylinderical
Dielectric rods in a square lattice suspended in air), by defining a
unit cell.
Looking at the in plane transmission and reflection spectrum of the
structure.
The next step is to look at the reflection and transmission from the
surface of the structure. (Imagine if the structure is invariant in z
direction, the light is incident on the x-y plane). So the source is
somewhere on the z axis while the structure is expanded in x-y plane.
Unfortunately it seems running the simulation causes a lot of problem, I
need to restart everything!!! In two cases of different dimension the
error was: std::bad_alloc
I noticed that someone had the same error in a 3D simulation and you
mentioned the problem was with the lack of enough computer memory.
I am not sure if I have chosen the best way to define my structure or
not; I know it gives me the exact structure but is it the best way for
this simulation?! ( In simple word, is my code correct?!; I have used
this code to see the transmission and reflection from a multilayer
dielectric as well and it works fine.)
And would you please tell me what is a supercell?! Will it be helpful in
my case?!
------------------------------------------------------------------------
-------------------------------------
Here is the code:
; 6/5/2008
; A structure of finite thickness of square lattice of cylinderical
rods, no substrate.
; a=1, r=0.2, d=4
; Transmission and reflection
(define-param epsAlu 8.9); Alumina epsilon
(define-param epsAir 1); Air epsilon
(define-param r 0.2); radius of cylinders
; The computational cell is set to be a 2dimensional cell, x-z plane
(set! geometry-lattice (make lattice (size 14 15 20))); I guess the
no-size makes the problem
(define-param epsAlu8.9? false); if true epsAlu=8.9
; The primitive lattice
(set! geometry
(if epsAlu8.9?
(make cylinder (center 0.5 0 0) (radius r) (height 4)
(direction (vector3 0 0 1))
(material (make dielectric (epsilon
epsAlu))))
(make cylinder (center 0.5 0 0) (radius r) (height 4)
(direction (vector3 0 0 1))
(material (make dielectric (epsilon
epsAir))))))
; Place the rods in a square lattice
(set! geometry (geometric-object-duplicates (vector3 1 0 0) 0 4
geometry))
(set! geometry (geometric-objects-duplicates (vector3 -5 0 0) 0 1
geometry))
(set! geometry (geometric-objects-duplicates (vector3 0 1 0) 0 4
geometry))
(set! geometry (geometric-objects-duplicates (vector3 0 -5 0) 0 1
geometry))
; The pml layers
(set! pml-layers (list (make pml (thickness 2.0) )))
; Source
(define-param fcen 0.5) ; pulse center frequency
(define-param df 0.8) ; pulse width (in frequency)
(define-param nfreq 1000)
(set! sources (list
(make source
(src (make gaussian-src (frequency fcen) (fwidth df)))
(component Ey)
(size 14 0 0) ; Not specifying the size would give us a
point source
(center 0 0 -7)
(amplitude 10) )));
; trans flux
(define trans ; transmitted flux
(add-flux fcen df nfreq
(make flux-region
(center 0 0 6) (size 14 0 0))))
; refl flux
(define refl ; reflected flux
(add-flux fcen df nfreq
(make flux-region
(center 0 0 -5) (size 14 0 0))))
;For actual run. it loads the negated normalized spectrum
(if epsAlu8.9? (load-minus-flux "refl-flux" refl))
;(run-sources+
;(stop-when-fields-decayed 50 Ey (vector3 0 0 7) 1e-3)
(run-until 200
(at-beginning output-epsilon)
(during-sources
(in-volume (volume (center 0 0 0) (size 14 0 20))
(to-appended "ey-slice" (at-every 0.5 output-efield-y)))))
;(at-every 0.5 output-efield-y))
;For normalization run, it saves the negated spectrum
(if (not epsAlu8.9?) (save-flux "refl-flux" refl))
(display-fluxes trans refl)
Regards,
Asa
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss