Skip to content

Conversation

@marc-flex
Copy link
Contributor

@marc-flex marc-flex commented Oct 1, 2025

Greptile Overview

Updated On: 2025-10-01 16:14:14 UTC

Summary

This PR corrects the monitor validation logic in Charge simulations within the TCAD module. The change modifies which monitor types require `unstructured=True` in the validation routine.

Specifically, the validation now checks SteadyPotentialMonitor and TemperatureMonitor instead of the previous combination of SteadyPotentialMonitor and SteadyFreeCarrierMonitor. This means:

  • TemperatureMonitor must now be unstructured in Charge simulations
  • SteadyFreeCarrierMonitor can now be structured (unstructured=False)
  • SteadyPotentialMonitor continues to require unstructured=True

The change aligns the code implementation with the existing comment that states "only Temperature and Potential monitors can be structured". Previously, the code was inconsistent with this documentation, incorrectly treating SteadyFreeCarrierMonitor as requiring unstructured configuration while not enforcing this requirement for TemperatureMonitor.

This validation occurs in the HeatChargeSimulation class and affects how users configure monitors in multi-physics simulations that combine heat transfer and charge transport physics. The change ensures proper computational backend compatibility for different monitor types in the TCAD charge simulation framework.

Important Files Changed

Changed Files
Filename Score Overview
tidy3d/components/tcad/simulation/heat_charge.py 4/5 Fixed monitor validation logic to correctly check TemperatureMonitor instead of SteadyFreeCarrierMonitor for unstructured requirement

Confidence score: 4/5

  • This PR is safe to merge with minimal risk as it fixes a validation inconsistency
  • Score reflects a straightforward logic correction that aligns code with documented behavior
  • No files require special attention beyond the single modified validation routine

Sequence Diagram

sequenceDiagram
    participant User
    participant HeatChargeSimulation
    participant Validators
    participant GridSpec
    participant Structures
    participant Monitors
    participant BoundarySpec
    participant Sources

    User->>HeatChargeSimulation: "Create simulation instance"
    HeatChargeSimulation->>Validators: "_post_init_validators()"
    Validators->>HeatChargeSimulation: "_estimate_charge_mesh_size()"
    
    User->>HeatChargeSimulation: "Validate structures"
    HeatChargeSimulation->>Validators: "check_unsupported_geometries()"
    Validators->>Structures: "Check geometry dimensions"
    Structures-->>Validators: "Return validation result"
    Validators-->>HeatChargeSimulation: "Validation complete"
    
    User->>HeatChargeSimulation: "Validate monitors"
    HeatChargeSimulation->>Validators: "_monitors_cross_solids()"
    Validators->>HeatChargeSimulation: "_check_cross_solids()"
    HeatChargeSimulation->>Structures: "Check intersecting media"
    Structures-->>HeatChargeSimulation: "Return intersection data"
    HeatChargeSimulation-->>Validators: "Return validation result"
    Validators-->>HeatChargeSimulation: "Monitor validation complete"
    
    User->>HeatChargeSimulation: "Check charge simulation setup"
    HeatChargeSimulation->>Validators: "check_charge_simulation()"
    Validators->>HeatChargeSimulation: "_check_simulation_types()"
    HeatChargeSimulation->>BoundarySpec: "Check voltage BCs"
    BoundarySpec-->>HeatChargeSimulation: "Return BC count"
    HeatChargeSimulation->>Monitors: "Check charge monitors"
    Monitors-->>HeatChargeSimulation: "Return monitor types"
    HeatChargeSimulation-->>Validators: "Return simulation type validation"
    Validators-->>HeatChargeSimulation: "Charge validation complete"
    
    User->>HeatChargeSimulation: "Plot simulation properties"
    HeatChargeSimulation->>HeatChargeSimulation: "plot_property()"
    HeatChargeSimulation->>Sources: "plot_sources()"
    HeatChargeSimulation->>Monitors: "plot_monitors()"
    HeatChargeSimulation->>BoundarySpec: "plot_boundaries()"
    BoundarySpec->>HeatChargeSimulation: "_construct_heat_charge_boundaries()"
    HeatChargeSimulation-->>User: "Return plotted axes"
Loading

@marc-flex marc-flex requested a review from momchil-flex October 1, 2025 16:13
@marc-flex marc-flex self-assigned this Oct 1, 2025
Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@github-actions
Copy link
Contributor

github-actions bot commented Oct 1, 2025

Diff Coverage

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

  • tidy3d/components/tcad/simulation/heat_charge.py (100%)

Summary

  • Total: 1 line
  • Missing: 0 lines
  • Coverage: 100%

@momchil-flex momchil-flex merged commit ef3d257 into develop Oct 3, 2025
27 of 52 checks passed
@momchil-flex momchil-flex deleted the marc/check_temp_mnt_unstructured branch October 3, 2025 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants