Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs =================================================================== diff -u -r4958 -r4959 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 4958) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 4959) @@ -88,7 +88,7 @@ if (headLine != null && !IsBelowSoilProfile(soilProfile1D, plLine)) { waternet.HeadLineList.Add(headLine); - if (soilProfile1D.BottomAquiferLayer != null) + if (soilProfile1D.BottomAquiferLayer != null && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) { double level = soilProfile1D.BottomAquiferLayer.TopLevel + penetrationLength; WaternetLine waternetLine = CreateWaternetLine(level, xLeft, xRight); @@ -103,7 +103,7 @@ if (headLine != null && !IsBelowSoilProfile(soilProfile1D, plLine)) { waternet.HeadLineList.Add(headLine); - if (soilProfile1D.BottomAquiferLayer != null) + if (soilProfile1D.BottomAquiferLayer != null && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) { double level = soilProfile1D.BottomAquiferLayer.TopLevel; WaternetLine waternetLine = CreateWaternetLine(level, xLeft, xRight); @@ -113,7 +113,7 @@ } } - CreateWaternetLinesForInBetweenAquifers(plLines, soilProfile1D, xLeft, xRight, waternet); + CreateWaternetLinesForInBetweenAquifers(waternet, soilProfile1D, xLeft, xRight, plLines.Lines[PlLineType.Pl4], pressureType); AdjustWaternetLineOfPhreaticLineWhenCoincidingWithOtherWaternetLines(waternet); return waternet; @@ -125,6 +125,7 @@ /// The to convert. /// The to convert the with. /// The penetration length. + /// The type of distribution of the vertical water pressures. /// A . /// Thrown when or /// is null. @@ -197,37 +198,40 @@ return xCoordinates; } - private static void CreateWaternetLinesForInBetweenAquifers(PlLines plLines, SoilProfile1D soilProfile1D, double xLeft, double xRight, Waternet waternet) + private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile1D soilProfile1D, double xLeft, double xRight, PlLine plLine4, IntrusionVerticalWaterPressureType? pressureType) { - PlLine plLine = plLines.Lines[PlLineType.Pl4]; - var headLine = CreateLine(plLine, headLine4Name); - if (headLine != null && !IsBelowSoilProfile(soilProfile1D, plLine)) + var headLine = CreateLine(plLine4, headLine4Name); + if (headLine == null || IsBelowSoilProfile(soilProfile1D, plLine4)) { - waternet.HeadLineList.Add(headLine); - if (soilProfile1D.GetInBetweenAquiferClusters != null) - { - foreach ((SoilLayer1D, SoilLayer1D) inBetweenAquiferCluster in soilProfile1D.GetInBetweenAquiferClusters.Where(layer => layer is { Item1: not null, Item2: not null })) - { - double levelTop = inBetweenAquiferCluster.Item1.TopLevel; - double levelBottom = inBetweenAquiferCluster.Item2.BottomLevel; - WaternetLine waternetLine = CreateWaternetLine(levelTop, levelBottom, xLeft, xRight); - waternetLine.Name = waternetLine4Name; - waternetLine.HeadLine = headLine; - waternet.WaternetLineList.Add(waternetLine); - } - } + return; } + + waternet.HeadLineList.Add(headLine); + if (soilProfile1D.GetInBetweenAquiferClusters == null || pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic) + { + return; + } + + foreach ((SoilLayer1D, SoilLayer1D) inBetweenAquiferCluster in soilProfile1D.GetInBetweenAquiferClusters.Where(layer => layer is { Item1: not null, Item2: not null })) + { + double levelTop = inBetweenAquiferCluster.Item1.TopLevel; + double levelBottom = inBetweenAquiferCluster.Item2.BottomLevel; + WaternetLine waternetLine = CreateWaternetLine(levelTop, levelBottom, xLeft, xRight); + waternetLine.Name = waternetLine4Name; + waternetLine.HeadLine = headLine; + waternet.WaternetLineList.Add(waternetLine); + } } - private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile2D soilProfile, PlLine plLine, + private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile2D soilProfile, PlLine plLine4, IntrusionVerticalWaterPressureType? pressureType) { - if (plLine == null) + if (plLine4 == null) { return; } - var headLine = CreateLine(plLine, headLine4Name); + var headLine = CreateLine(plLine4, headLine4Name); waternet.HeadLineList.Add(headLine); if (pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic) Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs =================================================================== diff -u -r4958 -r4959 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 4958) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 4959) @@ -80,11 +80,11 @@ Assert.That(waternet.WaternetLineList, Is.Empty); } - [TestCase(IntrusionVerticalWaterPressureType.Standard, -2.110)] - [TestCase(IntrusionVerticalWaterPressureType.Linear, 1.212)] - [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -2.110)] - [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -30.000)] - public void TestConvertPlLinesToWaternet_1DSoilProfile(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1) + [TestCase(IntrusionVerticalWaterPressureType.Standard, -2.110, 5)] + [TestCase(IntrusionVerticalWaterPressureType.Linear, 1.212, 5)] + [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -2.110, 5)] + [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -30.000, 1)] + public void TestConvertPlLinesToWaternet_1DSoilProfile(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount) { PlLines plLines = CreatePlLinesForTest(); @@ -137,19 +137,24 @@ Assert.That(waternet.HeadLineList[0].Points[1].Z, Is.EqualTo(-1).Within(precision3Decimals)); // expected: 1 waternet line from pl 1, 2, 3 and 2 waternet lines for 4 - Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(5)); + Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(waternetLineCount)); Assert.That(waternet.WaternetLineList[0].Name, Is.EqualTo("Waternet line phreatic line")); - Assert.That(waternet.WaternetLineList[1].Name, Is.EqualTo("Penetration zone lower aquifer")); - Assert.That(waternet.WaternetLineList[2].Name, Is.EqualTo("Waternet line lower aquifer")); - Assert.That(waternet.WaternetLineList[3].Name, Is.EqualTo("Waternet area in-between aquifer")); - Assert.That(waternet.WaternetLineList[4].Name, Is.EqualTo("Waternet area in-between aquifer")); + if (pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) + { + Assert.That(waternet.WaternetLineList[1].Name, Is.EqualTo("Penetration zone lower aquifer")); + Assert.That(waternet.WaternetLineList[2].Name, Is.EqualTo("Waternet line lower aquifer")); + Assert.That(waternet.WaternetLineList[3].Name, Is.EqualTo("Waternet area in-between aquifer")); + Assert.That(waternet.WaternetLineList[4].Name, Is.EqualTo("Waternet area in-between aquifer")); + } }); Assert.Multiple(() => { // expected waternet line 0 is connected to pl1 with level: // for DAM Standard type, -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(waternet.WaternetLineList[0].HeadLine.Points, Is.EqualTo(waternet.PhreaticLine.Points)); Assert.That(waternet.WaternetLineList[0].HeadLine.Name, Is.EqualTo(waternet.PhreaticLine.Name)); Assert.That(waternet.WaternetLineList[0].Points, Has.Count.EqualTo(2)); @@ -158,46 +163,49 @@ Assert.That(waternet.WaternetLineList[0].Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); Assert.That(waternet.WaternetLineList[0].Points[1].Z, Is.EqualTo(levelWaternetPl1).Within(precision3Decimals)); - // expected waternet line 1 is connected to pl2 with level -6.111 + 2.1 = -4.011 - Assert.That(waternet.WaternetLineList[1].HeadLine, Is.EqualTo(waternet.HeadLineList[0])); - Assert.That(waternet.WaternetLineList[1].Points, Has.Count.EqualTo(2)); - Assert.That(waternet.WaternetLineList[1].Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[1].Points[0].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[1].Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[1].Points[1].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); + if (pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) + { + // expected waternet line 1 is connected to pl2 with level -6.111 + 2.1 = -4.011 + Assert.That(waternet.WaternetLineList[1].HeadLine, Is.EqualTo(waternet.HeadLineList[0])); + Assert.That(waternet.WaternetLineList[1].Points, Has.Count.EqualTo(2)); + Assert.That(waternet.WaternetLineList[1].Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[1].Points[0].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[1].Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[1].Points[1].Z, Is.EqualTo(-4.011).Within(precision3Decimals)); - // expected waternet line 2 is connected to pl3 with level -6.111 - Assert.That(waternet.WaternetLineList[2].HeadLine, Is.EqualTo(waternet.HeadLineList[1])); - Assert.That(waternet.WaternetLineList[2].Points, Has.Count.EqualTo(2)); - Assert.That(waternet.WaternetLineList[2].Points[0].Z, Is.EqualTo(-6.111).Within(precision3Decimals)); + // expected waternet line 2 is connected to pl3 with level -6.111 + Assert.That(waternet.WaternetLineList[2].HeadLine, Is.EqualTo(waternet.HeadLineList[1])); + Assert.That(waternet.WaternetLineList[2].Points, Has.Count.EqualTo(2)); + Assert.That(waternet.WaternetLineList[2].Points[0].Z, Is.EqualTo(-6.111).Within(precision3Decimals)); - // expected waternet line 3 is connected to pl4 with level between -2.111 and -3.373 - Assert.That(waternet.WaternetLineList[3].HeadLine, Is.EqualTo(waternet.HeadLineList[2])); - Assert.That(waternet.WaternetLineList[3].Points, Has.Count.EqualTo(5)); - Assert.That(waternet.WaternetLineList[3].Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[0].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[1].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[2].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[2].Z, Is.EqualTo(-3.373).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[3].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[3].Z, Is.EqualTo(-3.373).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[4].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[3].Points[4].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); + // expected waternet line 3 is connected to pl4 with level between -2.111 and -3.373 + Assert.That(waternet.WaternetLineList[3].HeadLine, Is.EqualTo(waternet.HeadLineList[2])); + Assert.That(waternet.WaternetLineList[3].Points, Has.Count.EqualTo(5)); + Assert.That(waternet.WaternetLineList[3].Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[0].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[1].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[2].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[2].Z, Is.EqualTo(-3.373).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[3].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[3].Z, Is.EqualTo(-3.373).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[4].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[3].Points[4].Z, Is.EqualTo(-2.111).Within(precision3Decimals)); - // expected waternet line 4 is connected to pl4 with level between -4.151 and -5.373 - Assert.That(waternet.WaternetLineList[4].HeadLine, Is.EqualTo(waternet.HeadLineList[2])); - Assert.That(waternet.WaternetLineList[4].Points, Has.Count.EqualTo(5)); - Assert.That(waternet.WaternetLineList[4].Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[0].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[1].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[2].X, Is.EqualTo(100).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[2].Z, Is.EqualTo(-5.373).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[3].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[3].Z, Is.EqualTo(-5.373).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[4].X, Is.EqualTo(0).Within(precision3Decimals)); - Assert.That(waternet.WaternetLineList[4].Points[4].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); + // expected waternet line 4 is connected to pl4 with level between -4.151 and -5.373 + Assert.That(waternet.WaternetLineList[4].HeadLine, Is.EqualTo(waternet.HeadLineList[2])); + Assert.That(waternet.WaternetLineList[4].Points, Has.Count.EqualTo(5)); + Assert.That(waternet.WaternetLineList[4].Points[0].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[0].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[1].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[1].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[2].X, Is.EqualTo(100).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[2].Z, Is.EqualTo(-5.373).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[3].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[3].Z, Is.EqualTo(-5.373).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[4].X, Is.EqualTo(0).Within(precision3Decimals)); + Assert.That(waternet.WaternetLineList[4].Points[4].Z, Is.EqualTo(-4.151).Within(precision3Decimals)); + } }); }