• Mathias Chouet's avatar
    refactor nubs · 7b6e5403
    Mathias Chouet authored
    merged cParamsCanal and ParamsSection
    Structures are now only defined by their LoiDebit (no more StructureType)
    Session : fixed serialization of lately registered Nubs
    Sections are now defined by a CalculatorType and a NodeType
    fixed bug in findFirstSingleParameter
    added tests for session serialisation
    7b6e5403
section_param_trapez_fluvial.spec.ts 6.42 KiB
import { cSnTrapez, ParamsSectionTrapez } from "../../src/section/section_trapez";
import { precDist } from "../test_config";
import { checkResult } from "../test_func";
let paramSection: ParamsSectionTrapez;
let sect: cSnTrapez;
function createSection(prec: number): cSnTrapez {
    paramSection = new ParamsSectionTrapez(2.5, // largeur de fond
        0.56, // fruit
        0.8, // tirant d'eau
        40, //  Ks=Strickler
        1.2,  //  Q=Débit
        0.001, //  If=pente du fond
        1, // YB= hauteur de berge
    paramSection.Pr.v = precDist;
    return new cSnTrapez(paramSection);
function createSectionDebordement(prec: number): cSnTrapez {
    paramSection = new ParamsSectionTrapez(2.5, // largeur de fond
        0.56, // fruit
        2, // tirant d'eau
        40, //  Ks=Strickler
        1.2,  //  Q=Débit
        0.001, //  If=pente du fond
        1, // YB= hauteur de berge
    paramSection.Pr.v = precDist;
    return new cSnTrapez(paramSection);
describe("Section paramétrée trapèze : ", () => {
    beforeEach(() => {
        sect = createSection(precDist);
    });
    describe("fluvial / pas de débordement :", () => {
        // charge spécifique
        it("Hs should equal to 0.813", () => {
            checkResult(sect.CalcSection("Hs"), 0.813);
        });
        // charge critique
        it("Hsc should equal to 0.413", () => {
            checkResult(sect.CalcSection("Hsc"), 0.413);
        });
        // largeur au miroir
        it("B should equal to 3.396", () => {
            checkResult(sect.CalcSection("B"), 3.396);
        });
        // périmètre mouillé
        it("P should equal to 4.334", () => {
            checkResult(sect.CalcSection("P"), 4.334);
        });
        // surface mouillée
        it("S should equal to 2.358", () => {
            checkResult(sect.CalcSection("S"), 2.358);
        });
        // rayon hydraulique
        it("R should equal to 0.544", () => {
            checkResult(sect.CalcSection("R"), 0.544);
        });
7172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
// vitesse moyenne it("V should equal to 0.509", () => { checkResult(sect.CalcSection("V"), 0.509); }); // nombre de Froude it("Fr should equal to 0.195", () => { checkResult(sect.CalcSection("Fr"), 0.195); }); // tirant d'eau critique it("Yc should equal to 0.28", () => { checkResult(sect.CalcSection("Yc"), 0.28); }); // tirant d'eau normal it("Yn should equal to 0.587", () => { checkResult(sect.CalcSection("Yn"), 0.587); }); // tirant d'eau fluvial it("Yf should equal to 0.8", () => { checkResult(sect.CalcSection("Yf"), 0.8); }); // tirant d'eau torrentiel it("Yt should equal to 0.127", () => { checkResult(sect.CalcSection("Yt"), 0.127); }); // tirant d'eau conjugué it("Yco should equal to 0.061", () => { checkResult(sect.CalcSection("Yco"), 0.061); }); // perte de charge it("J should equal to 0.00036", () => { const sect2 = createSection(0.00001); checkResult(sect2.CalcSection("J"), 0.00036); }); // Variation linéaire de l'énergie spécifique it("I-J should equal to 0.001", () => { checkResult(sect.CalcSection("I-J"), 0.001); }); // impulsion hydraulique it("Imp should equal to 9396.158", () => { checkResult(sect.CalcSection("Imp"), 9396.158); }); // force tractrice (contrainte de cisaillement) it("Tau0 should equal to 1.944", () => { checkResult(sect.CalcSection("Tau0"), 1.944); }); }); }); describe("Section paramétrée trapèze : ", () => { beforeEach(() => { sect = createSectionDebordement(precDist); }); describe("fluvial / débordement :", () => { // charge spécifique it("Hs should equal to 2.002", () => { checkResult(sect.CalcSection("Hs"), 2.002); });
141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
// charge critique it("Hsc should equal to 0.413", () => { checkResult(sect.CalcSection("Hsc"), 0.413); }); // largeur au miroir it("B should equal to 3.62", () => { checkResult(sect.CalcSection("B"), 3.62); }); // périmètre mouillé it("P should equal to 6.792", () => { checkResult(sect.CalcSection("P"), 6.792); }); // surface mouillée it("S should equal to 6.68", () => { checkResult(sect.CalcSection("S"), 6.68); }); // rayon hydraulique it("R should equal to 0.983", () => { checkResult(sect.CalcSection("R"), 0.983); }); // vitesse moyenne it("V should equal to 0.18", () => { checkResult(sect.CalcSection("V"), 0.18); }); // nombre de Froude it("Fr should equal to 0.042", () => { checkResult(sect.CalcSection("Fr"), 0.042); }); // tirant d'eau critique it("Yc should equal to 0.28", () => { checkResult(sect.CalcSection("Yc"), 0.28); }); // tirant d'eau normal it("Yn should equal to 0.587", () => { checkResult(sect.CalcSection("Yn"), 0.587); }); // tirant d'eau fluvial it("Yf should equal to 2", () => { checkResult(sect.CalcSection("Yf"), 2); }); // tirant d'eau torrentiel it("Yt should equal to 0.077", () => { checkResult(sect.CalcSection("Yt"), 0.077); }); // tirant d'eau conjugué it("Yco should equal to 0.009", () => { checkResult(sect.CalcSection("Yco"), 0.009); }); // perte de charge it("J should equal to 0.00002", () => { const sect2 = createSection(0.00001); checkResult(sect2.CalcSection("J"), 0.00002); }); // Variation linéaire de l'énergie spécifique it("I-J should equal to 0.001", () => { checkResult(sect.CalcSection("I-J"), 0.001); });
211212213214215216217218219220221222223
// impulsion hydraulique it("Imp should equal to 63915.169", () => { checkResult(sect.CalcSection("Imp"), 63915.169); }); // force tractrice (contrainte de cisaillement) it("Tau0 should equal to 0.199", () => { checkResult(sect.CalcSection("Tau0"), 0.199); }); }); });