Workflow (2D)

Wave Types and Polarizations

PhoXonic.jl supports various wave types for photonic and phononic crystals.

2D Wave Types

2D Wave Polarizations

Wave TypeField ComponentsDescription
TEWaveH_zE in xy-plane, H perpendicular
TMWaveE_zH in xy-plane, E perpendicular
SHWaveu_zShear horizontal (anti-plane)
PSVWaveux, uyIn-plane (P + SV coupled)

For 3D wave types, see 3D Calculations.

Basic Workflow

  1. Define Lattice (square_lattice, hexagonal_lattice, etc.)
  2. Define Materials (Dielectric, IsotropicElastic)
  3. Create Geometry with Shapes (Circle, Rectangle, Sphere, etc.)
  4. Create Solver with Wave Types — see also Solver Methods
  5. Compute Band Structure (compute_bands)
  6. Analyze results — see Analysis and Post-Processing

2D Photonic Crystal

Triangular Lattice Rods (TM mode)

See also: examples/101_triangular_rods.jl

using PhoXonic

# 1. Lattice
lat = hexagonal_lattice(1.0)

# 2. Materials
air = Dielectric(1.0)
rod = Dielectric(12.0)  # High-ε like GaAs

# 3. Geometry: rods in air
geo = Geometry(lat, air, [(Circle([0.0, 0.0], 0.2), rod)])

# 4. Solver
solver = Solver(TMWave(), geo, (64, 64); cutoff=7)

# 5. Compute bands
kpath = simple_kpath_hexagonal(npoints=30)
bands = compute_bands(solver, kpath; bands=1:8)

# 6. Find gaps
gaps = find_all_gaps(bands)
for g in gaps
    println("Gap between bands $(g.bands): $(g.gap_ratio*100)%")
end

Square Lattice (TE/TM comparison)

See also: examples/103_square_rods.jl

lat = square_lattice(1.0)
geo = Geometry(lat, air, [(Circle([0.0, 0.0], 0.2), rod)])

# TE mode
solver_te = Solver(TEWave(), geo, (64, 64); cutoff=7)
bands_te = compute_bands(solver_te, kpath; bands=1:8)

# TM mode
solver_tm = Solver(TMWave(), geo, (64, 64); cutoff=7)
bands_tm = compute_bands(solver_tm, kpath; bands=1:8)

2D Phononic Crystal

Steel/Epoxy (SH mode)

See also: examples/201_phononic_steel_epoxy.jl

# Materials
epoxy = IsotropicElastic(ρ=1180.0, λ=4.43e9, μ=1.59e9)
steel = IsotropicElastic(ρ=7800.0, λ=1.15e11, μ=8.28e10)

# Geometry
lat = square_lattice(0.01)  # 1 cm period
geo = Geometry(lat, epoxy, [(Circle([0.0, 0.0], 0.004), steel)])

# SH solver
solver = Solver(SHWave(), geo, (64, 64); cutoff=7)
kpath = simple_kpath_square(a=0.01, npoints=30)
bands = compute_bands(solver, kpath; bands=1:8)

P-SV Mode (in-plane)

solver_psv = Solver(PSVWave(), geo, (64, 64); cutoff=7)
bands_psv = compute_bands(solver_psv, kpath; bands=1:12)

Subpixel Averaging

For smoother convergence at material boundaries:

solver = Solver(TMWave(), geo, (64, 64);
    cutoff=7,
    discretization=SubpixelAverage(4)  # 4×4 subsampling
)

For 3D photonic/phononic crystals (TransverseEM, FullVectorEM, FullElastic), see 3D Calculations.

For solver methods (DenseMethod, KrylovKitMethod, LOBPCGMethod), see Solver Methods.

For post-processing (convergence, group velocity, k-path, plotting, saving/loading), see Analysis and Post-Processing.

API Reference

  • Core API - Lattice, Materials, Shapes, Geometry
  • Solver API - Wave types, Solver, BandStructure