Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs =================================================================== diff -u -r5941 -r5994 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 5941) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 5994) @@ -120,33 +120,12 @@ } [Test] - [TestCase(0)] - [TestCase(0.01)] - [TestCase(10)] - public void GivenPlLinesFullyDefinedAtOrBelowBottomSoil1DProfile_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsEmptyWaternet(double offsetFromBottomOfProfile) + public void GivenPlLinesWithoutPoints_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsEmptyWaternet() { // Setup SoilProfile1D soilProfile = FactoryForSoilProfiles.CreateSoilProfile1DWithTwoClustersOfInBetweenAquifers(out SurfaceLine2 surfaceLine); - double bottomLevel = soilProfile.BottomLevel; - double plLineZCoordinate = bottomLevel - offsetFromBottomOfProfile; - var plLines = new PlLines(); - PlLine plLine = plLines.Lines[PlLineType.Pl1]; - plLine.Points.Add(new PlLinePoint(leftCoordinate, plLineZCoordinate)); - plLine.Points.Add(new PlLinePoint(rightCoordinate, plLineZCoordinate)); - plLine = plLines.Lines[PlLineType.Pl2]; - plLine.Points.Add(new PlLinePoint(leftCoordinate, plLineZCoordinate)); - plLine.Points.Add(new PlLinePoint(rightCoordinate, plLineZCoordinate)); - - plLine = plLines.Lines[PlLineType.Pl3]; - plLine.Points.Add(new PlLinePoint(leftCoordinate, plLineZCoordinate)); - plLine.Points.Add(new PlLinePoint(rightCoordinate, plLineZCoordinate)); - - plLine = plLines.Lines[PlLineType.Pl4]; - plLine.Points.Add(new PlLinePoint(leftCoordinate, plLineZCoordinate)); - plLine.Points.Add(new PlLinePoint(rightCoordinate, plLineZCoordinate)); - // Call Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, surfaceLine, penetrationLength, IntrusionVerticalWaterPressureType.Standard); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs =================================================================== diff -u -r5941 -r5994 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 5941) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 5994) @@ -74,7 +74,7 @@ PlLine plLine = plLines.Lines[PlLineType.Pl1]; var headLine = CreateLine(plLine, headLine1Name); - if (plLine != null && !IsBelowSoilProfile(soilProfile1D, plLine)) + if (plLine != null && plLine.Points.Count != 0) { waternet.PhreaticLine = CreateLine(plLine, headLine1Name); WaternetLine waternetLine = CreateWaternetLineForPhreaticLine(soilProfile1D, surfaceLine, plLine, xLeft, xRight, pressureType); @@ -90,7 +90,7 @@ plLine = plLines.Lines[PlLineType.Pl2]; headLine = CreateLine(plLine, headLine2Name); - if (headLine != null && !IsBelowSoilProfile(soilProfile1DDikeToeAtPolder, plLine) && + if (headLine != null && plLine.Points.Count != 0 && pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent && penetrationLength > 0) { waternet.HeadLineList.Add(headLine); @@ -103,7 +103,7 @@ plLine = plLines.Lines[PlLineType.Pl3]; headLine = CreateLine(plLine, headLine3Name); - if (headLine != null && !IsBelowSoilProfile(soilProfile1DDikeToeAtPolder, plLine) && + if (headLine != null && plLine.Points.Count != 0 && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) { waternet.HeadLineList.Add(headLine); @@ -142,7 +142,7 @@ var waternet = new Waternet(); PlLine plLine = plLines.Lines[PlLineType.Pl1]; - if (plLine != null) + if (plLine != null && plLine.Points.Count != 0) { var headLine = CreateLine(plLine, headLine1Name); waternet.PhreaticLine = CreateLine(plLine, headLine1Name); @@ -153,7 +153,7 @@ } plLine = plLines.Lines[PlLineType.Pl2]; - if (plLine != null && pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent && penetrationLength > 0) + if (plLine != null && plLine.Points.Count != 0 && pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent && penetrationLength > 0) { var headLine = CreateLine(plLine, headLine2Name); waternet.HeadLineList.Add(headLine); @@ -164,7 +164,7 @@ } plLine = plLines.Lines[PlLineType.Pl3]; - if (plLine != null && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) + if (plLine != null && plLine.Points.Count != 0 && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) { var headLine = CreateLine(plLine, headLine3Name); waternet.HeadLineList.Add(headLine); @@ -193,17 +193,13 @@ private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile1D soilProfile1D, double xLeft, double xRight, PlLine plLine4, IntrusionVerticalWaterPressureType? pressureType) { - var headLine = CreateLine(plLine4, headLine4Name); - if (headLine == null || IsBelowSoilProfile(soilProfile1D, plLine4)) + if (plLine4 == null || plLine4.Points.Count == 0 || soilProfile1D.GetInBetweenAquiferClusters == null + || pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic) { return; } - - if (soilProfile1D.GetInBetweenAquiferClusters == null || pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic) - { - return; - } - + + var headLine = CreateLine(plLine4, headLine4Name); waternet.HeadLineList.Add(headLine); var number = 0; foreach ((SoilLayer1D, SoilLayer1D) inBetweenAquiferCluster in soilProfile1D.GetInBetweenAquiferClusters.Where(layer => layer is { Item1: not null, Item2: not null })) @@ -226,16 +222,11 @@ private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile2D soilProfile, SurfaceLine2 surfaceLine, PlLine plLine4, IntrusionVerticalWaterPressureType? pressureType) { - if (plLine4 == null) + if (plLine4 == null || plLine4.Points.Count == 0 || pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic) { return; } - if (pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic) - { - return; - } - SoilProfile2DHelper.DetermineInBetweenAquifersLayerBoundaryPoints(soilProfile, out List inBetweenAquiferUpperCoordinates, out List inBetweenAquiferLowerCoordinates); @@ -480,12 +471,6 @@ return waternetLine; } - - private static bool IsBelowSoilProfile(SoilProfile1D soilProfile, PlLine line) - { - double bottomSoilProfileLevel = soilProfile.BottomLevel; - return line.Points.Any(point => point.Z <= bottomSoilProfileLevel); - } /// /// Throws when the pl lines object is not assigned.