using Deltares.DamUplift; using NUnit.Framework; namespace Deltares.DamUpliftTests { [TestFixture] public class UpliftCalculatorTest { [Test] public void TestCalculateExtraHeightForSimpleProfileWithPhreaticLineInProfile() { // test is copied from 'https://repos.deltares.nl/repos/dam/dam classic' revision 190 const double cTolerance = 0.0001; var calculator = new UpliftCalculator(); calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); calculator.SurfaceLevel = 5.0; calculator.PhreaticLevel = -1.0; calculator.TopOfLayerToBeEvaluated = -10; calculator.VolumicWeightOfWater = 10.0; // Phreatic level in profile // Mass of soil volume above // dry 6 m x 12 kN/m3 = 72 // wet 9 m x 16 kN/m3 = 144 // Total: 72 + 144 = 216 // UpliftFactor = 1.2 // Phreatic pressure // 20 m x 10 kN/m3 = 200 // Mass of Watervolume = 200 // mass of soil = uplift factor * Mass of watervolume = 1.2 * 200 = 240 // Extra mass soil = 240 - 216 = 24 // Extra Height = Extra mass soil / (unit weight soil for raising) = 24 / 12 = 2.0 calculator.UnitWeightSoilEmbankment = null; Assert.AreEqual(2.0, calculator.CalculateExtraHeight(10.0, 1.2), cTolerance); // Extra Height = Extra mass soil / (unit weight soil for raising) = 24 / 8 = 3.0 calculator.UnitWeightSoilEmbankment = 8.0; Assert.AreEqual(3.0, calculator.CalculateExtraHeight(10.0, 1.2), cTolerance); } [Test] public void TestCalculateHeadOfPlLineForSimpleProfileWithPhreaticLineInProfile() { // test is copied from 'https://repos.deltares.nl/repos/dam/dam classic' revision 190 const double cTolerance = 0.0001; var calculator = new UpliftCalculator(); calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); calculator.SurfaceLevel = 5.0; calculator.PhreaticLevel = -1.0; calculator.TopOfLayerToBeEvaluated = -10; calculator.VolumicWeightOfWater = 10.0; // Phreatic level in profile // Mass of soil volume above // dry 6 m x 12 kN/m3 = 72 // wet 9 m x 16 kN/m3 = 144 // Total: 72 + 144 = 216 // UpliftFactor = 1.0 // Mass of Watervolume = mass of soil / uplift factor = 216 / 1.0 = 216 // Head = mass of watervolume / volumic weight water - top of layer = 216 / 10 - (-10) = 21.6 - (-10.0) = 11.6 m Assert.AreEqual(11.6, calculator.CalculateHeadOfPLLine(1.0), cTolerance); double upliftFactor = calculator.CalculateUpliftFactor(11.6); Assert.AreEqual(1.0, upliftFactor, cTolerance); calculator.IsUseOvenDryUnitWeight = true; double head = calculator.CalculateHeadOfPLLine(1.0); double upliftFactorOvenDry = calculator.CalculateUpliftFactor(head); Assert.AreEqual(1.0, upliftFactorOvenDry, cTolerance); } [Test] public void TestCalculateUpliftFactorForSimpleProfileWithPhreaticLineInProfile() { // test is copied from 'https://repos.deltares.nl/repos/dam/dam classic' revision 190 const double cTolerance = 0.0001; var calculator = new UpliftCalculator(); calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); calculator.SurfaceLevel = 5.0; calculator.PhreaticLevel = -1.0; calculator.TopOfLayerToBeEvaluated = -10; calculator.VolumicWeightOfWater = 10.0; // Phreatic level in profile // Mass of soil volume above // dry 6 m x 12 kN/m3 = 72 // wet 9 m x 16 kN/m3 = 144 // Total: 72 + 144 = 216 // Phreatic pressure // 20 m x 10 kN/m3 = 200 // UpliftFactor = 216/200 = 1.08 Assert.AreEqual(1.08, calculator.CalculateUpliftFactor(10.0), cTolerance); } /// /// Same as above test, but now the oven dry unit weight has to be used /// [Test] public void TestCalculateUpliftFactorForSimpleProfileWithPhreaticLineInProfileAndDryOption() { // test is copied from 'https://repos.deltares.nl/repos/dam/dam classic' revision 190 const double cTolerance = 0.0001; var calculator = new UpliftCalculator(); calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); foreach (var layer in calculator.SoilProfile.Layers) { layer.DryUnitWeight = layer.AbovePhreaticLevel; layer.AbovePhreaticLevel = layer.AbovePhreaticLevel + 1.0; } calculator.SurfaceLevel = 5.0; calculator.PhreaticLevel = -1.0; calculator.TopOfLayerToBeEvaluated = -10; calculator.VolumicWeightOfWater = 10.0; calculator.IsUseOvenDryUnitWeight = true; // Phreatic level in profile // Mass of soil volume above // dry 6 m x 12 kN/m3 = 72 // wet 9 m x 16 kN/m3 = 144 // Total: 72 + 144 = 216 // Phreatic pressure // 20 m x 10 kN/m3 = 200 // UpliftFactor = 216/200 = 1.08 Assert.AreEqual(1.08, calculator.CalculateUpliftFactor(10.0), cTolerance); } [Test] [ExpectedException(typeof(UpliftCalculatorException))] public void TestThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateExtraHeight() { // test is copied from 'https://repos.deltares.nl/repos/dam/dam classic' revision 190 var calculator = new UpliftCalculator(); calculator.CalculateUpliftFactor(0.0); } [Test] [ExpectedException(typeof(UpliftCalculatorException))] public void TestThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateHeadOfPlLine() { // test is copied from 'https://repos.deltares.nl/repos/dam/dam classic' revision 190 var calculator = new UpliftCalculator(); calculator.CalculateHeadOfPLLine(0.0); } [Test] [ExpectedException(typeof(UpliftCalculatorException), ExpectedMessage = "Het ondergrondprofiel is niet gedefinieerd")] [SetUICulture("nl-NL")] public void TestLanguageNlThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateUpliftFactor() { var calculator = new UpliftCalculator(); calculator.CalculateUpliftFactor(0.0); } [Test] [ExpectedException(typeof(UpliftCalculatorException), ExpectedMessage = "The soilprofile is not defined")] [SetUICulture("en-US")] public void TestLanguageEnThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateUpliftFactor() { var calculator = new UpliftCalculator(); calculator.CalculateUpliftFactor(0.0); } [TestFixtureSetUp] public void FixtureSetup() { } [TestFixtureTearDown] public void FixtureTearDown() { } } }