You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes full 3D simulations (photonic crystal periodic in x, y, z directions) will be required, but Peacock.jl currently supports only 2D simulations (crystal periodic in x and y directions, and assumed homogeneous along the z direction).
Extending the solver (plane wave expansion method) to 3D is relatively straightforward. But the 2D and 3D solvers have different inputs and outputs, in particular the 2D solution is a scalar field (out of plane component of either E or H), and the 3D solution is a vector field (all three components of either E or H, for the simplest approach).
Current interface
Only for 2D
epf(x,y) =...muf(x,y) =...
geometry =Geometry(epf, muf, a1, a2, d1, d2)
solver =Solver(geometry, fourier_space_cutoff)
modes =solve(solver, k, polarisation) # returns array of Mode with out-of-plane E or H, depending on polarisation
Desired interfaces
For 3D
epf(x,y,z) =...muf(x,y,z) =...
geometry =Geometry(epf, muf, a1, a2, a3, d1, d2, d3)
solver =Solver3D(geometry, fourier_space_cutoff)
modes =solve(solver, k) # returns array of Mode with all components of E and H
For 2D
epf(x,y) =...muf(x,y) =...
geometry =Geometry(epf, muf, a1, a2, d1, d2)
solver =SolverTE(geometry, fourier_space_cutoff) # <-- different Solvers for different polarisations
modes =solve(solver, k) # returns array of Mode with all components of E and H
Required changes
Make Geometry 3D, but create two constructors
Geometry(epf, muf, a1, a2, a3, d1, d2, d3) should produce a 3D geometry
Geometry(epf, muf, a1, a2, d1, d2) should produce a 2D geometry, internally represented as a thin 3D geometry
Separate Solver into SolverTE, SolverTM, and Solver3D
Allowing SolverTE and SolverTM to be constructed separately would reduce efficiency in cases where users wanted to solve for both polarisations, as their construction can share data. However, for 2D simulations this normally won't be too expensive, and if it was, we could create another function to construct SolverTE and SolverTM simultaneously.
Extend Mode to hold all six components of the electric/magnetic fields
struct Mode
k0::Vector{Float64}...# electric field components
Sx::Vector{ComplexF64}
Sy::Vector{ComplexF64}
Sz::Vector{ComplexF64}# magnetic field components
Ux::Vector{ComplexF64}
Uy::Vector{ComplexF64}
Uz::Vector{ComplexF64}end
This would require storing more data for each Mode. However, this wouldn't be too expensive as the Fourier-space representations of the fields are efficient, and solve would return the same object for 3D, TE, and TM polarised simulations.
Allows the same Mode object to be returned for TE, TM, and 3D simulations
Users would also have instant access to all components of the electric/magnetic fields.
The text was updated successfully, but these errors were encountered:
Issue
Sometimes full 3D simulations (photonic crystal periodic in x, y, z directions) will be required, but
Peacock.jl
currently supports only 2D simulations (crystal periodic in x and y directions, and assumed homogeneous along the z direction).Extending the solver (plane wave expansion method) to 3D is relatively straightforward. But the 2D and 3D solvers have different inputs and outputs, in particular the 2D solution is a scalar field (out of plane component of either E or H), and the 3D solution is a vector field (all three components of either E or H, for the simplest approach).
Current interface
Only for 2D
Desired interfaces
For 3D
For 2D
Required changes
Make
Geometry
3D, but create two constructorsGeometry(epf, muf, a1, a2, a3, d1, d2, d3)
should produce a 3D geometryGeometry(epf, muf, a1, a2, d1, d2)
should produce a 2D geometry, internally represented as a thin 3D geometrySeparate
Solver
intoSolverTE
,SolverTM
, andSolver3D
SolverTE
andSolverTM
to be constructed separately would reduce efficiency in cases where users wanted to solve for both polarisations, as their construction can share data. However, for 2D simulations this normally won't be too expensive, and if it was, we could create another function to constructSolverTE
andSolverTM
simultaneously.Extend
Mode
to hold all six components of the electric/magnetic fieldssolve
would return the same object for 3D, TE, and TM polarised simulations.Mode
object to be returned for TE, TM, and 3D simulationsThe text was updated successfully, but these errors were encountered: