Hi:

I'm trying to calculate the flux from a dipole interacting with a structure.
I want to vary the width of the structure (StripSizeX) with a do loop,
however, the program does not run and simply stops as soon as I starts it.
The ctl file is attached below

do ((StripSizeX 300 (+ StripSizeX 5))) (> StripSizeX 305)
        (set! geometry-lattice (make lattice (size CellSizeX CellSizeY
no-size)))
        (set! geometry (list
                                (make block (center 0 0) (size infinity
infinity infinity)
                                        (material (make dielectric
                                                        (epsilon 1)
                                                )
                                        )
                                )
                                (make block (center 0 0) (size StripSizeX
StripSizeY infinity)
                                        (material (make dielectric
                                                        (epsilon 3.038) ; Ag
eps for 400~1000nm
                                                        (polarizations
                                                        (make polarizability
                                                                (omega
4.9827e-20) (gamma 6.1610e-5) (sigma 1.9376e34)))
                                                )
                                        )
                                )
                               (make block (center 0 0) (size Gap StripSizeY
infinity)
                                        (material (make dielectric
                                                        (epsilon 1) ; air
gap
                                                )
                                        )
                                )
                        )
        )

        (let (
                (totflux
                    (add-flux fcen df nfreq
                        (make flux-region (center SourceX (+ SourceY (*
BoxSizeY -1))) (size (* BoxSizeX 2) 0 ) (weight -1))    ; -y
                        (make flux-region (center SourceX (+ SourceY (*
BoxSizeY 1)))  (size (* BoxSizeX 2) 0 )            )    ; +y
                        (make flux-region (center (+ SourceX (* BoxSizeX
-1)) SourceY) (size 0 (* BoxSizeY 2) ) (weight -1))    ; -x
                        (make flux-region (center (+ SourceX (* BoxSizeX 1))
SourceY)  (size 0 (* BoxSizeY 2) )            )    ; +x
                    )
                )
                (radflux
                    (add-flux fcen df nfreq
                        (make flux-region (center 0 (- (* StripSizeY -0.5)
D)) (size (+ StripSizeX D D) 0) (weight -1))    ; -y
                        (make flux-region (center 0 (+ (* StripSizeY  0.5)
D)) (size (+ StripSizeX D D) 0)            )    ; +y
                        (make flux-region (center (- (* StripSizeX -0.5) D)
0) (size 0 (+ StripSizeY D D)) (weight -1))    ; -x
                        (make flux-region (center (+ (* StripSizeX  0.5) D)
0) (size 0 (+ StripSizeY D D))            )    ; +x
                    )
                )

            )
        (run-sources+ (stop-when-fields-decayed (/ 12 fcen) Ex (vector3
SourceX (+ SourceX (* BoxSizeX -1))) 1e-3)
                                (at-beginning output-epsilon)
                                ;(after-sources (harminv Hz (vector3 SourceX
SourceY) fcen df))
        )
        (display-fluxes totflux radflux)
        )
)



I'd also like to save the flux data to a different file for each geometry.
Can I simply add the following inside the do loop:
(set-param! filename-prefix StripSizeX)
(save-flux TotalFlux totflux)

I'm not sure how to construct the filename-prefix from a variable. Do I have
to create a string somehow before I can use it in (set-param!
filename-prefix) ?
Thank you.


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

Reply via email to