flaport / fdtd

A 3D electromagnetic FDTD simulator written in Python with optional GPU support
https://fdtd.readthedocs.io
MIT License
484 stars 117 forks source link

Discontinuity in the curls of E and H?? #8

Closed Kiranalu closed 2 years ago

Kiranalu commented 4 years ago

Hi, firstly thanks for the amazing code. How do I introduce the discontinuity in the curls of E and H, and in the update equations of E and H?

I tried to introduce the discontinuity in the curl_E and curl_H and update_E and update_H uisng the decorator with out changing the class . it did not work for me. The discontinuity equations I have introduced are (eqn 5 , 6 from supplimentary and eqn 5, 6 from main paper ) from https://doi.org/10.1038/s41467-018-05579-6 , if you introduce this into your pakage, it will be grate . I hope we can solve the issue by using decorator on curl_E and curl_H and update_E and updat_H. thanks for the reply. please let me know your comments.

flaport commented 4 years ago

Hi Kiranalu,

Thanks for liking the code 🙂.

I had a quick scan through the paper you mentioned. It looks indeed very interesting. However, I have to admit that it's a bit out of my comfort zone and unfortunately I do not have the time to delve much deeper into this subject.

However, If you want to implement it, please fee free to do so. Here are a few directions to get you started:

  1. It's best to subclass Object and define new update equations there
  2. The update equations (eqn 5, 6 in the paper) look in fact quite similar to the update equations for objects with a certain conductivity (i.e. absorbing objects). See for example the update equations (4.24) in my phd thesis. As an example, I added an AbsorbingObject to the code base (commit 2f25c1e8aaa6db721404cec64809d923601fdde0), accompanied with an example on how to use it in the examples folder. You can create a similar subclass with the update equations of the paper.
  3. It seems like the paper you mentioned is using complex numbers, I'm a bit uncertain how this will play along with my current FDTD implementation (which uses a purely real implementation). It will for sure not work with the PyTorch backend, it might work without issues with the numpy backend.
Kiranalu commented 4 years ago

Hi Kiranalu,

Thanks for liking the code 🙂.

I had a quick scan through the paper you mentioned. It looks indeed very interesting. However, I have to admit that it's a bit out of my comfort zone and unfortunately I do not have the time to delve much deeper into this subject.

However, If you want to implement it, please fee free to do so. Here are a few directions to get you started:

  1. It's best to subclass Object and define new update equations there
  2. The update equations (eqn 5, 6 in the paper) look in fact quite similar to the update equations for objects with a certain conductivity (i.e. absorbing objects). See for example the update equations (4.24) in my phd thesis. As an example, I added an AbsorbingObject to the code base (commit 2f25c1e), accompanied with an example on how to use it in the examples folder. You can create a similar subclass with the update equations of the paper.
  3. It seems like the paper you mentioned is using complex numbers, I'm a bit uncertain how this will play along with my current FDTD implementation (which uses a purely real implementation). It will for sure not work with the PyTorch backend, it might work without issues with the numpy backend.

Hi Flaport, thanks for the suggestion. Since my discontinuity is mode dependent (Ez or Hz), so I need to know, How do I choose perticular mode? and How do I chose source polarization and propagation direction ? please kindly let me know with some examples How can I can change them. As you mentioned my equations are like 4.25 of your thesis but the implimentation should be like 4.67 of your thesis, the discontinuity is different for different components of curls of Ex and Ey and Hz, please also kindly share how you are implimenting eqn 4.67 of your thesis?

thanks for the reply.