Index: dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.ExitPointDeterminatorTests/UpliftCalculatorTests.cs
===================================================================
diff -u
--- dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.ExitPointDeterminatorTests/UpliftCalculatorTests.cs (revision 0)
+++ dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.ExitPointDeterminatorTests/UpliftCalculatorTests.cs (revision 277)
@@ -0,0 +1,223 @@
+using System;
+using Deltares.DamPiping.ExitPointDeterminator;
+using NUnit.Framework;
+
+namespace Deltares.DamPiping.ExitPointDeterminatorTests
+{
+ [TestFixture]
+ public class UpliftCalculatorTests
+ {
+ ///
+ /// Determines whether the uplift calculator can handle the situation when effective stress = 0 (no blanket).
+ /// In this situation there should be no uplift
+ ///
+ [Test]
+ public void CanHandleEffectiveStressIsZero()
+ {
+ const double cTolerance = 0.0001;
+ var upliftCalculator = new UpliftCalculator
+ {
+ VolumetricWeightOfWater = 10, ModelFactorUplift = 1.0, EffectiveStress = 0, RExit = 0.8, HRiver = 3.0, HExit = 0.6,
+ PhiPolder = 0.5, PhiExit = 0.8
+ };
+ upliftCalculator.Calculate();
+ // Effectivestress = 0, so no blanket, so uplift factor = 0
+ Assert.AreEqual(0.0, upliftCalculator.FoSu, cTolerance);
+ }
+
+ ///
+ /// Determines whether the uplift calculator can handle the situation when effective stress is smaller than 0 (no blanket).
+ /// It is must throw an exception.
+ ///
+ [Test]
+ [ExpectedException(typeof(UpliftCalculatorException))]
+ public void CanHandleEffectiveStressLessThanZero()
+ {
+ var upliftCalculator = new UpliftCalculator
+ {
+ VolumetricWeightOfWater = 10, ModelFactorUplift = 1.0, EffectiveStress = -0.1, RExit = 0.8, HRiver = 3.0, HExit = 0.6,
+ PhiPolder = 0.5, PhiExit = 0.8
+ };
+ upliftCalculator.Calculate();
+ }
+
+ ///
+ /// Determines whether the uplift calculator can handle the situation when phi_exit is equal to h_exit].
+ /// In this situation there should be no uplift
+ ///
+ [Test]
+ [TestCase(0)]
+ [TestCase(1e-6)]
+ [TestCase(2)]
+ public void CanHandlePhiExitEqualHExit(double difference)
+ {
+ var upliftCalculator = new UpliftCalculator
+ {
+ VolumetricWeightOfWater = 10, ModelFactorUplift = 1.0, EffectiveStress = 45, RExit = 0.8, HRiver = 3.0, HExit = 0.6,
+ PhiPolder = 0.5, PhiExit = 0.6 - difference
+ };
+ upliftCalculator.Calculate();
+ Assert.AreEqual(upliftCalculator.FoSu, double.PositiveInfinity);
+ }
+
+ [Test]
+ [TestCase(0)]
+ [TestCase(1e-6)]
+ [TestCase(2)]
+ public void Validate_PhiExitLessOrEqualHExit(double difference)
+ {
+ var upliftCalculator = new UpliftCalculator
+ {
+ VolumetricWeightOfWater = 10, ModelFactorUplift = 1.0, EffectiveStress = 45, RExit = 0.8, HRiver = 3.0, HExit = 0.6,
+ PhiPolder = 0.5, PhiExit = 0.6 - difference
+ };
+ var results = upliftCalculator.Validate();
+ CollectionAssert.IsEmpty(results);
+ }
+
+ [Test]
+ [ExpectedException(typeof(PipingException))]
+ public void RExitIsZeroThrowsExcTest()
+ {
+ var upliftCalculator = new UpliftCalculator
+ {
+ PhiExit = 1,
+ RExit = 0
+ };
+ upliftCalculator.Calculate();
+ }
+
+ ///
+ /// Determines whether the uplift calculator can handle the situation when phi_exit is less than h_exit.
+ /// In this situation there should be no uplift indicated by a FoSu being > 1 (99.0).
+ ///
+ [Test]
+ public void CanHandlePhiExitLessThanHExit()
+ {
+ var upliftCalculator = new UpliftCalculator
+ {
+ VolumetricWeightOfWater = 10, ModelFactorUplift = 1.0, EffectiveStress = 45, RExit = 0.8, HRiver = 3.0, HExit = 0.6,
+ PhiPolder = 0.5, PhiExit = 0.5
+ };
+ upliftCalculator.Calculate();
+ Assert.True(upliftCalculator.FoSu > 1.0);
+ }
+
+// [Test]
+// public void TestCalculate()
+// {
+// var upliftCalculator = new UpliftCalculator
+// {
+// VolumetricWeightOfWater = 10, ModelFactorUplift = 1.0, EffectiveStress = 45, RExit = 0.8, HRiver = 3.0, HExit = 0.6,
+// PhiPolder = 0.5
+// };
+// upliftCalculator.PhiExit = PiezoHeadCalculator.CalculatePhiExit(upliftCalculator.PhiPolder,
+// upliftCalculator.RExit, upliftCalculator.HRiver);
+// upliftCalculator.Calculate();
+// // PhiExit = PhiPolder + RExit * (HRiver - PhiPolder) = 0.5 + 0.8 * (3.0 - 0.5) = 2.5
+// // DelptaPhiCu = EffectiveStress / VolumetricWeightOfWater = 45 / 10 = 4.5
+// Assert.AreEqual(4.5, upliftCalculator.DeltaPhiCu, 0.0001);
+// // Zu = ModelFactorUplift * DelptaPhiCu - (PhiExit - HExit) = 1.0 * 4.5 - (2.5 - 0.6) = 2.6
+// Assert.AreEqual(2.6, upliftCalculator.Zu, 0.0001);
+// // FosU = ModelFactorUplift * DelptaPhiCu / (PhiExit - HExit) = 1.0 * 4.5 / (2.5 - 0.6) = 2.6
+// Assert.AreEqual(2.368421, upliftCalculator.FoSu, 0.0001);
+// // Hcu = (DelptaPhiCu + HExit - PhiPolder) / RExit + PhiPolder = (4.5 + 0.6 - 0.5) / 0.8 + 0.5
+// Assert.AreEqual(6.25, upliftCalculator.Hcu, 0.0001);
+// }
+
+ [Test]
+ public void TestValidateNaNParameter()
+ {
+ var calculator = new UpliftCalculator
+ {
+ VolumetricWeightOfWater = 10,
+ ModelFactorUplift = 1.0,
+ EffectiveStress = 45,
+ RExit = 0.8,
+ HRiver = 3.0,
+ HExit = 0.6,
+ PhiPolder = 0.5
+ };
+
+ var originalErrors = calculator.Validate();
+
+ calculator.VolumetricWeightOfWater = double.NaN;
+ calculator.ModelFactorUplift = double.NaN;
+ calculator.EffectiveStress = double.NaN;
+ calculator.HRiver = double.NaN;
+ calculator.PhiExit = double.NaN;
+ calculator.RExit = double.NaN;
+ calculator.HExit = double.NaN;
+ calculator.PhiPolder = double.NaN;
+
+ var nanErrors = calculator.Validate();
+
+ // trivial check
+ Assert.AreEqual(originalErrors.Count + 8, nanErrors.Count);
+ }
+
+ [Test]
+ public void Calculate_EffectiveStressZero_FoSZero()
+ {
+ var calculator = new UpliftCalculator
+ {
+ EffectiveStress = 0,
+ VolumetricWeightOfWater = 10,
+ ModelFactorUplift = 0.3,
+ RExit = 0.8,
+ HRiver = 3.0,
+ PhiExit = 4,
+ HExit = 2,
+ PhiPolder = 0.5
+ };
+
+ calculator.Calculate();
+
+ Assert.AreEqual(calculator.DeltaPhiCu, 0.0, PipingConstants.Epsilon);
+ Assert.AreEqual(0.0, calculator.FoSu);
+ }
+
+ [Test]
+ public void Calculate_ModelFactorZero_FoSZero()
+ {
+ var calculator = new UpliftCalculator
+ {
+ ModelFactorUplift = 0,
+ VolumetricWeightOfWater = 10,
+ EffectiveStress = 45,
+ RExit = 0.8,
+ HRiver = 3.0,
+ PhiExit = 2,
+ HExit = 1,
+ PhiPolder = 0.5
+ };
+
+ calculator.Calculate();
+
+ Assert.AreEqual(0.0, calculator.FoSu);
+ }
+
+ [Test]
+ [TestCase(5, 5)]
+ [TestCase(2, 5)]
+ [TestCase(2, (2+1e-6))]
+ public void Calculate_HydraulicHeadDifferenceLessThanOrEqualToZero_FoSInfinity(double phiExit, double hExit)
+ {
+ var calculator = new UpliftCalculator
+ {
+ VolumetricWeightOfWater = 10,
+ ModelFactorUplift = 1.0,
+ EffectiveStress = 45,
+ RExit = 0.8,
+ HRiver = 3.0,
+ PhiExit = phiExit,
+ HExit = hExit,
+ PhiPolder = 0.5
+ };
+
+ calculator.Calculate();
+
+ Assert.AreEqual(Double.PositiveInfinity, calculator.FoSu);
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag 277 refers to a dead (removed) revision in file `dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.ExitPointDeterminator/Routines2D.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 277 refers to a dead (removed) revision in file `dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.ExitPointDeterminator/Point2D.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 277 refers to a dead (removed) revision in file `dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.ExitPointDeterminator/Vector3D.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 277 refers to a dead (removed) revision in file `dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.ExitPointDeterminator/Point3D.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.ExitPointDeterminatorTests/Deltares.DamPiping.ExitPointDeterminatorTests.csproj
===================================================================
diff -u -r275 -r277
--- dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.ExitPointDeterminatorTests/Deltares.DamPiping.ExitPointDeterminatorTests.csproj (.../Deltares.DamPiping.ExitPointDeterminatorTests.csproj) (revision 275)
+++ dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamPiping.ExitPointDeterminatorTests/Deltares.DamPiping.ExitPointDeterminatorTests.csproj (.../Deltares.DamPiping.ExitPointDeterminatorTests.csproj) (revision 277)
@@ -53,6 +53,7 @@
+
Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.ExitPointDeterminator/Deltares.DamPiping.ExitPointDeterminator.csproj
===================================================================
diff -u -r267 -r277
--- dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.ExitPointDeterminator/Deltares.DamPiping.ExitPointDeterminator.csproj (.../Deltares.DamPiping.ExitPointDeterminator.csproj) (revision 267)
+++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamPiping.ExitPointDeterminator/Deltares.DamPiping.ExitPointDeterminator.csproj (.../Deltares.DamPiping.ExitPointDeterminator.csproj) (revision 277)
@@ -56,13 +56,13 @@
-
-
-
+
+
+
-
+