Skip to content

Commit a0712cc

Browse files
weiliangjin2021momchil-flex
authored andcommitted
Rename global_min_dl to dl_min in AutoGrid
1 parent 6a81711 commit a0712cc

File tree

5 files changed

+19
-19
lines changed

5 files changed

+19
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ method for computing the overlap integral over two sets of frequency-domain fiel
2525
- `sidewall_angle` option for `Cylinder` that allows a `Cylinder` to be tuned into a conical frustum or a cone.
2626
- `reference_plane` for `PolySlab` that provides options to define the vertices at the bottom, middle, or top of the `PolySlab`.
2727
- Automesh generation: `MeshOverrideStructure` that allows for a direct grid size specification in override structures,
28-
and `global_min_dl` that bounds the minimal grid size.
28+
and `dl_min` that bounds the minimal grid size.
2929
- More material models to the material database such as gold from Olman2012.
3030
- In `AdvancedFitterParam` for `StableDispersionFitter`, `random_seed` option to set the random seed,
3131
and `bound_f_lower` to set the lower bound of pole frequency.

tests/sims/simulation_1_8_0.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

tests/test_components/test_meshgenerate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ def test_mesh_multiple_direct_override_and_global_min():
538538
Let's consider three override structures: enforced + default + enforced;
539539
The two enforced structure overlap.
540540
541-
We also test global_min_dl here.
541+
We also test dl_min here.
542542
"""
543543

544544
override_enforce1 = td.MeshOverrideStructure(
@@ -570,13 +570,13 @@ def test_mesh_multiple_direct_override_and_global_min():
570570
assert min(sizes) <= 0.05
571571
assert sizes[-1] > 0.12
572572

573-
# now let's set a global_min_dl
573+
# now let's set a dl_min
574574
sim = td.Simulation(
575575
size=(3, 3, 3),
576576
grid_spec=td.GridSpec.auto(
577577
wavelength=WAVELENGTH,
578578
override_structures=[override_enforce1, override_default, override_enforce2],
579-
global_min_dl=0.1,
579+
dl_min=0.1,
580580
),
581581
run_time=1e-13,
582582
structures=[BOX1],
@@ -660,5 +660,5 @@ def test_shapely_strtree_warnings(caplog):
660660
structures=[BOX1, BOX2],
661661
wavelength=1.0,
662662
min_steps_per_wvl=6,
663-
global_min_dl=1.0,
663+
dl_min=1.0,
664664
)

tidy3d/components/grid/grid_spec.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class AutoGrid(GridSpec1d):
276276
lt=2.0,
277277
)
278278

279-
global_min_dl: pd.NonNegativeFloat = pd.Field(
279+
dl_min: pd.NonNegativeFloat = pd.Field(
280280
0,
281281
title="Lower bound of grid size",
282282
description="Lower bound of the grid size along this dimension regardless of "
@@ -341,7 +341,7 @@ def _make_coords_initial( # pylint:disable=too-many-arguments,arguments-differ,
341341
struct_list,
342342
wavelength,
343343
self.min_steps_per_wvl,
344-
self.global_min_dl,
344+
self.dl_min,
345345
)
346346
# Put just a single pixel if 2D-like simulation
347347
if interval_coords.size == 1:
@@ -554,7 +554,7 @@ def auto( # pylint:disable=too-many-arguments
554554
min_steps_per_wvl: pd.PositiveFloat = 10.0,
555555
max_scale: pd.PositiveFloat = 1.4,
556556
override_structures: List[StructureType] = (),
557-
global_min_dl: pd.NonNegativeFloat = 0.0,
557+
dl_min: pd.NonNegativeFloat = 0.0,
558558
mesher: MesherType = GradedMesher(),
559559
) -> GridSpec:
560560
"""Use the same :class:`AutoGrid` along each of the three directions.
@@ -573,7 +573,7 @@ def auto( # pylint:disable=too-many-arguments
573573
A list of structures that is added on top of the simulation structures in
574574
the process of generating the grid. This can be used to refine the grid or make it
575575
coarser depending than the expected need for higher/lower resolution regions.
576-
global_min_dl: pd.NonNegativeFloat
576+
dl_min: pd.NonNegativeFloat
577577
Lower bound of grid size.
578578
mesher : MesherType = GradedMesher()
579579
The type of mesher to use to generate the grid automatically.
@@ -587,7 +587,7 @@ def auto( # pylint:disable=too-many-arguments
587587
grid_1d = AutoGrid(
588588
min_steps_per_wvl=min_steps_per_wvl,
589589
max_scale=max_scale,
590-
global_min_dl=global_min_dl,
590+
dl_min=dl_min,
591591
mesher=mesher,
592592
)
593593
return cls(

tidy3d/components/grid/mesher.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def parse_structures( # pylint:disable=too-many-arguments
3333
structures: List[StructureType],
3434
wavelength: pd.PositiveFloat,
3535
min_steps_per_wvl: pd.NonNegativeInt,
36-
global_min_dl: pd.NonNegativeFloat,
36+
dl_min: pd.NonNegativeFloat,
3737
) -> Tuple[ArrayLike[float, 1], ArrayLike[float, 1]]:
3838
"""Calculate the positions of all bounding box interfaces along a given axis."""
3939

@@ -59,7 +59,7 @@ def parse_structures(
5959
structures: List[StructureType],
6060
wavelength: pd.PositiveFloat,
6161
min_steps_per_wvl: pd.NonNegativeInt,
62-
global_min_dl: pd.NonNegativeFloat,
62+
dl_min: pd.NonNegativeFloat,
6363
) -> Tuple[ArrayLike[float, 1], ArrayLike[float, 1]]:
6464
"""Calculate the positions of all bounding box interfaces along a given axis.
6565
In this implementation, in most cases the complexity should be O(len(structures)**2),
@@ -76,7 +76,7 @@ def parse_structures(
7676
Wavelength to use for the step size and for dispersive media epsilon.
7777
min_steps_per_wvl : pd.NonNegativeInt
7878
Minimum requested steps per wavelength.
79-
global_min_dl: pd.NonNegativeFloat
79+
dl_min: pd.NonNegativeFloat
8080
Lower bound of grid size.
8181
8282
Returns
@@ -120,7 +120,7 @@ def parse_structures(
120120

121121
# Required maximum steps in every structure
122122
structure_steps = self.structure_steps(
123-
structures_ordered, wavelength, min_steps_per_wvl, global_min_dl, axis
123+
structures_ordered, wavelength, min_steps_per_wvl, dl_min, axis
124124
)
125125
# Smallest of the maximum steps
126126
min_step = np.amin(structure_steps)
@@ -346,7 +346,7 @@ def structure_steps(
346346
structures: List[StructureType],
347347
wavelength: float,
348348
min_steps_per_wvl: float,
349-
global_min_dl: pd.NonNegativeFloat,
349+
dl_min: pd.NonNegativeFloat,
350350
axis: Axis,
351351
) -> ArrayLike[float, 1]:
352352
"""Get the minimum mesh required in each structure.
@@ -359,7 +359,7 @@ def structure_steps(
359359
Wavelength to use for the step size and for dispersive media epsilon.
360360
min_steps_per_wvl : float
361361
Minimum requested steps per wavelength.
362-
global_min_dl: pd.NonNegativeFloat
362+
dl_min: pd.NonNegativeFloat
363363
Lower bound of grid size.
364364
axis : Axis
365365
Axis index along which to operate.
@@ -371,9 +371,9 @@ def structure_steps(
371371
structure.medium.eps_diagonal(C_0 / wavelength)[axis]
372372
)
373373
index = max(abs(n), abs(k))
374-
min_steps.append(max(global_min_dl, wavelength / index / min_steps_per_wvl))
374+
min_steps.append(max(dl_min, wavelength / index / min_steps_per_wvl))
375375
elif isinstance(structure, MeshOverrideStructure):
376-
min_steps.append(max(global_min_dl, structure.dl[axis]))
376+
min_steps.append(max(dl_min, structure.dl[axis]))
377377
return np.array(min_steps)
378378

379379
@staticmethod

0 commit comments

Comments
 (0)