Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Other solvers (Eg FDFD) #20

Open
sp94 opened this issue May 9, 2021 · 4 comments
Open

Other solvers (Eg FDFD) #20

sp94 opened this issue May 9, 2021 · 4 comments
Labels
breaking Will change the interface enhancement New feature or request

Comments

@sp94
Copy link
Owner

sp94 commented May 9, 2021

While plane-wave expansion method is efficient for modelling dielectric materials, it is inefficient at modelling materials such as metals or modelling finite (non-periodic) systems

It would therefore be useful to add other methods of solution to Peacock, such as the finite-difference frequency-domain (FDFD) method. We could begin with an implementation of 2D FDFD to solve for eigenmodes of a periodic structure - these results could be compared directly against the existing plane-wave expansion method in Peacock.

A priority would be to keep the interface simple and consistent between the different solvers.

@kabume
Copy link
Contributor

kabume commented May 13, 2021

Hi @sp94 , I have written the slover-function of 2D FDFD, and it support full anisotropy, which can be seen at https://github.com/kabume/Peacock.jl/tree/master/src. Besides, the demo of anisotropic square lattice (time-broken case) can be seen at https://github.com/kabume/Peacock.jl/blob/master/test/test_FDFD_aniso.jl, the
relative permittivity and permeability are expressed as eps=[14 -12.4im 0; 12.4im 14 0; 0 0 15] and mu=[14 12.4im 0; -12.4im 14 0; 0 0 15]. The result is the same as Zhao's paper. The result of getting started of Peacock is also listed .

Some existing functions of Peacock can be used directly, like Peacock.sample_path and geometry, which are very useful.

Some problems still need to be solved:

  1. the geometry function is so complicated for fully anisotropic case;
  2. The FDFD solver that I have written is very simple, we still need to make some improvements so that existing functions of Peacock (eg plot_band_diagram) can be used on the new solver;
  3. The FDFD solver only supports the eigenvalue problem now, and the source function and PML (UPML) need to be added.
  4. FDFD seems a better fit for working on the GPU because of the sparse matrix.

@sp94
Copy link
Owner Author

sp94 commented May 13, 2021

Thank you @kabume, this looks really good :)

Here are my first thoughts on how we can merge these together in an easy to use way.


FDFD.__ and PWEM.__ submodules

I think we should create internal submodules Peacock.FDFD and Peacock.PWEM, so that you can do

  1. Using both solvers in the same script (probably less common):
using Peacock

solver1 = FDFD.Solver(...)
solver2 = PWEM.Solver(...)

modes1 = solve(solver1, ...)
modes2 = solve(solver2, ...)
  1. Or just PWEM:
using Peacock.PWEM
solver = Solver(...)
modes = solve(solver, k, polarisation)
plot(modes[1])
  1. Using just FDFD:
using Peacock.FDFD
solver = Solver(...)
modes = solve(solver, k, polarisation)
plot(modes[1])

Then solve(solver, k, polarisation) can use Julia's automatic dispatch to behave differently depending whether solver is a FDFD.Solver or PWEM.Solver, and can return either FDFD.Eigenmode or PWEM.Eigenmode.

Then we will make sure that the solvers and eigenmodes have a consistent interface that can be used by eg plot(mode), plot_band_diagram(solver,...).


Anisotropy

I think we can use the same Geometry for both FDFD and PWEM, but allow epf and muf to return either a scalar, 3-vector, or 3x3-matrix.

Then, we could make multiple types of solvers, eg IsotropicSolver, AnisotropicSolverTE, AnisotropicSolverTM (and maybe later also AnisotropicSolver for when there are anisotropic terms that mix the TE/TM modes together). And similar for PWEM.

When we construct solver = Solver(geometry, ...) we can try and automatically pick the simplest option based on the structure of epf and muf. i.e. if all of epf and muf are scalars, return IsotropicSolver.


These are just my first thoughts, I will probably come back and edit or add more soon :)

Thanks again!

@sp94 sp94 added the enhancement New feature or request label May 13, 2021
@kabume
Copy link
Contributor

kabume commented May 13, 2021

The method of submodules looks so clear! I'll try it soon.

Besides, the geometry function may add a dielectric averaging function to get more accurate results, like this slide.

@sp94
Copy link
Owner Author

sp94 commented May 13, 2021

Good idea, I've opened an issue for dielectric smoothing
#22

@sp94 sp94 added the breaking Will change the interface label May 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking Will change the interface enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants