Commit 9af01069 by Dorchies David

### 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) 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; 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); print_r("Vmax"); print_r("V_technique"); ... ...
 ... ... @@ -16,43 +16,43 @@ z_amont = 12.5; // Cote amont (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 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) // ***************************************************************************** printf("\n*** Emergent conditions Cd=2.6***\n") printf("\n*** Emergent conditions Cd=2.592***\n") // ***************************************************************************** h = 0.6 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) // ***************************************************************************** printf("\n*** Submerged conditions Cd=1.1***\n") printf("\n*** Submerged conditions Cd=1.1003***\n") // ***************************************************************************** k = 0.7 h = 0.8 Cd0 = 1.1 // Forme ronde Cd0 = 1.1003 // Forme ronde C = 0.13 macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg) // ***************************************************************************** printf("\n*** JalHyd #85 ***\n") // ***************************************************************************** Cd0 = 1.1 Cd0 = 1.1003 k = 0.8 C = 0.2; // Concentration Q = [] for h = 0.7:0.1:1.2 Q = [Q, macrorugo_searchQ(ks, D, k, Cd0, S, B, h, C, z_amont, long, bDbg)] 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") ... ...
 ... ... @@ -10,7 +10,7 @@ function print_r(s) if size(e,2) > 1 then e = e' end printf("%f ",e) printf("%f, ",e) printf("]\n") else printf("%s: %"+pat+",\n",s,e); ... ...
 ... ... @@ -4,152 +4,152 @@ import { MacrorugoParams } from "../../src/macrorugo/macrorugo_params"; import { checkResult } from "../test_func"; /* *** Emergent conditions Cd=1.1*** ** Emergent conditions Cd=1.1003*** *** INPUT *** ks = 0.010000 D = 0.500000 ks: 0.010000, D: 0.500000, k = 0.700000 Cd0 = 1.100000 S = 0.050000 B = 1.000000 h = 0.600000 C = 0.130000 Cd0: 1.100300, S: 0.050000, B: 1.000000, h: 0.600000, C: 0.130000, RESULTS: find_Q_nat(1.052971)=0.600890 Q=0.692437 fVal=0.000000 cote_bas = 12.200000 Vdeb = 1.154061 Vg: 1.804786, Fr = 0.743902 P = 566.066964 flowcond = emergent Vmax = 2.673954 V_technique = 1.991299 q_technique = 0.561860 Strickler = 7.255093 find_Q_nat(1.052827)=0.600769 Q=0.692366 fVal=0.000000 ZF2: 12.200000, Vdeb: 1.153943, Vg: 1.804601, Fr: 0.743826, PV: 566.009124, flowcond: emergent, Vmax: 2.673506, V_technique: 1.991299, q_technique: 0.561860, Strickler: 7.254351, */ function macroRugoInstanceEmergentCd11(): MacroRugo { function macroRugoInstanceEmergentCd1(): MacroRugo { return new MacroRugo( new MacrorugoParams( 12.5, // ZF1 6, // L 1, // B 0.05, // If 0.692437, // Q 0.692366, // Q 0.6, // h 0.01, // Ks 0.13, // C 0.5, // D 0.7, // k 1.1 // Cd0 1 // Cd0 ) ); } const macroRugoExtraResultEmergentCd11: { [key: string]: number | MacroRugoFlowType } = { const macroRugoExtraResultEmergentCd1: { [key: string]: number | MacroRugoFlowType } = { ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT, ZF2: 12.200000, Vdeb: 1.154061, Vg: 1.804786, Fr: 0.743902, PV: 566.066964, Vmax: 2.673954, Strickler: 7.255093 Vdeb: 1.153943, Vg: 1.804601, Fr: 0.743826, PV: 566.009124, Vmax: 2.673506, Strickler: 7.254351 }; /* ** Emergent conditions Cd=2.6*** ** Emergent conditions Cd=2.592*** *** INPUT *** ks: 0.010000, D: 0.500000, k = 0.700000 Cd0: 2.600000, Cd0: 2.592000, S: 0.050000, B: 1.000000, h: 0.600000, C: 0.130000, RESULTS: find_Q_nat(0.674174)=0.320793 Q=0.481698 fVal=0.000000 find_Q_nat(0.675214)=0.321449 Q=0.482344 fVal=0.000000 ZF2: 12.200000, Vdeb: 0.802831, Vg: 1.255512, Fr: 0.517500, PV: 393.788411, Vdeb: 0.803907, Vg: 1.257195, Fr: 0.518194, PV: 394.316317, flowcond: emergent, Vmax: 2.163235, Vmax: 2.166970, V_technique: 1.991299, q_technique: 0.561860, Strickler: 5.047056 Strickler: 5.053822 */ function macroRugoInstanceEmergentCd26(): MacroRugo { const nub: MacroRugo = macroRugoInstanceEmergentCd11(); nub.prms.Cd0.singleValue = 2.6; function macroRugoInstanceEmergentCd2(): MacroRugo { const nub: MacroRugo = macroRugoInstanceEmergentCd1(); nub.prms.Cd0.singleValue = 2; nub.prms.Q.singleValue = 0.481698; return nub; } const macroRugoExtraResultEmergentCd26: { [key: string]: number | MacroRugoFlowType } = { const macroRugoExtraResultEmergentCd2: { [key: string]: number | MacroRugoFlowType } = { ENUM_MacroRugoFlowType: MacroRugoFlowType.EMERGENT, ZF2: 12.200000, Vdeb: 0.802831, Vg: 1.255512, Fr: 0.517500, PV: 393.788411, Vmax: 2.163235, Strickler: 5.047056 Vdeb: 0.803907, Vg: 1.257195, Fr: 0.518194, PV: 394.316317, Vmax: 2.166970, Strickler: 5.053822 }; /* *** Submerged conditions Cd=1.1*** ** Submerged conditions Cd=1.1003*** *** INPUT *** ks: 0.010000, D: 0.500000, k = 0.700000 Cd0: 1.100000, Cd0: 1.100300, S: 0.050000, B: 1.000000, h: 0.800000, C: 0.130000, RESULTS: find_Q_nat(1.403961)=0.143445 Q=1.289205 fVal=0.000000 find_Q_nat(1.403770)=0.143414 Q=1.289038 fVal=0.000000 ZF2: 12.200000, Vdeb: 1.611506, Vg: 2.520165, Fr: 0.899600, PV: 790.443862, Vdeb: 1.611298, Vg: 2.519839, Fr: 0.899484, PV: 790.341606, flowcond: immerge, q_technique: 0.940450, Strickler: 8.362838 Strickler: 8.361756 */ function macroRugoInstanceSubmerged(): MacroRugo { const nub: MacroRugo = macroRugoInstanceEmergentCd11(); const nub: MacroRugo = macroRugoInstanceEmergentCd1(); nub.prms.Y.singleValue = 0.8; nub.prms.Q.singleValue = 1.289205; nub.prms.Q.singleValue = 1.289038; return nub; } const macroRugoExtraResultSubmerged: { [key: string]: number | MacroRugoFlowType } = { ENUM_MacroRugoFlowType: MacroRugoFlowType.SUBMERGED, ZF2: 12.200000, Vdeb: 1.611506, PV: 790.443862, Strickler: 8.362838 Vdeb: 1.611298, PV: 790.341606, Strickler: 8.361756 }; function MacroRugoFactory(sInstance: string): MacroRugo { let nub: MacroRugo; switch (sInstance) { case "EmergentCd11": { nub = macroRugoInstanceEmergentCd11(); case "EmergentCd1": { nub = macroRugoInstanceEmergentCd1(); break; } case "EmergentCd26": { nub = macroRugoInstanceEmergentCd26(); case "EmergentCd2": { nub = macroRugoInstanceEmergentCd2(); break; } case "Submerged": { ... ... @@ -206,7 +206,7 @@ function testMacroRugoConfig(sInstance: string, Q0: number, fVal0: number, mrExt } function macroRugoInstanceJalHyd85(): MacroRugo { const nubMR = macroRugoInstanceEmergentCd11(); const nubMR = macroRugoInstanceEmergentCd1(); nubMR.prms.C.singleValue = 0.2; nubMR.prms.PBH.singleValue = 0.8; nubMR.calculatedParam = nubMR.prms.Q; ... ... @@ -215,8 +215,8 @@ function macroRugoInstanceJalHyd85(): MacroRugo { describe("Class MacroRugo: ", () => { testMacroRugoConfig("EmergentCd11", 1.052971, 0.600890, macroRugoExtraResultEmergentCd11); testMacroRugoConfig("EmergentCd26", 0.674174, 0.320793, macroRugoExtraResultEmergentCd26); testMacroRugoConfig("EmergentCd1", 1.052827, 0.600769, macroRugoExtraResultEmergentCd1); testMacroRugoConfig("EmergentCd2", 0.675214, 0.321449, macroRugoExtraResultEmergentCd2); // Le test passe en debug mais pas sous Jasmine !?? // describe(`Condition Submerged` , () => { // it(`resolveAlpha_t(0.07) should be 0.074752`, () => { ... ... @@ -224,7 +224,7 @@ describe("Class MacroRugo: ", () => { // 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", () => { it("CalcSerie Q should return the good result :)", () => { ... ... @@ -232,7 +232,7 @@ describe("Class MacroRugo: ", () => { const nubMR2 = macroRugoInstanceJalHyd85(); 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(); for (let i = 0; i < aQ.length; i++) { ... ...
 ... ... @@ -158,7 +158,7 @@ export class MacroRugo extends FishPass { public Equation(sVarCalc: string): Result { 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)) / (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; if (q0 > 0) { this.setFlowType(); ... ... @@ -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 */ private get Cd(): number { 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; } ... ... @@ -440,7 +451,7 @@ export class MacroRugo extends FishPass { */ private get r(): number { 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; } ... ...
 ... ... @@ -475,7 +475,7 @@ export class Session { 0.13, // C 0.4, // D 0.4, // k 1.2 // Cd0 1 // Cd0 ), dbg ); break; ... ... @@ -539,7 +539,7 @@ export class Session { 0.13, // C 0.4, // D 0.4, // k 1.2 // Cd0 1 // Cd0 ), dbg ); break; ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!