Are you using the C++ or Scheme interface? For the C++ interface, the subpixel averaging, if turned on (it is off by default), can take a substantially longer time to finish although this happens only once before the start of the time stepping. The reason for this lies in the way in which the material volume fractions and interface normals for pixels lying on the boundary between two materials are computed (see Farjadpour et al., Optics Letters, 31, pp. 2972-74 for more information). The Scheme interface, on the other hand, uses a library of geometric objects for which these quantities are computed analytically and quickly to very high accuracy whereas the C++ interface uses numerical quadrature (given a tolerance and max number of iterations, explained below) and thus can be quite slow to converge as you have discovered.

There are a couple of things you can try. By default, the C++ interface does not use subpixel averaging. To turn it on, you need to invoke the set_materials (or set_epsilon) function of the structure class whose header is defined as follows (see the meep.hpp file in the src/ for more information):

  void set_materials(material_function &mat,
                     bool use_anisotropic_averaging=true,
                     double tol=DEFAULT_SUBPIXEL_TOL,
                     int maxeval=DEFAULT_SUBPIXEL_MAXEVAL);

Note the last two parameters, tol and maxeval, which are by default 1e-4 and 100000. You can either leave subpixel averaging turned off, trading accuracy for time or you can turn it on and decrease the value of these two parameters which should speed up subpixel averaging quite a bit. In Meep, to compute the material volume fractions for a cubic voxel, the number of equidistant subpixel points is repeatedly doubled until the volume fractions have converged (every time this happens is referred to as an iteration). The normals are computed using a spherical quadrature method via a weighted average of points around a sphere overlapping the interface boundary. So you can now see why if maxeval is large and tol is small, subpixel averaging can take a very long time to execute since this happens for every pixel on the boundary interface throughout the computational cell. Thus, the higher the resolution, the more pixels to compute these values for and the longer the simulation becomes.

Also, note that if you use a custom material function in Scheme (essentially by using any function that is not a predefined geometric object like sphere, block, etc), Meep will automatically resort to numerical quadrature. Here again, in your libctl file, you can either turn subpixel averaging off (it is on by default in Scheme except when metals are present) or adjust these parameters via, for example:

(set! subpixel-maxeval 1000)
(set! subpixel-tol 1e-2)

In our experience, we have discovered that subpixel averaging using the analytic values is much more accurate (and obviously faster) than subpixel averaging using numerical quadrature. Nevertheless, subpixel averaging in general can potentially result in a large improvement of accuracy for your simulations overall and allow you to significantly reduce the size of your simulations.

Pablo Bianucci wrote:
Hello,

I am trying to run a 3D simulation (using a mirror symmetry on the Z axis),
with a 12.5625 x 12.5625 x 9 cell and resolution=100.

Meep-MPI has been running for more than a full week on 4 cores, and it
has not finished the subpixel averaging yet, and the "remaining
percentage" is esentially menaningless (it goes all the way to 99.9%
and then goes back to something small).
I've tried running it with a small resolution of about 5 and it works (although
the "remaining percentage" is also out-of-whack it eventually finishes and proceeds to the FDTD simulation).

Is it that my simulation is too large and I can't expect to solve it on a 
desktop
system (I have 16 Gb of RAM in it)? Or is it a Meep issue?

I have also tried to disable the espilon averaging but it did not seem to work.

Thanks for any tips!

Pablo B.


_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss


_______________________________________________
meep-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to