driftlet 1.2.1 → 1.2.3
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 +2 -2
- package/docs/device.md +5 -0
- package/docs/internals.md +93 -0
- package/docs/numerics.md +12 -1
- package/docs/reliability.md +53 -4
- package/llms.txt +6 -6
- package/package.json +2 -1
- package/src/lawRows.js +564 -0
- package/src/laws.js +693 -0
- package/src/solver.js +110 -1006
- package/types/lawRows.d.ts +5 -0
- package/types/laws.d.ts +86 -0
- package/types/solver.d.ts +78 -43
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export function applyLaws(s: any, dt: any): void;
|
|
2
|
+
export function captureLaws(s: any): void;
|
|
3
|
+
export function captureLocal(s: any): void;
|
|
4
|
+
export function solveBordered(s: any, rhs: any, delta: any, deltaV: any, pins: any): void;
|
|
5
|
+
export function snapFlat(s: any): void;
|
package/types/laws.d.ts
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export function moves({ model }: {
|
|
2
|
+
model: any;
|
|
3
|
+
}, st: any): boolean;
|
|
4
|
+
export function still({ model }: {
|
|
5
|
+
model: any;
|
|
6
|
+
}, st: any): boolean;
|
|
7
|
+
export function carrierZ({ model, z }: {
|
|
8
|
+
model: any;
|
|
9
|
+
z: any;
|
|
10
|
+
}, k: any): any;
|
|
11
|
+
export function contactCharges({ model, nNodes, phiUndefined }: {
|
|
12
|
+
model: any;
|
|
13
|
+
nNodes: any;
|
|
14
|
+
phiUndefined: any;
|
|
15
|
+
}, k: any): boolean;
|
|
16
|
+
export function feeds(k: any, st: any): any;
|
|
17
|
+
export function noCurrent(t: any): boolean;
|
|
18
|
+
export function chargeOnly({ model, terms }: {
|
|
19
|
+
model: any;
|
|
20
|
+
terms: any;
|
|
21
|
+
}, k: any): boolean;
|
|
22
|
+
export function conservedMoieties(s: any, { drives, alsoCurrent, skip }?: {
|
|
23
|
+
drives?: boolean;
|
|
24
|
+
alsoCurrent?: any[];
|
|
25
|
+
skip?: any;
|
|
26
|
+
}): Float64Array<any>[];
|
|
27
|
+
export function findLaws(s: any): {
|
|
28
|
+
constraints: any[];
|
|
29
|
+
affinities: {
|
|
30
|
+
rx: any;
|
|
31
|
+
f: any;
|
|
32
|
+
row: any;
|
|
33
|
+
idx: Int32Array<any>;
|
|
34
|
+
w: Float64Array<any>;
|
|
35
|
+
len: number;
|
|
36
|
+
res: number;
|
|
37
|
+
}[];
|
|
38
|
+
localConstraints: {
|
|
39
|
+
parts: ({
|
|
40
|
+
i: any;
|
|
41
|
+
w: number;
|
|
42
|
+
q?: undefined;
|
|
43
|
+
k?: undefined;
|
|
44
|
+
} | {
|
|
45
|
+
q: any;
|
|
46
|
+
k: any;
|
|
47
|
+
w: number;
|
|
48
|
+
i?: undefined;
|
|
49
|
+
})[];
|
|
50
|
+
row: any;
|
|
51
|
+
nodes: any;
|
|
52
|
+
reference: Float64Array<any>;
|
|
53
|
+
}[];
|
|
54
|
+
islands: {
|
|
55
|
+
stretch: any;
|
|
56
|
+
row: any;
|
|
57
|
+
flux: any[];
|
|
58
|
+
weight: number[];
|
|
59
|
+
outside: any[];
|
|
60
|
+
idx: Int32Array<ArrayBuffer>;
|
|
61
|
+
w: Float64Array<ArrayBuffer>;
|
|
62
|
+
len: number;
|
|
63
|
+
res: number;
|
|
64
|
+
}[];
|
|
65
|
+
timeLaws: {
|
|
66
|
+
parts: {
|
|
67
|
+
stretch: number;
|
|
68
|
+
w: number;
|
|
69
|
+
}[];
|
|
70
|
+
surface: {
|
|
71
|
+
col: number;
|
|
72
|
+
w: number;
|
|
73
|
+
}[];
|
|
74
|
+
carriers: any;
|
|
75
|
+
terminals: any[];
|
|
76
|
+
circuit: any;
|
|
77
|
+
lambda: number;
|
|
78
|
+
idx: Int32Array<ArrayBuffer>;
|
|
79
|
+
w: Float64Array<ArrayBuffer>;
|
|
80
|
+
len: number;
|
|
81
|
+
}[];
|
|
82
|
+
contactLaw: boolean[];
|
|
83
|
+
carriers: any;
|
|
84
|
+
conserved: Set<any>;
|
|
85
|
+
unkept: Float64Array<any>[];
|
|
86
|
+
};
|
package/types/solver.d.ts
CHANGED
|
@@ -138,48 +138,93 @@ export class Solver {
|
|
|
138
138
|
_findStretches(): void;
|
|
139
139
|
stretches: any[];
|
|
140
140
|
stretchOf: Int32Array<ArrayBuffer>;
|
|
141
|
+
rough: number[];
|
|
141
142
|
moieties: Float64Array<any>[];
|
|
142
143
|
flatStretches: any[];
|
|
143
144
|
_roughAmount(st: any): number;
|
|
144
|
-
_moves(st: any): boolean;
|
|
145
|
-
_still(st: any): boolean;
|
|
146
|
-
_carrierZ(k: any): number;
|
|
147
|
-
_contactCharges(k: any): boolean;
|
|
148
|
-
_feeds(k: any, st: any): any;
|
|
149
145
|
_laws(): void;
|
|
150
146
|
constraints: any[];
|
|
151
|
-
affinities:
|
|
152
|
-
|
|
147
|
+
affinities: {
|
|
148
|
+
rx: any;
|
|
149
|
+
f: any;
|
|
150
|
+
row: any;
|
|
151
|
+
idx: Int32Array<any>;
|
|
152
|
+
w: Float64Array<any>;
|
|
153
|
+
len: number;
|
|
154
|
+
res: number;
|
|
155
|
+
}[];
|
|
156
|
+
localConstraints: {
|
|
157
|
+
parts: ({
|
|
158
|
+
i: any;
|
|
159
|
+
w: number;
|
|
160
|
+
q?: undefined;
|
|
161
|
+
k?: undefined;
|
|
162
|
+
} | {
|
|
163
|
+
q: any;
|
|
164
|
+
k: any;
|
|
165
|
+
w: number;
|
|
166
|
+
i?: undefined;
|
|
167
|
+
})[];
|
|
168
|
+
row: any;
|
|
169
|
+
nodes: any;
|
|
170
|
+
reference: Float64Array<any>;
|
|
171
|
+
}[];
|
|
172
|
+
islands: {
|
|
173
|
+
stretch: any;
|
|
174
|
+
row: any;
|
|
175
|
+
flux: any[];
|
|
176
|
+
weight: number[];
|
|
177
|
+
outside: any[];
|
|
178
|
+
idx: Int32Array<ArrayBuffer>;
|
|
179
|
+
w: Float64Array<ArrayBuffer>;
|
|
180
|
+
len: number;
|
|
181
|
+
res: number;
|
|
182
|
+
}[];
|
|
183
|
+
timeLaws: {
|
|
184
|
+
parts: {
|
|
185
|
+
stretch: number;
|
|
186
|
+
w: number;
|
|
187
|
+
}[];
|
|
188
|
+
surface: {
|
|
189
|
+
col: number;
|
|
190
|
+
w: number;
|
|
191
|
+
}[];
|
|
192
|
+
carriers: any;
|
|
193
|
+
terminals: any[];
|
|
194
|
+
circuit: any;
|
|
195
|
+
lambda: number;
|
|
196
|
+
idx: Int32Array<ArrayBuffer>;
|
|
197
|
+
w: Float64Array<ArrayBuffer>;
|
|
198
|
+
len: number;
|
|
199
|
+
}[];
|
|
153
200
|
contactLaw: boolean[];
|
|
154
|
-
|
|
155
|
-
|
|
201
|
+
carriers: any;
|
|
202
|
+
unkept: Float64Array<any>[];
|
|
203
|
+
contactQ: any[];
|
|
156
204
|
pinnedIslands: any[];
|
|
157
205
|
islandsOn: boolean;
|
|
158
206
|
pins: any[];
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
207
|
+
_structure(): {
|
|
208
|
+
model: any;
|
|
209
|
+
n: any;
|
|
210
|
+
M: any;
|
|
211
|
+
z: Int32Array<ArrayBuffer>;
|
|
212
|
+
nNodes: any;
|
|
213
|
+
stretches: any[];
|
|
214
|
+
stretchOf: Int32Array<ArrayBuffer>;
|
|
215
|
+
flatStretches: any[];
|
|
216
|
+
rough: number[];
|
|
217
|
+
surfCols: any;
|
|
218
|
+
surfColOf: any;
|
|
219
|
+
terms: any;
|
|
220
|
+
floating: any;
|
|
221
|
+
blockOfNode: Int32Array<any>;
|
|
222
|
+
blockOfFace: Int32Array<ArrayBuffer>;
|
|
223
|
+
rxsIn: any;
|
|
224
|
+
nodeMaterial: Int32Array<any>;
|
|
225
|
+
phiUndefined: Uint8Array<any>;
|
|
177
226
|
};
|
|
178
|
-
|
|
179
|
-
_circuitLaws(dt: any): void;
|
|
180
|
-
_solveBordered(rhs: any, delta: any, deltaV: any, pins: any): void;
|
|
181
|
-
dWork: Float64Array<any>;
|
|
182
|
-
borderCols: any[];
|
|
227
|
+
_directSteady(): boolean;
|
|
183
228
|
_surfaceStart(g: any): void;
|
|
184
229
|
/** Amount (mol per unit area) of surface column j's species, Γ Σ v·a·θ, in the current state. */
|
|
185
230
|
surfaceAmount(j: any): number;
|
|
@@ -189,7 +234,6 @@ export class Solver {
|
|
|
189
234
|
deltaV: Float64Array<any>;
|
|
190
235
|
stuckReactions(): any[];
|
|
191
236
|
_drivenKey(): any;
|
|
192
|
-
_noCurrent(t: any): boolean;
|
|
193
237
|
_refreshSources(): void;
|
|
194
238
|
/** η_i (μ̄/RT) of a port's outside level for species i (its electrode's carrier: at V itself). */
|
|
195
239
|
portEta(port: any, i: any): number;
|
|
@@ -272,14 +316,6 @@ export class Solver {
|
|
|
272
316
|
_portCapacitance(port: any, k: any, dt: any): void;
|
|
273
317
|
_surfaceStorage(port: any, dt: any): void;
|
|
274
318
|
_contact(side: any, dt: any): void;
|
|
275
|
-
_flatLevel(st: any): {
|
|
276
|
-
k: number;
|
|
277
|
-
hi: number;
|
|
278
|
-
lo: number;
|
|
279
|
-
};
|
|
280
|
-
_snapFlat(): void;
|
|
281
|
-
_flatRows(): void;
|
|
282
|
-
_applyAffinities(): void;
|
|
283
319
|
_replaceRow(b: any, rs: any): void;
|
|
284
320
|
_equilibrate(): void;
|
|
285
321
|
_assembleDifference(dt: any): {
|
|
@@ -456,7 +492,7 @@ export class Solver {
|
|
|
456
492
|
* Steady state: where a transient from the present state ends, found as the solution of the
|
|
457
493
|
* steady equations (dt = ∞, no storage term), with no slow modes to wait out, however slow the
|
|
458
494
|
* physics (e.g. exponentially scarce minority carriers). What the storage term held is held by
|
|
459
|
-
* the steady system's own rows instead (see
|
|
495
|
+
* the steady system's own rows instead (see src/laws.js): each conserved amount in place of a balance
|
|
460
496
|
* row that says nothing new, levels that carry nothing held flat, islands' summed balances.
|
|
461
497
|
* Where Newton from here fails: continuation along the drives, then the pseudo-transient ramp.
|
|
462
498
|
* The clock is not advanced, and open-system conservation bookkeeping restarts here.
|
|
@@ -478,7 +514,6 @@ export class Solver {
|
|
|
478
514
|
_steadyFromHere(opts: any): any;
|
|
479
515
|
dimmer: boolean;
|
|
480
516
|
_bound(k: any): boolean;
|
|
481
|
-
_chargeOnly(k: any): boolean;
|
|
482
517
|
_floatingContinuation(opts: any, r: any): any;
|
|
483
518
|
_generationContinuation(opts: any, r: any): {
|
|
484
519
|
converged: boolean;
|