Dear Meep users and developer,
I am eventually willing to model excentric shapes using meep, for
which I believe I need to use "material-function".
However, it seems that using material-function automatically turns off
eps-averaging when using libctl (analytical averaging at least).
But I read - here :
http://www.mail-archive.com/[email protected]/msg02865.html -
that there was still a "numerical averaging" performed.
However, I do not see the effect of this numerical averaging in my
slab test case, where I calculate the simple R and T coefficient of a
simple lossy plate both analytically and using meep.
To test this, I simply define the same slab geometry in two different ways:
1- Using Meep geometry subclasses :
(set! geometry (list
(make block (center 0 0) (size sx L infinity) (material (make
dielectric (epsilon eps) (D-conductivity sigma_d) ) ) )))
)
2- Using a material-function :
(define (my-material-func p)
(make dielectric (epsilon eps) (D-conductivity sigma_d)))
(set! geometry (list
(make block (center 0 0 0) (size sx L infinity) (material (make
material-function (material-func my-material-func)) ) )
(make block (center 0 0 0) (size 0 0 0) (material (make dielectric
(epsilon eps) (D-conductivity sigma_d)) ) ) ; <= init
consuctivity
))
I ran configuration 1- and 2- with / whithout eps-averaging. The
results are presented in the attached image.
Using the slab built via material function is equivalent to using
Meep's block subclass with eps-averaging=false.
I didn't see any effect of subpixel or maxeval where I was expecting
one because of some numerical averaging, as mentionned in the earlier
message.
Would using C++ interface help? Is there any workaround to have
eps-averaging (even numerical, I understand why analytical isn't
possible) AND a cutsom material-function at the same time?
Thank you very much for any suggestion.
Best,
Guillaume Demésy
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;; image:
http://imagepaste.nullnetwork.net/viewimage.php?id=1078
or
http://dl.free.fr/vOMwX91qg
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;; code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(use-output-directory "slab_h5")
(set-param! resolution 50)
(define-param nfreq 400)
(set! eps-averaging? true)
(define-param eps 4.)
(define-param sigma_norm 0.5 )
(define-param sigma_d (/ sigma_norm eps))
(define-param a 1.)
(define-param sx (* 0.5 a) )
(define-param sy (* 6. a))
(define-param fcen 1.)
(define-param df 0.25)
(define-param L (* 1. a) )
(define-param dpml (* 2. a) )
(define-param RCyl (* 0.16 a ))
(define-param kx1 (/ -0.8 a) )
(define-param theta (asin (/ kx1 fcen) ) )
(define-param theta_deg (* 180. (/ 1 pi) (asin (/ kx1 fcen))) )
(define-param norm-run? false)
(define sypml (+ sy (* 2. dpml)))
(set! geometry-lattice (make lattice (size sx sypml no-size)))
(set! pml-layers (list (make pml (thickness dpml) (direction Y))))
(define kx (* 1 kx1))
(set! k-point (vector3 kx 0 0))
(set! ensure-periodicity true)
(define (my-amp-func p) (exp (* 0+2i pi kx (vector3-x p))))
(define (my-material-func p)
(make dielectric (epsilon eps) (D-conductivity sigma_d) ) )
(if (not norm-run?)
(set! geometry (list
(make block (center 0 0 0) (size sx L infinity) (material (make
material-function (material-func my-material-func)) ) )
(make block (center 0 0 0) (size 0 0 0) (material (make dielectric
(epsilon eps) (D-conductivity sigma_d)) ) )
)) )
;(if (not norm-run?)
;(set! geometry (list
; (make block (center 0 0) (size sx L infinity) (material (make
dielectric (epsilon eps) (D-conductivity sigma_d) ) ) )))
;)
(set! sources (list
(make source
(src (make gaussian-src (frequency fcen) (fwidth df)))
(component Ez)
(center 0. (* 0.45 sy)) (size sx 0)
(amp-func my-amp-func))))
(define trans ; transmitted flux
(add-flux fcen df nfreq
(make flux-region
(center 0 (* -0.4 sy)) (size sx 0) ) ) )
(define refl ; transmitted flux
(add-flux fcen df nfreq
(make flux-region
(center 0 (* 0.4 sy)) (size sx 0) ) ) )
(if (not norm-run?) (load-minus-flux "refl-flux" refl))
(run-sources+ (stop-when-fields-decayed
100 Ez
;(vector3 0 (* -0.48 sy) )
(vector3 0 (* -0. a) )
1e-3)
(at-beginning output-epsilon)
(at-end output-efield-z)
)
(if norm-run? (save-flux "refl-flux" refl))
(display-fluxes trans refl)
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss