Skip to content

Commit

Permalink
Added EME solver
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyflex committed Mar 6, 2024
1 parent e5c1439 commit 83f9a91
Show file tree
Hide file tree
Showing 20 changed files with 2,099 additions and 35 deletions.
64 changes: 64 additions & 0 deletions tests/test_components/test_eme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import pytest
import pydantic.v1 as pd
import numpy as np
from matplotlib import pyplot as plt

import tidy3d as td

from ..utils import STL_GEO, assert_log_level, log_capture


def make_eme_sim():
# general simulation parameters
lambda0 = 1
freq0 = td.C_0 / lambda0
freqs = [freq0]
sim_size = 3 * lambda0, 3 * lambda0, 3 * lambda0
waveguide_size = (lambda0 / 2, lambda0, td.inf)
min_steps_per_wvl = 20

# EME parameters
monitor_size = (2 * lambda0, 2 * lambda0, 0.1 * lambda0)
eme_num_cells = 5 # EME grid num cells
eme_axis = 2

# Structures and FDTD grid
waveguide_geometry = td.Box(size=waveguide_size)
waveguide_medium = td.Medium(permittivity=2, conductivity=1e-6)
waveguide = td.Structure(geometry=waveguide_geometry, medium=waveguide_medium)
grid_spec = td.GridSpec.auto(wavelength=lambda0, min_steps_per_wvl=min_steps_per_wvl)

# EME setup
mode_spec = td.ModeSpec(num_modes=5, num_pml=(10, 10))
eme_grid_spec = td.EMEUniformGrid(num_cells=eme_num_cells, mode_spec=mode_spec)

# field monitor stores field on FDTD grid
field_monitor = td.EMEFieldMonitor(size=(0, td.inf, td.inf), name="field", colocate=True)

coeff_monitor = td.EMECoefficientMonitor(
size=monitor_size,
name="coeffs",
)

mode_monitor = td.EMEModeSolverMonitor(
size=(td.inf, td.inf, td.inf),
name="modes",
)

monitors = [mode_monitor, coeff_monitor, field_monitor]
structures = [waveguide]

sim = td.EMESimulation(
size=sim_size,
monitors=monitors,
structures=structures,
grid_spec=grid_spec,
axis=eme_axis,
eme_grid_spec=eme_grid_spec,
freqs=freqs,
)
return sim


def test_eme_data_array():
pass
Loading

0 comments on commit 83f9a91

Please sign in to comment.