before functional changes by codex
This commit is contained in:
35
test/integration/pfr-boundary.integration.test.js
Normal file
35
test/integration/pfr-boundary.integration.test.js
Normal file
@@ -0,0 +1,35 @@
|
||||
const test = require('node:test');
|
||||
const assert = require('node:assert/strict');
|
||||
|
||||
const { Reactor_PFR } = require('../../src/specificClass');
|
||||
const { makeReactorConfig } = require('../helpers/factories');
|
||||
|
||||
test('_applyBoundaryConditions enforces Danckwerts inlet and Neumann outlet for flowing case', () => {
|
||||
const reactor = new Reactor_PFR(
|
||||
makeReactorConfig({ reactor_type: 'PFR', n_inlets: 1, length: 10, resolution_L: 5, volume: 50, alpha: 0.2 }),
|
||||
);
|
||||
|
||||
reactor.Fs[0] = 2;
|
||||
reactor.Cs_in[0] = Array(13).fill(9);
|
||||
reactor.D = 1;
|
||||
|
||||
const state = Array.from({ length: reactor.n_x }, (_, i) => Array(13).fill(i));
|
||||
reactor._applyBoundaryConditions(state);
|
||||
|
||||
assert.deepEqual(state[reactor.n_x - 1], state[reactor.n_x - 2]);
|
||||
assert.equal(state[0].every((v) => Number.isFinite(v)), true);
|
||||
});
|
||||
|
||||
test('_applyBoundaryConditions copies first interior slice when no flow is present', () => {
|
||||
const reactor = new Reactor_PFR(
|
||||
makeReactorConfig({ reactor_type: 'PFR', n_inlets: 1, length: 10, resolution_L: 5, volume: 50 }),
|
||||
);
|
||||
|
||||
reactor.Fs[0] = 0;
|
||||
const state = Array.from({ length: reactor.n_x }, (_, i) => Array(13).fill(i + 10));
|
||||
|
||||
reactor._applyBoundaryConditions(state);
|
||||
|
||||
assert.deepEqual(state[0], state[1]);
|
||||
assert.deepEqual(state[reactor.n_x - 1], state[reactor.n_x - 2]);
|
||||
});
|
||||
Reference in New Issue
Block a user