Hello everyone,

I am trying to model an amplitude function of form exp(-k.r)sin(theta)/r in Cartesian coordinates. This function in cartesian coordinates looks like exp{-i(kx*x+ky*y+kz*z)}sqrt(x*x+y*y)/(x*x+y*y+z*z). So when I use only one variable, say x, then everything works fine. But with two or three variables, I get error.

(define-param fcen 0.0127)
(define-param df 0.01)

(define-param kx (vector3 1 0 0))
(define-param ky (vector3 0 1 0))
(define-param kz (vector3 0 0 1))

(define (my-amp kx ky kz)
(lambda(x y z) (/ (* exp(* 0-i (+ (vector3-dot kx x) (vector3-dot ky y) (vector3-dot kz z))) (sqrt(+ (* x x) (* y y)))) (+ (* x x) (* y y) (* z z))))
)

(set! sources (list
                  (make source
                        (src (make gaussian-src (frequency fcen)(fwidth df)))
(center 0 0 (/ a 2))(size 2.4 2.4 0)(component Hz)(amp-func (my-amp kx ky kz))
                  )
))

Can anyone tell what is wrong with this amplitude function. The error is:-

Backtrace:
In ice-9/boot-9.scm:
 157: 8 [catch #t #<catch-closure 1332a80> ...]
In unknown file:
   ?: 7 [apply-smob/1 #<catch-closure 1332a80>]
In ice-9/eval.scm:
 432: 6 [eval # #]
 432: 5 [eval # #]
In unknown file:
   ?: 4 [primitive-load "src.ctl"]
In ice-9/eval.scm:
 432: 3 [eval # #]
In ice-9/boot-9.scm:
702: 2 [map #<procedure 1d868a0 at ice-9/eval.scm:416:20 (a)> ((# # # # ...))]
In unknown file:
   ?: 1 [meep-fields-add-volume-source # 9 # ...]
In ice-9/eval.scm:
416: 0 [#<procedure 1d86f00 at ice-9/eval.scm:416:20 (a b c)> #(-1.5 -1.5 0.0)]

ice-9/eval.scm:416:20: In procedure #<procedure 1d86f00 at ice-9/eval.scm:416:20 (a b c)>: ice-9/eval.scm:416:20: Wrong number of arguments to #<procedure 1d86f00 at ice-9/eval.scm:416:20 (a b c)>


Thanking you,
Jitendra

_______________________________________________
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