jalhyd
Version:
JaLHyd, a Javascript Library for Hydraulics
79 lines • 2.77 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.cHautNormale = void 0;
const internal_modules_1 = require("../../internal_modules");
const internal_modules_2 = require("../../internal_modules");
/**
* Calcul de la hauteur normale
*/
// tslint:disable-next-line:class-name
class cHautNormale extends internal_modules_2.acNewton {
/**
* Constructeur de la classe
* @param oSn Section sur laquelle on fait le calcul
*/
// tslint:disable-next-line:variable-name
constructor(Sn, maxIter, dbg = false) {
super(Sn.prms, maxIter, dbg);
this.Sn = Sn;
this.Q = Sn.prms.Q.v;
this.Ks = Sn.prms.Ks.v;
this.If = Sn.prms.If.v;
}
/**
* Calcul de la fonction dont on cherche le zéro
* @param rX Variable dont dépend la fonction
*/
CalcFn(rX) {
// Calcul de la fonction
/* return (this.Q - this.Ks * Math.pow(this.Sn.CalcSection("R", rX), 2 / 3)
* this.Sn.CalcSection("S", rX) * Math.sqrt(this.If)); */
const rR = this.Sn.CalcSection("R", rX);
if (!rR.ok) {
return rR;
}
const rS = this.Sn.CalcSection("S", rX);
if (!rS.ok) {
return rS;
}
const v = (this.Q - this.Ks * Math.pow(rR.vCalc, 2 / 3) * rS.vCalc * Math.sqrt(this.If));
return new internal_modules_1.Result(v);
}
/**
* Calcul analytique de la dérivée de la fonction dont on cherche le zéro
* @param rX Variable dont dépend la fonction
*/
CalcDer(rX) {
const rDR = this.Sn.CalcSection("dR");
if (!rDR.ok) {
return rDR;
}
const rR = this.Sn.CalcSection("R");
if (!rR.ok) {
return rR;
}
const rS = this.Sn.CalcSection("S");
if (!rS.ok) {
return rS;
}
// L'initialisation a été faite lors de l'appel à CalcFn
// let Der = 2 / 3 * this.Sn.CalcSection("dR") * Math.pow(this.Sn.CalcSection("R"), -1 / 3)
// * this.Sn.CalcSection("S");
// tslint:disable-next-line:variable-name
let Der = 2 / 3 * rDR.vCalc * Math.pow(rR.vCalc, -1 / 3) * rS.vCalc;
const rR2 = this.Sn.CalcSection("R");
if (!rR2.ok) {
return rR2;
}
const rB = this.Sn.CalcSection("B");
if (!rB.ok) {
return rB;
}
// Der = Der + Math.pow(this.Sn.CalcSection("R"), 2 / 3) * this.Sn.CalcSection("B");
Der = Der + Math.pow(rR2.vCalc, 2 / 3) * rB.vCalc;
Der = Der * -this.Ks * Math.sqrt(this.If);
return new internal_modules_1.Result(Der);
}
}
exports.cHautNormale = cHautNormale;
//# sourceMappingURL=hauteur_normale.js.map