# Layer Refinement

Layer Refinement defines automatic mesh snapping and refinement for layered structures.

This object corresponds to tidy3d.LayerRefinementSpec (opens new window).

Layer refinement is useful for RF layouts where thin conductor or dielectric layers need controlled resolution along the layer normal direction. It can also align grid cells with important stack-up interfaces, layer bounds, and in-plane corners.

# Name

name: Unique name for the layer refinement.

  • Required field

# Geometry

The refinement region can be created from nets, from layers, or from an explicit geometry.

# Nets

nets: Net objects used to define the refinement region.

  • Required field when creating from the Nets tab

When one or more nets are selected, the layer refinement geometry follows the bounding box of the selected nets.

# Layers

layers: Layer objects used to define the refinement region.

  • Required field when creating from the Layers tab

When one or more layers are selected, the layer refinement geometry follows the bounding box of the selected layers.

# Convert to Center and Size

convert to center and size: Convert the selected nets or layers into an explicit center and size definition.

This option applies only to geometry created from selected nets or layers. Use this option to convert the geometry to the center/size definition for manual adjustment.

WARNING

The conversion to the center/size definition is non-reversible. To revert back to the layer- or net-based definition, please create a new LayerRefinementSpec.

# Center + Size

Object definition through a center position and size.

center: Center of the refinement region in x, y, and z-directions.

  • Type: floating-point number
  • Unit: m, mm (default unit), um

size: Size of the refinement region in x, y, and z-directions.

  • Type: floating-point number
  • Unit: m, mm (default unit), um
  • Constraint: greater than or equal to 0
  • Required field

# Bounds

Object definition through minimum and maximum coordinate bounds.

min: Values of the x, y, and z coordinates defining the lower corner of the refinement region.

  • Type: floating-point number
  • Unit: m, mm (default unit), um
  • Required field

max: Values of the x, y, and z coordinates defining the upper corner of the refinement region.

  • Type: floating-point number
  • Unit: m, mm (default unit), um
  • Required field

# Settings

# Layer Normal Axis

axis: Layer normal axis used to orient layer-boundary, in-plane-corner, and in-plane-edge refinement.

  • GUI label: Layer normal axis
  • Options:
    • Auto: For geometry defined by selected nets or layers, use the normal axis of the associated stack-up base plane.
    • Manual: Select X, Y, or Z.
  • For an explicit center-and-size geometry, select X, Y, or Z directly.
  • Required field

min_steps_along_axis: Minimum number of grid steps across the layer thickness along the selected normal axis.

  • GUI label: Follows the selected axis, such as Min. Steps Along X Axis, Min. Steps Along Y Axis, or Min. Steps Along Z Axis
  • Type: floating-point number

Layer-normal refinement is applied through the selected normal direction. For example, when axis = Z, min_steps_along_axis = 2 creates at least two grid steps across each selected copper layer thickness in the z direction, while dielectric layers can remain on the default grid.

Minimum steps along the Z axis

min_steps_per_geometry: Minimum number of grid cells placed across each small disjoint geometry detected in the layer plane.

  • GUI label: Min. steps per geometry
  • Type: floating-point number
  • Constraint: greater than 0
  • Default: 2

Leave this field empty to disable small-geometry resolution.

# Refinement Along Normal Axis

These controls snap or refine grid cells near layer boundaries along the selected normal axis. In the GUI, the panel label follows the selected axis, such as X Axis Boundary Refinement, Y Axis Boundary Refinement, or Z Axis Boundary Refinement.

bounds_snapping: Toggle whether grid boundaries are snapped to a boundary position along the layer normal axis.

  • Options:
    • True: Enable Snap to boundary.
    • False: Do not add a bounds snapping position.

type: Boundary position used when Snap to boundary is enabled.

  • Options: Lower/Center/Upper/Bounds

For axis = Z, bounds snapping aligns z grid boundaries with selected positions through the layer thickness.

Bounds snapping

bounds_refinement: Toggle whether the mesh is refined near the selected layer boundary.

  • Options:
    • True: Enable Refine near boundary.
    • False: Do not add bounds refinement.

When enabled, bounds_refinement uses the following Grid Refinement settings.

# Refinement Along In-plane Axes

These controls snap or refine grid cells near detected corners and axis-unaligned edges in the plane perpendicular to the selected normal axis. In the GUI, the corner and edge panel labels follow the selected axis, such as YZ Plane Corner Refinement and YZ Plane Edge Refinement for the x normal axis.

# Refine Near Corners

corner_snapping: Toggle whether grid boundaries are snapped to detected in-plane corners.

  • Options:
    • True: Enable Snap to corners.
    • False: Do not add corner snapping points.
  • Default: True

corner_refinement: Toggle whether the mesh is refined near detected in-plane corners.

  • Options:
    • True: Enable Refine near corners.
    • False: Do not add corner refinement.
  • Default: True

When enabled, corner_refinement uses the following Grid Refinement settings.

Corner snapping and refinement in the in-plane axes

# Refine Near Edges

in_plane_edge_refinement: Controls mesh refinement along axis-unaligned edges in the layer plane.

  • GUI label: Refine near edges
  • Type: string, GridRefinement, or None
  • Default: Mirror corner

Enable the Refine near edges radio button to display the refinement definition:

  • Mirror corner: String ("mirror_corner") that reuses the same GridRefinement settings as corner_refinement.
  • Custom: GridRefinement object whose settings are defined by the user specifically for in-plane edge refinement. See Grid Refinement for its fields.

Disabling Refine near edges sets in_plane_edge_refinement to None and does not add edge refinement.

In-plane edge refinement

# Advanced

corner_finder: Toggle custom corner-finder settings for in-plane corner detection.

  • Options:
    • True: Enable Custom corner finder and show the corner-finder fields.
    • False: Use the default corner-finder behavior.
  • Default: True

See Corner Finder Specification for the shared corner-finder object.

dl_min_from_gap_width: Toggle whether detected gap width contributes to the suggested minimum grid size.

  • Options:
    • True: Enable Min. grid size from gap width.
    • False: Do not use detected gap width for the local minimum grid size.

gap_meshing_iters: Number of recursive iterations used for resolving thin in-plane gaps.

  • GUI label: Auto gap mesh iterations
  • Type: integer
  • Default: 1

Gap meshing in the XY plane

refinement_inside_sim_only: Toggle whether refinement is limited to structural features inside the simulation domain.

  • Options:
    • True: Enable Refine inside simulation bounds only.
    • False: Allow refinement based on structural features outside the simulation domain also.
  • Default: True

interior_disjoint_geometries: Toggle handling of disjoint interior geometries.

  • Options:
    • True: Enable Interior disjoint geometries.
    • False: Do not include disjoint interior geometries.

NOTE

Layer refinement is applied through the grid specification and is used when at least one grid direction uses AutoGrid or QuasiUniformGrid.