From b90e0bfe3b137da20d8e3881cf15a2d694a0581f Mon Sep 17 00:00:00 2001 From: David Dorchies <david.dorchies@irstea.fr> Date: Mon, 8 Oct 2018 19:11:04 +0200 Subject: [PATCH] =?UTF-8?q?#22=20Changement=20nom=20variable=20fracAxAy=20?= =?UTF-8?q?et=20limitation=20des=20param=C3=A8tres=20calculables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/macrorugo/macrorugo.ts | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/macrorugo/macrorugo.ts b/src/macrorugo/macrorugo.ts index b69ba0d5..d1342103 100644 --- a/src/macrorugo/macrorugo.ts +++ b/src/macrorugo/macrorugo.ts @@ -21,8 +21,8 @@ export class MacroRugo extends Nub { // Water at 20 °C has a kinematic viscosity of about 10−6 m2·s−1 // (https://en.wikipedia.org/wiki/Viscosity#Kinematic_viscosity,_%CE%BD) - /** Ratio between the lenght (parallel to flow) and the width (perpendicular to flow) of a cell (-) */ - private static readonly fracAyAx = 1; + /** Ratio between the width (perpendicular to flow) and the lenght (parallel to flow) of a cell (-) */ + private static readonly fracAxAy = 1; /** Limit between emergent and submerged flow */ private static readonly limitSubmerg = 1.1; @@ -67,7 +67,7 @@ export class MacroRugo extends Nub { // Vitesse débitante r.extraResults.Vdeb = this.V(this.prms.Q) / this.prms.B.v / this.prms.Y.v; // Froude - r.extraResults.Fr = r.extraResults.Vdeb / (1 - Math.sqrt(MacroRugo.fracAyAx * this.prms.C.v)) + r.extraResults.Fr = r.extraResults.Vdeb / (1 - Math.sqrt(MacroRugo.fracAxAy * this.prms.C.v)) / Math.sqrt(MacroRugo.g * this.prms.Y.v); // Vitesse maximale r.extraResults.V = r.extraResults.Vdeb * this.calc_fFr(r.extraResults.Vdeb); @@ -125,9 +125,9 @@ export class MacroRugo extends Nub { this.prms.Q.calculability = ParamCalculability.EQUATION; this.prms.Y.calculability = ParamCalculability.DICHO; this.prms.C.calculability = ParamCalculability.DICHO; - this.prms.PBD.calculability = ParamCalculability.DICHO; + this.prms.PBD.calculability = ParamCalculability.FREE; this.prms.PBH.calculability = ParamCalculability.FREE; - this.prms.Cd0.calculability = ParamCalculability.DICHO; + this.prms.Cd0.calculability = ParamCalculability.FREE; } /** @@ -161,7 +161,7 @@ export class MacroRugo extends Nub { const kappa = 0.41; // von Karman constant // U0 = Averaged velocity (m.s-1) - this.U0 = Q / this.prms.B.v / this.prms.Y.v; + this.U0 = Q / this.prms.B.v / h; /** Calulated average velocity */ let uMoy: number; @@ -242,12 +242,11 @@ export class MacroRugo extends Nub { * Bed friction coefficient Equation (3) (Cassan et al., 2016) */ private calcCf(U0: number): number { - // Between Eq (8) and (9) (Cassan et al., 2016) - // tslint:disable-next-line:variable-name - const Re = U0 * this.prms.Y.v / MacroRugo.nu; if (this.prms.Ks.v < 1E-6) { - return 0.3164 / 4. * Math.pow(Re, -0.25); + // Between Eq (8) and (9) (Cassan et al., 2016) + const reynolds = U0 * this.prms.Y.v / MacroRugo.nu; + 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); @@ -256,9 +255,6 @@ export class MacroRugo extends Nub { /** * Calculation of Cd : drag coefficient of a block under the actual flow conditions - * @param Cd0 - * @param pf - * @param D * @param fFr */ private calcCd(fFr: number): number { @@ -304,10 +300,10 @@ export class MacroRugo extends Nub { return alpha * this.calcUz(alpha) - l0 * this.ustar; } - private resolveU0(U0: number) { + private resolveU0(U0: number): number { const g = MacroRugo.g; - const alpha = 1 - (1 * this.prms.C.v); + const alpha = 1 - (1 / MacroRugo.fracAxAy * this.prms.C.v); // tslint:disable-next-line:variable-name const Cd = this.calcCd(this.calc_fFr(U0)); @@ -327,7 +323,7 @@ export class MacroRugo extends Nub { private calc_fFr(u0: number): number { // tslint:disable-next-line:variable-name - const Fr = u0 / (1 - Math.sqrt(MacroRugo.fracAyAx * this.prms.C.v)) / Math.sqrt(MacroRugo.g * this.prms.Y.v); + const Fr = u0 / (1 - Math.sqrt(MacroRugo.fracAxAy * this.prms.C.v)) / Math.sqrt(MacroRugo.g * this.prms.Y.v); /** Interpolation linéaire entre le bloc rond (Cd0=1) et le carré (Cd0=2) */ const r = 0.4 * this.prms.Cd0.v + 0.7; @@ -371,7 +367,7 @@ function uniroot<T>(func: (param: number) => number, thisArg: T, lowerLimit: num let tolAct; // Actual tolerance let newStep; // Step at this iteration let prevStep; // Distance from the last but one to the last approximation - let p; // Interpolation step is calculated in the form p/q; division is delayed until the last moment + let p; // Interpolation step is calculated in the form p/q; division is delayed until the last moment let q; while (maxIter-- > 0) { -- GitLab