Skip to content

Commit

Permalink
Add lossless Green2008 cSi and modify default SiO2 in material_library
Browse files Browse the repository at this point in the history
  • Loading branch information
weiliangjin2021 committed Jun 3, 2024
1 parent 2cf9de0 commit 95a4ca7
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `RectangularWaveguide.plot_field` optionally draws geometry edges over fields.
- `RectangularWaveguide` supports layered cladding above and below core.
- `SubpixelSpec` accepted by `Simulation.subpixel` to select subpixel averaging methods separately for dielectric, metal, and PEC materials. Specifically, added support for conformal mesh methods near PEC structures that can be specified through the field `pec` in the `SubpixelSpec` class. Note: previously, `subpixel=False` was implementing staircasing for every material except PEC. Now, `subpixel=False` implements direct staircasing for all materials. For PEC, the behavior of `subpixel=False` in Tidy3D < 2.7 is now achieved through `subpixel=SubpixelSpec(pec=HeuristicPECStaircasing())`, while `subpixel=True` in Tidy3D < 2.7 is now achieved through `subpixel=SubpixelSpec(pec=Staircasing())`. The default is `subpixel=SubpixelSpec(pec=PECConformal())` for more accurate PEC modelling.
- Lossless `Green2008` variant for crystalline silicon added to material library.

### Changed
- Default variant for silicon dioxide in material library switched from `Horiba` to `Palik_Lossless`.

### Fixed
- `ModeSolver.plot_field` correctly returning the plot axes.
Expand Down
14 changes: 14 additions & 0 deletions tests/test_package/test_material_library.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import pytest
import numpy as np
import pydantic.v1 as pydantic
from ..utils import assert_log_level
from ..utils import log_capture # noqa: F401

from tidy3d.material_library.material_library import (
VariantItem,
Expand All @@ -14,6 +16,18 @@
import tidy3d as td


def test_warning_default_variant_switching(log_capture): # noqa: F811
"""Issue warning for switching default medium variant."""

# no warning for most materials with no default change
_ = td.material_library["cSi"].medium
assert_log_level(log_capture, None)

# issue warning for SiO2
_ = td.material_library["SiO2"].medium
assert_log_level(log_capture, "WARNING")


def test_VariantItem():
"""Test if the variant class is working as expected."""
_ = VariantItem(
Expand Down
25 changes: 24 additions & 1 deletion tidy3d/material_library/material_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from ..components.medium import PoleResidue, Medium2D, AnisotropicMedium, Sellmeier
from ..components.base import Tidy3dBaseModel
from ..components.types import Axis
from ..log import log
from ..exceptions import SetupError
from .material_reference import material_refs, ReferenceData
from .parametric_materials import Graphene
Expand Down Expand Up @@ -99,6 +100,11 @@ def __getitem__(self, variant_name):
@property
def medium(self):
"""The default medium."""
if self.name == "Silicon Dioxide":
log.warning(
"Since Tidy3d 2.7, the default variant for silicon dioxide has been switched from "
"'Horiba' to 'Palik_Lossless'."
)
return self.variants[self.default].medium


Expand Down Expand Up @@ -1731,6 +1737,22 @@ def medium(self, optical_axis: Axis):
"main/Si/Green-2008.yml",
)

cSi_Green2008Lossless = VariantItem(
medium=PoleResidue(
eps_inf=12.254420790112501,
poles=[
(
(-1286227551710880.2 + 0j),
(8.042934900897995e-08 + 0j),
),
],
frequency_range=(206753419710997.8, 249827048333333.34),
),
reference=[material_refs["Green2008"]],
data_url="https://refractiveindex.info/data_csv.php?datafile=database/data-nk/"
"main/Si/Green-2008.yml",
)

cSi_PalikLossy = VariantItem(
medium=PoleResidue(
eps_inf=1.0,
Expand Down Expand Up @@ -2121,7 +2143,7 @@ def medium(self, optical_axis: Axis):
Palik_Lossy=SiO2_Palik_Lossy,
Horiba=SiO2_Horiba,
),
default="Horiba",
default="Palik_Lossless",
),
SiON=MaterialItem(
name="Silicon Oxynitride",
Expand Down Expand Up @@ -2212,6 +2234,7 @@ def medium(self, optical_axis: Axis):
SalzbergVilla1957=cSi_SalzbergVilla1957,
Li1993_293K=cSi_Li1993_293K,
Green2008=cSi_Green2008,
Green2008_Lossless=cSi_Green2008Lossless,
),
default="Green2008",
),
Expand Down
12 changes: 10 additions & 2 deletions tidy3d/plugins/dispersion/fit_fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,12 @@ def make_configs():
best_model.unweighted_rms_error,
)

return best_model.pole_residue, best_model.rms_error
return (
best_model.pole_residue.updated_copy(
frequency_range=self.frequency_range
),
best_model.rms_error,
)

# if exited loop, did not reach tolerance (warn)
progress.update(
Expand All @@ -829,7 +834,10 @@ def make_configs():
best_model.unweighted_rms_error,
)

return best_model.pole_residue, best_model.rms_error
return (
best_model.pole_residue.updated_copy(frequency_range=self.frequency_range),
best_model.rms_error,
)

@classmethod
def constant_loss_tangent_model(
Expand Down

0 comments on commit 95a4ca7

Please sign in to comment.