0
$\begingroup$

I am hoping to start (very slowly) on implementing some form of a computational photonics/electromagnetism package. I know things like Meep, S4, FDTD++, EMPy, and a host of other proprietary/free/closed source tools exist, but this is more about hopefully getting a long-term project for myself that I can use as a multi-language, multi-level learning experience.

Given this, I have a few questions, in decreasing order of how much they have stumped me so far. Direct references to libraries, frameworks, and/or books/papers that can help me gain insight into these questions are greatly appreciated.

  1. How does one implement geometry? How do I state the location, orientation, of my polygons, or circles, spheres, et al?
  2. How does one go about meshing? And giving physical qualities to the geometric objects that have been meshed? For example, how do I go about adding my permittivity to my objects? It can't all just be spamming if-then-else statements that return epsilon, can it? If it is, how is this even implemented? Are all the if-then-else statements dealt with at the very beginning before we start simulating?
  3. For a scalar finite difference, say, 2nd derivative, I've seen it being applied using a sparse matrix, and also as a convolution kernel. Are there any benefits of one over the other?
  4. Is there any way to apply vector derivatives (the curl, in particular) using either sparse matrices, or convolution kernels, or are loops the only way to go about this?
  5. Any other resources that one may have encountered in this particular area are welcome.
$\endgroup$
  • 2
    $\begingroup$ I think that your question is too broad to find a good answer. What about getting you a book on Computational Electromagnetics? $\endgroup$ – nicoguaro Jun 2 '17 at 23:39
  • $\begingroup$ I've attempted to read Obayya's computational photonics, and I've got a good hold on the formulae involved. But I still haven't come across something that gives me good insight into the meshing/gridding process. $\endgroup$ – Chronum Jun 3 '17 at 3:13
  • $\begingroup$ There are meshing applications, for example, gmsh, tetgen or triangle. $\endgroup$ – nicoguaro Jun 3 '17 at 5:08
3
$\begingroup$

Your questions suggest that you are new to implementing solvers for PDEs, and that you are not familiar with the usual data structures and algorithms used in this field. It would probably be very useful for you to see how other people write codes like the one you are trying to write, because you will see how they arrange data, how they represent geometry and materials, etc.

Take a look at the tutorial programs that come with all of the major finite element codes, for example, to get this kind of experience. All of FEniCS, libMesh, and deal.II have extensive collections of tutorial programs that will show you many of the relevant techniques.

(Disclaimer: I'm one of the principal authors of deal.II.)

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.