Expand reactor demo telemetry and stability handling
This commit is contained in:
@@ -35,7 +35,10 @@ test('CSTR uses kla-based oxygen transfer when kla is finite', () => {
|
||||
reactor.OTR = 1;
|
||||
reactor.state = Array(NUM_SPECIES).fill(0);
|
||||
|
||||
const expected = reactor._calcOTR(0, reactor.temperature);
|
||||
const expected = Math.min(
|
||||
reactor._calcOTR(0, reactor.temperature),
|
||||
reactor._calcOxygenSaturation(reactor.temperature),
|
||||
);
|
||||
reactor.tick(1);
|
||||
|
||||
assert.ok(Math.abs(reactor.state[0] - expected) < 1e-9);
|
||||
@@ -75,7 +78,10 @@ test('PFR uses kla-based transfer branch when kla is finite', () => {
|
||||
reactor.OTR = 0;
|
||||
reactor.state = Array.from({ length: reactor.n_x }, () => Array(NUM_SPECIES).fill(0));
|
||||
|
||||
const expected = reactor._calcOTR(0, reactor.temperature) * (reactor.n_x / (reactor.n_x - 2));
|
||||
const expected = Math.min(
|
||||
reactor._calcOTR(0, reactor.temperature) * (reactor.n_x / (reactor.n_x - 2)),
|
||||
reactor._calcOxygenSaturation(reactor.temperature),
|
||||
);
|
||||
reactor.tick(1);
|
||||
|
||||
assert.ok(Math.abs(reactor.state[1][0] - expected) < 1e-9);
|
||||
|
||||
Reference in New Issue
Block a user