Skip to content

feat(tidy3d): FXC-1539 implement spatially varying heat conductivity#3333

Open
damiano-flex wants to merge 1 commit intodevelopfrom
damiano/spatial_conductivity
Open

feat(tidy3d): FXC-1539 implement spatially varying heat conductivity#3333
damiano-flex wants to merge 1 commit intodevelopfrom
damiano/spatial_conductivity

Conversation

@damiano-flex
Copy link
Contributor

@damiano-flex damiano-flex commented Feb 24, 2026

Frontend implementation of spatially varying conductivity.

  • Potentially, we could enable spatially varying conductivity for conductors too.
  • I am not 100% sure on the plot part. It had to be changed to accommodate the non-uniform heat source, but I am wondering if it pollutes other plots. Let's see if we get something useful out from bug-bot.

Note

Medium Risk
Expands core simulation/material validation and plotting paths to support non-scalar conductivities; risk is mainly in schema/serialization compatibility and potential plotting regressions (norm/overlays), plus a new unsupported-case guard for semiconductor mixes.

Overview
Adds support for spatially varying thermal conductivity by allowing SolidMedium/SolidSpec.conductivity to accept SpatialDataArray (including from_si_units scaling) and updating JSON schemas to allow non-numeric conductivity values.

Extends Scene.plot_structures_property to plot heat_conductivity/electric_conductivity with updated bounds handling for spatial data and an optional pcolormesh overlay clipped to each structure; includes tests covering acceptance, unit scaling, overlay rendering, and log-scale norm behavior.

Also allows ChargeConductorMedium.conductivity to be a SpatialDataArray, and adds a HeatChargeSimulation setup check that rejects spatial conductor conductivity when semiconductor structures are present (with a corresponding test).

Written by Cursor Bugbot for commit 5756c58. This will update automatically on new commits. Configure here.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 24, 2026

Diff Coverage

Diff: origin/develop...HEAD, staged and unstaged changes

  • tidy3d/components/material/tcad/charge.py (100%)
  • tidy3d/components/material/tcad/heat.py (100%)
  • tidy3d/components/scene.py (94.5%): Missing lines 1242,1855-1856,1970
  • tidy3d/components/tcad/simulation/heat_charge.py (100%)

Summary

  • Total: 91 lines
  • Missing: 4 lines
  • Coverage: 95%

tidy3d/components/scene.py

Lines 1238-1246

  1238                     ax=ax,
  1239                     norm=norm,
  1240                 )
  1241             elif property == "electric_conductivity":
! 1242                 Scene._add_cbar(
  1243                     vmin=property_min,
  1244                     vmax=property_max,
  1245                     label=f"Electric conductivity ({CONDUCTIVITY})",
  1246                     cmap=STRUCTURE_HEAT_COND_CMAP,

Lines 1851-1860

  1851             cond_list = []
  1852             for medium in cond_mediums:
  1853                 cond = medium.charge.conductivity
  1854                 if isinstance(cond, SpatialDataArray):
! 1855                     cond_list.append(float(np.min(cond.values)))
! 1856                     cond_list.append(float(np.max(cond.values)))
  1857                 else:
  1858                     cond_list.append(float(cond))
  1859 
  1860         if len(cond_list) == 0:

Lines 1966-1974

  1966         elif property == "electric_conductivity":
  1967             if isinstance(medium.charge, ChargeConductorMedium):
  1968                 cond = medium.charge.conductivity
  1969                 if isinstance(cond, SpatialDataArray):
! 1970                     return cond
  1971         return None
  1972 
  1973     def _plot_spatial_conductivity_on_shape(
  1974         self,

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@damiano-flex damiano-flex force-pushed the damiano/spatial_conductivity branch 2 times, most recently from 3d7aca8 to 68ce9a2 Compare February 24, 2026 15:19
@damiano-flex damiano-flex force-pushed the damiano/spatial_conductivity branch from 68ce9a2 to 5756c58 Compare February 24, 2026 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant