Commit ad258312 authored by Dorchies David's avatar Dorchies David
Browse files

Fix #191 MacroRugo: Transition between Submerged and emergent flow

parent 97c2337e
......@@ -177,7 +177,7 @@ function testMacroRugoConfig(sInstance: string, Q0: number, fVal0: number, mrExt
const nubit = MacroRugoFactory(sInstance);
nubit.prms.Q.v = Q0;
// tslint:disable-next-line:no-string-literal
nubit["bSubmerged"] = (nubit.prms.Y.v / nubit.prms.PBH.v > MacroRugo["limitSubmerg"]);
nubit["setFlowType"]();
// tslint:disable-next-line:no-string-literal
expect(nubit["resolveQ"]()).toBeCloseTo(fVal0, 5);
});
......
......@@ -4,7 +4,7 @@ import { Props } from "../../src/props";
import { Session } from "../../src/session";
let m154: MacroRugo;
const aQ154: number[] = [0.285749, 0.300390, 0.315000, 0.329554, 0.344031, 0.358410, 0.372674, 0.469966];
const aQ154: number[] = [0.285749, 0.300390, 0.315000, 0.329554, 0.344031, 0.358410, 0.372674, 0.407595];
let i154: number;
describe("Class MacroRugo: ", () => {
describe("jalhyd #154", () => {
......@@ -15,6 +15,8 @@ describe("Class MacroRugo: ", () => {
m154.prms.Ks.v = 0.1;
m154.prms.Cd0.v = 1;
m154.prms.Y.v = 0.3;
// tslint:disable-next-line: no-string-literal
m154["setFlowType"]();
const aQ: number[] = [0.105312, 0.061355, 0.228021];
for (let i = 0; i < aQ.length; i++) {
m154.prms.Q.v = 0.2 + i * 0.05;
......
......@@ -28,10 +28,10 @@ export class MacroRugo extends Nub {
private static readonly fracAxAy = 1;
/** Limit between emergent and submerged flow */
private static readonly limitSubmerg = 1.01;
private static readonly limitSubmerg = 1.1;
/** Flag for submerged Flow */
private bSubmerged: boolean;
private flowType: MacroRugoFlowType;
/** Velocity at the bed (m.s-1) */
private u0: number;
......@@ -155,7 +155,7 @@ export class MacroRugo extends Nub {
(this.prms.Cd0.v * this.prms.C.v)) * this.prms.Y.v * this.prms.B.v;
let r: Result;
if (q0 > 0) {
this.bSubmerged = (this.prms.Y.v / this.prms.PBH.v > MacroRugo.limitSubmerg);
this.setFlowType();
const dicho = new Dichotomie(this, "Q", false, this.resolveQ);
r = dicho.Dichotomie(0, SessionSettings.precision, q0);
} else {
......@@ -193,6 +193,17 @@ export class MacroRugo extends Nub {
};
}
private setFlowType() {
const hstar: number = this.prms.Y.v / this.prms.PBH.v;
if (hstar > MacroRugo.limitSubmerg) {
this.flowType = MacroRugoFlowType.SUBMERGED;
} else if (hstar < 1) {
this.flowType = MacroRugoFlowType.EMERGENT;
} else {
this.flowType = MacroRugoFlowType.QUASI_EMERGENT;
}
}
/**
* Equation from Cassan, L., Laurens, P., 2016. Design of emergent and submerged rock-ramp fish passes.
* Knowledge & Management of Aquatic Ecosystems 45.
......@@ -205,12 +216,14 @@ export class MacroRugo extends Nub {
/** adimensional water depth */
const hstar: number = this.prms.Y.v / this.prms.PBH.v;
if (this.bSubmerged) {
// Submerged conditions
return this.resolveQSubmerged();
} else {
// Emergent conditions
return this.resolveQEmergent();
switch (this.flowType) {
case MacroRugoFlowType.SUBMERGED:
return this.resolveQSubmerged();
case MacroRugoFlowType.EMERGENT:
return this.resolveQEmergent();
case MacroRugoFlowType.QUASI_EMERGENT:
const a = (hstar - 1) / (MacroRugo.limitSubmerg - 1);
return (1 - a) * this.resolveQEmergent() + a * this.resolveQSubmerged();
}
}
......
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