You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to randomized the position and the phase of these dipole emitters in my model and I would like to inspect their position before running my model. Can anyone check if my code is correct? and how can I visualize the dipoles in Paraview?
;; to generate random number
(define random-num (lambda ()
(let ((time (gettimeofday)))
(set! random-state (seed->random-state (+ (car time) (cdr time)))))
(if (> (random:uniform) 0.5) (random:uniform) (* -1 (random:uniform)))))
;; to generate random dipoles
(define-param perp-dipole? true)
(define src-cmpt (if perp-dipole? Ez Ex)) ; current source component
(define-param num-src 10) ; number of point sources
(set! sources
(map (lambda (cz)
(make source
(src (make gaussian-src (frequency fcen) (fwidth df)))
(component src-cmpt)
(center (* 0.1 cz) (* 0.1 cz) (* 0.1 cz)))
(amplitude (exp (* 0+2i pi (abs (random-num)))))))
(arith-sequence (/ num-src) (/ num-src) num-src)))
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all, I am looking into these two examples and I am using Paraview to inspect my model,
(1) http://simpetus.com/projects_scheme.html#meep_oled
(2) https://meep.readthedocs.io/en/latest/Scheme_Tutorials/Custom_Source/#stochastic-dipole-emission-in-light-emitting-diodes
I would like to randomized the position and the phase of these dipole emitters in my model and I would like to inspect their position before running my model. Can anyone check if my code is correct? and how can I visualize the dipoles in Paraview?
;; to generate random number
(define random-num (lambda ()
(let ((time (gettimeofday)))
(set! random-state (seed->random-state (+ (car time) (cdr time)))))
(if (> (random:uniform) 0.5) (random:uniform) (* -1 (random:uniform)))))
;; to generate random dipoles
(define-param perp-dipole? true)
(define src-cmpt (if perp-dipole? Ez Ex)) ; current source component
(define-param num-src 10) ; number of point sources
(set! sources
(map (lambda (cz)
(make source
(src (make gaussian-src (frequency fcen) (fwidth df)))
(component src-cmpt)
(center (* 0.1 cz) (* 0.1 cz) (* 0.1 cz)))
(amplitude (exp (* 0+2i pi (abs (random-num)))))))
(arith-sequence (/ num-src) (/ num-src) num-src)))
Beta Was this translation helpful? Give feedback.
All reactions