fix: normalize engineering checks across units
Convert pump-depth vs rod-length mismatch gating to meter-equivalent comparisons, add imperial coverage, and correct rod material mapping with exported helper tests while refreshing related GUI/docs copy. Made-with: Cursor
This commit is contained in:
@@ -53,12 +53,14 @@ export function deriveTrajectoryFrictionMultiplier(model) {
|
||||
|
||||
function rodTypeToProps(typeCode) {
|
||||
const t = Math.round(typeCode);
|
||||
if (t === 2) {
|
||||
if (t === 3) {
|
||||
return { E: FIBERGLASS_E, rho: FIBERGLASS_RHO };
|
||||
}
|
||||
return { E: STEEL_E, rho: STEEL_RHO };
|
||||
}
|
||||
|
||||
export { rodTypeToProps };
|
||||
|
||||
function buildRodNodes(model) {
|
||||
const nx = 48;
|
||||
const nodes = nx + 1;
|
||||
|
||||
26
solver-api/tests/solverClient.test.js
Normal file
26
solver-api/tests/solverClient.test.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { rodTypeToProps } from "../src/solverClient.js";
|
||||
|
||||
describe("solverClient rod type mapping", () => {
|
||||
it("maps fiberglass rod type 3 to fiberglass properties", () => {
|
||||
expect(rodTypeToProps(3)).toEqual({
|
||||
E: 5.5e9,
|
||||
rho: 1900
|
||||
});
|
||||
});
|
||||
|
||||
it("maps sinker and steel rod types to steel-like properties", () => {
|
||||
expect(rodTypeToProps(2)).toEqual({
|
||||
E: 2.05e11,
|
||||
rho: 7850
|
||||
});
|
||||
expect(rodTypeToProps(0)).toEqual({
|
||||
E: 2.05e11,
|
||||
rho: 7850
|
||||
});
|
||||
expect(rodTypeToProps(1)).toEqual({
|
||||
E: 2.05e11,
|
||||
rho: 7850
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user