Index: dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.BlighCalculatorTests/PipingCalculatorBlighTests.cs =================================================================== diff -u -r325 -r352 --- dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.BlighCalculatorTests/PipingCalculatorBlighTests.cs (.../PipingCalculatorBlighTests.cs) (revision 325) +++ dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.BlighCalculatorTests/PipingCalculatorBlighTests.cs (.../PipingCalculatorBlighTests.cs) (revision 352) @@ -15,33 +15,51 @@ HRiver = 1 }; bc.Calculate(); - Assert.AreEqual(-1, bc.Zp); Assert.AreEqual(0, bc.FoSp); - Assert.AreEqual(0, bc.Hcp); Assert.AreEqual(0, bc.Hc); } [Test] public void TestCalculation() { + // Hc = SeepageLength / CreepFactor = 40.5 / 18 = 2.25 + // CreepFactor is calculated with D70 + // reducedFall = HRiver - HExit - (Rc * DTotal) = 2.0 - 0.0 - (0.3 * 5.0) = 0.5 + // FoSp = Hc / reducedFall = 2.25 / 0.5 const double diff = 0.0001; var bc = new PipingCalculatorBligh { HRiver = 2.0, - ModelFactorPiping = 1.0, HExit = 0.0, Rc = 0.3, DTotal = 5.0, SeepageLength = 40.5, - //bc.D50 = 2.5e-3; // WTI Test succeeds with CreepFactorWTI todo: remove D50 and CreepFactorWTI? - D70 = 180.0 // Dam: set D70 instead of D50 + D70 = 180.0 }; bc.Calculate(); Assert.AreEqual(4.5, bc.FoSp, diff); Assert.AreEqual(2.25, bc.Hc, diff); + } - Assert.AreEqual(1.75, bc.Zp, diff); // not relevant for Dam todo: remove Zp? - Assert.AreEqual(3.75, bc.Hcp, diff); // not relevant for Dam todo: remove Hcp? + [Test] + public void TestCreepFactor() + { + var bc = new PipingCalculatorBligh(); + bc.D70 = 180.0; // d50 < 150 + var factor = bc.CreepFactor(); + Assert.AreEqual(18.0, factor); + + bc.D70 = 200; // 150 < d50 < 300 + factor = bc.CreepFactor(); + Assert.AreEqual(15.0, factor); + + bc.D70 = 400; // 300 > d50 + factor = bc.CreepFactor(); + Assert.AreEqual(12.0, factor); + + bc.D70 = null; // d70 not specified + factor = bc.CreepFactor(); + Assert.AreEqual(18.0, factor); } [Test] @@ -50,7 +68,6 @@ var bc = new PipingCalculatorBligh { HRiver = 2.0, - ModelFactorPiping = 1.0, HExit = 0.0, Rc = 0.3, DTotal = 5.0, @@ -60,19 +77,18 @@ var originalErrors = bc.Validate(); bc.HRiver = double.NaN; - bc.ModelFactorPiping = double.NaN; bc.HExit = double.NaN; bc.Rc = double.NaN; bc.DTotal = double.NaN; bc.SeepageLength = double.NaN; bc.D70 = double.NaN; var nanErrors = bc.Validate(); - Assert.AreEqual(originalErrors.Count + 7, nanErrors.Count); + Assert.AreEqual(originalErrors.Count + 6, nanErrors.Count); // D70 is allowed to be null bc.D70 = null; nanErrors = bc.Validate(); - Assert.AreEqual(originalErrors.Count + 6, nanErrors.Count); + Assert.AreEqual(originalErrors.Count + 5, nanErrors.Count); } [Test] @@ -82,7 +98,6 @@ var calculator = new PipingCalculatorBligh { HRiver = 2.0, - ModelFactorPiping = 1.0, HExit = 0.0, Rc = -1e-6, DTotal = 5.0, @@ -102,7 +117,6 @@ var calculator = new PipingCalculatorBligh { HRiver = 2.0, - ModelFactorPiping = 1.0, HExit = 0.0, Rc = -1e-6, DTotal = 5.0, @@ -122,7 +136,6 @@ var calculator = new PipingCalculatorBligh { HRiver = 2.0, - ModelFactorPiping = 1.0, HExit = 2.0, Rc = 0, DTotal = 5.0, Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.BlighCalculator/PipingCalculatorBligh.cs =================================================================== diff -u -r335 -r352 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.BlighCalculator/PipingCalculatorBligh.cs (.../PipingCalculatorBligh.cs) (revision 335) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.BlighCalculator/PipingCalculatorBligh.cs (.../PipingCalculatorBligh.cs) (revision 352) @@ -15,17 +15,10 @@ private double foSp; private double hc; - private double hcp; private double rc = RcDefault; - private double zp; private double reducedFall; /// - /// Model factor for piping as input - /// - public double ModelFactorPiping { get; set; } - - /// /// River level as input /// public double HRiver { get; set; } @@ -55,59 +48,19 @@ public double SeepageLength { get; set; } /// - /// The bottom level of the aquitard layer which is on a level above the exit point's - /// z-coordinate. A value of indicates that no such aquitard - /// layer exists. - /// - public double BottomLevelAquitardAboveExitPointZ { get; set; } - - /// - /// Median grainsize D50 as input - /// - public double D50 { get; set; } - - /// /// Median grainsize D70 as input /// public double? D70 { get; set; } /// - /// Limit state function as result - /// - public double Zp - { - get - { - return zp; - } - set { } - } - - /// /// Safety factor of piping as result /// public double FoSp { - get - { - return foSp; - } - set { } + get { return foSp; } } /// - /// Critical water lever for piping as result - /// - public double Hcp - { - get - { - return hcp; - } - set { } - } - - /// /// Critical head difference for piping as result. /// public double Hc @@ -116,7 +69,6 @@ { return hc; } - set { } } /// @@ -126,26 +78,22 @@ { hc = GetHc(); reducedFall = GetReducedFall(); - zp = (ModelFactorPiping*hc) - reducedFall; DetermineFactorOfSafety(); - hcp = (ModelFactorPiping*hc) + HExit + (Rc*DTotal); } private void DetermineFactorOfSafety() { - foSp = 0; + const double cDefaultMaxReturnValue = 90.0; + const double cDefaultMinReturnValue = 0.0; - if (!IsPipingPossible()) + foSp = cDefaultMinReturnValue; + if (Math.Abs(hc) > Epsilon) { - foSp = double.PositiveInfinity; - } - else - { - var reducedCriticalHeadDifference = ModelFactorPiping*hc; - if (Math.Abs(reducedCriticalHeadDifference) > Epsilon) + if (reducedFall <= 0) { - foSp = (reducedCriticalHeadDifference)/Math.Max(0, reducedFall); + foSp = cDefaultMaxReturnValue; } + foSp = hc / reducedFall; } } @@ -155,46 +103,13 @@ /// the proper value of Hc according to Bligh private double GetHc() { -// return SeepageLength/CreepFactorWTI(); return SeepageLength / CreepFactor(); } /// - /// Determine creep factor for Bligh according to WTI - /// - /// creep factor - private double CreepFactorWTI() - { - // d50 is in meters; the table for Bligh is in micro meters so convert locally - var ld50 = D50*1e6; - if (ld50 < 150.0) - { - // according to specs: d50 < 150 - return 18.0; - } - if (ld50 < 300.0) - { - // according to specs: 150 < d50 < 300 - return 15.0; - } - if (ld50 < 2000.0) - { - // according to specs: 300 < d50 < 2000 - return 12.0; - } - if (ld50 < 16000.0) - { - // according to specs: 2000 < d50 < 16000 - return 9.0; - } - // according to specs: d50 > 16000 - return 4.0; - } - - /// /// Determine creep factor for Bligh /// - private double CreepFactor() + internal double CreepFactor() { const double cBligh = 18.0; if (D70 != null) @@ -203,32 +118,33 @@ double d50 = D50DividedByD70 * D70.Value; if (d50 < 150.0) { - // according to specs: d50 < 150 + // d50 < 150 return 18.0; } else { if (d50 < 300.0) { - // according to specs: 150 < d50 < 300 + // 150 < d50 < 300 return 15.0; } else { - // according to specs: 300 < d50 < 2000 + // 300 > d50 return 12.0; } } } else { + // d70 not specified return cBligh; } } private double GetReducedFall() { - return HRiver - HExit - (Rc*DTotal); + return HRiver - HExit - (Rc * DTotal); } /// @@ -270,20 +186,12 @@ { LogParameterIsNaN(errors, "DTotal"); } - if (double.IsNaN(ModelFactorPiping)) - { - LogParameterIsNaN(errors, "ModelFactorPiping"); - } if (double.IsNaN(HExit)) { LogParameterIsNaN(errors, "HExit"); } - if (double.IsNaN(D50)) + if (D70 != null && double.IsNaN((double)D70)) { - LogParameterIsNaN(errors, "D50"); - } - if (D70 != null && double.IsNaN((double) D70)) - { LogParameterIsNaN(errors, "D70"); } @@ -295,14 +203,5 @@ var msg = string.Format(Resources.PipingCalculatorBligh_LogParameterIsNaN_NaNParameterError, paramName); list.Add(msg); } - private bool IsPipingPossible() - { - var isCoverageLayerThicknessZero = Math.Abs(DTotal) < Epsilon; - var isAquitardLayerInDikePresent = !double.IsNaN(BottomLevelAquitardAboveExitPointZ); - var isAquitardAbovePhreaticLevelAtExitPoint = BottomLevelAquitardAboveExitPointZ <= HExit; - - return !isCoverageLayerThicknessZero || - (isAquitardLayerInDikePresent && isAquitardAbovePhreaticLevelAtExitPoint); - } } } Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.BlighCalculator/Properties/AssemblyInfo.cs.svn =================================================================== diff -u -r267 -r352 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.BlighCalculator/Properties/AssemblyInfo.cs.svn (.../AssemblyInfo.cs.svn) (revision 267) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.BlighCalculator/Properties/AssemblyInfo.cs.svn (.../AssemblyInfo.cs.svn) (revision 352) @@ -1,8 +1,10 @@ using System.Reflection; using System.Runtime.InteropServices; +using System.Runtime.CompilerServices; // The following GUID is for the ID of the typelib if this project is exposed to COM [assembly: Guid("ca25d0bc-fac6-429b-9fcf-e57e357889b9")] [assembly: AssemblyVersion("17.1.0.SVNREV")] [assembly: AssemblyFileVersion("17.1.0.SVNREV")] +[assembly: InternalsVisibleTo("Deltares.DamPiping.BlighCalculatorTests")]