Commit fe8eb878 authored by Mathias Chouet's avatar Mathias Chouet 🍝
Browse files

Merge branch...

Merge branch '209-section-parametree-le-tirant-d-eau-critique-ne-converge-pas-sur-une-section-circulaire-fermee' into 'master'

Resolve "Section paramétrée: le tirant d'eau critique ne converge pas sur une section circulaire fermée"

Closes #209

See merge request cassiopee/jalhyd!69
parents 19f3ba9b e51b9d57
...@@ -4,211 +4,96 @@ import { SessionSettings } from "../../../src/session_settings"; ...@@ -4,211 +4,96 @@ import { SessionSettings } from "../../../src/session_settings";
import { precDist } from "../../test_config"; import { precDist } from "../../test_config";
import { checkResult } from "../../test_func"; import { checkResult } from "../../test_func";
let paramSection: ParamsSectionCirc;
let sect: cSnCirc; let sect: cSnCirc;
function createSection(prec: number): cSnCirc { const resultSectCirc: {[name: string]: number} = {
paramSection = new ParamsSectionCirc(2, // diamètre Hs: 0.853, Hsc: 0.694, B: 1.959, P: 2.738, S: 1.173, R: 0.428, V: 1.023,
0.8, // tirant d'eau Fr: 0.422, Yc: 0.512, Yn: 0.976, Ycor: 0.361, Ycon: 0.307, J: 0.002,
40, // Ks=Strickler 'I-J': -0.00102, Imp: 5076.304, Tau0: 8.505
1.2, // Q=Débit
0.001, // If=pente du fond
1, // YB= hauteur de berge
);
SessionSettings.precision = prec;
return new cSnCirc(paramSection);
} }
function createSectionDebordement(prec: number): cSnCirc { describe("Section paramétrée circulaire ouverte: ", () => {
paramSection = new ParamsSectionCirc(2, // diamètre beforeEach(() =>{
2, // tirant d'eau SessionSettings.precision = precDist;
40, // Ks=Strickler
1.2, // Q=Débit
0.001, // If=pente du fond
1, // YB= hauteur de berge
);
SessionSettings.precision = prec;
return new cSnCirc(paramSection);
}
describe("Section paramétrée circulaire : ", () => {
beforeEach(() => {
sect = createSection(precDist);
}); });
describe("fluvial / pas de débordement :", () => { describe("fluvial / pas de débordement :", () => {
// charge spécifique beforeEach(() => {
it("Hs should equal to 0.853", () => { sect = new cSnCirc(
checkResult(sect.CalcSection("Hs"), 0.853); new ParamsSectionCirc(
}); 2, // diamètre
0.8, // tirant d'eau
// charge critique 40, // Ks=Strickler
it("Hsc should equal to 0.694", () => { 1.2, // Q=Débit
checkResult(sect.CalcSection("Hsc"), 0.694); 0.001, // If=pente du fond
}); 1, // YB= hauteur de berge
)
// largeur au miroir );
it("B should equal to 1.959", () => { });
checkResult(sect.CalcSection("B"), 1.959);
}); for(const v in resultSectCirc) {
if (resultSectCirc.hasOwnProperty(v))
// périmètre mouillé it(`${v} should equal to ${resultSectCirc[v]}`, () => {
it("P should equal to 2.738", () => { checkResult(sect.CalcSection(v), resultSectCirc[v]);
checkResult(sect.CalcSection("P"), 2.738); });
}); }
});
// surface mouillée
it("S should equal to 1.173", () => {
checkResult(sect.CalcSection("S"), 1.173);
});
// rayon hydraulique
it("R should equal to 0.428", () => {
checkResult(sect.CalcSection("R"), 0.428);
});
// vitesse moyenne
it("V should equal to 1.023", () => {
checkResult(sect.CalcSection("V"), 1.023);
});
// nombre de Froude
it("Fr should equal to 0.422", () => {
checkResult(sect.CalcSection("Fr"), 0.422);
});
// tirant d'eau critique
it("Yc should equal to 0.512", () => {
checkResult(sect.CalcSection("Yc"), 0.512);
});
// tirant d'eau normal
it("Yn should equal to 0.976", () => {
checkResult(sect.CalcSection("Yn"), 0.976);
});
// tirant d'eau correspondant
it("Ycor should equal to 0.361", () => {
checkResult(sect.CalcSection("Ycor"), 0.361);
});
// tirant d'eau conjugué
it("Ycon should equal to 0.307", () => {
checkResult(sect.CalcSection("Ycon"), 0.307);
});
// perte de charge
it("J should equal to 0.002", () => {
// sect = createSection(0.00001);
checkResult(sect.CalcSection("J"), 0.002);
});
// Variation linéaire de l'énergie spécifique
it("I-J should equal to -0.00102", () => {
sect = createSection(0.00001);
checkResult(sect.CalcSection("I-J"), -0.00102);
});
// impulsion hydraulique describe("fluvial / debordement :", () => {
it("Imp should equal to 5076.304", () => {
checkResult(sect.CalcSection("Imp"), 5076.304); beforeEach(() => {
}); sect = new cSnCirc(
new ParamsSectionCirc(
2, // diamètre
2, // tirant d'eau
40, // Ks=Strickler
1.2, // Q=Débit
0.001, // If=pente du fond
1, // YB= hauteur de berge
)
);
});
const resultSectCircDeb: {[name: string]: number} = {
Hs: 2.006, Hsc: 0.694, B: 2, P: Math.PI + 2, S: Math.PI / 2 + 2, R: 0.694, V: 0.336,
Fr: 0.08, Yc: 0.512, Yn: 0.976, Ycor: 0.232, Ycon: 0.24, J: 0.0001,
'I-J': 0.001, Imp: 6943.271, Tau0: 0.782
}
for(const v in resultSectCircDeb) {
if (resultSectCircDeb.hasOwnProperty(v))
it(`${v} should equal to ${resultSectCircDeb[v]}`, () => {
checkResult(sect.CalcSection(v), resultSectCircDeb[v]);
});
}
// force tractrice (contrainte de cisaillement)
it("Tau0 should equal to 8.505", () => {
checkResult(sect.CalcSection("Tau0"), 8.505);
});
}); });
}); });
describe("Section paramétrée circulaire : ", () => { describe("Section paramétrée circulaire fermée: ", () => {
beforeEach(() => { beforeEach(() =>{
sect = createSectionDebordement(precDist); SessionSettings.precision = precDist;
}); });
describe("fluvial / débordement :", () => { describe("fluvial / pas de débordement :", () => {
// charge spécifique beforeEach(() => {
it("Hs should equal to 2.006", () => { sect = new cSnCirc(
checkResult(sect.CalcSection("Hs"), 2.006); new ParamsSectionCirc(
}); 2, // diamètre
0.8, // tirant d'eau
// charge critique 40, // Ks=Strickler
it("Hsc should equal to 0.694", () => { 1.2, // Q=Débit
checkResult(sect.CalcSection("Hsc"), 0.694); 0.001, // If=pente du fond
}); 2, // YB= hauteur de berge
)
// largeur au miroir );
it("B should equal to 2", () => { });
checkResult(sect.CalcSection("B"), 2);
}); for(const v in resultSectCirc) {
if (resultSectCirc.hasOwnProperty(v))
// périmètre mouillé it(`${v} should equal to ${resultSectCirc[v]}`, () => {
it("P should equal to 5.142", () => { checkResult(sect.CalcSection(v), resultSectCirc[v]);
checkResult(sect.CalcSection("P"), 5.142); });
}); }
// surface mouillée
it("S should equal to 3.571", () => {
checkResult(sect.CalcSection("S"), 3.571);
});
// rayon hydraulique
it("R should equal to 0.694", () => {
checkResult(sect.CalcSection("R"), 0.694);
});
// vitesse moyenne
it("V should equal to 0.336", () => {
checkResult(sect.CalcSection("V"), 0.336);
});
// nombre de Froude
it("Fr should equal to 0.08", () => {
checkResult(sect.CalcSection("Fr"), 0.08);
});
// tirant d'eau critique
it("Yc should equal to 0.512", () => {
checkResult(sect.CalcSection("Yc"), 0.512);
});
// tirant d'eau normal
it("Yn should equal to 0.976", () => {
checkResult(sect.CalcSection("Yn"), 0.976);
});
// tirant d'eau correspondant
it("Ycor should equal to 0.232", () => {
checkResult(sect.CalcSection("Ycor"), 0.232);
});
// tirant d'eau conjugué
it("Ycon should equal to 0.24", () => {
checkResult(sect.CalcSection("Ycon"), 0.24);
});
// perte de charge
it("J should equal to 0.0001", () => {
sect = createSectionDebordement(0.00001);
checkResult(sect.CalcSection("J"), 0.0001);
});
// Variation linéaire de l'énergie spécifique
it("I-J should equal to 0.001", () => {
sect = createSectionDebordement(0.00001);
checkResult(sect.CalcSection("I-J"), 0.001);
});
// impulsion hydraulique
it("Imp should equal to 6943.271", () => {
checkResult(sect.CalcSection("Imp"), 6943.271);
});
// force tractrice (contrainte de cisaillement)
it("Tau0 should equal to 0.782", () => {
checkResult(sect.CalcSection("Tau0"), 0.782);
});
}); });
}); });
...@@ -101,7 +101,7 @@ export abstract class acNewton extends Debug { ...@@ -101,7 +101,7 @@ export abstract class acNewton extends Debug {
return rDER; return rDER;
} }
const rDer = rDER.vCalc; const rDer = Math.max(-1E10, Math.min(rDER.vCalc, 1E10)); // Bornage de la dérivée pour éviter Delta=0
if (rDer !== 0) { if (rDer !== 0) {
if (XOR(rFn < 0, this.rFnPrec < 0)) { if (XOR(rFn < 0, this.rFnPrec < 0)) {
this.iOscil++; this.iOscil++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment