Skip to content

Singularity correction at metallic edges #2498

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Added heat sources with custom spatial dependence. It is now possible to add a `SpatialDataArray` as the `rate` in a `HeatSource`.
- Added Transient Heat simulations. It is now possible to run transient Heat simulations. This can be done by specifying `analysis_spec` of `HeatChargeSimulation` object as `UnsteadyHeatAnalysis`.
- A `num_grid_cells` field to `WavePort`, which ensures that there are 5 grid cells across the port. Grid refinement can be disabled by passing `None` to `num_grid_cells`.
- Enable singularity correction at PEC edges.

### Fixed
- Fixed bug in broadband adjoint source creation when forward simulation had a pulse amplitude greater than 1 or a nonzero pulse phase.
Expand Down
21 changes: 21 additions & 0 deletions tests/test_components/test_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2385,6 +2385,27 @@ def test_conformal_dt():
assert sim_heuristic.dt == dt


def test_edge_correction():
"""make sure edge correction can be enabled for PEC, but not lossy meal."""
sim = td.Simulation(
size=(2.0, 2.0, 2.0),
run_time=1e-12,
structures=[],
grid_spec=td.GridSpec.uniform(dl=0.1),
subpixel=td.SubpixelSpec(pec=td.PECConformal(edge_singularity_correction=False)),
)

sim = sim.updated_copy(
subpixel=td.SubpixelSpec(pec=td.PECConformal(edge_singularity_correction=True))
)

# but cannot be True for lossy metal
with pytest.raises(pydantic.ValidationError):
sim = sim.updated_copy(
subpixel=td.SubpixelSpec(metal=td.SurfaceImpedance(edge_singularity_correction=True))
)


def test_sim_volumetric_structures(tmp_path):
"""Test volumetric equivalent of 2D materials."""
sigma = 0.45
Expand Down
18 changes: 17 additions & 1 deletion tidy3d/components/subpixel_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import pydantic.v1 as pd

from .base import Tidy3dBaseModel, cached_property
from .types import TYPE_TAG_STR
from .types import TYPE_TAG_STR, Literal

# Default Courant number reduction rate in PEC conformal's scheme
DEFAULT_COURANT_REDUCTION_PEC_CONFORMAL = 0.3
Expand Down Expand Up @@ -120,6 +120,14 @@ class PECConformal(AbstractSubpixelAveragingMethod):
ge=0,
)

edge_singularity_correction: bool = pd.Field(
True,
title="Apply Singularity Model At Metal Edges",
description="Apply field correction model at metallic edges where field singularity occurs. "
"The correction is applied to straight edges aligned with the primal grids, and the wedge angle is either "
"0 or 90 degree.",
)

@cached_property
def courant_ratio(self) -> float:
"""The scaling ratio applied to Courant number so that the courant number
Expand All @@ -146,6 +154,14 @@ class SurfaceImpedance(PECConformal):
ge=0,
)

edge_singularity_correction: Literal[False] = pd.Field(
False,
title="Apply Singularity Model At Metal Edges",
description="Apply field correction model at metallic edges where field singularity occurs. "
"The correction is applied to straight edges aligned with the primal grids, and the wedge angle is either "
"0 or 90 degree.",
)
Comment on lines +157 to +163
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: This forces edge_singularity_correction to False for SurfaceImpedance but the rationale isn't documented. Add comment explaining why this must be False



LossyMetalSubpixelType = Union[Staircasing, VolumetricAveraging, SurfaceImpedance]

Expand Down
Loading