Dear all, I am having a problem with meep. I am trying to optimize a geometry with it by searching for the maximum of a function, but after a while I run our of memory and the process cannot be completed. At each iteration the required memory increases, so I guess it is keeping something in memory.
I have written a simplified scheme file that shows the basic issue: meep is run in a function and the function is called 6 times, simulating an optimization run. The actual geometry that is defined in this function does not change, so basically it is the same calculation over and over. I have traced the memory usage during the simulated optimization and plotted the results. The resulting graph is attached as well. The graph clearly shows a step-wise increment on each iteration. Using this example scheme file I made the following observations: if I comment out the (set! geometry ...) statement, the memory usage keeps constant. If I just comment out the dispersive material, there is still an increment in memory but not nearly as bad, so it seems that it is keeping the geometry in memory after each iteration. Is there any way to force meep to clear the memory used for the geometry? I tried forcing a garbage collection with the command (gc), but it had no effect. I append the code i have been working with and a plot of the memory usage during the 6 iterations. I would be grateful for any suggestion about how to avoid this. Best Regards Lur Eguiluz
<<attachment: Memory usage.jpg>>
;Definition of the parameters
(define d1 400)
(define d2 400)
(define d3 200)
(define box_l 5000)
(define box_d 5000)
(define dpml 600)
;Definition of the source characteristics
(define-param fmax 1/500 )
(define-param fmin 1/1000)
(define cfreq (* 0.5 (+ fmin fmax) ))
(define-param freqwidth (- fmax fmin))
(define monitor_center (vector3 0 0 (+ (/ d3 -2) 10 )) )
;Definition of dispersive material characteristics
(define dispersive_material
(make dielectric (epsilon 5.3894024200841582)
(polarizations
(make polarizability
(omega 5.7239396145741243e-07 ) (gamma 2.1739597464408151e-05 ) (sigma 1.4274791830538642e+008 ) )
(make polarizability
(omega 0.0023282216492433606 ) (gamma 0.00040132006132541213 ) (sigma 1.4316008270417622 ) )
)))
;Definition of an initial vector
(define-param initial (vector 0 0 0 0 0 0 0 0 0))
;Selection of the lattice size, resolution and eps-averaging
(set! geometry-lattice (make lattice (size (+ box_d dpml dpml) (+ box_l dpml dpml) (+ d1 d2 d3 dpml dpml) )))
(set-param! resolution (/ 1 50))
(set! eps-averaging? false)
;Make all directions absorb waves (infinite media) with perfectly matched layers
(set! pml-layers (list (make pml (thickness dpml) (direction ALL) (side ALL) ) ))
;Set the source
(set! sources (list (make source
(src (make gaussian-src (cutoff 6) (frequency cfreq) (fwidth (* pi freqwidth)) ))
(component Ey) (center 0 0 (+ (* -1 (/ d3 2)) 10 ) ) (size 0 0 0))))
(use-output-directory)
(define (geometryfunc local_parameter)
(reset-meep) ;Sets all the fields to zero
;Define the geometry inside the box
(set! geometry (append (list
(make block (center 0 0 (/ (+ (+ d1 dpml) d3) -2) )
(size infinity infinity (+ d1 dpml))
(material (make dielectric (index 1.5) ) ) ) ; glass
(make block (center 0 0 0 )
(size infinity infinity d3 )
(material dispersive_material ) )
)
))
;Try to force garbage collection
(gc)
;Run the sources
(run-sources+ (stop-when-fields-decayed 2000 Ey monitor_center 1e-7)
(in-point monitor_center (to-appended "monitor_center" output-efield) ))
)
(geometryfunc initial)
(geometryfunc initial)
(geometryfunc initial)
(geometryfunc initial)
(geometryfunc initial)
(geometryfunc initial)_______________________________________________ meep-discuss mailing list [email protected] http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

