Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Greptile Overview
Updated On: 2025-10-21 11:28:16 UTC
Greptile Summary
This PR adds support for impact ionization in semiconductor device simulations by implementing Selberherr's model as a new
SelberherrImpactIonizationclass. Impact ionization is a critical physical phenomenon where high-energy carriers create electron-hole pairs through collisions, essential for modeling avalanche photodiodes and breakdown effects. The implementation follows established patterns for generation-recombination models in the TCAD module, with six material-dependent parameters (alpha_n_inf, alpha_p_inf, E_n_crit, E_p_crit, beta_n, beta_p) and two formulation options ('Selberherr' and 'PQ'). The new model is properly integrated into the type system, exposed through the public API, documented in the changelog, and covered by a basic construction test.Changed Files
SelberherrImpactIonizationin the import list and RecombinationModelType unionSelberherrImpactIonizationin the public API by adding it to imports and__all__SelberherrImpactIonizationclass with parameters, docstring, and mathematical formulationConfidence score: 3/5
Specific issues:
Missing formulation validation (tidy3d/components/tcad/generation_recombination.py, line 357): The
formulationfield accepts any string but should be restricted to 'Selberherr' or 'PQ'. Use Pydantic'sLiteral["Selberherr", "PQ"]type annotation instead ofstrto enforce valid values at model construction time.Potential numerical instability (tidy3d/components/tcad/generation_recombination.py, line 299): The mathematical formula involves
E · J_νin the denominator, which could be zero or negative if the electric field and current density are perpendicular or opposing. Consider adding documentation about expected input ranges or runtime validation to prevent undefined behavior.Insufficient test coverage (tests/test_components/test_heat_charge.py, lines 2386-2394): The test only verifies successful construction with valid parameters. Add tests for: (a) invalid formulation strings to verify validation works, (b) boundary cases for numerical parameters (zeros, very small/large values), and (c) integration with charge simulations if applicable. (Rule: 40c78813-75a7-47ea-a080-1509e6e686a9)
Incomplete propagation check: Verify that the new model is properly handled in all code paths that process
RecombinationModelType. Search for pattern matches, isinstance checks, or method dispatch on recombination models to ensure nothing was missed. (Rule: 809457d4-6b33-46ed-b49b-37057d02807e)Sequence Diagram
sequenceDiagram participant User participant SemiconductorMedium participant HeatChargeSimulation participant Solver User->>SemiconductorMedium: "Create with SelberherrImpactIonization in R parameter" SemiconductorMedium-->>User: "Returns configured medium" User->>HeatChargeSimulation: "Create simulation with semiconductor structures" HeatChargeSimulation->>HeatChargeSimulation: "Validate configuration" User->>Solver: "web.run(simulation)" Solver->>Solver: "Apply impact ionization model during solve" Solver-->>User: "Returns simulation data"Context used:
dashboard- When modifying a piece of logic, ensure the change is propagated to all independent functions or cal... (source)dashboard- Add tests for all public constructors and methods to confirm expected behavior, including effects on... (source)