-
Notifications
You must be signed in to change notification settings - Fork 66
feat(FXC-4425) Plot BCs in Heat/Charge simulations #3103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a new plot() method to the HeatChargeSimulation class that provides a unified plotting interface. When property is None, it plots scene structures using the parent class's plot method and automatically adds electric boundary conditions for CHARGE simulations. When property is specified, it delegates to the existing plot_property() method.
- Added
plot()method with optionalpropertyparameter for flexible visualization - Automatic plotting of electric boundary conditions for CHARGE simulations when
property=None - Updated type annotations for
plot_property()method to useLiteraltypes for better type safety
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| tidy3d/components/tcad/simulation/heat_charge.py | Added new plot() method with unified interface, updated type annotations for plot_property() parameter, and added Literal import |
| tests/test_components/test_heat_charge.py | Added comprehensive test coverage for the new plot() method covering HEAT and CHARGE simulations with various property values |
| CHANGELOG.md | Documented the new feature in the unreleased section |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional Comments (1)
3 files reviewed, 4 comments
bef8d70 to
98bbae7
Compare
|
@greptile update summary |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3 files reviewed, 2 comments
…BCs are plotted in Charge simulations
98bbae7 to
f7df7a7
Compare
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
|
Greptile Summary
This PR enhances
HeatChargeSimulation.plot()to automatically display boundary conditions based on the simulation type. When called, the method now determines whether it's a HEAT, CHARGE, or CONDUCTION simulation and adds the appropriate boundary condition visualizations (heat boundaries for HEAT simulations, electric boundaries for CHARGE/CONDUCTION simulations).Key changes:
plot()method inHeatChargeSimulationto call parent's implementation then add simulation-type-specific boundary conditionsplot_boundaries()method with appropriatepropertyparameterLiteraltype hint forpropertyparameter inplot_property()methodIssues found:
**patch_kwargsparameter from parent class signature - breaks backward compatibility if users pass additional keyword arguments toplot()**patch_kwargsparameter needs to be forwarded tosuper().plot()callConfidence Score: 4/5
**patch_kwargsparameter creates a backward compatibility issue where users passing additional keyword arguments toplot()will encounter errors. This is a logical error that needs to be fixed before merging. The rest of the implementation follows good patterns by delegating to the parent class and reusing existingplot_boundaries()functionality.tidy3d/components/tcad/simulation/heat_charge.py- theplot()method signature must match the parent class to maintain backward compatibilityImportant Files Changed
plot()override to automatically add boundary conditions; missing**patch_kwargsparameter from parent signatureSequence Diagram
sequenceDiagram participant User participant HeatChargeSimulation participant AbstractSimulation participant Scene participant plot_boundaries User->>HeatChargeSimulation: plot(x, y, z, ax, ...) HeatChargeSimulation->>AbstractSimulation: super().plot(x, y, z, ax, ...) AbstractSimulation->>Scene: scene.plot_structures() Scene-->>AbstractSimulation: ax AbstractSimulation->>AbstractSimulation: plot_sources() AbstractSimulation->>AbstractSimulation: plot_monitors() AbstractSimulation->>AbstractSimulation: plot_boundaries() AbstractSimulation->>AbstractSimulation: plot_symmetries() AbstractSimulation-->>HeatChargeSimulation: ax HeatChargeSimulation->>HeatChargeSimulation: _get_simulation_types() alt HEAT simulation HeatChargeSimulation->>plot_boundaries: plot_boundaries(property="heat_conductivity") plot_boundaries-->>HeatChargeSimulation: ax end alt CHARGE or CONDUCTION simulation HeatChargeSimulation->>plot_boundaries: plot_boundaries(property="electric_conductivity") plot_boundaries-->>HeatChargeSimulation: ax end HeatChargeSimulation-->>User: ax