Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs =================================================================== diff -u -r5093 -r5097 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 5093) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 5097) @@ -94,7 +94,7 @@ public void GivenPlLinesFullyDefinedAtOrBelowBottomSoil1DProfile_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsEmptyWaternet(double offsetFromBottomOfProfile) { // Setup - SoilProfile1D soilProfile = CreateSoilProfile1DForTest(out GeometryPointString surfaceLine); + SoilProfile1D soilProfile = CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out GeometryPointString surfaceLine); double bottomLevel = soilProfile.BottomLevel; double plLineZCoordinate = bottomLevel - offsetFromBottomOfProfile; @@ -127,154 +127,190 @@ }); } - [TestCase(IntrusionVerticalWaterPressureType.Standard, -2.110, 6, 0)] - [TestCase(IntrusionVerticalWaterPressureType.Standard, -6.110, 6, -29)] - [TestCase(IntrusionVerticalWaterPressureType.Linear, 1.212, 6, 0)] - [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -2.110, 6, 0)] - [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -30.000, 1, 0)] - [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -2.110, 7, 0)] - [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -2.110, 7, 0)] - public void Given1DSoilProfileWithTwoInBetweenAquifers_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsValidWaternet(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount, double pL1Level) + public class Given1DSoilProfileWithTwoClustersOfInBetweenAquifers { - PlLines plLines = CreateAllPlLines(pL1Level); + private static GeometryPointString surfaceLine; + private readonly SoilProfile1D soilProfile1D = CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out surfaceLine); - SoilProfile1D soilProfile1D = CreateSoilProfile1DForTest(out GeometryPointString surfaceLine); - Assert.Multiple(() => + [TestCase(IntrusionVerticalWaterPressureType.Standard, -2.110, 6)] + [TestCase(IntrusionVerticalWaterPressureType.Linear, 1.212, 6)] + [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -2.110, 6)] + [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -30.000, 1)] + [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -2.110, 7)] + public void WhenCreatingWaternetBasedOnPlLinesWithPhreaticLineInTopOfHighestAquitard_ThenReturnsValidWaternet(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount) { - Assert.That(soilProfile1D.GetInBetweenAquiferClusters, Has.Count.EqualTo(2).Within(precision3Decimals)); - Assert.That(soilProfile1D.GetInBetweenAquiferClusters[0].Item1.TopLevel, Is.EqualTo(-2.111).Within(precision3Decimals)); - Assert.That(soilProfile1D.GetInBetweenAquiferClusters[0].Item2.BottomLevel, Is.EqualTo(-3.373).Within(precision3Decimals)); - Assert.That(soilProfile1D.GetInBetweenAquiferClusters[1].Item1.TopLevel, Is.EqualTo(-4.151).Within(precision3Decimals)); - Assert.That(soilProfile1D.GetInBetweenAquiferClusters[1].Item2.BottomLevel, Is.EqualTo(-5.373).Within(precision3Decimals)); - Assert.That(soilProfile1D.BottomAquiferLayer.TopLevel, Is.EqualTo(-6.111).Within(precision3Decimals)); - }); - - const double penetrateLength = 2.1; - const double left = 0; - const double right = 100; - Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, left, right, pressureType); - - // Pl 1 is the phreatic line and gets waternet line to bottom level of the deepest layer where PL 1 lies - // Pl 2 gets waternet line to level of BottomAquiferLayer.TopLevel + penetrationLength - // Pl 3 gets waternet line to level of BottomAquiferLayer - // Pl 4 gets 4 waternet lines to level of InBetweenAquiferLayer.TopLevel and InBetweenAquiferLayer.BottomLevel for both in-between aquifers - Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(waternetLineCount)); - - Assert.Multiple(() => - { - // phreatic line (PL 1) - Assert.That(waternet.PhreaticLine.Points, Has.Count.EqualTo(2)); - Assert.That(waternet.PhreaticLine.Points[0].X, Is.EqualTo(leftCoordinate).Within(precision3Decimals)); - Assert.That(waternet.PhreaticLine.Points[0].Z, Is.EqualTo(pL1Level).Within(precision3Decimals)); - Assert.That(waternet.PhreaticLine.Points[1].X, Is.EqualTo(rightCoordinate).Within(precision3Decimals)); - Assert.That(waternet.PhreaticLine.Points[1].Z, Is.EqualTo(pL1Level).Within(precision3Decimals)); - - WaternetLine waternetLinePl1 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line phreatic line"); - // expected: waternet line connected to pl1 has level: - // - for DAM Standard and Semi time dependent types, -2.111 m + 1 mm (Pl1 is in layer 2 from 0 m to -2.111 m) - // - for Linear type, 1.212 (the surface level) - // - for Hydrostatic type, -2.111 m + 1 mm (Pl1 is in layer 2 from 0 m to -2.111 m) - // - for Full hydrostatic, -30 (the bottom of the geometry) - - Assert.That(waternetLinePl1.HeadLine.Points, Is.EqualTo(waternet.PhreaticLine.Points)); - Assert.That(waternetLinePl1.HeadLine.Name, Is.EqualTo(waternet.PhreaticLine.Name)); - Assert.That(waternetLinePl1.Points, Has.Count.EqualTo(2)); - Assert.That(waternetLinePl1.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternetLinePl1.Points[0].Z, Is.EqualTo(levelWaternetPl1).Within(precision3Decimals)); - Assert.That(waternetLinePl1.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternetLinePl1.Points[1].Z, Is.EqualTo(levelWaternetPl1).Within(precision3Decimals)); - }); - - // PL 2 - WaternetLine waternetLinePl2 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Penetration zone lower aquifer"); - if (pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent) - { + const double pL1Level = 0; + PlLines plLines = CreateAllPlLines(pL1Level); + Assert.Multiple(() => { - Assert.That(waternet.HeadLineList[0].Points, Has.Count.EqualTo(2)); - Assert.That(waternet.HeadLineList[0].Name, Is.EqualTo("Head line 2 (PL 2)")); - // check the points of first headline that represents pl 2 - Assert.That(waternet.HeadLineList[0].Points[0].X, Is.EqualTo(leftCoordinate).Within(precision3Decimals)); - Assert.That(waternet.HeadLineList[0].Points[0].Z, Is.EqualTo(-6).Within(precision3Decimals)); - Assert.That(waternet.HeadLineList[0].Points[1].X, Is.EqualTo(rightCoordinate).Within(precision3Decimals)); - Assert.That(waternet.HeadLineList[0].Points[1].Z, Is.EqualTo(-6).Within(precision3Decimals)); - // expected: waternet line connected to pl2 has level -6.111 + 2.1 = -4.011 - Assert.That(waternetLinePl2.HeadLine, Is.EqualTo(waternet.HeadLineList[0])); - Assert.That(waternetLinePl2.Points, Has.Count.EqualTo(2)); - Assert.That(waternetLinePl2.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternetLinePl2.Points[0].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); - Assert.That(waternetLinePl2.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternetLinePl2.Points[1].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); + Assert.That(soilProfile1D.GetInBetweenAquiferClusters, Has.Count.EqualTo(2).Within(precision3Decimals)); + Assert.That(soilProfile1D.GetInBetweenAquiferClusters[0].Item1.TopLevel, Is.EqualTo(-2.111).Within(precision3Decimals)); + Assert.That(soilProfile1D.GetInBetweenAquiferClusters[0].Item2.BottomLevel, Is.EqualTo(-3.373).Within(precision3Decimals)); + Assert.That(soilProfile1D.GetInBetweenAquiferClusters[1].Item1.TopLevel, Is.EqualTo(-4.151).Within(precision3Decimals)); + Assert.That(soilProfile1D.GetInBetweenAquiferClusters[1].Item2.BottomLevel, Is.EqualTo(-5.373).Within(precision3Decimals)); + Assert.That(soilProfile1D.BottomAquiferLayer.TopLevel, Is.EqualTo(-6.111).Within(precision3Decimals)); }); - } - else - { - Assert.That(waternetLinePl2, Is.Null); - } - // PL 3 and PL 4 - WaternetLine waternetLinePl3 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line lower aquifer"); - WaternetLine waternetLinePl4TopInBetweenAquiferTop = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line in-between aquifer top (1)"); - WaternetLine waternetLinePl4TopInBetweenAquiferBottom = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line in-between aquifer bottom (1)"); - WaternetLine waternetLinePl4BottomInBetweenAquiferTop = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line in-between aquifer top (2)"); - WaternetLine waternetLinePl4BottomInBetweenAquiferBottom = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line in-between aquifer bottom (2)"); + const double penetrateLength = 2.1; + const double left = 0; + const double right = 100; + Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, left, right, pressureType); - if (pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) - { + // Pl 1 is the phreatic line and gets waternet line to bottom level of the deepest layer where PL 1 lies + // Pl 2 gets waternet line to level of BottomAquiferLayer.TopLevel + penetrationLength + // Pl 3 gets waternet line to level of BottomAquiferLayer + // Pl 4 gets 4 waternet lines to level of InBetweenAquiferLayer.TopLevel and InBetweenAquiferLayer.BottomLevel for both in-between aquifers + Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(waternetLineCount)); + Assert.Multiple(() => { - // expected: waternet line connected to pl3 has level -6.111 - Assert.That(waternetLinePl3.HeadLine.Name, Is.EqualTo("Head line 3 (PL 3)")); - Assert.That(waternetLinePl3.Points, Has.Count.EqualTo(2)); + // phreatic line (PL 1) + Assert.That(waternet.PhreaticLine.Points, Has.Count.EqualTo(2)); + Assert.That(waternet.PhreaticLine.Points[0].X, Is.EqualTo(leftCoordinate).Within(precision3Decimals)); + Assert.That(waternet.PhreaticLine.Points[0].Z, Is.EqualTo(pL1Level).Within(precision3Decimals)); + Assert.That(waternet.PhreaticLine.Points[1].X, Is.EqualTo(rightCoordinate).Within(precision3Decimals)); + Assert.That(waternet.PhreaticLine.Points[1].Z, Is.EqualTo(pL1Level).Within(precision3Decimals)); + + WaternetLine waternetLinePl1 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line phreatic line"); + // expected: waternet line connected to pl1 has level: + // - for DAM Standard and Semi time dependent types, -2.111 m + 1 mm (Pl1 is in layer 2 from 0 m to -2.111 m) + // - for Linear type, 1.212 (the surface level) + // - for Hydrostatic type, -2.111 m + 1 mm (Pl1 is in layer 2 from 0 m to -2.111 m) + // - for Full hydrostatic, -30 (the bottom of the geometry) + + Assert.That(waternetLinePl1.HeadLine.Points, Is.EqualTo(waternet.PhreaticLine.Points)); + Assert.That(waternetLinePl1.HeadLine.Name, Is.EqualTo(waternet.PhreaticLine.Name)); + Assert.That(waternetLinePl1.Points, Has.Count.EqualTo(2)); + Assert.That(waternetLinePl1.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternetLinePl1.Points[0].Z, Is.EqualTo(levelWaternetPl1).Within(precision3Decimals)); + Assert.That(waternetLinePl1.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternetLinePl1.Points[1].Z, Is.EqualTo(levelWaternetPl1).Within(precision3Decimals)); }); - Assert.Multiple(() => + + // PL 2 + WaternetLine waternetLinePl2 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Penetration zone lower aquifer"); + if (pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent) { - Assert.That(waternetLinePl3.Points[0].Z, Is.EqualTo(-6.111).Within(precision3Decimals)); + Assert.Multiple(() => + { + Assert.That(waternet.HeadLineList[0].Points, Has.Count.EqualTo(2)); + Assert.That(waternet.HeadLineList[0].Name, Is.EqualTo("Head line 2 (PL 2)")); + // check the points of first headline that represents pl 2 + Assert.That(waternet.HeadLineList[0].Points[0].X, Is.EqualTo(leftCoordinate).Within(precision3Decimals)); + Assert.That(waternet.HeadLineList[0].Points[0].Z, Is.EqualTo(-6).Within(precision3Decimals)); + Assert.That(waternet.HeadLineList[0].Points[1].X, Is.EqualTo(rightCoordinate).Within(precision3Decimals)); + Assert.That(waternet.HeadLineList[0].Points[1].Z, Is.EqualTo(-6).Within(precision3Decimals)); + // expected: waternet line connected to pl2 has level -6.111 + 2.1 = -4.011 + Assert.That(waternetLinePl2.HeadLine, Is.EqualTo(waternet.HeadLineList[0])); + Assert.That(waternetLinePl2.Points, Has.Count.EqualTo(2)); + Assert.That(waternetLinePl2.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternetLinePl2.Points[0].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); + Assert.That(waternetLinePl2.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternetLinePl2.Points[1].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); + }); + } + else + { + Assert.That(waternetLinePl2, Is.Null); + } - // expected: highest waternet lines connected to pl4 have levels -2.111 and -3.373 - Assert.That(waternetLinePl4TopInBetweenAquiferTop.HeadLine.Name, Is.EqualTo("Head line 4 (PL 4)")); - Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points, Has.Count.EqualTo(2)); - Assert.That(waternetLinePl4TopInBetweenAquiferBottom.HeadLine.Name, Is.EqualTo("Head line 4 (PL 4)")); - Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points, Has.Count.EqualTo(2)); - }); - Assert.Multiple(() => + // PL 3 and PL 4 + WaternetLine waternetLinePl3 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line lower aquifer"); + WaternetLine waternetLinePl4TopInBetweenAquiferTop = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line in-between aquifer top (1)"); + WaternetLine waternetLinePl4TopInBetweenAquiferBottom = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line in-between aquifer bottom (1)"); + WaternetLine waternetLinePl4BottomInBetweenAquiferTop = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line in-between aquifer top (2)"); + WaternetLine waternetLinePl4BottomInBetweenAquiferBottom = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line in-between aquifer bottom (2)"); + + if (pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) { - Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points[0].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); - Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points[1].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); - Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points[0].Z, Is.EqualTo(-3.373).Within(precision3Decimals)); - Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points[1].Z, Is.EqualTo(-3.373).Within(precision3Decimals)); + Assert.Multiple(() => + { + // expected: waternet line connected to pl3 has level -6.111 + Assert.That(waternetLinePl3.HeadLine.Name, Is.EqualTo("Head line 3 (PL 3)")); + Assert.That(waternetLinePl3.Points, Has.Count.EqualTo(2)); + }); + Assert.Multiple(() => + { + Assert.That(waternetLinePl3.Points[0].Z, Is.EqualTo(-6.111).Within(precision3Decimals)); - // expected: lowest waternet lines 4 connected to pl4 have levels -4.151 and -5.373 - Assert.That(waternetLinePl4BottomInBetweenAquiferTop.HeadLine.Name, Is.EqualTo("Head line 4 (PL 4)")); - Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points, Has.Count.EqualTo(2)); - Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.HeadLine.Name, Is.EqualTo("Head line 4 (PL 4)")); - Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points, Has.Count.EqualTo(2)); - }); - Assert.Multiple(() => + // expected: highest waternet lines connected to pl4 have levels -2.111 and -3.373 + Assert.That(waternetLinePl4TopInBetweenAquiferTop.HeadLine.Name, Is.EqualTo("Head line 4 (PL 4)")); + Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points, Has.Count.EqualTo(2)); + Assert.That(waternetLinePl4TopInBetweenAquiferBottom.HeadLine.Name, Is.EqualTo("Head line 4 (PL 4)")); + Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points, Has.Count.EqualTo(2)); + }); + Assert.Multiple(() => + { + Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points[0].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); + Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternetLinePl4TopInBetweenAquiferTop.Points[1].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); + Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points[0].Z, Is.EqualTo(-3.373).Within(precision3Decimals)); + Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternetLinePl4TopInBetweenAquiferBottom.Points[1].Z, Is.EqualTo(-3.373).Within(precision3Decimals)); + + // expected: lowest waternet lines 4 connected to pl4 have levels -4.151 and -5.373 + Assert.That(waternetLinePl4BottomInBetweenAquiferTop.HeadLine.Name, Is.EqualTo("Head line 4 (PL 4)")); + Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points, Has.Count.EqualTo(2)); + Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.HeadLine.Name, Is.EqualTo("Head line 4 (PL 4)")); + Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points, Has.Count.EqualTo(2)); + }); + Assert.Multiple(() => + { + Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points[0].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); + Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points[1].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); + Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points[0].Z, Is.EqualTo(-5.373).Within(precision3Decimals)); + Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points[1].Z, Is.EqualTo(-5.373).Within(precision3Decimals)); + }); + } + else { - Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points[0].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); - Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternetLinePl4BottomInBetweenAquiferTop.Points[1].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); - Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points[0].Z, Is.EqualTo(-5.373).Within(precision3Decimals)); - Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternetLinePl4BottomInBetweenAquiferBottom.Points[1].Z, Is.EqualTo(-5.373).Within(precision3Decimals)); - }); + Assert.Multiple(() => + { + Assert.That(waternetLinePl3, Is.Null); + Assert.That(waternetLinePl4TopInBetweenAquiferTop, Is.Null); + Assert.That(waternetLinePl4TopInBetweenAquiferBottom, Is.Null); + Assert.That(waternetLinePl4BottomInBetweenAquiferTop, Is.Null); + Assert.That(waternetLinePl4BottomInBetweenAquiferBottom, Is.Null); + }); + } } - else + + [TestCase(IntrusionVerticalWaterPressureType.Standard, -6.110)] + [TestCase(IntrusionVerticalWaterPressureType.Linear, 1.212)] + [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -2.110)] + [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -30.000)] + [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -6.110)] + public void WhenCreatingWaternetBasedOnPlLinesWithPhreaticLineGoingThroughBottomAquifer_ThenExpectedWaternetLineForPl1Returned(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1) { + PlLines plLines = CreateAllPlLines(-29); + + const double penetrateLength = 2.1; + const double left = 0; + const double right = 100; + Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, left, right, pressureType); + + // Expected: waternet line connected to pl1 has level: + // - for DAM Standard and Semi time dependent types, -6.111 m + 1 mm (Pl1 is in bottom aquifer) + // - for Linear type, 1.212 (the surface level) + // - for Hydrostatic type, -2.111 m + 1 mm (Pl1 is in layer 2 from 0 m to -2.111 m) + // - for Full hydrostatic, -30 (the bottom of the geometry) Assert.Multiple(() => { - Assert.That(waternetLinePl3, Is.Null); - Assert.That(waternetLinePl4TopInBetweenAquiferTop, Is.Null); - Assert.That(waternetLinePl4TopInBetweenAquiferBottom, Is.Null); - Assert.That(waternetLinePl4BottomInBetweenAquiferTop, Is.Null); - Assert.That(waternetLinePl4BottomInBetweenAquiferBottom, Is.Null); + WaternetLine waternetLinePl1 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line phreatic line"); + Assert.That(waternetLinePl1.HeadLine.Points, Is.EqualTo(waternet.PhreaticLine.Points)); + Assert.That(waternetLinePl1.HeadLine.Name, Is.EqualTo(waternet.PhreaticLine.Name)); + Assert.That(waternetLinePl1.Points, Has.Count.EqualTo(2)); + Assert.That(waternetLinePl1.Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternetLinePl1.Points[0].Z, Is.EqualTo(levelWaternetPl1).Within(precision3Decimals)); + Assert.That(waternetLinePl1.Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternetLinePl1.Points[1].Z, Is.EqualTo(levelWaternetPl1).Within(precision3Decimals)); }); } } @@ -283,7 +319,7 @@ public void GivenNullPlLines_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsNoHeadLines() { PlLines plLines = CreateAllPlLines(); - SoilProfile1D soilProfile1D = CreateSoilProfile1DForTest(out GeometryPointString surfaceLine); + SoilProfile1D soilProfile1D = CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out GeometryPointString surfaceLine); Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, 0.5, 0, 0, IntrusionVerticalWaterPressureType.SemiTimeDependent); // head lines Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3)); @@ -315,7 +351,7 @@ public void Given1DSoilProfileWithoutAquifer_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsException() { PlLines plLines = CreateAllPlLines(); - SoilProfile1D soilProfile1D = CreateSoilProfile1DForTest(out GeometryPointString surfaceLine); + SoilProfile1D soilProfile1D = CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out GeometryPointString surfaceLine); const double penetrateLength = 2.1; Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, 0, 0, IntrusionVerticalWaterPressureType.SemiTimeDependent); Assert.Multiple(() => @@ -456,7 +492,7 @@ [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, 10.001)] [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -35.000)] [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -24.999)] - public void WhenPhreaticLineGoesThroughBottomAquifer_ThenExpectedPlLine1IsReturned(IntrusionVerticalWaterPressureType? pressureType, double expectedLevelWaternetPl1) + public void WhenCreatingWaternetBasedOnPlLinesWithPhreaticLineGoingThroughBottomAquifer_ThenExpectedWaternetLineForPl1Returned(IntrusionVerticalWaterPressureType? pressureType, double expectedLevelWaternetPl1) { PlLines plLines = CreateAllPlLines(-32); @@ -1446,7 +1482,7 @@ }); } - private static SoilProfile1D CreateSoilProfile1DForTest(out GeometryPointString surfaceLine) + private static SoilProfile1D CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out GeometryPointString surfaceLine) { const double topLevel = 1.212; surfaceLine = new GeometryPointString();