Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj
===================================================================
diff -u -r1254 -r1255
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 1254)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 1255)
@@ -70,6 +70,7 @@
+
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Uplift/SoilVolumeMassCalculatorTest.cs
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Uplift/SoilVolumeMassCalculatorTest.cs (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Uplift/SoilVolumeMassCalculatorTest.cs (revision 1255)
@@ -0,0 +1,173 @@
+//-----------------------------------------------------------------------
+//
+// Copyright (c) 2009 Deltares. All rights reserved.
+//
+// B.S.T.I.M. The
+// tom.the@deltares.nl
+// 16-06-2009
+// Contains class to test calculation of SoilVolumeMass
+//-----------------------------------------------------------------------
+
+using Deltares.DamEngine.Calculators.Uplift;
+using Deltares.DamEngine.TestHelpers.Factories;
+using NUnit.Framework;
+
+namespace Deltares.Uplift.Tests
+{
+ [TestFixture]
+ public class SoilVolumeMassCalculatorTest
+ {
+ [Test]
+ public void CalculateForComplexProfileWithPhreaticLineInProfile1()
+ {
+ const double cTolerance = 0.001;
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateComplexProfile();
+ calculator.SurfaceLevel = 0.21;
+ calculator.PhreaticLevel = -0.98;
+ calculator.TopOfLayerToBeEvaluated = -5.0;
+ // See spreadsheet "DAM Volumic weight test"
+ Assert.AreEqual(76.358, calculator.CalculateTotalMass(), cTolerance);
+ }
+
+ [Test]
+ public void CalculateForComplexProfileWithPhreaticLineInProfile2()
+ {
+ const double cTolerance = 0.001;
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateComplexProfile();
+ calculator.SurfaceLevel = 10.0;
+ calculator.PhreaticLevel = -1.8;
+ calculator.TopOfLayerToBeEvaluated = -5.0;
+ // See spreadsheet "DAM Volumic weight test"
+ Assert.AreEqual(230.22, calculator.CalculateTotalMass(), cTolerance);
+ }
+
+ [Test]
+ public void CalculateForSimpleProfileWithPhreaticLineAboveProfile()
+ {
+ const double cTolerance = 0.0001;
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile();
+ calculator.SurfaceLevel = 5.0;
+ calculator.PhreaticLevel = 10.0;
+ calculator.TopOfLayerToBeEvaluated = -10;
+ calculator.VolumicWeightOfWater = 10.0;
+ // All wet soil
+ // wet 15 m x 16 kN/m3 = 240
+ // water above surface 5 m x 10.0 kN/m3 = 50
+ // Total: 240 + 50 = 290
+ Assert.AreEqual(290.0, calculator.CalculateTotalMass(), cTolerance);
+ }
+
+ [Test]
+ public void CalculateForSimpleProfileWithPhreaticLineBelowProfile()
+ {
+ const double cTolerance = 0.0001;
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile();
+ calculator.SurfaceLevel = 5.0;
+ calculator.PhreaticLevel = -20.0;
+ calculator.TopOfLayerToBeEvaluated = -10;
+ // All dry soil
+ // dry 15 m x 12 kN/m3 = 180
+ Assert.AreEqual(180.0, calculator.CalculateTotalMass(), cTolerance);
+ }
+
+ [Test]
+ public void CalculateForSimpleProfileWithPhreaticLineInProfile()
+ {
+ const double cTolerance = 0.0001;
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile();
+ calculator.SurfaceLevel = 5.0;
+ calculator.PhreaticLevel = -1.0;
+ calculator.TopOfLayerToBeEvaluated = -10;
+ // Phreatic level in profile
+ // dry 6 m x 12 kN/m3 = 72
+ // wet 9 m x 16 kN/m3 = 144
+ // Total: 72 + 144 = 216
+ Assert.AreEqual(216.0, calculator.CalculateTotalMass(), cTolerance);
+ }
+
+ ///
+ /// Same as above test, but now the oven dry unit weight has to be used
+ ///
+ [Test]
+ public void CalculateForSimpleProfileWithPhreaticLineInProfileAndDryOption()
+ {
+ const double cTolerance = 0.0001;
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile();
+ foreach (var layer in calculator.SoilProfile.Layers)
+ {
+ layer.Soil.DryUnitWeight = layer.Soil.AbovePhreaticLevel;
+ layer.Soil.AbovePhreaticLevel = layer.Soil.AbovePhreaticLevel + 1.0;
+ }
+ calculator.SurfaceLevel = 5.0;
+ calculator.PhreaticLevel = -1.0;
+ calculator.TopOfLayerToBeEvaluated = -10;
+ calculator.IsUseOvenDryUnitWeight = true;
+ // Phreatic level in profile
+ // dry 6 m x 12 kN/m3 = 72
+ // wet 9 m x 16 kN/m3 = 144
+ // Total: 72 + 144 = 216
+ Assert.AreEqual(216.0, calculator.CalculateTotalMass(), cTolerance);
+ }
+
+ [Test]
+ public void CalculateForTwoLayerProfileWithPhreaticLineOnBoundary()
+ {
+ const double cTolerance = 0.0001;
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateTwoLayerProfile();
+ calculator.SurfaceLevel = 10.0;
+ calculator.PhreaticLevel = 2.0;
+ calculator.TopOfLayerToBeEvaluated = -10;
+ calculator.VolumicWeightOfWater = 10.0;
+ // All wet soil
+ // dry 8 m x 10 kN/m3 = 80
+ // wet 12 m x 22 kN/m3 = 264
+ // Total: 80 + 264 = 344
+ Assert.AreEqual(344.0, calculator.CalculateTotalMass(), cTolerance);
+ }
+
+ [Test]
+ [ExpectedException(typeof(SoilVolumicMassCalculatorException))]
+ public void ThrowsExceptionWhenSoilProfileParameterIsMissing()
+ {
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.CalculateTotalMass();
+ }
+
+ [Test]
+ [ExpectedException(typeof(SoilVolumicMassCalculatorException))]
+ public void ThrowsExceptionWhenSurfaceLevelIsAboveProfile()
+ {
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile();
+ calculator.SurfaceLevel = 15.0;
+ calculator.CalculateTotalMass();
+ }
+
+ [Test]
+ [ExpectedException(typeof(SoilVolumicMassCalculatorException))]
+ public void ThrowsExceptionWhenSurfaceLevelIsBelowProfile()
+ {
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile();
+ calculator.SurfaceLevel = -100.0;
+ calculator.CalculateTotalMass();
+ }
+
+ [Test]
+ [ExpectedException(typeof(SoilVolumicMassCalculatorException))]
+ public void ThrowsExceptionWhenTopLevelToBeValuatedIsBelowProfile()
+ {
+ var calculator = new SoilVolumicMassCalculator();
+ calculator.SoilProfile = FactoryForSoilProfiles.CreateSimpleProfile();
+ calculator.TopOfLayerToBeEvaluated = -100.0;
+ calculator.CalculateTotalMass();
+ }
+ }
+}
\ No newline at end of file