-
Notifications
You must be signed in to change notification settings - Fork 66
hotfix/updated simulation types check #3060
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.
1 file reviewed, 1 comment
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 updates the simulation type checking logic for TCAD charge simulations. The main purpose is to change how charge simulation types are determined - now primarily based on analysis_spec type rather than the presence of semiconductor materials, with additional validation to ensure semiconductors are present when required.
Key Changes:
- Moved
ChargeTypesandChargeMonitorTypestuple definitions from local scope to module level for better reusability - Modified
_check_simulation_typesto determine CHARGE type based onanalysis_specinstead of semiconductor presence - Added validation in
check_charge_simulationto ensure at least one semiconductor medium exists in charge simulations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Diff CoverageDiff: origin/develop...HEAD, staged and unstaged changes
Summary
|
09478f6 to
d0abb8a
Compare
|
@greptile Check the latest version of this PR. Check that previous issues have been resolved. |
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.
2 files reviewed, no comments
Greptile Overview
Greptile Summary
This PR refactors the simulation type detection logic to make
analysis_specthe authoritative source for determining CHARGE simulation type, rather than inferring it from semiconductor presence.Key changes:
ChargeTypesandChargeMonitorTypesto module level for reuse across methods_check_simulation_typesto trigger CHARGE only whenanalysis_specis aChargeTypesinstancecheck_charge_simulationto ensure semiconductors are present when CHARGE simulation is detected_get_simulation_typesto directly return CHARGE type based onanalysis_specThe logic is now more explicit and predictable: CHARGE simulations require both a ChargeTypes
analysis_specAND semiconductor media, with proper validation ensuring both conditions are met.Confidence Score: 4/5
Important Files Changed
File Analysis
analysis_specrather than semiconductor presence, moved type definitions to module level, added semiconductor validation for charge simulations, and fixed typosSequence Diagram
sequenceDiagram participant User participant HeatChargeSimulation participant _check_simulation_types participant _check_if_semiconductor_present participant check_charge_simulation User->>HeatChargeSimulation: Create simulation with analysis_spec HeatChargeSimulation->>_check_simulation_types: Validate (root validator) alt analysis_spec is ChargeTypes _check_simulation_types->>_check_simulation_types: Add CHARGE to simulation_types end _check_simulation_types->>_check_if_semiconductor_present: Check for semiconductors _check_if_semiconductor_present-->>_check_simulation_types: semiconductor_present flag loop For each boundary alt Boundary is HeatBCTypes _check_simulation_types->>_check_simulation_types: Add HEAT to simulation_types else Boundary is ElectricBCTypes AND no semiconductors _check_simulation_types->>_check_simulation_types: Add CONDUCTION to simulation_types end end loop For each source alt Source is HeatSourceTypes _check_simulation_types->>_check_simulation_types: Add HEAT to simulation_types end end _check_simulation_types-->>HeatChargeSimulation: Return simulation_types HeatChargeSimulation->>check_charge_simulation: Validate charge setup alt CHARGE in simulation_types check_charge_simulation->>check_charge_simulation: Validate VoltageBC count >= 2 check_charge_simulation->>check_charge_simulation: Validate ChargeMonitorTypes present check_charge_simulation->>_check_if_semiconductor_present: Check semiconductors _check_if_semiconductor_present-->>check_charge_simulation: semiconductor_present alt No semiconductors check_charge_simulation->>User: Raise SetupError end end check_charge_simulation-->>HeatChargeSimulation: Validation complete HeatChargeSimulation-->>User: Simulation created successfully