Core API
Dimensions
PhoXonic.Dim1 — Type
Dim1One-dimensional structures (e.g., Bragg mirrors, superlattices).
PhoXonic.Dim2 — Type
Dim2Two-dimensional structures (e.g., photonic crystal slabs, 2D phononic crystals).
PhoXonic.Dim3 — Type
Dim3Three-dimensional structures (e.g., 3D photonic crystals, bulk phononic crystals).
Lattice
PhoXonic.Lattice — Type
Lattice{D<:Dimension}Represents a periodic lattice in D dimensions.
Fields
vectors: Primitive lattice vectors as a tuple of SVectorsreciprocal: Reciprocal lattice vectors (computed automatically)
PhoXonic.lattice_1d — Function
lattice_1d(a::Real=1.0)Create a 1D periodic lattice with period a.
PhoXonic.square_lattice — Function
square_lattice(a::Real=1.0)Create a 2D square lattice with lattice constant a.
PhoXonic.hexagonal_lattice — Function
hexagonal_lattice(a::Real=1.0)Create a 2D hexagonal (triangular) lattice with lattice constant a.
PhoXonic.cubic_lattice — Function
cubic_lattice(a::Real=1.0)Create a 3D simple cubic lattice with lattice constant a.
PhoXonic.fcc_lattice — Function
fcc_lattice(a::Real=1.0)Create a 3D face-centered cubic lattice with conventional lattice constant a.
PhoXonic.reciprocal_vectors — Function
reciprocal_vectors(lattice::Lattice)Return the reciprocal lattice vectors.
Materials
PhoXonic.Dielectric — Type
Dielectric(ε, μ=1.0)Isotropic dielectric material with permittivity ε and permeability μ.
Examples
air = Dielectric(1.0)
silicon = Dielectric(11.7)PhoXonic.IsotropicElastic — Type
IsotropicElastic(ρ, C11, C12, C44)Isotropic elastic material with density ρ and elastic constants.
For isotropic materials: C44 = (C11 - C12) / 2
Fields
ρ: Mass density [kg/m³]C11: Elastic constant (λ + 2μ) [Pa]C12: Elastic constant (λ) [Pa]C44: Shear modulus (μ) [Pa]
Examples
# Steel
steel = IsotropicElastic(7800.0, 282e9, 113e9, 84.5e9)
# From Lamé parameters
epoxy = IsotropicElastic(ρ=1180.0, λ=4.43e9, μ=1.59e9)PhoXonic.from_E_ν — Function
from_E_ν(ρ, E, ν)Create isotropic elastic material from Young's modulus E and Poisson's ratio ν.
Shapes
PhoXonic.Circle — Type
Circle(center, radius)A circle in 2D.
Examples
c = Circle(Vec2(0, 0), 0.2)
c = Circle([0.0, 0.0], 0.2)PhoXonic.Rectangle — Type
Rectangle(center, size)An axis-aligned rectangle in 2D.
Examples
r = Rectangle(Vec2(0, 0), Vec2(0.5, 0.3))PhoXonic.Polygon — Type
Polygon(vertices)A polygon in 2D defined by its vertices (in order).
PhoXonic.Sphere — Type
Sphere(center, radius)A sphere in 3D.
PhoXonic.Cylinder — Type
Cylinder(center, radius, height, axis)A cylinder in 3D with specified center, radius, height, and axis direction. Default axis is along z.
PhoXonic.Segment — Type
Segment(start, stop)A line segment in 1D.
Geometry
PhoXonic.Geometry — Type
Geometry{D<:Dimension, M<:Material}Represents the geometry of a periodic crystal structure.
Fields
lattice: The periodic latticebackground: Background materialinclusions: List of (shape, material) pairs
Examples
lattice = square_lattice(1.0)
air = Dielectric(1.0)
rod = Dielectric(8.9)
geo = Geometry(lattice, air, [(Circle(Vec2(0,0), 0.2), rod)])PhoXonic.discretize — Function
discretize(geo::Geometry{Dim2}, resolution, property, [method])Discretize a 2D geometry onto a grid.
Arguments
geo: The geometry to discretizeresolution: Tuple (Nx, Ny) of grid pointsproperty: Property to extract (:ε, :μ, :ρ, :C11, :C12, :C44)method: Discretization method (default: SimpleGrid())
Returns
A matrix of property values on the grid.
discretize(geo::Geometry{Dim1}, resolution, property, [method])Discretize a 1D geometry onto a grid.
discretize(geo::Geometry{Dim3}, resolution, property, [method])Discretize a 3D geometry onto a grid.
Arguments
geo: The 3D geometry to discretizeresolution: Tuple (Nx, Ny, Nz) of grid pointsproperty: Property to extract (:ε, :μ, :ρ, :C11, :C12, :C44, etc.)method: Discretization method (default: SimpleGrid())
Returns
A 3D array of property values on the grid.
discretize(geometry, resolution, ...)Discretize geometry on a grid.
See concrete method signatures for detailed documentation and keyword arguments.
PhoXonic.DiscretizationMethod — Type
DiscretizationMethodAbstract type for material discretization methods.
PhoXonic.SimpleGrid — Type
SimpleGridSimple point-sampling discretization. Each grid point gets the material value at that exact location.
PhoXonic.SubpixelAverage — Type
SubpixelAverageSubpixel averaging for smoother material boundaries. Uses volume fractions to average material properties.
Plane Wave Basis
PhoXonic.PlaneWaveBasis — Type
PlaneWaveBasis{D<:Dimension}Plane wave basis for D-dimensional periodic structures.
Fields
lattice: The underlying latticecutoff: Maximum index for plane wavesindices: List of (p, q, ...) indices for each plane waveG: Reciprocal lattice vectors for each plane wavenum_pw: Total number of plane waves
PhoXonic.convolution_matrix — Function
convolution_matrix(f::AbstractMatrix, basis::PlaneWaveBasis{Dim2})Compute the convolution matrix for a 2D function f(r).
The convolution matrix C has elements: C[i,j] = f̂(Gi - Gj) where f̂ is the Fourier transform of f.
Arguments
f: Real-space function values on a grid (Nx × Ny)basis: Plane wave basis
Returns
A complex matrix of size (numpw × numpw).
convolution_matrix(f::AbstractVector, basis::PlaneWaveBasis{Dim1})Compute the convolution matrix for a 1D function f(x).
convolution_matrix(f::AbstractArray{T,3}, basis::PlaneWaveBasis{Dim3}) where TCompute the convolution matrix for a 3D function f(r).
See also:
- Solver API - Wave types, Solver, Band structure
- Advanced API - Matrix-free, Green's function
- Plotting API (requires Plots.jl)
- I/O API (requires JLD2.jl)