Maybe you need to call (reset-meep) between (func true) and (func false).

Chris

On Wed, Aug 8, 2018 at 8:30 AM, 37 zigen <37zi...@gmail.com> wrote:

> Dear meep users.
>
> I tried to run simulation multiple times.
> However, it shows different result wheather I run the code below as it is
> or I run the code with commenting out (func false) and then run once more
> with commenting out (func true) and undoing the commenting out of (func
> false)
>
> Does anyone know why?
>
> Thank you for reading.
>
> Sincerely.
>
>
> *(define-param sx 30) ; size of cell in X direction
>       *
> *(define-param sy 30) ; size of cell in Y direction
>       *
> *(set! geometry-lattice (make lattice (size sx sy no-size)))*
> * ;(define-param no-obstacle? true) ;*
> *(define-param fcen 0.25) ; pulse center frequency
>        *
> *(define-param df 0.2)    ; pulse width (in frequency)
>     *
> *(define-param nfreq 100) ; number of frequencies at which to compute
> flux             *
>
>
> *(define func*
> *  (lambda(no-obstacle?) *
> *    (define trans 0)*
> *    (define refl 0)*
>
>
> *    (set! geometry*
> *   (if (not no-obstacle?)*
> *       (list*
> *        (make block*
> * (center 0 0)*
> * (size 0.1 28 infinity)*
> * (material (make medium (epsilon 1)(D-conductivity 0.00765)))*
> * )*
> *        )*
> *       (list*
> *        (make block*
> * (center 0 0)*
> * (size  infinity infinity infinity)*
> * (material (make dielectric (epsilon 1)))*
> * )*
> *        )*
> *       )*
> *   )*
>
> *    (set! sources (list*
> *    (make source*
> *      (src (make gaussian-src (frequency fcen) (fwidth df)))*
> *      (component Ez)*
> *      (center -14 0)*
> *      (size 0 28))))*
> *    (set! pml-layers (list (make pml (thickness 1.0))))*
> *    (set-param! resolution 20)*
>
> *    (set! trans ; transmitted flux
>         *
> *   (add-flux fcen df nfreq*
> *     (make flux-region*
> *       (center 10 0 0) (size 0 28)*
> *       )*
> *     )*
> *   )*
>
> *    (set! refl ; reflected flux
>          *
> *   (add-flux fcen df nfreq*
> *     (make flux-region *
> *       (center -10 0 0) (size 0 28)*
> *       )*
> *     )*
> *   )*
>
>
> *    ;(if (not no-obstacle?) (load-minus-flux "refl-flux" refl))*
>
> * ;(run-sources+ 500 (at-beginning output-epsilon)(to-appended "ez"
> (at-every 1 output-efield-z)))*
> *    (run-sources+ *
> *     (stop-when-fields-decayed 50 Ez*
> *        (if no-obstacle? (vector3 0 0 0)*
> *    (vector3 0 0 0)*
> *    )*
> *        1e-3))*
> *    (if no-obstacle? (save-flux "refl-flux" refl))*
> *    (display-fluxes trans refl)*
>
> *    )    *
> *  )*
>
> *(func true)*
> *(func false)*
>
> _______________________________________________
> meep-discuss mailing list
> meep-discuss@ab-initio.mit.edu
> http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
>
_______________________________________________
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