From 8c69033a27095d40b593bb1235c967f31f7ef0e7 Mon Sep 17 00:00:00 2001 From: momchil Date: Tue, 12 Nov 2024 14:10:21 +0100 Subject: [PATCH] Set minimum PML layers to 6 --- CHANGELOG.md | 3 ++- tidy3d/components/boundary.py | 16 +++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dc94d0da5..32f6a9e25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - `CustomMedium` design regions require far less data when performing inverse design by reducing adjoint field monitor size for dims with one pixel. -- Calling `.values` on `DataArray` no longer raises a `DeprecationWarning` during automatic differentiation +- Calling `.values` on `DataArray` no longer raises a `DeprecationWarning` during automatic differentiation. +- Minimum number of PML layers set to 6. ### Fixed - Regression in local field projection leading to incorrect results for `far_field_approx=True`. diff --git a/tidy3d/components/boundary.py b/tidy3d/components/boundary.py index 76441f9f3..97c51a4ea 100644 --- a/tidy3d/components/boundary.py +++ b/tidy3d/components/boundary.py @@ -260,10 +260,11 @@ class PMLParams(AbsorberParams): class AbsorberSpec(BoundaryEdge): """Specifies the generic absorber properties along a single dimension.""" - num_layers: pd.NonNegativeInt = pd.Field( + num_layers: int = pd.Field( ..., title="Number of Layers", description="Number of layers of standard PML.", + gt=5, ) parameters: AbsorberParams = pd.Field( ..., @@ -376,10 +377,11 @@ class PML(AbsorberSpec): """ - num_layers: pd.NonNegativeInt = pd.Field( + num_layers: int = pd.Field( 12, title="Number of Layers", description="Number of layers of standard PML.", + gt=5, ) parameters: PMLParams = pd.Field( @@ -413,8 +415,11 @@ class StablePML(AbsorberSpec): * `Introduction to perfectly matched layer (PML) tutorial `__ """ - num_layers: pd.NonNegativeInt = pd.Field( - 40, title="Number of Layers", description="Number of layers of 'stable' PML." + num_layers: int = pd.Field( + 40, + title="Number of Layers", + description="Number of layers of 'stable' PML.", + gt=5, ) parameters: PMLParams = pd.Field( @@ -463,10 +468,11 @@ class Absorber(AbsorberSpec): * `How to troubleshoot a diverged FDTD simulation <../../notebooks/DivergedFDTDSimulation.html>`_ """ - num_layers: pd.NonNegativeInt = pd.Field( + num_layers: int = pd.Field( 40, title="Number of Layers", description="Number of layers of absorber to add to + and - boundaries.", + gt=5, ) parameters: AbsorberParams = pd.Field(