PN Junction model from Sze - #2
Closed
mdmaas wants to merge 4 commits into
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Implements a PN-junction depletion model for the 2D TW-MZM workflow, replacing the hand-picked junction capacitance with textbook physics.
Formulas (Sze & Ng, Physics of Semiconductor Devices, 3rd ed., Wiley, ch. 2)
V_bi = (k_B T / q) ln(Na·Nd / ni²)W = sqrt(2·eps_s·(V_bi + V_R)/q · (Na+Nd)/(Na·Nd)), split asymmetricallyx_p = W·Nd/(Na+Nd)into P andx_n = W·Na/(Na+Nd)into NW = [12·eps_s·(V_bi+V_R)/(q·a)]^(1/3)with grade constanta = |dN/dx|C_j = eps_s / W(per area),C = eps_s·A/WabsoluteDoping concentrations use the industry-standard cm⁻³; lengths in µm.
User API
Two representation modes, auto-selected from W vs the flanking doped sections (high-res when
W >= ~1/5of the smaller flank, capacitance otherwise; manual override viamode=):sim.set_pn_junction(junc, layer_p="p_rib", layer_n="n_rib", length_um=10.0, height_um=0.22)The profile builder returns doped regions, P/N regions, junction metadata (widths/capacitance/chosen mode):
Demo
The 2d_twmzm notebook now illustrates this: default doping (~1e19 cm⁻³, W≈17 nm) auto-selects capacitance mode (13.9 fF vs the previous hardcoded 1 fF), and a sweep shows W crossing the threshold into high-res mode.
Also fixed
build_doped_cross_section()never registered the merged doping/rib materials onstack.materials, so doped domains silently resolved to eps=1.0 without conductivity in generated Palace configs (visible in prior demo artifacts). Now registered, with regression test.Tests
41 new tests: physics values/limits/scalings and error paths, profile geometry/materials/auto-mode boundary cases, and end-to-end Palace checks (Impedance Cs value in capacitance mode; junction dielectric domain group with eps=11.9/no conductivity in high-res mode).