Commit 638bb28d authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Fix #165 - new discharge law WeirSubmerged

parent e869cb71
......@@ -39,7 +39,7 @@ describe("iterator : ", () => {
pst.addChild(st);
const symbs = [
"Q", "Z1", "Z2", "CdWR", "CdGR", "CdWSL", "h1", "h2", "L", "Q", "W", "Z1", "Z2", "ZDV"
"Q", "Z1", "Z2", "CdWR", "CdGR", "CdWSL", "CdWS", "h1", "h2", "L", "Q", "W", "Z1", "Z2", "ZDV"
];
const vals = [1, 2, 3];
checkParams(pst.parameterIterator, symbs, vals);
......
import { RectangularStructureParams } from "../../src/structure/rectangular_structure_params";
import { StructureFlowMode, StructureFlowRegime } from "../../src/structure/structure";
import { StructureWeirSubmerged } from "../../src/structure/structure_weir_submerged";
import { MessageCode } from "../../src/util/message";
import { itCalcQ } from "../structure/functions";
import { precDigits } from "../test_config";
function getStructTest(): StructureWeirSubmerged {
return new StructureWeirSubmerged(new RectangularStructureParams(0, 101, 102, 101.5, 0.2, 0.9), false);
}
describe("Class StructureWeirSubmerged: ", () => {
describe("Calc(Q): ", () => {
const Z1: number[] = [102];
const Q: number[] = [0.282];
const mode: StructureFlowMode = StructureFlowMode.WEIR;
const regime: StructureFlowRegime = StructureFlowRegime.SUBMERGED;
for (let i = 0; i < Q.length; i++) {
itCalcQ(getStructTest(), Z1[i], Infinity, Q[i], mode, regime);
}
});
describe("Calc(Z1): ", () => {
it("Z1(Q=0.780) should be 75.234", () => {
const testZ1 = new StructureWeirSubmerged(
new RectangularStructureParams(0.780, 73.665, 75.301, 75.077, 0.35, 0.9),
false);
testZ1.prms.Z1.v = 100; // Test with initial condition far from solution
expect(testZ1.Calc("Z1").vCalc).toBeCloseTo(75.234, precDigits);
});
});
describe("Calcul avec h2/h1 < 0.8 (=0.5) : ", () => {
it("le log devrait contenir 1 message", () => {
const structTest = getStructTest();
structTest.prms.Z1.singleValue = 110;
structTest.prms.Z2.singleValue = 105;
structTest.prms.ZDV.singleValue = 100;
const res = structTest.CalcSerie().resultElement;
expect(res.log.messages.length).toBe(1);
expect(
res.log.messages[0].code
).toBe(MessageCode.WARNING_WEIR_SUBMERSION_LOWER_THAN_08);
});
});
});
......@@ -28,6 +28,7 @@ import { StructureWeirCem88d } from "./structure_weir_cem88d";
import { StructureWeirCem88v } from "./structure_weir_cem88v";
import { StructureWeirCunge80 } from "./structure_weir_cunge80";
import { StructureWeirFree } from "./structure_weir_free";
import { StructureWeirSubmerged } from "./structure_weir_submerged";
import { StructureWeirSubmergedLarinier } from "./structure_weir_submerged_larinier";
import { StructureWeirVillemonte } from "./structure_weir_villemonte";
......@@ -105,6 +106,11 @@ export function CreateStructure(loiDebit: LoiDebit, parentNub?: ParallelStructur
ret = new StructureWeirSubmergedLarinier(rectStructPrms, dbg);
break;
case LoiDebit.WeirSubmerged:
rectStructPrms.CdWS.singleValue = 0.9;
ret = new StructureWeirSubmerged(rectStructPrms, dbg);
break;
case LoiDebit.KIVI:
const structKiviPrm: StructureKiviParams = new StructureKiviParams(
8.516, // Q
......
......@@ -11,6 +11,7 @@ export abstract class RectangularStructure extends Structure {
super(prms, dbg);
this.prms.CdGR.visible = false;
this.prms.CdWR.visible = false;
this.prms.CdWS.visible = false;
this.prms.CdWSL.visible = false;
}
......
......@@ -19,6 +19,8 @@ export class RectangularStructureParams extends StructureParams {
public CdWR: ParamDefinition;
// tslint:disable-next-line:variable-name
public CdWSL: ParamDefinition;
// tslint:disable-next-line:variable-name
public CdWS: ParamDefinition;
/**
* Constructeur d'une structure rectangulaire
......@@ -41,5 +43,7 @@ export class RectangularStructureParams extends StructureParams {
this.addParamDefinition(this.CdWR);
this.CdWSL = new ParamDefinition(this, "CdWSL", domainCd, undefined, rCd);
this.addParamDefinition(this.CdWSL);
this.CdWS = new ParamDefinition(this, "CdWS", domainCd, undefined, rCd);
this.addParamDefinition(this.CdWS);
}
}
......@@ -35,6 +35,8 @@ export enum LoiDebit {
TriangularTruncWeirFree,
// Loi de débit fente noyée (Larinier 1992)
WeirSubmergedLarinier,
// Loi de débit fente noyée (Rajaratnam & Muralidhar 1969)
WeirSubmerged,
// Loi de débit orifice noyé
OrificeSubmerged,
// Loi de débit orifice dénoyé
......
import { Message, MessageCode, ParamCalculability } from "../index";
import { Result } from "../util/result";
import { RectangularStructure } from "./rectangular_structure";
import { RectangularStructureParams } from "./rectangular_structure_params";
import { Structure, StructureFlowMode, StructureFlowRegime } from "./structure";
import { LoiDebit } from "./structure_props";
/**
* Equation de la fente noyée
* d'après Rajaratnam, N., et D. Muralidhar.
* « Flow below deeply submerged rectangular weirs ».
* Journal of Hydraulic Research 7, nᵒ 3 (1969): 355–374.
*/
export class StructureWeirSubmerged extends RectangularStructure {
constructor(prms: RectangularStructureParams, dbg: boolean = false) {
super(prms, dbg);
this._loiDebit = LoiDebit.WeirSubmerged;
this.prms.CdWS.visible = true;
}
public Calc(sVarCalc: string, rInit?: number): Result {
this.currentResult = super.Calc(sVarCalc, rInit);
const h2h1ratio = this.prms.h2.v / this.prms.h1.v;
if (h2h1ratio < 0.8) {
this._result.resultElement.addMessage(new Message(
MessageCode.WARNING_WEIR_SUBMERSION_LOWER_THAN_08,
{ h1: this.prms.h1.v, h2: this.prms.h2.v }
));
}
return this._result;
}
/**
* Calcul analytique Q
* @param sVarCalc Variable à calculer (doit être "Q")
*/
public CalcQ(): Result {
const data = this.getResultData();
const v = this.prms.CdWS.v * this.prms.L.v * Structure.R2G
* this.prms.h2.v * Math.sqrt(this.prms.h1.v - this.prms.h2.v);
return new Result(v, this, data);
}
protected getFlowRegime() {
return StructureFlowRegime.SUBMERGED;
}
protected getFlowMode() {
return StructureFlowMode.WEIR;
}
/**
* paramétrage de la calculabilité des paramètres
*/
protected setParametersCalculability() {
super.setParametersCalculability();
this.prms.L.calculability = ParamCalculability.DICHO;
this.prms.CdWS.calculability = ParamCalculability.DICHO;
}
}
......@@ -352,6 +352,11 @@ export enum MessageCode {
*/
WARNING_SLOT_SUBMERSION_NOT_BETWEEN_07_AND_09,
/**
* La formule du seuil noyé n'est pas conseillé pour un ennoiement inférieur à 0.8
*/
WARNING_WEIR_SUBMERSION_LOWER_THAN_08,
/**
* Vanne levante : ZDV > ZDV max
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment