Open sp94 opened 3 years ago
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:
geometry
function is so complicated for fully anisotropic case;plot_band_diagram
) can be used on the new solver;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.__
submodulesI think we should create internal submodules Peacock.FDFD
and Peacock.PWEM
, so that you can do
using Peacock
solver1 = FDFD.Solver(...) solver2 = PWEM.Solver(...)
modes1 = solve(solver1, ...) modes2 = solve(solver2, ...)
2. Or just PWEM:
```julia
using Peacock.PWEM
solver = Solver(...)
modes = solve(solver, k, polarisation)
plot(modes[1])
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,...)
.
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!
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.
Good idea, I've opened an issue for dielectric smoothing https://github.com/sp94/Peacock.jl/issues/22
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.