driftlet 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/types.js CHANGED
@@ -39,6 +39,8 @@
39
39
  * @property {{ species: string, conductivity: number }} [conductor] a metal or fast ion
40
40
  * conductor: its one carrier and conductivity (S/m); its only level is the carrier's (a metal's
41
41
  * Fermi level), and φ is undefined inside
42
+ * @property {number} [T] the temperature its data are for (K): a device at another temperature
43
+ * warns (semiconductor() sets it)
42
44
  */
43
45
 
44
46
  /**
@@ -163,7 +165,8 @@
163
165
  * species and the terminal species at the port's level
164
166
  * @property {Record<string, { mu0: number, capacity: number, theta0?: number }>} [surface] with reactions: species
165
167
  * on the electrode's sites, Langmuir (μ = μ° + RT ln(θ/θ₀)), capacity in mol of sites per m² of electrode,
166
- * shared; a reaction with `bare: true` runs only on the bare fraction θ₀ = 1 − Σθ
168
+ * shared; reactions run on Langmuir sites (what fills sites needs bare ones), and one with `bare: true`
169
+ * needs a bare site even if it fills none (θ₀ = 1 − Σθ)
167
170
  * @property {{ C: number, zeroCharge?: number }} [capacitance] a capacitance spread through the window (F/m² of
168
171
  * electrode): σ = C (V − zeroCharge − φ) on the port's side, aσ in each node's charge balance; a gate
169
172
  * along a channel, a double layer
package/types/data.d.ts CHANGED
@@ -15,19 +15,56 @@ export function aqueous(names: string[], { epsr, material }?: {
15
15
  };
16
16
  /**
17
17
  * A semiconductor from `SEMICONDUCTORS`, as a library piece: electrons `e-` and holes `h+`, with
18
- * c_ref = Nc and Nv, D from the mobilities by the Einstein relation at 300 K, and μ°_e⁻ = 0 (φ
19
- * anchored at the conduction band) and μ°_h⁺ = Eg·F. The data are for 300 K, so use `T: 300`.
18
+ * c_ref = Nc and Nv, D from the mobilities by the Einstein relation at T, and μ°_e⁻ = 0 (φ
19
+ * anchored at the conduction band) and μ°_h⁺ = Eg·F. The data are for 300 K; another T (150 to
20
+ * 500 K) moves them: the gap by Varshni's shift from 300 K, Nc and Nv as T^1.5, the mobilities by
21
+ * lattice-limited power laws (light doping). The material carries its `T`, and a device at
22
+ * another temperature warns: give the device the same T.
20
23
  * Statistics are ideal (Boltzmann); add Fermi–Dirac to the material for degenerate doping.
21
24
  * @param {string} name 'Si', 'Ge' or 'GaAs'
22
- * @param {{ material?: string }} [opts]
25
+ * @param {{ material?: string, T?: number }} [opts] the material's name, and the temperature
26
+ * (K, default 300, the table's)
23
27
  * @returns {{ species: object[], materials: Record<string, object> }}
24
28
  */
25
- export function semiconductor(name: string, { material }?: {
29
+ export function semiconductor(name: string, { material, T }?: {
26
30
  material?: string;
31
+ T?: number;
27
32
  }, ...args: any[]): {
28
33
  species: object[];
29
34
  materials: Record<string, object>;
30
35
  };
36
+ /**
37
+ * A trap level in a semiconductor that holds charge: its two charge states as immobile species
38
+ * (D = 0), filled and emptied by capturing carriers, e⁻ + X⁰ = X⁻ and X⁻ + h⁺ = X⁰ (acceptor-like)
39
+ * or X⁺ + e⁻ = X⁰ and X⁰ + h⁺ = X⁺ (donor-like). In steady state it recombines at exactly the
40
+ * `srh` law's rate with the same τ_n, τ_p and n₁, and its charge is in Poisson's equation, which
41
+ * the `srh` law (the trap's occupancy eliminated) leaves out. Each node keeps its own total.
42
+ * @param {{ species: object[], materials: Record<string, object> }} lib a library entry with e⁻
43
+ * and h⁺ (semiconductor()), returned with the trap's states added
44
+ * @param {{ density: number, tauN: number, tauP: number, n1?: number, charge?: 'acceptor' | 'donor',
45
+ * name?: string, material?: string, T?: number }} opts density N_t (mol/m³); τ_n = 1/(c_n N_t)
46
+ * and τ_p = 1/(c_p N_t) (s) at that density; n₁, the electron density that half-fills it
47
+ * (mol/m³; default n_i, midgap); T (K, default the material's T, else 300)
48
+ * @returns {{ library: object, bulkReactions: object[], c0: Record<string, number> }} the library
49
+ * for build(), the capture reactions, and c0 for each layer holding the trap (its total N_t)
50
+ */
51
+ export function trap(lib: {
52
+ species: object[];
53
+ materials: Record<string, object>;
54
+ }, { density, tauN, tauP, n1, charge, name, material, T }?: {
55
+ density: number;
56
+ tauN: number;
57
+ tauP: number;
58
+ n1?: number;
59
+ charge?: "acceptor" | "donor";
60
+ name?: string;
61
+ material?: string;
62
+ T?: number;
63
+ }, ...args: any[]): {
64
+ library: object;
65
+ bulkReactions: object[];
66
+ c0: Record<string, number>;
67
+ };
31
68
  /**
32
69
  * A metal from `METALS` as a conductor material, its carrier `e-`.
33
70
  * @param {string} name
@@ -57,7 +94,7 @@ export const H2O: -237.129e3;
57
94
  export const WATER_EPSR: 78.3;
58
95
  /**
59
96
  * Semiconductors at 300 K (Sze, Physics of Semiconductor Devices, 2nd ed., 1981, appendix):
60
- * relative permittivity, band gap Eg (eV), electron affinity chi (V), effective densities of
97
+ * relative permittivity, band gap Eg (eV), electron affinity chi (eV), effective densities of
61
98
  * states Nc and Nv (cm⁻³), and drift mobilities of lightly doped material mun and mup
62
99
  * (cm²/(V·s)).
63
100
  */
package/types/errors.d.ts CHANGED
@@ -6,6 +6,14 @@
6
6
  * @param {new (message: string) => Error} [Kind]
7
7
  */
8
8
  export function checkOptions(where: string, opts: unknown, allowed: string[], Kind?: new (message: string) => Error): void;
9
+ /**
10
+ * A value as an error message shows it: a number as itself (NaN and Infinity too, which JSON
11
+ * would print as null), a string quoted and called one ("350", a string, where a number was
12
+ * wanted).
13
+ * @param {unknown} v
14
+ * @returns {string}
15
+ */
16
+ export function shown(v: unknown): string;
9
17
  export class DeviceError extends Error {
10
18
  constructor(message: any);
11
19
  }
package/types/kit.d.ts CHANGED
@@ -66,4 +66,4 @@ export { hodgkinHuxley, ghkCurrent } from "./channels.js";
66
66
  export { describe, unitWarnings } from "./describe.js";
67
67
  export { henderson, planck } from "./junction.js";
68
68
  export { perovskiteCell, PEROVSKITE_SCANS, hysteresis } from "./devices.js";
69
- export { IONS, H2O, WATER_EPSR, SEMICONDUCTORS, METALS, aqueous, semiconductor, metal } from "./data.js";
69
+ export { IONS, H2O, WATER_EPSR, SEMICONDUCTORS, METALS, aqueous, semiconductor, metal, trap } from "./data.js";
package/types/solver.d.ts CHANGED
@@ -115,6 +115,7 @@ export class Solver {
115
115
  chargeNode: Uint8Array<any>;
116
116
  chargeNodes: Int32Array<ArrayBuffer>;
117
117
  lateStorage: Uint8Array<any>;
118
+ portHeldEnd: Uint8Array<ArrayBuffer>;
118
119
  combining: boolean;
119
120
  bookkeeping: any;
120
121
  bookkeepingFaces: number[];
@@ -209,6 +210,7 @@ export class Solver {
209
210
  dtNow: any;
210
211
  transformed: any;
211
212
  _nodeConductor(g: any, dt: any): void;
213
+ _portHeldAt(g: any, i: any): boolean;
212
214
  _nodesDilute(g0: any, g1: any, dt: any): void;
213
215
  _nodeConcentrated(g: any, dt: any): void;
214
216
  _storage(g: any, i: any, dt: any, Kz?: number): void;
package/types/types.d.ts CHANGED
@@ -88,6 +88,11 @@ export type MaterialDef = {
88
88
  species: string;
89
89
  conductivity: number;
90
90
  };
91
+ /**
92
+ * the temperature its data are for (K): a device at another temperature
93
+ * warns (semiconductor() sets it)
94
+ */
95
+ T?: number;
91
96
  };
92
97
  export type GridOptions = {
93
98
  /**
@@ -390,7 +395,8 @@ export type PortDef = {
390
395
  /**
391
396
  * with reactions: species
392
397
  * on the electrode's sites, Langmuir (μ = μ° + RT ln(θ/θ₀)), capacity in mol of sites per m² of electrode,
393
- * shared; a reaction with `bare: true` runs only on the bare fraction θ₀ = 1 − Σθ
398
+ * shared; reactions run on Langmuir sites (what fills sites needs bare ones), and one with `bare: true`
399
+ * needs a bare site even if it fills none (θ₀ = 1 − Σθ)
394
400
  */
395
401
  surface?: Record<string, {
396
402
  mu0: number;