Commit 9af01069 authored by Dorchies David's avatar Dorchies David
Browse files

feat(macrorugo): Add intermediate parameter Cx for handling changes of Cd0 transparently

Fix #291
parent 9d4dc05b
...@@ -35,7 +35,11 @@ function macrorugo_resultComp(z_amont, S, long, Q, L, pf, C, Cd0, h, D) ...@@ -35,7 +35,11 @@ function macrorugo_resultComp(z_amont, S, long, Q, L, pf, C, Cd0, h, D)
q_technique=0.815*(pf/D)^1.45*S^0.557*C^(-0.456)*(9.81*D)^0.5.*D*L; q_technique=0.815*(pf/D)^1.45*S^0.557*C^(-0.456)*(9.81*D)^0.5.*D*L;
V_technique=4.54*(pf/D)^0.32*S^0.56*(9.81*D)^0.5; V_technique=4.54*(pf/D)^0.32*S^0.56*(9.81*D)^0.5;
end end
coeff_contraction = (Cd0 * 0.4 + 1.21) / 1.5; if Cd0 > 2
coeff_contraction=1.5;
else
coeff_contraction=1.1;
end
Vmax=Vg.*coeff_contraction*calcfFr(Fr); Vmax=Vg.*coeff_contraction*calcfFr(Fr);
print_r("Vmax"); print_r("Vmax");
print_r("V_technique"); print_r("V_technique");
......
...@@ -16,43 +16,43 @@ z_amont = 12.5; // Cote amont (m) ...@@ -16,43 +16,43 @@ z_amont = 12.5; // Cote amont (m)
long = 6; // Longueur rampe (m) long = 6; // Longueur rampe (m)
// ***************************************************************************** // *****************************************************************************
printf("\n*** Emergent conditions Cd=1.1***\n") printf("\n*** Emergent conditions Cd=1.1003***\n")
// ***************************************************************************** // *****************************************************************************
h = 0.6 h = 0.6
k = 0.7 k = 0.7
Cd0 = 1.1 // Forme ronde Cd0 = 1.1003 // Forme ronde
macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg) macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)
// ***************************************************************************** // *****************************************************************************
printf("\n*** Emergent conditions Cd=2.6***\n") printf("\n*** Emergent conditions Cd=2.592***\n")
// ***************************************************************************** // *****************************************************************************
h = 0.6 h = 0.6
k = 0.7 k = 0.7
Cd0 = 2.6 // Forme plane Cd0 = 2.592 // Forme plane
macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg) macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)
// ***************************************************************************** // *****************************************************************************
printf("\n*** Submerged conditions Cd=1.1***\n") printf("\n*** Submerged conditions Cd=1.1003***\n")
// ***************************************************************************** // *****************************************************************************
k = 0.7 k = 0.7
h = 0.8 h = 0.8
Cd0 = 1.1 // Forme ronde Cd0 = 1.1003 // Forme ronde
C = 0.13 C = 0.13
macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg) macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)
// ***************************************************************************** // *****************************************************************************
printf("\n*** JalHyd #85 ***\n") printf("\n*** JalHyd #85 ***\n")
// ***************************************************************************** // *****************************************************************************
Cd0 = 1.1 Cd0 = 1.1003
k = 0.8 k = 0.8
C = 0.2; // Concentration C = 0.2; // Concentration
Q = [] Q = []
for h = 0.7:0.1:1.2 for h = 0.7:0.1:1.2
Q = [Q, macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)] Q = [Q, macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)]
end end
disp Q print_r("Q")
macrorugo_searchQ(ks, D, 0.5, 2.6, S, 2, 0.85, C, z_amont, long, bDbg) macrorugo_searchQ(ks, D, 0.5, 2.592, S, 2, 0.85, C, z_amont, long, bDbg)
// ***************************************************************************** // *****************************************************************************
printf("\n*** JalHyd #144 ***\n") printf("\n*** JalHyd #144 ***\n")
......
...@@ -10,7 +10,7 @@ function print_r(s) ...@@ -10,7 +10,7 @@ function print_r(s)
if size(e,2) > 1 then if size(e,2) > 1 then
e = e' e = e'
end end
printf("%f ",e) printf("%f, ",e)
printf("]\n") printf("]\n")
else else
printf("%s: %"+pat+",\n",s,e); printf("%s: %"+pat+",\n",s,e);
......
...@@ -4,152 +4,152 @@ import { MacrorugoParams } from "../../src/macrorugo/macrorugo_params"; ...@@ -4,152 +4,152 @@ import { MacrorugoParams } from "../../src/macrorugo/macrorugo_params";
import { checkResult } from "../test_func"; import { checkResult } from "../test_func";
/* /*
*** Emergent conditions Cd=1.1*** ** Emergent conditions Cd=1.1003***
*** INPUT *** *** INPUT ***
ks = 0.010000 ks: 0.010000,
D = 0.500000 D: 0.500000,
k = 0.700000 k = 0.700000
Cd0 = 1.100000 Cd0: 1.100300,
S = 0.050000 S: 0.050000,
B = 1.000000 B: 1.000000,
h = 0.600000 h: 0.600000,
C = 0.130000 C: 0.130000,
RESULTS: RESULTS:
find_Q_nat(1.052971)=0.600890 find_Q_nat(1.052827)=0.600769
Q=0.692437 fVal=0.000000 Q=0.692366 fVal=0.000000
cote_bas = 12.200000 ZF2: 12.200000,
Vdeb = 1.154061 Vdeb: 1.153943,
Vg: 1.804786, Vg: 1.804601,
Fr = 0.743902 Fr: 0.743826,
P = 566.066964 PV: 566.009124,
flowcond = emergent flowcond: emergent,
Vmax = 2.673954 Vmax: 2.673506,
V_technique = 1.991299 V_technique: 1.991299,
q_technique = 0.561860 q_technique: 0.561860,
Strickler = 7.255093 Strickler: 7.254351,
*/ */
function macroRugoInstanceEmergentCd11(): MacroRugo { function macroRugoInstanceEmergentCd1(): MacroRugo {
return new MacroRugo( return new MacroRugo(
new MacrorugoParams( new MacrorugoParams(
12.5, // ZF1 12.5, // ZF1
6, // L 6, // L
1, // B 1, // B
0.05, // If 0.05, // If
0.692437, // Q 0.692366, // Q
0.6, // h 0.6, // h
0.01, // Ks 0.01, // Ks
0.13, // C 0.13, // C
0.5, // D 0.5, // D
0.7, // k 0.7, // k
1.1 // Cd0 1 // Cd0
) )
); );
} }
const macroRugoExtraResultEmergentCd11: { [key: string]: number | MacroRugoFlowType } = { const macroRugoExtraResultEmergentCd1: { [key: string]: number | MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT, ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT,
ZF2: 12.200000, ZF2: 12.200000,
Vdeb: 1.154061, Vdeb: 1.153943,
Vg: 1.804786, Vg: 1.804601,
Fr: 0.743902, Fr: 0.743826,
PV: 566.066964, PV: 566.009124,
Vmax: 2.673954, Vmax: 2.673506,
Strickler: 7.255093 Strickler: 7.254351
}; };
/* /*
** Emergent conditions Cd=2.6*** ** Emergent conditions Cd=2.592***
*** INPUT *** *** INPUT ***
ks: 0.010000, ks: 0.010000,
D: 0.500000, D: 0.500000,
k = 0.700000 k = 0.700000
Cd0: 2.600000, Cd0: 2.592000,
S: 0.050000, S: 0.050000,
B: 1.000000, B: 1.000000,
h: 0.600000, h: 0.600000,
C: 0.130000, C: 0.130000,
RESULTS: RESULTS:
find_Q_nat(0.674174)=0.320793 find_Q_nat(0.675214)=0.321449
Q=0.481698 fVal=0.000000 Q=0.482344 fVal=0.000000
ZF2: 12.200000, ZF2: 12.200000,
Vdeb: 0.802831, Vdeb: 0.803907,
Vg: 1.255512, Vg: 1.257195,
Fr: 0.517500, Fr: 0.518194,
PV: 393.788411, PV: 394.316317,
flowcond: emergent, flowcond: emergent,
Vmax: 2.163235, Vmax: 2.166970,
V_technique: 1.991299, V_technique: 1.991299,
q_technique: 0.561860, q_technique: 0.561860,
Strickler: 5.047056 Strickler: 5.053822
*/ */
function macroRugoInstanceEmergentCd26(): MacroRugo { function macroRugoInstanceEmergentCd2(): MacroRugo {
const nub: MacroRugo = macroRugoInstanceEmergentCd11(); const nub: MacroRugo = macroRugoInstanceEmergentCd1();
nub.prms.Cd0.singleValue = 2.6; nub.prms.Cd0.singleValue = 2;
nub.prms.Q.singleValue = 0.481698; nub.prms.Q.singleValue = 0.481698;
return nub; return nub;
} }
const macroRugoExtraResultEmergentCd26: { [key: string]: number | MacroRugoFlowType } = { const macroRugoExtraResultEmergentCd2: { [key: string]: number | MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT, ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT,
ZF2: 12.200000, ZF2: 12.200000,
Vdeb: 0.802831, Vdeb: 0.803907,
Vg: 1.255512, Vg: 1.257195,
Fr: 0.517500, Fr: 0.518194,
PV: 393.788411, PV: 394.316317,
Vmax: 2.163235, Vmax: 2.166970,
Strickler: 5.047056 Strickler: 5.053822
}; };
/* /*
*** Submerged conditions Cd=1.1*** ** Submerged conditions Cd=1.1003***
*** INPUT *** *** INPUT ***
ks: 0.010000, ks: 0.010000,
D: 0.500000, D: 0.500000,
k = 0.700000 k = 0.700000
Cd0: 1.100000, Cd0: 1.100300,
S: 0.050000, S: 0.050000,
B: 1.000000, B: 1.000000,
h: 0.800000, h: 0.800000,
C: 0.130000, C: 0.130000,
RESULTS: RESULTS:
find_Q_nat(1.403961)=0.143445 find_Q_nat(1.403770)=0.143414
Q=1.289205 fVal=0.000000 Q=1.289038 fVal=0.000000
ZF2: 12.200000, ZF2: 12.200000,
Vdeb: 1.611506, Vdeb: 1.611298,
Vg: 2.520165, Vg: 2.519839,
Fr: 0.899600, Fr: 0.899484,
PV: 790.443862, PV: 790.341606,
flowcond: immerge, flowcond: immerge,
q_technique: 0.940450, q_technique: 0.940450,
Strickler: 8.362838 Strickler: 8.361756
*/ */
function macroRugoInstanceSubmerged(): MacroRugo { function macroRugoInstanceSubmerged(): MacroRugo {
const nub: MacroRugo = macroRugoInstanceEmergentCd11(); const nub: MacroRugo = macroRugoInstanceEmergentCd1();
nub.prms.Y.singleValue = 0.8; nub.prms.Y.singleValue = 0.8;
nub.prms.Q.singleValue = 1.289205; nub.prms.Q.singleValue = 1.289038;
return nub; return nub;
} }
const macroRugoExtraResultSubmerged: { [key: string]: number | MacroRugoFlowType } = { const macroRugoExtraResultSubmerged: { [key: string]: number | MacroRugoFlowType } = {
ENUM_MacroRugoFlowType: MacroRugoFlowType.SUBMERGED, ENUM_MacroRugoFlowType: MacroRugoFlowType.SUBMERGED,
ZF2: 12.200000, ZF2: 12.200000,
Vdeb: 1.611506, Vdeb: 1.611298,
PV: 790.443862, PV: 790.341606,
Strickler: 8.362838 Strickler: 8.361756
}; };
function MacroRugoFactory(sInstance: string): MacroRugo { function MacroRugoFactory(sInstance: string): MacroRugo {
let nub: MacroRugo; let nub: MacroRugo;
switch (sInstance) { switch (sInstance) {
case "EmergentCd11": { case "EmergentCd1": {
nub = macroRugoInstanceEmergentCd11(); nub = macroRugoInstanceEmergentCd1();
break; break;
} }
case "EmergentCd26": { case "EmergentCd2": {
nub = macroRugoInstanceEmergentCd26(); nub = macroRugoInstanceEmergentCd2();
break; break;
} }
case "Submerged": { case "Submerged": {
...@@ -206,7 +206,7 @@ function testMacroRugoConfig(sInstance: string, Q0: number, fVal0: number, mrExt ...@@ -206,7 +206,7 @@ function testMacroRugoConfig(sInstance: string, Q0: number, fVal0: number, mrExt
} }
function macroRugoInstanceJalHyd85(): MacroRugo { function macroRugoInstanceJalHyd85(): MacroRugo {
const nubMR = macroRugoInstanceEmergentCd11(); const nubMR = macroRugoInstanceEmergentCd1();
nubMR.prms.C.singleValue = 0.2; nubMR.prms.C.singleValue = 0.2;
nubMR.prms.PBH.singleValue = 0.8; nubMR.prms.PBH.singleValue = 0.8;
nubMR.calculatedParam = nubMR.prms.Q; nubMR.calculatedParam = nubMR.prms.Q;
...@@ -215,8 +215,8 @@ function macroRugoInstanceJalHyd85(): MacroRugo { ...@@ -215,8 +215,8 @@ function macroRugoInstanceJalHyd85(): MacroRugo {
describe("Class MacroRugo: ", () => { describe("Class MacroRugo: ", () => {
testMacroRugoConfig("EmergentCd11", 1.052971, 0.600890, macroRugoExtraResultEmergentCd11); testMacroRugoConfig("EmergentCd1", 1.052827, 0.600769, macroRugoExtraResultEmergentCd1);
testMacroRugoConfig("EmergentCd26", 0.674174, 0.320793, macroRugoExtraResultEmergentCd26); testMacroRugoConfig("EmergentCd2", 0.675214, 0.321449, macroRugoExtraResultEmergentCd2);
// Le test passe en debug mais pas sous Jasmine !?? // Le test passe en debug mais pas sous Jasmine !??
// describe(`Condition Submerged` , () => { // describe(`Condition Submerged` , () => {
// it(`resolveAlpha_t(0.07) should be 0.074752`, () => { // it(`resolveAlpha_t(0.07) should be 0.074752`, () => {
...@@ -224,7 +224,7 @@ describe("Class MacroRugo: ", () => { ...@@ -224,7 +224,7 @@ describe("Class MacroRugo: ", () => {
// expect(macroRugoInstanceSubmerged()["resolveAlpha_t"](0.07)).toBeCloseTo(0.074752, 5); // expect(macroRugoInstanceSubmerged()["resolveAlpha_t"](0.07)).toBeCloseTo(0.074752, 5);
// }); // });
// }); // });
testMacroRugoConfig("Submerged", 1.403961, 0.143445, macroRugoExtraResultSubmerged); testMacroRugoConfig("Submerged", 1.403770, 0.143414, macroRugoExtraResultSubmerged);
describe("JalHyd #85", () => { describe("JalHyd #85", () => {
it("CalcSerie Q should return the good result :)", () => { it("CalcSerie Q should return the good result :)", () => {
...@@ -232,7 +232,7 @@ describe("Class MacroRugo: ", () => { ...@@ -232,7 +232,7 @@ describe("Class MacroRugo: ", () => {
const nubMR2 = macroRugoInstanceJalHyd85(); const nubMR2 = macroRugoInstanceJalHyd85();
nubMR.prms.Y.setValues(0.7, 1.2, 0.1); nubMR.prms.Y.setValues(0.7, 1.2, 0.1);
const aQ: number[] = [0.6885501, 0.8244762, 1.1663925, 1.4760379, 1.8506109, 2.2883764]; const aQ: number[] = [0.688476, 0.824387, 1.166239, 1.475853, 1.850393, 2.288123];
nubMR.CalcSerie(); nubMR.CalcSerie();
for (let i = 0; i < aQ.length; i++) { for (let i = 0; i < aQ.length; i++) {
......
...@@ -158,7 +158,7 @@ export class MacroRugo extends FishPass { ...@@ -158,7 +158,7 @@ export class MacroRugo extends FishPass {
public Equation(sVarCalc: string): Result { public Equation(sVarCalc: string): Result {
const Q = this.prms.Q.v; const Q = this.prms.Q.v;
const q0 = Math.sqrt(2 * MacroRugo.g * this.prms.If.v * this.prms.PBD.v * (1 - (this.sigma * this.prms.C.v)) / const q0 = Math.sqrt(2 * MacroRugo.g * this.prms.If.v * this.prms.PBD.v * (1 - (this.sigma * this.prms.C.v)) /
(this.prms.Cd0.v * this.prms.C.v)) * this.prms.Y.v * this.prms.B.v; (this.Cx * this.prms.C.v)) * this.prms.Y.v * this.prms.B.v;
let r: Result; let r: Result;
if (q0 > 0) { if (q0 > 0) {
this.setFlowType(); this.setFlowType();
...@@ -299,12 +299,23 @@ export class MacroRugo extends FishPass { ...@@ -299,12 +299,23 @@ export class MacroRugo extends FishPass {
} }
} }
/**
* Interpolation of Cd0 for Cd from calibrated Cd0 (See #291)
* Cx = 1.1 for Cd0 = 1 and Cx = 2.592 for Cd0 = 2
*/
private get Cx(): number {
if (this._cache.Cx === undefined) {
this._cache.Cx = this.prms.Cd0.v * 1.4917 -0.3914;
}
return this._cache.Cx;
}
/** /**
* Calculation of Cd : drag coefficient of a block under the actual flow conditions * Calculation of Cd : drag coefficient of a block under the actual flow conditions
*/ */
private get Cd(): number { private get Cd(): number {
if (this._cache.Cd === undefined) { if (this._cache.Cd === undefined) {
this._cache.Cd = this.prms.Cd0.v * Math.min(3, (1 + 1 / Math.pow(this.prms.Y.v / this.prms.PBD.v, 2))); this._cache.Cd = this.Cx * Math.min(3, (1 + 1 / Math.pow(this.prms.Y.v / this.prms.PBD.v, 2)));
} }
return this._cache.Cd; return this._cache.Cd;
} }
...@@ -440,7 +451,7 @@ export class MacroRugo extends FishPass { ...@@ -440,7 +451,7 @@ export class MacroRugo extends FishPass {
*/ */
private get r(): number { private get r(): number {
if (this._cache.r === undefined) { if (this._cache.r === undefined) {
this._cache.r = (this.prms.Cd0.v * 0.4 + 1.21) / 1.5; this._cache.r = 0.4 * this.prms.Cd0.v + 0.7;
} }
return this._cache.r; return this._cache.r;
} }
......
...@@ -475,7 +475,7 @@ export class Session { ...@@ -475,7 +475,7 @@ export class Session {
0.13, // C 0.13, // C
0.4, // D 0.4, // D
0.4, // k 0.4, // k
1.2 // Cd0 1 // Cd0
), dbg ), dbg
); );
break; break;
...@@ -539,7 +539,7 @@ export class Session { ...@@ -539,7 +539,7 @@ export class Session {
0.13, // C 0.13, // C
0.4, // D 0.4, // D
0.4, // k 0.4, // k
1.2 // Cd0 1 // Cd0
), dbg ), dbg
); );
break; break;
......
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