Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs =================================================================== diff -u -r4934 -r4958 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 4934) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 4958) @@ -39,7 +39,8 @@ BottomAquifer, TopLayerInBetweenAquiferCluster, BottomLayerInBetweenAquiferCluster, - HighestAquifer + HighestAquifer, + LowestLayer } private const double epsilon = 1e-9; @@ -153,7 +154,7 @@ var headLine = CreateLine(plLine, headLine2Name); waternet.HeadLineList.Add(headLine); - if (bottomAquiferCoordinates.Any()) + if (bottomAquiferCoordinates.Any() && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) { WaternetLine waternetLine = CreateWaternetLine(bottomAquiferCoordinates, penetrationLength); waternetLine.Name = waternetLine2Name; @@ -168,7 +169,7 @@ var headLine = CreateLine(plLine, headLine3Name); waternet.HeadLineList.Add(headLine); - if (bottomAquiferCoordinates.Any()) + if (bottomAquiferCoordinates.Any() && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic) { WaternetLine waternetLine = CreateWaternetLine(bottomAquiferCoordinates); waternetLine.HeadLine = headLine; @@ -177,7 +178,7 @@ } } - CreateWaternetLinesForInBetweenAquifers(waternet, soilProfile, plLines.Lines[PlLineType.Pl4]); + CreateWaternetLinesForInBetweenAquifers(waternet, soilProfile, plLines.Lines[PlLineType.Pl4], pressureType); AdjustWaternetLineOfPhreaticLineWhenCoincidingWithOtherWaternetLines(waternet); @@ -218,7 +219,8 @@ } } - private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile2D soilProfile, PlLine plLine) + private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile2D soilProfile, PlLine plLine, + IntrusionVerticalWaterPressureType? pressureType) { if (plLine == null) { @@ -228,6 +230,11 @@ var headLine = CreateLine(plLine, headLine4Name); waternet.HeadLineList.Add(headLine); + if (pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic) + { + return; + } + double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile); int inBetweenAquiferCount = DetermineInBetweenAquiferClusterCount(soilProfile, xCoordinates); if (inBetweenAquiferCount == 0) @@ -386,7 +393,7 @@ if (currentAquifer != null) { previousAquiferLayer = currentAquifer; - coordinates.Add(layerType is LayerType.BottomLayerInBetweenAquiferCluster? new Point2D(xCoordinate, currentAquifer.BottomLevel) : new Point2D(xCoordinate, currentAquifer.TopLevel)); + coordinates.Add(layerType is LayerType.BottomLayerInBetweenAquiferCluster or LayerType.LowestLayer? new Point2D(xCoordinate, currentAquifer.BottomLevel) : new Point2D(xCoordinate, currentAquifer.TopLevel)); } } @@ -418,6 +425,8 @@ return soilProfile1D.GetInBetweenAquiferClusters[indexInBetweenAquifer].Item2; case LayerType.HighestAquifer: return soilProfile1D.GetHighestAquifer(); + case LayerType.LowestLayer: + return soilProfile1D.Layers.Last(); } return null; @@ -428,6 +437,7 @@ /// - For DAM Standard type, this line lies on the bottom of the soil layers “in which the phreatic plane lies”. /// - For Linear type, it is the surface line. /// - For Hydrostatic type, it is the top of the highest aquifer. + /// - For Full hydrostatic, it is the bottom of the lowest layer. /// /// /// @@ -450,6 +460,12 @@ return CreateWaternetLine(topAquiferLevel, xLeft, xRight); } + if (pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic) + { + double topAquiferLevel = soilProfile1D.Layers.Last().BottomLevel; + return CreateWaternetLine(topAquiferLevel, xLeft, xRight); + } + double level = soilProfile1D.GetLayerAt(phreaticLine.GetMinZ()).BottomLevel; return CreateWaternetLine(level, xLeft, xRight); @@ -484,7 +500,11 @@ case IntrusionVerticalWaterPressureType.Standard: break; case IntrusionVerticalWaterPressureType.FullHydroStatic: - break; + { + double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile2D); + Point2D[] lowestBoundaryCoordinates = DetermineLayerBoundaryCoordinates(LayerType.LowestLayer, xCoordinates, soilProfile2D).ToArray(); + return CreateWaternetLine(lowestBoundaryCoordinates); + } case IntrusionVerticalWaterPressureType.SemiTimeDependent: break; case null: Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs =================================================================== diff -u -r4934 -r4958 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 4934) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 4958) @@ -83,6 +83,7 @@ [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) { PlLines plLines = CreatePlLinesForTest(); @@ -441,17 +442,18 @@ /// bottom aquifer layer /// --------------------------------------------------- Level -30 m /// - [TestCase(IntrusionVerticalWaterPressureType.Standard, -9.999)] - [TestCase(IntrusionVerticalWaterPressureType.Linear, 0)] - [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -9.999)] - public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerConsistOfOnePart_ReturnsExpectedWaternet(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1) + [TestCase(IntrusionVerticalWaterPressureType.Standard, -9.999, 4)] + [TestCase(IntrusionVerticalWaterPressureType.Linear, 0, 4)] + [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -9.999, 4)] + [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -30.000, 1)] + public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerConsistOfOnePart_ReturnsExpectedWaternet(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount) { // Setup SoilLayer2D soilLayer = CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, false); SoilLayer2D soilLayerAquiferInBetween = CreateRectangularSoilLayer2D(-10, -20, leftCoordinate, rightCoordinate, true); SoilLayer2D soilLayerInBetween = CreateRectangularSoilLayer2D(-20, -25, leftCoordinate, rightCoordinate, false); SoilLayer2D soilLayerAquiferBottom = CreateRectangularSoilLayer2D(-25, -30, leftCoordinate, rightCoordinate, true); - + var soilProfile = new SoilProfile2D { Geometry = new GeometryData @@ -465,7 +467,7 @@ soilProfile.Surfaces.Add(soilLayerAquiferInBetween); soilProfile.Surfaces.Add(soilLayerInBetween); soilProfile.Surfaces.Add(soilLayerAquiferBottom); - + PlLines plLines = CreateAllPlLines(); // Call @@ -479,7 +481,7 @@ AssertGeometry(plLines.Lines[PlLineType.Pl3].Points, waternet.HeadLineList[1].Points); AssertGeometry(plLines.Lines[PlLineType.Pl4].Points, waternet.HeadLineList[2].Points); - Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(4)); + Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(waternetLineCount)); WaternetLine pl1WaternetLine = waternet.WaternetLineList[0]; Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name)); @@ -498,25 +500,28 @@ bottomRightInBetweenLayer ]; - WaternetLine pl2WaternetLine = waternet.WaternetLineList[1]; - Assert.That(pl2WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[0])); - GeometryPoint[] offSetAquiferCoordinates = expectedBottomAquiferCoordinates.Select(aquiferCoordinate => new GeometryPoint(aquiferCoordinate.X, aquiferCoordinate.Z + penetrationLength)) - .ToArray(); - AssertGeometry(offSetAquiferCoordinates, pl2WaternetLine.Points); + if (waternetLineCount > 1) + { + WaternetLine pl2WaternetLine = waternet.WaternetLineList[1]; + Assert.That(pl2WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[0])); + GeometryPoint[] offSetAquiferCoordinates = expectedBottomAquiferCoordinates.Select(aquiferCoordinate => new GeometryPoint(aquiferCoordinate.X, aquiferCoordinate.Z + penetrationLength)) + .ToArray(); + AssertGeometry(offSetAquiferCoordinates, pl2WaternetLine.Points); - WaternetLine pl3WaternetLine = waternet.WaternetLineList[2]; - Assert.That(pl3WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[1])); - AssertGeometry(expectedBottomAquiferCoordinates, pl3WaternetLine.Points); + WaternetLine pl3WaternetLine = waternet.WaternetLineList[2]; + Assert.That(pl3WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[1])); + AssertGeometry(expectedBottomAquiferCoordinates, pl3WaternetLine.Points); - WaternetLine pl4WaternetLine = waternet.WaternetLineList[3]; - Assert.That(pl4WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[2])); - AssertGeometry([ - new Point2D(leftCoordinate, -10), - new Point2D(rightCoordinate, -10), - new Point2D(rightCoordinate, -20), - new Point2D(leftCoordinate, -20), - new Point2D(leftCoordinate, -10) - ], pl4WaternetLine.Points); + WaternetLine pl4WaternetLine = waternet.WaternetLineList[3]; + Assert.That(pl4WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[2])); + AssertGeometry([ + new Point2D(leftCoordinate, -10), + new Point2D(rightCoordinate, -10), + new Point2D(rightCoordinate, -20), + new Point2D(leftCoordinate, -20), + new Point2D(leftCoordinate, -10) + ], pl4WaternetLine.Points); + } } ///