-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dear Meepers,
I am trying to define a polarizability with spatially varying sigma.  My code
reads, in part:

        (make polarizability
                (omega omega_in)
                (gamma omega_in)
                (delta-epsilon (/ 1 omega_in))
                (sigma sigma_func)
        )

sigma_func is a function of a single variable that returns a number.
When I run this code, I get an error:
ERROR: wrong type for property sigma type number

The Meep Reference says sigma is a number, consistent with the error.  The page
on Dielectric Materials in Meep says sigma is a user-specified function of
position.  *Does anyone have an example .ctl file in which they successfully
used a spatially varying sigma?*

I attach my .ctl file, for the curious.

- --Ben
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHDrPhUJT6e6HFtqQRAqkQAJ9Llc2wk9CqOFrnUgt534kKJpsX9wCeJm1d
Ig7kOXiUpAUfVnSLiOa3ZJ0=
=ud15
-----END PGP SIGNATURE-----
(set! eps-averaging? false)
(define my_freq 1)
(set! geometry (list))

(define (initialize-polarizability p)
        (set! geometry (cons
                (make block     (center infinity)
                                (size 0 0 0) 
                                (material (make dielectric (epsilon 1) 
(polarizations p)))
                )
                geometry
        ))
)

(define (make-polarizability-from-conductivity sigma_func omega_in)
        (make polarizability
                (omega omega_in)
                (gamma omega_in)
                (delta-epsilon (/ 1 omega_in))
                (sigma sigma_func)
        )
)

(define (make-mat-from-eps-and-sigma eps_func sigma_func omega_in)
        (let ((p (make-polarizability-from-conductivity sigma_func omega_in)))
                (initialize-polarizability p)
                (make material-function (material-func (lambda (v)
                        (make dielectric (epsilon (eps_func v)) (polarizations 
p))
                )))
        )
)

(define my-mat (make-mat-from-eps-and-sigma
                (lambda (v) 1)
                (lambda (v) 200)
                my_freq
))

(set! geometry-lattice (make lattice (size 2 2 no-size)))
(set! geometry (cons
        (make block (center 0 0) (size 1 1 infinity) (material my-mat))
        geometry
))

(set! sources (list
               (make source
                 (src (make continuous-src (frequency my_freq) (start-time 0) 
(end-time infinity) (width (/ 10 my_freq))))
                 (component Ez)
                 (center -0.6 -0.2))))
(set! pml-layers (list (make pml (thickness 0.25))))
(set! resolution 256)
(define my_endtime 20)
(run-until my_endtime
           (at-beginning output-epsilon)
           (at-time (- my_endtime (/ 1 my_freq)) output-hfield)
           (at-time (- my_endtime (/ 0.75 my_freq)) output-hfield)
           (at-time (- my_endtime (/ 0.5 my_freq)) output-hfield)
           (at-time (- my_endtime (/ 0.25 my_freq)) output-hfield)
           (at-time my_endtime output-hfield))
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to