jalhyd
Version:
JaLHyd, a Javascript Library for Hydraulics
87 lines • 3.23 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.cHautCritique = void 0;
const internal_modules_1 = require("../../internal_modules");
const internal_modules_2 = require("../../internal_modules");
const internal_modules_3 = require("../../internal_modules");
const internal_modules_4 = require("../../internal_modules");
/**
* Calcul de la hauteur critique
*/
// tslint:disable-next-line:class-name
class cHautCritique extends internal_modules_3.acNewton {
/**
* Constructeur de la classe
* @param Sn 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.clone();
}
/**
* Calcul de la fonction dont on cherche le zéro
* @param rX Variable dont dépend la fonction
*/
CalcFn(rX) {
const rS = this.Sn.CalcSection("S", rX);
if (!rS.ok) {
return rS;
}
// Calcul de la fonction
// if (this.Sn.CalcSection("S", rX) !== 0)
if (rS.vCalc === 0) {
return new internal_modules_2.Result(new internal_modules_1.Message(internal_modules_1.MessageCode.ERROR_SECTION_SURFACE_NULLE));
}
/* return (Math.pow(this.Sn.prms.Q.v, 2)
* this.Sn.CalcSection("B", rX) / Math.pow(this.Sn.CalcSection("S", rX), 3)
/ ParamsSection.G - 1); */
const rB = this.Sn.CalcSection("B", rX);
if (!rB.ok) {
return rB;
}
const rS2 = this.Sn.CalcSection("S", rX);
if (!rS2.ok) {
return rS2;
}
const v = (Math.pow(this.Sn.prms.Q.v, 2) * rB.vCalc / Math.pow(rS2.vCalc, 3) / internal_modules_4.ParamsSection.G - 1);
return new internal_modules_2.Result(v);
// return Infinity;
}
/**
* 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) {
// let S = this.Sn.CalcSection("S");
const rS = this.Sn.CalcSection("S");
if (!rS.ok) {
return rS;
}
const S = rS.vCalc;
// if (S !== 0) {
if (S === 0) {
return new internal_modules_2.Result(new internal_modules_1.Message(internal_modules_1.MessageCode.ERROR_SECTION_SURFACE_NULLE));
}
// let B = this.Sn.CalcSection("B");
const rB = this.Sn.CalcSection("B");
if (!rB.ok) {
return rB;
}
const B = rB.vCalc;
const rDB = this.Sn.CalcSection("dB");
if (!rDB.ok) {
return rDB;
}
// L'initialisation à partir de rX a été faite lors de l'appel à CalcFn
// let Der = (this.Sn.CalcSection("dB") * S - 3 * B * B);
// tslint:disable-next-line:variable-name
const Der = (rDB.vCalc * S - 3 * B * B);
const v = Math.pow(this.Sn.prms.Q.v, 2) / internal_modules_4.ParamsSection.G * Der / Math.pow(S, 4);
return new internal_modules_2.Result(v);
// }
// return Infinity;
}
}
exports.cHautCritique = cHautCritique;
//# sourceMappingURL=hauteur_critique.js.map