driftlet 0.10.0 → 0.11.4

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.
@@ -31,11 +31,19 @@ export class BlockTridiagonal {
31
31
  minPivotRatio: number;
32
32
  /** The block found exactly singular by the last factor(), or −1. */
33
33
  singularBlock: number;
34
+ /**
35
+ * Static pivoting: an exactly zero pivot (all its candidates cancelled to nothing) is
36
+ * replaced by 1e-15 of its block's largest entry rather than thrown on, for a caller that
37
+ * refines its solves (and counted in `perturbedPivots`).
38
+ */
39
+ staticPivots: boolean;
40
+ /** How many pivots the last factor() replaced. */
41
+ perturbedPivots: number;
34
42
  /** Zero all of A, B, C (ready for fresh assembly). */
35
43
  clear(): void;
36
44
  /**
37
45
  * Factorise the current A, B, C. A, B, C are left untouched.
38
- * Throws if a diagonal block is exactly singular.
46
+ * Throws if a diagonal block is exactly singular (unless `staticPivots`).
39
47
  */
40
48
  factor(): void;
41
49
  /**
@@ -0,0 +1,30 @@
1
+ export class DifferenceTerms {
2
+ constructor(N: any, nodes: any, segments: any);
3
+ N: any;
4
+ dead: Uint8Array<any>;
5
+ nI: Int32Array<any>;
6
+ nP: Int32Array<any>;
7
+ nZ: Float64Array<any>;
8
+ nMass: Float64Array<any>;
9
+ nCharge: Float64Array<any>;
10
+ sI: Int32Array<ArrayBuffer>;
11
+ sZ: Float64Array<any>;
12
+ sC: Float64Array<ArrayBuffer>;
13
+ dI: Int32Array<ArrayBuffer>;
14
+ dK: Float64Array<any>;
15
+ combos: any[];
16
+ t: Float64Array<any>;
17
+ x: Float64Array<any>;
18
+ reset(rate?: number): void;
19
+ rate: number;
20
+ nn: number;
21
+ ns: number;
22
+ nd: number;
23
+ node(i: any, p: any, z: any, mass: any, charge: any): void;
24
+ segment(iL: any, iR: any, pL: any, pR: any, z: any, a: any, b: any, d: any): void;
25
+ displacement(pL: any, pR: any, k: any): void;
26
+ kill(row: any): void;
27
+ combine(rk: any, ri: any, w: any): void;
28
+ capture(row: any, w: any, mass: any, into: any): void;
29
+ apply(v: any, out: any, steady?: number, mass?: number): any;
30
+ }
package/types/index.d.ts CHANGED
@@ -14,7 +14,8 @@ export class Device {
14
14
  get grid(): any;
15
15
  /**
16
16
  * Change part of the definition (deep-merged). A contact given V or I drops the other, so
17
- * `{ contacts: { right: { I: 0 } } }` switches it to open circuit. A change to the terminals'
17
+ * `{ contacts: { right: { I: 0 } } }` switches it to open circuit. Ports are patched by name,
18
+ * `{ ports: { gate: { V: 0.2 } } }` (an array replaces them all). A change to the terminals'
18
19
  * drives alone (V, I, R) is applied in place, cheaply. Otherwise the device is rebuilt, keeping the current state as
19
20
  * the warm start when the grid and species are unchanged (else restarting from the regions' c0).
20
21
  * @param {object} patch a partial device definition, merged into the current one
package/types/solver.d.ts CHANGED
@@ -54,6 +54,7 @@ export class Solver {
54
54
  time: number;
55
55
  lastDt: number;
56
56
  atSteady: boolean;
57
+ lin: DifferenceTerms;
57
58
  contactFlux: {
58
59
  left: Float64Array<any>;
59
60
  right: Float64Array<any>;
@@ -95,7 +96,6 @@ export class Solver {
95
96
  rxs: any;
96
97
  portArea: any;
97
98
  portRates: any;
98
- strictlyNeutral: any;
99
99
  generationScale: number;
100
100
  hasGeneration: any;
101
101
  rxsIn: any;
@@ -105,6 +105,7 @@ export class Solver {
105
105
  };
106
106
  chargeNode: Uint8Array<any>;
107
107
  chargeNodes: Int32Array<ArrayBuffer>;
108
+ lateStorage: Uint8Array<any>;
108
109
  combining: boolean;
109
110
  bookkeeping: any;
110
111
  bookkeepingFaces: number[];
@@ -114,29 +115,42 @@ export class Solver {
114
115
  _activeSlots(): void;
115
116
  active: Uint8Array<ArrayBuffer>;
116
117
  loc: Int32Array<ArrayBuffer>;
117
- sys: BlockTridiagonal;
118
+ sys: any;
118
119
  SINK: number;
119
120
  rix: Int32Array<ArrayBuffer>;
120
121
  fullOf: Int32Array<ArrayBuffer>;
121
122
  res: Float64Array<ArrayBuffer>;
122
123
  delta: Float64Array<ArrayBuffer>;
124
+ rowScale: Float64Array<ArrayBuffer>;
123
125
  _factor(): void;
124
126
  _solveLinear(rhs: any, delta: any): void;
125
127
  _findStretches(): void;
126
128
  stretches: any[];
127
129
  stretchOf: Int32Array<ArrayBuffer>;
128
130
  moieties: Float64Array<any>[];
131
+ flatStretches: any[];
132
+ levelStretches: any[];
133
+ flattening: boolean;
129
134
  constraints: any[];
130
135
  localConstraints: any[];
136
+ islands: any[];
137
+ pinnedIslands: any[];
138
+ islandsOn: boolean;
139
+ pins: any[];
131
140
  constrained: boolean;
132
141
  _captureLocal(): void;
142
+ _applyIslands(): any[];
143
+ islandRow: Float64Array<any>;
144
+ _rowInto(o: any, add: any): void;
145
+ linRow: Float64Array<any>;
133
146
  _applyLocalConstraints(): void;
134
147
  _conservedMoieties(): Float64Array<any>[];
135
148
  _directSteady(): boolean;
136
149
  _applyConstraints(): void;
137
150
  _solveBordered(rhs: any, delta: any, deltaV: any, pins: any): void;
138
- dWork: Float64Array<ArrayBuffer>;
151
+ dWork: Float64Array<any>;
139
152
  borderCols: any[];
153
+ _surfaceStart(g: any): void;
140
154
  /** Amount (mol per unit area) of surface column j's species, Γ Σ v·a·θ, in the current state. */
141
155
  surfaceAmount(j: any): number;
142
156
  /** Total amount (mol per unit area) of a stretch's species in the current state. */
@@ -167,7 +181,7 @@ export class Solver {
167
181
  _j(rb: any, rs: any, cb: any, cs: any, v: any): void;
168
182
  /** Assemble residual and Jacobian for a backward-Euler step of size dt. */
169
183
  assemble(dt: any): void;
170
- transformed: boolean;
184
+ transformed: any;
171
185
  _nodeConductor(g: any, dt: any): void;
172
186
  _nodesDilute(g0: any, g1: any, dt: any): void;
173
187
  _nodeConcentrated(g: any, dt: any): void;
@@ -195,31 +209,42 @@ export class Solver {
195
209
  _faceReaction(rx: any, k: any, f: any, bf: any, bL: any, bR: any, Af: any): void;
196
210
  _terminals(dt: any): void;
197
211
  _circuit(k: any): void;
198
- _captureRow(b: any, s: any, w: any, into: any): number;
212
+ _captureRow(b: any, s: any, w: any, into: any): any;
199
213
  _port(port: any, flux: any, k: any, dt: any, holds: any): void;
200
214
  _portReaction(port: any, rx: any, area: any, rates: any, flux: any, k: any): void;
201
215
  _portCapacitance(port: any, k: any, dt: any): void;
202
216
  _surfaceStorage(port: any, dt: any): void;
203
217
  _contact(side: any, dt: any): void;
218
+ _flatRows(): void;
219
+ _levelRows(): void;
204
220
  _replaceRow(b: any, rs: any): void;
205
221
  _equilibrate(): void;
222
+ _assembleDifference(dt: any): {
223
+ rest: any;
224
+ lin: DifferenceTerms;
225
+ };
226
+ sysRest: any;
227
+ diffTerms: DifferenceTerms;
228
+ _refine(dt: any, delta: any, deltaV: any): boolean;
206
229
  _maxPotentialStep(delta: any, deltaV?: Float64Array<any>): number;
207
230
  /**
208
231
  * Newton iteration for one backward-Euler step from the current cOld.
209
232
  * @returns {{converged: boolean, iterations: number, history: number[]}}
210
233
  */
211
- newton(dt: any, { maxIter, tol, maxStep }?: {
234
+ newton(dt: any, { maxIter, tol, maxStep, islands }?: {
212
235
  maxIter?: number;
213
236
  tol?: number;
214
237
  maxStep?: number;
238
+ islands?: boolean;
215
239
  }): {
216
240
  converged: boolean;
217
241
  iterations: number;
218
242
  history: number[];
219
243
  };
244
+ _kirchhoff(): number;
220
245
  _noteConditioning(): void;
221
246
  conditioning: {
222
- digits: number;
247
+ digits: any;
223
248
  x: number;
224
249
  where: string;
225
250
  };
@@ -328,6 +353,13 @@ export class Solver {
328
353
  im: Float64Array<ArrayBuffer>;
329
354
  };
330
355
  };
356
+ _regionShift(yr: any, yi: any): Float64Array<any>[];
357
+ _regionEdgeRows(): Uint8Array<any>;
358
+ _currentCuts(): {
359
+ idx: any[];
360
+ g: any[];
361
+ d: any[];
362
+ }[];
331
363
  _smallSignalProfiles(xr: any, xi: any): {
332
364
  phi: {
333
365
  re: Float64Array<any>;
@@ -351,7 +383,16 @@ export class Solver {
351
383
  * The clock is not advanced, and open-system conservation bookkeeping restarts here.
352
384
  */
353
385
  solveSteady(opts?: {}): any;
386
+ unreached: {
387
+ terminal: any;
388
+ target: any;
389
+ low: any;
390
+ high: any;
391
+ };
392
+ _solveSteadyAll(opts: any): any;
354
393
  _steadyFromHere(opts: any): any;
394
+ dimmer: boolean;
395
+ _floatingContinuation(opts: any, r: any): any;
355
396
  _generationContinuation(opts: any, r: any): {
356
397
  converged: boolean;
357
398
  steps: any;
@@ -397,4 +438,4 @@ export class Solver {
397
438
  _renormalizeSpectators(): void;
398
439
  _diff(): Float64Array<ArrayBuffer>;
399
440
  }
400
- import { BlockTridiagonal } from './blockTridiagonal.js';
441
+ import { DifferenceTerms } from './difference.js';