Skip to content
Snippets Groups Projects
Commit 88205954 authored by François Grand's avatar François Grand
Browse files

test: Lechat-Calmon: add tests with specific values (taken from execution with...

test: Lechat-Calmon: add tests with specific values (taken from execution with master release at this time and Lechapt-Calmon original paper, see https://gitlab.irstea.fr/cassiopee/nghyd/-/issues/585#note_73402)

refs #334
parent 3a258cdb
No related merge requests found
import { LCMaterial } from "../../src/lc-material";
import { ParamCalculability } from "../../src/param/param-definition";
import { PL_LechaptCalmon } from "../../src/pipe_flow/pl_lechaptcalmon";
import { PL_LechaptCalmonParams } from "../../src/pipe_flow/pl_lechaptcalmon_params";
......@@ -22,6 +23,25 @@ function getLechapt(): PL_LechaptCalmon {
return l;
}
function getLechaptWith(Q: number, D: number, Lg: number, Kloc: number, mat: LCMaterial): PL_LechaptCalmon {
const lc = new PL_LechaptCalmon(
new PL_LechaptCalmonParams(
Q, // débit
D, // diamètre
0, /// perte de charge
Lg, // longueur du toyo
Kloc, // coef de perte de charge singulière
1.863, // paramètre L du matériau
2, // paramètre M du matériau
5.33 // paramètre N du matériau
)
);
lc.calculatedParam = lc.prms.J;
lc.material = mat;
lc.prms.J.singleValue = lc.CalcSerie().vCalc;
return lc;
}
let lechapt: PL_LechaptCalmon = getLechapt();
describe("Class LechaptCalmon : ", () => {
......@@ -65,3 +85,66 @@ describe("Class LechaptCalmon : ", () => {
});
});
});
describe("article original", () => {
it("", () => {
const oldMaxIter = SessionSettings.maxIterations;
const oldPrec = SessionSettings.precision;
try {
SessionSettings.maxIterations = 100;
SessionSettings.precision = 1e-7;
// L,M,N : cf. pl_lechaptcalmon.ts
const lechaptPrms = new PL_LechaptCalmonParams(
0.0085, // débit
0.175, // diamètre
0, /// perte de charge
1000, // longueur du toyo
0, // Ks
1.863, // paramètre L du matériau
2, // paramètre M du matériau
5.33, // paramètre N du matériau
);
const lechapt = new PL_LechaptCalmon(lechaptPrms);
lechapt.material = LCMaterial.HydraulicallySmoothPipe005D02;
lechapt.calculatedParam = lechaptPrms.J;
const res = lechapt.CalcSerie();
expect(res.vCalc).toBeCloseTo(0.784, 3);
}
finally {
SessionSettings.maxIterations = oldMaxIter;
SessionSettings.precision = oldPrec;
}
});
});
describe("specific values -", () => {
it("test 1", () => {
const lc = getLechaptWith(3, 1.2, 100, 0, LCMaterial.HydraulicallySmoothPipe025D1);
expect(lc.prms.J.singleValue).toBeCloseTo(0.295085, 6);
expect(lc.result.resultElements[0].getValue("V")).toBeCloseTo(2.652582, 6);
expect(lc.result.resultElements[0].getValue("Jl")).toBeCloseTo(0.295085, 6);
expect(lc.result.resultElements[0].getValue("Kl")).toBeCloseTo(0.822826, 6);
expect(lc.result.resultElements[0].getValue("fD")).toBeCloseTo(0.009874, 6);
lc.material = LCMaterial.UnlinedCastIronCoarseConcrete;
lc.prms.J.singleValue = lc.CalcSerie().vCalc;
expect(lc.prms.J.singleValue).toBeCloseTo(0.634482, 6);
expect(lc.result.resultElements[0].getValue("V")).toBeCloseTo(2.652582, 6);
expect(lc.result.resultElements[0].getValue("Jl")).toBeCloseTo(0.634482, 6);
expect(lc.result.resultElements[0].getValue("Kl")).toBeCloseTo(1.769215, 6);
expect(lc.result.resultElements[0].getValue("fD")).toBeCloseTo(0.021231, 6);
});
it("test 2", () => {
const lc = getLechaptWith(0.05, 0.5, 100, 1, LCMaterial.RolledSteelSmoothConcrete);
expect(lc.prms.J.singleValue).toBeCloseTo(0.015625, 6);
expect(lc.result.resultElements[0].getValue("V")).toBeCloseTo(0.254648, 6);
expect(lc.result.resultElements[0].getValue("Jl")).toBeCloseTo(0.012320, 6);
expect(lc.result.resultElements[0].getValue("Kl")).toBeCloseTo(3.727563, 6);
expect(lc.result.resultElements[0].getValue("fD")).toBeCloseTo(0.023638, 6);
});
});
......@@ -61,6 +61,7 @@ export * from "./pab/pab_puissance";
export * from "./pab/pab_puissance_params";
export * from "./pab/cloison_aval";
export * from "./pipe_flow/pl_lechaptcalmon";
export * from "./pipe_flow/pl_lechaptcalmon_params";
export * from "./pipe_flow/pressureloss";
export * from "./pipe_flow/pressureloss_law";
export * from "./lc-material";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment