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

Fix #144 Very shallow water macrorugo's bug

parent 0dd575a4
......@@ -25,10 +25,10 @@ function [res]=find_Q_nat(Q,ks,D,h,Cd0,S,L,pf,C,sigma,bDbg)
//if Cd0==2
// fFr=(min(2.5,Frg^(-4/3)));//
//else
fFr=(min(coeff_contraction./(1-(Frg.^2)/4),Frg.^(-2/3))).^2;
fFr=(min(coeff_contraction./(1-(Frg.^2)/4),abs(Frg).^(-2/3))).^2;
//end
if Frg>1.5
if abs(Frg)>1.5
fFr=(Frg.^(-2/3)).^2;
end
......@@ -108,7 +108,7 @@ function [res]=find_Q_nat(Q,ks,D,h,Cd0,S,L,pf,C,sigma,bDbg)
if ks==0
Cf=0.3164/4.*Re.^(-0.25);
else
Cf=2/(5.1*log10(pf/ks-1)+6)^2;
Cf=2/(5.1*log10(pf/ks)+6)^2;
end
if bDbg then print_r('Cf'); end;
......
// Test JalHyd #144
clear
sCurrentPath = get_absolute_file_path("test_macrorugo_jalhyd144.sce");
getd(sCurrentPath);
bDbg = %f;
bDbg_RA = %f;
// macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)
for h = 0.05
macrorugo_searchQ(0.15, 0.5, 0.4, 1, 0.05, 5, h, 0.13, 100, 25, bDbg)
end
......@@ -44,12 +44,12 @@ function macroRugoInstanceEmergentCd15(): MacroRugo {
const macroRugoExtraResultEmergentCd15: { [key: string]: number|MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT,
Fr: 0.530417,
PV: 242.170537,
Fr: 0.530425,
PV: 242.174003,
Q_GuideTech: 0.561860,
V_GuideTech: 1.991299,
Vdeb: 0.822870,
Vmax: 1.799472,
Vdeb: 0.822881,
Vmax: 1.799502,
ZF2: 12.2
};
......@@ -83,12 +83,12 @@ function macroRugoInstanceEmergentCd2(): MacroRugo {
const macroRugoExtraResultEmergentCd2: { [key: string]: number|MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT,
Fr: 0.404814,
PV: 184.824088,
Fr: 0.404817,
PV: 184.825734,
Q_GuideTech: 0.414154,
V_GuideTech: 1.592932,
Vdeb: 0.628013,
Vmax: 1.536115,
Vdeb: 0.628018,
Vmax: 1.536129,
ZF2: 12.2
};
......@@ -191,8 +191,8 @@ function testMacroRugoConfig(sInstance: string, Q0: number, fVal0: number, mrExt
describe("Class MacroRugo: ", () => {
testMacroRugoConfig("EmergentCd15", 0.901710, 0.379574, macroRugoExtraResultEmergentCd15);
testMacroRugoConfig("EmergentCd2", 0.768677, 0.418044, macroRugoExtraResultEmergentCd2);
testMacroRugoConfig("EmergentCd15", 0.901710, 0.379539, macroRugoExtraResultEmergentCd15);
testMacroRugoConfig("EmergentCd2", 0.768677, 0.418029, macroRugoExtraResultEmergentCd2);
// Le test passe en debug mais pas sous Jasmine !??
// describe(`Condition Submerged` , () => {
// it(`resolveAlpha_t(0.07) should be 0.074752`, () => {
......
import { MacroRugo } from "../../src/macrorugo/macrorugo";
import { MacrorugoParams } from "../../src/macrorugo/macrorugo_params";
describe("Class MacroRugo: ", () => {
describe("jalhyd #144", () => {
it("Q should be 0.04033", () => {
const m = new MacroRugo(
new MacrorugoParams(
100, 25, 5, 0.05, 1, 0.05, 0.15, 0.13, 0.5, 0.4, 1
)
);
m.calculatedParam = m.prms.Q;
expect(m.CalcSerie().vCalc).toBeCloseTo(0.039283, 5);
});
});
});
......@@ -205,9 +205,8 @@ export class MacroRugo extends Nub {
// Submerged conditions
/** Velocity at the bed §2.3.2 Cassan et al., 2016 */
const cf = 2 / Math.pow(5.1 * Math.log10(k / ks) + 6, 2);
this.u0 = Math.sqrt(k * 2 * g * S * this.R
/ (this.Cd * C * k / D + cf * this.R));
/ (this.Cd * C * k / D + this.calcCf(k) * this.R));
/** turbulent length scale (m) within the blocks layer (alpha_t) */
const alpha = uniroot(this.resolveAlpha_t, this, 1E-6, 100);
/** averaged velocity at the top of blocks (m.s-1) */
......@@ -288,8 +287,9 @@ export class MacroRugo extends Nub {
/**
* Bed friction coefficient Equation (3) (Cassan et al., 2016)
* @param Y Water depth (m)
*/
private calcCf(): number {
private calcCf(Y: number): number {
if (this.prms.Ks.v < 1E-9) {
// Between Eq (8) and (9) (Cassan et al., 2016)
......@@ -297,7 +297,7 @@ export class MacroRugo extends Nub {
return 0.3164 / 4. * Math.pow(reynolds, -0.25);
} else {
// Equation (3) (Cassan et al., 2016)
return 2 / Math.pow(5.1 * Math.log10(this.prms.Y.v / this.prms.Ks.v - 1) + 6, 2);
return 2 / Math.pow(5.1 * Math.log10(Y / this.prms.Ks.v) + 6, 2);
}
}
......@@ -352,7 +352,7 @@ export class MacroRugo extends Nub {
const Cd = this.prms.Cd0.v * (1 + 1 / Math.pow(this.prms.Y.v / this.prms.PBD.v, 2)) * this.fFr;
/** N from Cassan 2016 eq(2) et Cassan 2014 eq(12) */
const N = (alpha * this.calcCf()) / (this.prms.Y.v / this.prms.PBD.v * Cd * this.prms.C.v);
const N = (alpha * this.calcCf(this.prms.Y.v)) / (this.prms.Y.v / this.prms.PBD.v * Cd * this.prms.C.v);
return this.U0 - Math.sqrt(
2 * MacroRugo.g * this.prms.If.v * this.prms.PBD.v *
......
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