driftlet 0.16.2 → 1.0.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/README.md +14 -3
- package/docs/device.md +29 -11
- package/docs/kit.md +10 -1
- package/docs/numerics.md +68 -12
- package/docs/statistics.md +2 -1
- package/docs/templates.md +260 -0
- package/llms.txt +107 -299
- package/package.json +15 -3
- package/src/blockTridiagonal.js +73 -1
- package/src/channels.js +6 -4
- package/src/checks.js +78 -3
- package/src/data.js +5 -1
- package/src/device.js +1 -1
- package/src/devices.js +2 -0
- package/src/equation.js +2 -1
- package/src/errors.js +33 -0
- package/src/grid.js +12 -0
- package/src/index.js +21 -10
- package/src/junction.js +3 -1
- package/src/kit.js +1 -1
- package/src/live.js +2 -0
- package/src/particles.js +2 -0
- package/src/plot.js +4 -0
- package/src/polarization.js +2 -1
- package/src/recorder.js +2 -1
- package/src/solution.js +39 -5
- package/src/solver.js +248 -30
- package/src/sources.js +8 -1
- package/src/stack.js +14 -1
- package/src/statistics.js +1 -1
- package/src/traces.js +3 -0
- package/src/types.js +3 -1
- package/types/blockTridiagonal.d.ts +1 -0
- package/types/channels.d.ts +3 -3
- package/types/checks.d.ts +9 -3
- package/types/data.d.ts +3 -3
- package/types/devices.d.ts +1 -1
- package/types/equation.d.ts +1 -1
- package/types/errors.d.ts +8 -0
- package/types/index.d.ts +4 -7
- package/types/junction.d.ts +2 -2
- package/types/kit.d.ts +1 -1
- package/types/live.d.ts +1 -1
- package/types/particles.d.ts +1 -1
- package/types/plot.d.ts +3 -3
- package/types/polarization.d.ts +1 -1
- package/types/recorder.d.ts +1 -1
- package/types/solver.d.ts +8 -1
- package/types/sources.d.ts +7 -7
- package/types/traces.d.ts +1 -1
- package/types/types.d.ts +9 -1
package/src/stack.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// that you didn't write: it only moves things to where the definition keeps them, and converts
|
|
5
5
|
// the kit's doping shorthand (donors and acceptors).
|
|
6
6
|
|
|
7
|
-
import { DeviceError } from './errors.js';
|
|
7
|
+
import { DeviceError, checkOptions } from './errors.js';
|
|
8
8
|
import { FARADAY } from './constants.js';
|
|
9
9
|
|
|
10
10
|
const fail = (message) => {
|
|
@@ -158,8 +158,21 @@ export function build(def) {
|
|
|
158
158
|
}
|
|
159
159
|
if (pendingFace) fail(`${at(pendingFace.k)}: a face after the last layer (the contact is the boundary there)`);
|
|
160
160
|
if (regions.length === 0) fail('build.stack has no layers');
|
|
161
|
+
// A contact holding a carrier its layer lacks: most often ohmic()'s default on a metal.
|
|
162
|
+
for (const [k, end] of [[0, regions[0]], [stack.length - 1, regions[regions.length - 1]]]) {
|
|
163
|
+
const held = isObject(stack[k].species) ? Object.keys(stack[k].species).filter((s) => stack[k].species[s] !== 'blocked') : [];
|
|
164
|
+
const mat = materials[end.material];
|
|
165
|
+
if (!isObject(mat)) continue;
|
|
166
|
+
const has = (s) => (isObject(mat.conductor) ? mat.conductor.species === s : isObject(mat.species) && mat.species[s] !== undefined);
|
|
167
|
+
const lacks = held.filter((s) => !has(s));
|
|
168
|
+
if (lacks.length === 0) continue;
|
|
169
|
+
const kept = held.filter(has);
|
|
170
|
+
const hint = stack[k].phi === 'bulk' && kept.length > 0 ? `: write ohmic(V, [${kept.map((s) => `'${s}'`).join(', ')}]) (ohmic() holds e- and h+ unless told${isObject(mat.conductor) ? '; a metal has only its carrier' : ''})` : '';
|
|
171
|
+
fail(`${at(k)}: the contact holds ${lacks.map((s) => `'${s}'`).join(' and ')}, which its layer's material '${end.material}' doesn't have${hint}`);
|
|
172
|
+
}
|
|
161
173
|
|
|
162
174
|
function region(item, path) {
|
|
175
|
+
checkOptions(path, item, ['name', 'material', 'length', 'fixedCharge', 'c0', 'velocity', 'mixing', 'grid', 'donors', 'acceptors']);
|
|
163
176
|
const { donors, acceptors, ...r } = item;
|
|
164
177
|
if (donors !== undefined || acceptors !== undefined) {
|
|
165
178
|
if (r.fixedCharge !== undefined) fail(`${path}: give doping as donors and acceptors, or fixedCharge, not both`);
|
package/src/statistics.js
CHANGED
|
@@ -157,7 +157,7 @@ function tableOccupancy(xs, zs, fail) {
|
|
|
157
157
|
const x = k / 4000;
|
|
158
158
|
const q = r(x);
|
|
159
159
|
if (x > 0 && x < 1 && !(1 + x * (1 - x) * q.d > 1e-9)) {
|
|
160
|
-
fail(`ocv:
|
|
160
|
+
fail(`ocv: near x = ${x.toFixed(3)} the curve is flat or rising against the ideal-solution slope, (RT/F) ln(x/(1−x)), as on a two-phase plateau (not supported): more points alone won't help; give it some of that slope, adding −a (RT/F) ln(x/(1−x)) to E (a = 0.1 passes at points 0.01 apart, less with points closer near the ends; docs/statistics.md)`);
|
|
161
161
|
}
|
|
162
162
|
rmin = Math.min(rmin, q.v);
|
|
163
163
|
rmax = Math.max(rmax, q.v);
|
package/src/traces.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// range. Plain data, for any plotting toolkit (driftlet/plot draws it as SVG).
|
|
4
4
|
|
|
5
5
|
import { level } from './equation.js';
|
|
6
|
+
import { DeviceError, checkOptions } from './errors.js';
|
|
6
7
|
|
|
7
8
|
const finite = (a) => {
|
|
8
9
|
for (let k = 0; k < a.length; k++) if (Number.isFinite(a[k])) return true;
|
|
@@ -78,6 +79,8 @@ export function typeset(name, z) {
|
|
|
78
79
|
* faces: number[], range: [number, number] }}
|
|
79
80
|
*/
|
|
80
81
|
export function traces(sol, { species, standard = true, phi = false, energy = false, levels = [], labels = {}, shifts = {} } = {}) {
|
|
82
|
+
checkOptions('traces', arguments[1], ['species', 'standard', 'phi', 'energy', 'levels', 'labels', 'shifts']);
|
|
83
|
+
if (!Array.isArray(levels)) throw new DeviceError("traces: levels must be a list, [{ half }, …], of the half-reactions whose levels to draw");
|
|
81
84
|
const names = Object.keys(sol.V);
|
|
82
85
|
const role = (name) => speciesRole(sol, name).role;
|
|
83
86
|
const slotOf = (name) => speciesRole(sol, name).slot;
|
package/src/types.js
CHANGED
|
@@ -218,7 +218,8 @@
|
|
|
218
218
|
* @property {Record<string, { V: number, current: number }>} terminals each terminal (left, right,
|
|
219
219
|
* then the ports by name): its voltage, and its current into the device (A/m²)
|
|
220
220
|
* @property {{ left: ContactResult, right: ContactResult }} contacts
|
|
221
|
-
* @property {{ left?: { V: number, D: number, charge: number }, right?: { V: number, D: number, charge: number } }}
|
|
221
|
+
* @property {{ left?: { V: number, D: number, charge: number }, right?: { V: number, D: number, charge: number } }} plates the charge on a gate or
|
|
222
|
+
* Stern plate at a capacitive contact
|
|
222
223
|
* @property {{ name: string, V: number, flux: Record<string, number>, current: number, x?: Float64Array,
|
|
223
224
|
* area?: Float64Array, rates?: Float64Array[], coverage?: Record<string, Float64Array>, bare?: Float64Array,
|
|
224
225
|
* sigma?: Float64Array, charge?: number }[]} ports what each internal port brings into the device;
|
|
@@ -248,6 +249,7 @@
|
|
|
248
249
|
* @property {{ re: Float64Array, im: Float64Array }} Z impedance −δV/δI, Ω·m²
|
|
249
250
|
* @property {{ phi: ComplexProfile, mu: Record<string, ComplexProfile>, c: Record<string, ComplexProfile> }[]} [profiles]
|
|
250
251
|
* per frequency, per unit excitation (volt, or A/m² in current mode)
|
|
252
|
+
* @property {string[]} warnings the steady state's warnings, which hold for its impedance too
|
|
251
253
|
*/
|
|
252
254
|
|
|
253
255
|
/** @typedef {{ re: Float64Array, im: Float64Array }} ComplexProfile */
|
|
@@ -46,6 +46,7 @@ export class BlockTridiagonal {
|
|
|
46
46
|
* Throws if a diagonal block is exactly singular (unless `staticPivots`).
|
|
47
47
|
*/
|
|
48
48
|
factor(): void;
|
|
49
|
+
_noisyPivots(i: any): number;
|
|
49
50
|
/**
|
|
50
51
|
* Solve with the current factorisation. `rhs` and `out` are Float64Arrays of length `size`
|
|
51
52
|
* (node-major); they may be the same array.
|
package/types/channels.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export function ghkCurrent(z: any, inside: any, outside: any, V: any, T: any): n
|
|
|
21
21
|
* port along a region: links that are their linear conductances, G = g × area per volume, gated the
|
|
22
22
|
* same, each ion's reversal potential following from the port's bath and the concentrations inside
|
|
23
23
|
* (so `inside`, `outside` and `at` aren't needed).
|
|
24
|
-
* @param {{ inside: object, outside: object, T
|
|
24
|
+
* @param {{ inside: object, outside: object, T: number, g?: { Na?: number, K?: number, leak?: number },
|
|
25
25
|
* leak?: string, leakZ?: number, at?: number, names?: { Na?: string, K?: string }, linear?: boolean, area?: number }} opts concentrations in
|
|
26
26
|
* mol/m³ by species name, K, S/m², V
|
|
27
27
|
* @returns {{ gates: object, species: object }}
|
|
@@ -29,7 +29,7 @@ export function ghkCurrent(z: any, inside: any, outside: any, V: any, T: any): n
|
|
|
29
29
|
export function hodgkinHuxley({ inside, outside, T, g, leak, leakZ, at, names, linear, area }?: {
|
|
30
30
|
inside: object;
|
|
31
31
|
outside: object;
|
|
32
|
-
T
|
|
32
|
+
T: number;
|
|
33
33
|
g?: {
|
|
34
34
|
Na?: number;
|
|
35
35
|
K?: number;
|
|
@@ -44,7 +44,7 @@ export function hodgkinHuxley({ inside, outside, T, g, leak, leakZ, at, names, l
|
|
|
44
44
|
};
|
|
45
45
|
linear?: boolean;
|
|
46
46
|
area?: number;
|
|
47
|
-
}): {
|
|
47
|
+
}, ...args: any[]): {
|
|
48
48
|
gates: object;
|
|
49
49
|
species: object;
|
|
50
50
|
};
|
package/types/checks.d.ts
CHANGED
|
@@ -18,6 +18,11 @@
|
|
|
18
18
|
* zero; under light it's J = F(G − R), and it says where every carrier went.
|
|
19
19
|
* - **conservation** (a transient): every closed, unreacting stretch keeps what it held plus
|
|
20
20
|
* what came in.
|
|
21
|
+
* - **order** (a steady state, with `refine` and `order`, the defaults): the device solved from
|
|
22
|
+
* its definition twice, its species listed as given and in reverse, which must give the same
|
|
23
|
+
* steady state (each terminal's voltage and current, each species' amount). A solve that
|
|
24
|
+
* depends on the listing has converged somewhere that isn't steady without noticing (round 11's
|
|
25
|
+
* fuzzer found it in ~1% of random reacting devices, by exactly this test).
|
|
21
26
|
* - **grid** (with `refine`, the default; in a transient, `ok: null` and a reminder, since the
|
|
22
27
|
* answer depends on the whole run): in a steady state, the device solved again on a grid
|
|
23
28
|
* twice as fine everywhere, from this solution interpolated onto it. The current, each floating terminal's voltage and each
|
|
@@ -26,15 +31,16 @@
|
|
|
26
31
|
* (about 3/4 of it).
|
|
27
32
|
* @param {import('./index.js').Device} device
|
|
28
33
|
* @param {object} [sol] the solution to check (default: the device's present state)
|
|
29
|
-
* @param {{ refine?: boolean, tol?: number }} [opts]
|
|
34
|
+
* @param {{ refine?: boolean, tol?: number, order?: boolean }} [opts]
|
|
30
35
|
* Every check passed when `ok`; an item with `ok: null` (a warning, or a check that couldn't be
|
|
31
36
|
* made) asks you to look, and doesn't fail it. `text` is a line per check, marked ok, FAIL or ?.
|
|
32
37
|
* @returns {{ ok: boolean, items: CheckItem[], text: string }}
|
|
33
38
|
*/
|
|
34
|
-
export function check(device: import("./index.js").Device, sol?: object, { refine, tol }?: {
|
|
39
|
+
export function check(device: import("./index.js").Device, sol?: object, { refine, tol, order }?: {
|
|
35
40
|
refine?: boolean;
|
|
36
41
|
tol?: number;
|
|
37
|
-
|
|
42
|
+
order?: boolean;
|
|
43
|
+
}, ...args: any[]): {
|
|
38
44
|
ok: boolean;
|
|
39
45
|
items: CheckItem[];
|
|
40
46
|
text: string;
|
package/types/data.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
export function aqueous(names: string[], { epsr, material }?: {
|
|
10
10
|
epsr?: number;
|
|
11
11
|
material?: string;
|
|
12
|
-
}): {
|
|
12
|
+
}, ...args: any[]): {
|
|
13
13
|
species: object[];
|
|
14
14
|
materials: Record<string, object>;
|
|
15
15
|
};
|
|
@@ -24,7 +24,7 @@ export function aqueous(names: string[], { epsr, material }?: {
|
|
|
24
24
|
*/
|
|
25
25
|
export function semiconductor(name: string, { material }?: {
|
|
26
26
|
material?: string;
|
|
27
|
-
}): {
|
|
27
|
+
}, ...args: any[]): {
|
|
28
28
|
species: object[];
|
|
29
29
|
materials: Record<string, object>;
|
|
30
30
|
};
|
|
@@ -36,7 +36,7 @@ export function semiconductor(name: string, { material }?: {
|
|
|
36
36
|
*/
|
|
37
37
|
export function metal(name: string, { material }?: {
|
|
38
38
|
material?: string;
|
|
39
|
-
}): {
|
|
39
|
+
}, ...args: any[]): {
|
|
40
40
|
species: object[];
|
|
41
41
|
materials: Record<string, object>;
|
|
42
42
|
};
|
package/types/devices.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export function perovskiteCell({ V, light, bulkSRH }?: {
|
|
|
19
19
|
};
|
|
20
20
|
light?: number;
|
|
21
21
|
bulkSRH?: boolean;
|
|
22
|
-
}): import("./types.js").DeviceDefinition;
|
|
22
|
+
}, ...args: any[]): import("./types.js").DeviceDefinition;
|
|
23
23
|
/**
|
|
24
24
|
* A J–V loop's figures of merit, from a transient's trace (`{ t, voltage, current }`, as a
|
|
25
25
|
* recorder or advance() gives it): the loop splits at time `turn` into the sweep before (`rev`)
|
package/types/equation.d.ts
CHANGED
|
@@ -78,7 +78,7 @@ export function level(sol: {
|
|
|
78
78
|
fixed?: Record<string, number>;
|
|
79
79
|
}, { standard }?: {
|
|
80
80
|
standard?: boolean;
|
|
81
|
-
}): Float64Array;
|
|
81
|
+
}, ...args: any[]): Float64Array;
|
|
82
82
|
/**
|
|
83
83
|
* The standard hydrogen electrode, 2 H⁺ + 2 e⁻ ⇌ H₂, with μ(H₂) = 0 (the element in its standard
|
|
84
84
|
* state, on the usual table convention). Needs `H+` among the species.
|
package/types/errors.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A function's options: a name it doesn't take (a typo) is an error, not silently ignored.
|
|
3
|
+
* @param {string} where the function, for the message
|
|
4
|
+
* @param {unknown} opts
|
|
5
|
+
* @param {string[]} allowed
|
|
6
|
+
* @param {new (message: string) => Error} [Kind]
|
|
7
|
+
*/
|
|
8
|
+
export function checkOptions(where: string, opts: unknown, allowed: string[], Kind?: new (message: string) => Error): void;
|
|
1
9
|
export class DeviceError extends Error {
|
|
2
10
|
constructor(message: any);
|
|
3
11
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
export { DeviceError } from "./device.js";
|
|
1
2
|
export { SolverError } from "./solver.js";
|
|
2
|
-
export { BlockTridiagonal } from "./blockTridiagonal.js";
|
|
3
3
|
export * from "./constants.js";
|
|
4
4
|
/** @typedef {import('./types.js').DeviceDefinition} DeviceDefinition */
|
|
5
5
|
/** @typedef {import('./types.js').Solution} Solution */
|
|
@@ -13,8 +13,8 @@ export class Device {
|
|
|
13
13
|
get solver(): any;
|
|
14
14
|
get grid(): any;
|
|
15
15
|
/**
|
|
16
|
-
* Change part of the definition (deep-merged). A contact given V or I drops the other
|
|
17
|
-
* `{ contacts: { right: { I: 0 } } }` switches it to open circuit. Ports are patched by name,
|
|
16
|
+
* Change part of the definition (deep-merged). A contact given V or I drops the other (and
|
|
17
|
+
* given I, any series R), so `{ contacts: { right: { I: 0 } } }` switches it to open circuit. Ports are patched by name,
|
|
18
18
|
* `{ ports: { gate: { V: 0.2 } } }` (an array replaces them all). A change to the terminals'
|
|
19
19
|
* drives alone (V, I, R) is applied in place, cheaply. Otherwise the device is rebuilt, keeping the current state as
|
|
20
20
|
* the warm start when the grid and species are unchanged (else restarting from the regions' c0).
|
|
@@ -72,7 +72,7 @@ export class Device {
|
|
|
72
72
|
/**
|
|
73
73
|
* Small-signal impedance Z(f) about the steady state (solved first), at one terminal: its
|
|
74
74
|
* held voltage is perturbed (or its driven current), the others keep their drives.
|
|
75
|
-
* Z = δV/δI with I into the device (Ω·m²)
|
|
75
|
+
* Z = δV/δI with I into the device (Ω·m²), with the steady state's `warnings`.
|
|
76
76
|
* @param {ArrayLike<number>} frequencies Hz
|
|
77
77
|
* @param {{ terminal?: string, profiles?: boolean }} [opts] the terminal (default 'right'), and
|
|
78
78
|
* whether to return complex profiles per frequency
|
|
@@ -110,6 +110,3 @@ export class Device {
|
|
|
110
110
|
}
|
|
111
111
|
export type DeviceDefinition = import("./types.js").DeviceDefinition;
|
|
112
112
|
export type Solution = import("./types.js").Solution;
|
|
113
|
-
export { DeviceError, normalizeDevice } from "./device.js";
|
|
114
|
-
export { buildGrid, gradedCells } from "./grid.js";
|
|
115
|
-
export { bernoulli, bernoulliDerivative } from "./bernoulli.js";
|
package/types/junction.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export function henderson(left: Record<string, number>, right: Record<string, nu
|
|
|
12
12
|
D: number;
|
|
13
13
|
}>, { T }?: {
|
|
14
14
|
T?: number;
|
|
15
|
-
}): number;
|
|
15
|
+
}, ...args: any[]): number;
|
|
16
16
|
/**
|
|
17
17
|
* Planck's liquid-junction potential, φ_R − φ_L (V): the steady state of constrained diffusion,
|
|
18
18
|
* a junction zone held between the two solutions, electroneutral, carrying no current. Solved by
|
|
@@ -29,4 +29,4 @@ export function planck(left: Record<string, number>, right: Record<string, numbe
|
|
|
29
29
|
}>, { T, steps }?: {
|
|
30
30
|
T?: number;
|
|
31
31
|
steps?: number;
|
|
32
|
-
}): number;
|
|
32
|
+
}, ...args: any[]): number;
|
package/types/kit.d.ts
CHANGED
|
@@ -59,7 +59,7 @@ export type VacuumSide = {
|
|
|
59
59
|
offset: number;
|
|
60
60
|
};
|
|
61
61
|
export { build, combine, layer, ohmic, bath } from "./stack.js";
|
|
62
|
-
export {
|
|
62
|
+
export { half, SHE, level } from "./equation.js";
|
|
63
63
|
export { traces, speciesRole, typeset } from "./traces.js";
|
|
64
64
|
export { pulse, square, triangle, ramp, injector, recombination, photogeneration } from "./sources.js";
|
|
65
65
|
export { hodgkinHuxley, ghkCurrent } from "./channels.js";
|
package/types/live.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export function live(def: object, { worker, onsolution, maxRamp }?: {
|
|
|
28
28
|
worker?: boolean | (() => any);
|
|
29
29
|
onsolution?: (solution: object, info: object) => void;
|
|
30
30
|
maxRamp?: number;
|
|
31
|
-
}): Live;
|
|
31
|
+
}, ...args: any[]): Live;
|
|
32
32
|
/**
|
|
33
33
|
* What a live device does with each change, on whichever thread solves it: apply, solve warm,
|
|
34
34
|
* ramp from the last good state if that fails, and fall back to the last good solution.
|
package/types/particles.d.ts
CHANGED
package/types/plot.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export function themeColor(role: "electron" | "cation" | "anion" | "redox", slot: number, { dark }?: {
|
|
9
9
|
dark?: boolean;
|
|
10
|
-
}): string;
|
|
10
|
+
}, ...args: any[]): string;
|
|
11
11
|
/**
|
|
12
12
|
* A label split into plain and subscript runs. Labels mark subscripts TeX-style: `V_{e⁻}`, or
|
|
13
13
|
* `C_ox` for a run of letters, digits and charge signs. Everything else is literal.
|
|
@@ -34,7 +34,7 @@ export function levelChart(tr: ReturnType<typeof traces>, { width, height, ylabe
|
|
|
34
34
|
xlim?: [number, number];
|
|
35
35
|
title?: string;
|
|
36
36
|
ytick?: (v: number) => string;
|
|
37
|
-
}): string;
|
|
37
|
+
}, ...args: any[]): string;
|
|
38
38
|
/**
|
|
39
39
|
* A solution's level diagram as an SVG string: each charged species' voltage (thick) and
|
|
40
40
|
* standard level (thin), regions as bands; or with `energy: true`, the familiar energy-up band
|
|
@@ -43,7 +43,7 @@ export function levelChart(tr: ReturnType<typeof traces>, { width, height, ylabe
|
|
|
43
43
|
* @param {Parameters<typeof traces>[1] & Parameters<typeof levelChart>[1]} [opts]
|
|
44
44
|
* @returns {string}
|
|
45
45
|
*/
|
|
46
|
-
export function bandDiagram(sol: import("./types.js").Solution, opts?: Parameters<typeof traces>[1] & Parameters<typeof levelChart>[1]): string;
|
|
46
|
+
export function bandDiagram(sol: import("./types.js").Solution, opts?: Parameters<typeof traces>[1] & Parameters<typeof levelChart>[1], ...args: any[]): string;
|
|
47
47
|
export const THEME: Readonly<{
|
|
48
48
|
light: {
|
|
49
49
|
electron: string[];
|
package/types/polarization.d.ts
CHANGED
|
@@ -24,7 +24,7 @@ export function polarization(device: import("./index.js").Device, sol: object, w
|
|
|
24
24
|
x?: number;
|
|
25
25
|
}, V: number | ArrayLike<number>, opts?: {
|
|
26
26
|
surface?: "held" | "equilibrium";
|
|
27
|
-
}): {
|
|
27
|
+
}, ...args: any[]): {
|
|
28
28
|
V: Float64Array;
|
|
29
29
|
current: Float64Array;
|
|
30
30
|
bare?: Float64Array;
|
package/types/recorder.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export function recorder(device: import("./index.js").Device, opts?: {
|
|
|
19
19
|
species?: string;
|
|
20
20
|
gate?: string;
|
|
21
21
|
})[];
|
|
22
|
-
}): {
|
|
22
|
+
}, ...args: any[]): {
|
|
23
23
|
advance: (tEnd: number, aopts?: object) => import("./types.js").Solution;
|
|
24
24
|
frame: (t: number) => import("./types.js").Solution;
|
|
25
25
|
frames: import("./types.js").Solution[];
|
package/types/solver.d.ts
CHANGED
|
@@ -143,6 +143,7 @@ export class Solver {
|
|
|
143
143
|
_feeds(k: any, st: any): any;
|
|
144
144
|
_laws(): void;
|
|
145
145
|
constraints: any[];
|
|
146
|
+
affinities: any[];
|
|
146
147
|
localConstraints: any[];
|
|
147
148
|
islands: any[];
|
|
148
149
|
pinnedIslands: any[];
|
|
@@ -157,7 +158,7 @@ export class Solver {
|
|
|
157
158
|
_rowInto(o: any, add: any): void;
|
|
158
159
|
linRow: Float64Array<any>;
|
|
159
160
|
_applyLocalConstraints(): void;
|
|
160
|
-
_conservedMoieties(drives?: boolean, alsoCurrent?: any[]): Float64Array<any>[];
|
|
161
|
+
_conservedMoieties(drives?: boolean, alsoCurrent?: any[], skip?: any): Float64Array<any>[];
|
|
161
162
|
_directSteady(): boolean;
|
|
162
163
|
_applyConstraints(): void;
|
|
163
164
|
_lawAmount(cs: any): {
|
|
@@ -178,6 +179,9 @@ export class Solver {
|
|
|
178
179
|
amount(stretch: any): number;
|
|
179
180
|
redrive(): void;
|
|
180
181
|
deltaV: Float64Array<any>;
|
|
182
|
+
stuckReactions(): any[];
|
|
183
|
+
_drivenKey(): any;
|
|
184
|
+
_noCurrent(t: any): boolean;
|
|
181
185
|
_refreshSources(): void;
|
|
182
186
|
/** η_i (μ̄/RT) of a port's outside level for species i (its electrode's carrier: at V itself). */
|
|
183
187
|
portEta(port: any, i: any): number;
|
|
@@ -256,6 +260,7 @@ export class Solver {
|
|
|
256
260
|
};
|
|
257
261
|
_snapFlat(): void;
|
|
258
262
|
_flatRows(): void;
|
|
263
|
+
_applyAffinities(): void;
|
|
259
264
|
_replaceRow(b: any, rs: any): void;
|
|
260
265
|
_equilibrate(): void;
|
|
261
266
|
_assembleDifference(dt: any): {
|
|
@@ -312,6 +317,7 @@ export class Solver {
|
|
|
312
317
|
sourceBefore: boolean;
|
|
313
318
|
solvedV: any;
|
|
314
319
|
stepped: boolean;
|
|
320
|
+
_guess(guess: any): void;
|
|
315
321
|
/**
|
|
316
322
|
* Adaptive time stepping to tEnd: variable-step BDF2 (or backward Euler), with the local error
|
|
317
323
|
* estimated against an explicit predictor through the previous states, and controlled to
|
|
@@ -374,6 +380,7 @@ export class Solver {
|
|
|
374
380
|
sourceTime: number;
|
|
375
381
|
};
|
|
376
382
|
_restore(s: any): void;
|
|
383
|
+
passedCurrent(k: any): any;
|
|
377
384
|
_terminalCurrent(): number;
|
|
378
385
|
/**
|
|
379
386
|
* Small-signal impedance about the current (steady) state, seen at one terminal. Linearising
|
package/types/sources.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export function pulse({ start, width, amplitude, rise, base }?: {
|
|
|
13
13
|
amplitude: number;
|
|
14
14
|
rise?: number;
|
|
15
15
|
base?: number;
|
|
16
|
-
}): {
|
|
16
|
+
}, ...args: any[]): {
|
|
17
17
|
t: number[];
|
|
18
18
|
values: number[];
|
|
19
19
|
};
|
|
@@ -27,7 +27,7 @@ export function square({ high, low, period, duty }?: {
|
|
|
27
27
|
low: number;
|
|
28
28
|
period: number;
|
|
29
29
|
duty?: number;
|
|
30
|
-
}): {
|
|
30
|
+
}, ...args: any[]): {
|
|
31
31
|
t: number[];
|
|
32
32
|
values: number[];
|
|
33
33
|
repeat: true;
|
|
@@ -42,7 +42,7 @@ export function triangle({ from, to, period }?: {
|
|
|
42
42
|
from: number;
|
|
43
43
|
to: number;
|
|
44
44
|
period: number;
|
|
45
|
-
}): {
|
|
45
|
+
}, ...args: any[]): {
|
|
46
46
|
t: number[];
|
|
47
47
|
values: number[];
|
|
48
48
|
repeat: true;
|
|
@@ -57,7 +57,7 @@ export function ramp({ from, to, duration, start }?: {
|
|
|
57
57
|
to: number;
|
|
58
58
|
duration: number;
|
|
59
59
|
start?: number;
|
|
60
|
-
}): {
|
|
60
|
+
}, ...args: any[]): {
|
|
61
61
|
t: number[];
|
|
62
62
|
values: number[];
|
|
63
63
|
};
|
|
@@ -84,7 +84,7 @@ export function injector({ name, region, from, to, species, I, headroom }?: {
|
|
|
84
84
|
repeat?: boolean;
|
|
85
85
|
};
|
|
86
86
|
headroom?: number;
|
|
87
|
-
}): object;
|
|
87
|
+
}, ...args: any[]): object;
|
|
88
88
|
/**
|
|
89
89
|
* Band-to-band recombination e⁻ + h⁺ ⇌ 0 in a material, from the minority-carrier lifetime it
|
|
90
90
|
* should give at a majority density: kf = 1/(τ · majority). (The rate is kf (np − n_i²), so τ is
|
|
@@ -96,7 +96,7 @@ export function recombination({ material, tau, majority }?: {
|
|
|
96
96
|
material: string;
|
|
97
97
|
tau: number;
|
|
98
98
|
majority: number;
|
|
99
|
-
}): {
|
|
99
|
+
}, ...args: any[]): {
|
|
100
100
|
equation: string;
|
|
101
101
|
kf: Record<string, number>;
|
|
102
102
|
};
|
|
@@ -122,7 +122,7 @@ export function photogeneration({ material, flux, alpha, mu, from, to, makes }?:
|
|
|
122
122
|
from?: number;
|
|
123
123
|
to: number;
|
|
124
124
|
makes?: string;
|
|
125
|
-
}): {
|
|
125
|
+
}, ...args: any[]): {
|
|
126
126
|
equation: string;
|
|
127
127
|
fixed: Record<string, number>;
|
|
128
128
|
kf: Record<string, {
|
package/types/traces.d.ts
CHANGED
package/types/types.d.ts
CHANGED
|
@@ -551,7 +551,11 @@ export type Solution = {
|
|
|
551
551
|
left: ContactResult;
|
|
552
552
|
right: ContactResult;
|
|
553
553
|
};
|
|
554
|
-
|
|
554
|
+
/**
|
|
555
|
+
* the charge on a gate or
|
|
556
|
+
* Stern plate at a capacitive contact
|
|
557
|
+
*/
|
|
558
|
+
plates: {
|
|
555
559
|
left?: {
|
|
556
560
|
V: number;
|
|
557
561
|
D: number;
|
|
@@ -665,6 +669,10 @@ export type ImpedanceResult = {
|
|
|
665
669
|
mu: Record<string, ComplexProfile>;
|
|
666
670
|
c: Record<string, ComplexProfile>;
|
|
667
671
|
}[];
|
|
672
|
+
/**
|
|
673
|
+
* the steady state's warnings, which hold for its impedance too
|
|
674
|
+
*/
|
|
675
|
+
warnings: string[];
|
|
668
676
|
};
|
|
669
677
|
export type ComplexProfile = {
|
|
670
678
|
re: Float64Array;
|