flaport / fdtd

A 3D electromagnetic FDTD simulator written in Python with optional GPU support

Home Page:https://fdtd.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overlapping Source inside Object

0xDBFB7 opened this issue · comments

I was trying to build a (dubious) test-case for current density by putting a source in a conductive medium, like so:

grid[x_,y_,z_] = fdtd.AbsorbingObject(permittivity=1.0, conductivity=conductivity)
grid[x_,y_,z_] = fdtd.PointSource(period=500)

The source E-field seems to always be forced to zero in this case. The source works when the objects are added in the other order.

I might be doing something wrong, just posting this issue to ask what the expected behavior should be when troubleshooting - is the overlapping case allowed and meaningful?

Thanks!

(tangentially related, should adding an object inside a PML maybe throw an exception? Do you know of any cases where that would be a valid thing to do?)

Hey Daniel,

Please give me some time to answer before closing the issue 😉

Anyway... I assume this is related to the internals of how this library works:

  1. If an object is added to the grid, the refractive index 'behind' the object is put to 0. This causes some problems and ideally a better solution should be found (see #4 and #6 ).
  2. Adding objects inside the PML is not recommended. The PML in this library is implemented pretty naively, which unfortunately makes it not so easy to combine with custom objects. It would indeed be better to raise an Exception right now.
  3. To solve the above issue, the PML probably has to be implemented differently... probably stretched coordinates or uPML... unfortunately I lack the time (and expertise?) to implement something like this right away... (feel free to give it a try and open a PR 😉)