flaport / fdtd

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

Polarization of plane source #49

Closed brandstetter-johannes closed 2 years ago

brandstetter-johannes commented 2 years ago

Hi, let me first say this repo is quite unique and phantastic!

My question: when using plane sources it seems that something is weird with the polarization, I got an error: TypeError: init() got an unexpected keyword argument 'polarization'. Should be in the init function https://github.com/flaport/fdtd/blob/master/fdtd/sources.py#L326

For example, this code snippet throws the error: grid[0, :, :] = fdtd.PlaneSource( period=WAVELENGTH / SPEED_LIGHT, polarization='z')

I installed via 'pip install fdtd' couple of days ago.

Am I right assuming that default polarization is still the z-axis?

flaport commented 2 years ago

Hi @brandstetter-johannes ,

This is weird, I do not have this issue. Can you try installing fdtd again as follows?

pip install --upgrade fdtd==0.2.5

Let me know if that solves your problem.

brandstetter-johannes commented 2 years ago

Hi @flaport thank you very much! The error is now resolved.

Johannes