Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs
===================================================================
diff -u -r4982 -r4986
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 4982)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 4986)
@@ -47,7 +47,7 @@
[TestCase(0)]
[TestCase(0.01)]
[TestCase(10)]
- public void CreateWaternetBasedOnPlLines_PlLinesFullyDefinedAtOrBelowBottomSoil1DProfile_ReturnsEmptyWaternet(double offsetFromBottomOfProfile)
+ public void GivenPlLinesFullyDefinedAtOrBelowBottomSoil1DProfile_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsEmptyWaternet(double offsetFromBottomOfProfile)
{
// Setup
SoilProfile1D soilProfile = CreateSoilProfile1DForTest(out GeometryPointString surfaceLine);
@@ -79,13 +79,13 @@
Assert.That(waternet.HeadLineList, Is.Empty);
Assert.That(waternet.WaternetLineList, Is.Empty);
}
-
+
[TestCase(IntrusionVerticalWaterPressureType.Standard, -2.110, 4)]
[TestCase(IntrusionVerticalWaterPressureType.Linear, 1.212, 4)]
[TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -2.110, 4)]
[TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -30.000, 1)]
[TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -2.110, 5)]
- public void TestConvertPlLinesToWaternet_1DSoilProfile(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount)
+ public void Given1DSoilProfileWithTwoInBetweenAquifers_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsValidWaternet(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount)
{
PlLines plLines = CreatePlLinesForTest();
@@ -219,7 +219,7 @@
}
[Test]
- public void TestConvertPlLinesToWaternetWhenNoHeadLinesExpected()
+ public void GivenNullPlLines_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsNoHeadLines()
{
PlLines plLines = CreatePlLinesForTest();
SoilProfile1D soilProfile1D = CreateSoilProfile1DForTest(out GeometryPointString surfaceLine);
@@ -250,7 +250,7 @@
}
[Test]
- public void TestConvertPlLinesToWaternetWhenNoWaternetLinesExpected()
+ public void Given1DSoilProfileWithoutAquifer_WhenCreatingWaternetBasedOnPlLinesAnd1DSoilProfile_ThenReturnsNoWaternetLinesForPl234()
{
PlLines plLines = CreatePlLinesForTest();
SoilProfile1D soilProfile1D = CreateSoilProfile1DForTest(out GeometryPointString surfaceLine);
@@ -291,6 +291,147 @@
});
}
+
+ /// X_a X_b
+ /// --------------------------------------------------- Level 20 m
+ /// Aquitard 1
+ /// --------------------------------------------------- Level 10 m
+ /// Aquifer 2a | Aquifer 2b | Aquifer 2c
+ /// --------------------------------------------------- Level 0 m
+ /// Aquitard 3
+ /// --------------------------------------------------- Level -10 m
+ /// Aquifer 4a | Aquifer 4b | Aquifer 4c
+ /// --------------------------------------------------- Level -20 m
+ /// Aquitard 5
+ /// --------------------------------------------------- Level -25 m
+ /// Aquifer 6a | Aquifer 6b | Aquifer 6c
+ /// --------------------------------------------------- Level -30 m
+ /// Aquifer 7a | Aquifer 7b | Aquifer 7c
+ /// --------------------------------------------------- Level -35 m
+ ///
+ [TestCase(IntrusionVerticalWaterPressureType.Standard, -9.999, 4)]
+ [TestCase(IntrusionVerticalWaterPressureType.Linear, 20.000, 4)]
+ [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, 10.001, 4)]
+ [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -35.000, 1)]
+ [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -9.999, 5, penetrationLength)]
+ [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -9.999, 4, 0)]
+ public void Given2DSoilProfileWithTwoInBetweenAquifers_WhenCreatingWaternetBasedOnPlLinesAnd2DSoilProfile_ThenReturnsValidWaternet(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount, double penetrationZone = double.NaN)
+ {
+ double xA = leftCoordinate + (rightCoordinate - leftCoordinate) / 3;
+ double xB = rightCoordinate - (rightCoordinate - leftCoordinate) / 3;
+ // Setup
+ SoilLayer2D aquitard1 = CreateRectangularSoilLayer2D(20, 10, leftCoordinate, rightCoordinate, false);
+ SoilLayer2D aquifer2A = CreateRectangularSoilLayer2D(10, 0, leftCoordinate, xA, true);
+ SoilLayer2D aquifer2B = CreateRectangularSoilLayer2D(10, 0, xA, xB, true);
+ SoilLayer2D aquifer2C = CreateRectangularSoilLayer2D(10, 0, xB, rightCoordinate, true);
+ SoilLayer2D aquitard3 = CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, false);
+ SoilLayer2D aquifer4A = CreateRectangularSoilLayer2D(-10, -20, leftCoordinate, xA, true);
+ SoilLayer2D aquifer4B = CreateRectangularSoilLayer2D(-10, -20, xA, xB, true);
+ SoilLayer2D aquifer4C = CreateRectangularSoilLayer2D(-10, -20, xB, rightCoordinate, true);
+ SoilLayer2D aquitard5 = CreateRectangularSoilLayer2D(-20, -25, leftCoordinate, rightCoordinate, false);
+ SoilLayer2D aquifer6A = CreateRectangularSoilLayer2D(-25, -30, leftCoordinate, xA, true);
+ SoilLayer2D aquifer6B = CreateRectangularSoilLayer2D(-25, -30, xA, xB, true);
+ SoilLayer2D aquifer6C = CreateRectangularSoilLayer2D(-25, -30, xB, rightCoordinate, true);
+ SoilLayer2D aquifer7A = CreateRectangularSoilLayer2D(-30, -35, leftCoordinate, xA, true);
+ SoilLayer2D aquifer7B = CreateRectangularSoilLayer2D(-30, -35, xA, xB, true);
+ SoilLayer2D aquifer7C = CreateRectangularSoilLayer2D(-30, -35, xB, rightCoordinate, true);
+
+ var soilProfile = new SoilProfile2D
+ {
+ Geometry = new GeometryData
+ {
+ Left = leftCoordinate,
+ Right = rightCoordinate,
+ Bottom = -35
+ }
+ };
+ soilProfile.Surfaces.Add(aquitard1);
+ soilProfile.Surfaces.Add(aquifer2A);
+ soilProfile.Surfaces.Add(aquifer2B);
+ soilProfile.Surfaces.Add(aquifer2C);
+ soilProfile.Surfaces.Add(aquitard3);
+ soilProfile.Surfaces.Add(aquifer4A);
+ soilProfile.Surfaces.Add(aquifer4B);
+ soilProfile.Surfaces.Add(aquifer4C);
+ soilProfile.Surfaces.Add(aquitard5);
+ soilProfile.Surfaces.Add(aquifer6A);
+ soilProfile.Surfaces.Add(aquifer6B);
+ soilProfile.Surfaces.Add(aquifer6C);
+ soilProfile.Surfaces.Add(aquifer7A);
+ soilProfile.Surfaces.Add(aquifer7B);
+ soilProfile.Surfaces.Add(aquifer7C);
+
+ PlLines plLines = CreateAllPlLines();
+
+ // Call
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationZone, pressureType);
+
+ // Assert
+ AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
+
+ Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
+ AssertGeometry(plLines.Lines[PlLineType.Pl2].Points, waternet.HeadLineList[0].Points);
+ 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(waternetLineCount));
+
+ WaternetLine pl1WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == waternet.PhreaticLine.Name);
+ Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
+ Point2D[] expectedWaternetLine1 =
+ [
+ new Point2D(leftCoordinate, levelWaternetPl1),
+ new Point2D(rightCoordinate, levelWaternetPl1)
+ ];
+ AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
+
+ Point2D[] expectedBottomAquiferCoordinates =
+ [
+ new Point2D(leftCoordinate, -25),
+ new Point2D(rightCoordinate, -25)
+ ];
+
+ WaternetLine pl2WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == "Head line 2 (PL 2)");
+ if (pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent && penetrationZone > 0)
+ {
+ 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);
+ }
+ else
+ {
+ Assert.That(pl2WaternetLine, Is.Null);
+ }
+
+ if (waternetLineCount > 1)
+ {
+ WaternetLine pl3WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == "Head line 3 (PL 3)");
+ Assert.That(pl3WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[1]));
+ AssertGeometry(expectedBottomAquiferCoordinates, pl3WaternetLine.Points);
+
+ WaternetLine pl4WaternetLine1 = waternet.WaternetLineList.Find(w => w.Name == "Waternet area in-between aquifer (1)");
+ Assert.That(pl4WaternetLine1.HeadLine, Is.SameAs(waternet.HeadLineList[2]));
+ AssertGeometry([
+ new Point2D(leftCoordinate, 10),
+ new Point2D(rightCoordinate, 10),
+ new Point2D(rightCoordinate, 0),
+ new Point2D(leftCoordinate, 0),
+ new Point2D(leftCoordinate, 10)
+ ], pl4WaternetLine1.Points);
+
+ WaternetLine pl4WaternetLine2 = waternet.WaternetLineList.Find(w => w.Name == "Waternet area in-between aquifer (2)");
+ Assert.That(pl4WaternetLine2.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)
+ ], pl4WaternetLine2.Points);
+ }
+ }
+
[Test]
public void TestConvertLevelToWaternetLine()
{
@@ -312,53 +453,22 @@
///
/// Different soil profiles 2D are tested, see the pictures in method GetSoilProfilesWithContinuousBottomAquiferLayer,
/// with a top clay layer and bottom aquifer layers always forming a continuous bottom layer.
- /// Expected is that:
- /// - PL3 is connected to the top of the bottom aquifer layer
- /// - PL2 is connected to the line parallel to the top of the bottom aquifer layer but shifted by 0.5 m (penetration length) upwards
- /// - PL4 is not used because no in-between aquifer is present
+ /// As there is only one aquifer, then the BottomAquifer is also the HighestAquifer.
///
///
///
[Test]
[TestCaseSource(nameof(GetSoilProfilesWithContinuousBottomAquiferLayer))]
- public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousAquiferLayers_ReturnsExpectedWaternet(
+ public void Given2DSoilProfileWithContinuousBottomAquifer_WhenDeterminingLayerBoundaryPointsOfBottomAquifer_ThenExpectedCoordinatesReturned(
SoilProfile2D soilProfile, IEnumerable expectedBottomAquiferCoordinates)
{
- // Setup
- PlLines plLines = CreateAllPlLines(5);
-
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
+ IEnumerable bottomAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.BottomAquifer, soilProfile);
+ IEnumerable highestAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.HighestAquifer, soilProfile);
// Assert
- AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
-
- Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
- AssertGeometry(plLines.Lines[PlLineType.Pl2].Points, waternet.HeadLineList[0].Points);
- 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(3));
-
- WaternetLine pl1WaternetLine = waternet.WaternetLineList[0];
- Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
- // As PL1 is above surface line, the waternet line associated to PL1 is the surface line
- var expectedWaternetLine1 = new List
- {
- new(leftCoordinate, 0),
- new(rightCoordinate, 0)
- };
- AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
-
- 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);
+ AssertGeometry(bottomAquifer, expectedBottomAquiferCoordinates);
+ AssertGeometry(highestAquifer, expectedBottomAquiferCoordinates);
}
///
@@ -373,7 +483,7 @@
/// --------------------------------------------------------------- Level -30 m
///
[Test]
- public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerConsistOfTwoParts_ReturnsExpectedWaternet()
+ public void Given2DSoilProfileWithContinuousInBetweenAquiferLayerConsistingOfTwoParts_WhenDeterminingLayerBoundaryPointsOfInBetweenAquifer_ThenExpectedCoordinatesReturned()
{
// Setup
SoilLayer2D soilLayer = CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, false);
@@ -397,55 +507,31 @@
soilProfile.Surfaces.Add(soilLayerInBetween);
soilProfile.Surfaces.Add(soilLayerAquiferBottom);
- PlLines plLines = CreateAllPlLines();
-
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
-
+ bool isInBetweenLayerPresent = PlLinesToWaternetConverter.AreInBetweenAquiferClustersPresent(soilProfile, out int count);
+ IEnumerable topLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.TopLayerInBetweenAquiferCluster, soilProfile, 0);
+ IEnumerable bottomLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.BottomLayerInBetweenAquiferCluster, soilProfile, 0);
+
// Assert
- AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
-
- Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
- AssertGeometry(plLines.Lines[PlLineType.Pl2].Points, waternet.HeadLineList[0].Points);
- 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));
-
- WaternetLine pl1WaternetLine = waternet.WaternetLineList[0];
- Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
- Point2D[] expectedWaternetLine1 =
+ Assert.Multiple(() =>
+ {
+ Assert.That(isInBetweenLayerPresent, Is.True);
+ Assert.That(count, Is.EqualTo(1));
+ });
+ GeometryPoint[] expectedTop =
[
- new Point2D(leftCoordinate, -9.999),
- new Point2D(rightCoordinate, -9.999)
+ new(leftCoordinate, -10),
+ new(middleXCoordinate, -10),
+ new(rightCoordinate, -10)
];
- AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
-
- Point2D[] expectedBottomAquiferCoordinates =
+ GeometryPoint[] expectedBottom =
[
- new Point2D(leftCoordinate, -25),
- new Point2D(rightCoordinate, -25)
+ new(leftCoordinate, -20),
+ new(middleXCoordinate, -20),
+ new(rightCoordinate, -20)
];
-
- 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 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);
+ AssertGeometry(topLevelInBetweenAquifer, expectedTop);
+ AssertGeometry(bottomLevelInBetweenAquifer, expectedBottom);
}
///
@@ -459,13 +545,8 @@
/// bottom aquifer layer
/// --------------------------------------------------- Level -30 m
///
- [TestCase(IntrusionVerticalWaterPressureType.Standard, -9.999, 3)]
- [TestCase(IntrusionVerticalWaterPressureType.Linear, 0, 3)]
- [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -9.999, 3)]
- [TestCase(IntrusionVerticalWaterPressureType.FullHydroStatic, -30.000, 1)]
- [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -9.999, 4, penetrationLength)]
- [TestCase(IntrusionVerticalWaterPressureType.SemiTimeDependent, -9.999, 3, 0)]
- public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerConsistOfOnePart_ReturnsExpectedWaternet(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount, double penetrationZone = double.NaN)
+ [Test]
+ public void Given2DSoilProfileWithContinuousInBetweenAquiferLayerConsistingOfOnePart_WhenDeterminingLayerBoundaryPointsOfInBetweenAquifer_ThenExpectedCoordinatesReturned()
{
// Setup
SoilLayer2D soilLayer = CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, false);
@@ -487,67 +568,29 @@
soilProfile.Surfaces.Add(soilLayerInBetween);
soilProfile.Surfaces.Add(soilLayerAquiferBottom);
- PlLines plLines = CreateAllPlLines();
-
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationZone, pressureType);
-
+ bool isInBetweenLayerPresent = PlLinesToWaternetConverter.AreInBetweenAquiferClustersPresent(soilProfile, out int count);
+ IEnumerable topLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.TopLayerInBetweenAquiferCluster, soilProfile, 0);
+ IEnumerable bottomLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.BottomLayerInBetweenAquiferCluster, soilProfile, 0);
+
// Assert
- AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
-
- Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
- AssertGeometry(plLines.Lines[PlLineType.Pl2].Points, waternet.HeadLineList[0].Points);
- 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(waternetLineCount));
-
- WaternetLine pl1WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == waternet.PhreaticLine.Name);
- Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
- Point2D[] expectedWaternetLine1 =
+ Assert.Multiple(() =>
+ {
+ Assert.That(isInBetweenLayerPresent, Is.True);
+ Assert.That(count, Is.EqualTo(1));
+ });
+ GeometryPoint[] expectedTop =
[
- new Point2D(leftCoordinate, levelWaternetPl1),
- new Point2D(rightCoordinate, levelWaternetPl1)
+ new(leftCoordinate, -10),
+ new(rightCoordinate, -10)
];
- AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
-
- var bottomRightInBetweenLayer = new Point2D(rightCoordinate, -25);
- var bottomLeftInBetweenLayer = new Point2D(leftCoordinate, -25);
- Point2D[] expectedBottomAquiferCoordinates =
+ GeometryPoint[] expectedBottom =
[
- bottomLeftInBetweenLayer,
- bottomRightInBetweenLayer
+ new(leftCoordinate, -20),
+ new(rightCoordinate, -20)
];
-
- WaternetLine pl2WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == "Head line 2 (PL 2)");
- if (pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent && penetrationZone > 0)
- {
- 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);
- }
- else
- {
- Assert.That(pl2WaternetLine, Is.Null);
- }
-
- if (waternetLineCount > 1)
- {
- WaternetLine pl3WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == "Head line 3 (PL 3)");
- Assert.That(pl3WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[1]));
- AssertGeometry(expectedBottomAquiferCoordinates, pl3WaternetLine.Points);
-
- WaternetLine pl4WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == "Head line 4 (PL 4)");
- 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);
- }
+ AssertGeometry(topLevelInBetweenAquifer, expectedTop);
+ AssertGeometry(bottomLevelInBetweenAquifer, expectedBottom);
}
///
@@ -567,7 +610,7 @@
/// ------------------------------------------------------------- Level -30 m
///
[Test]
- public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerRightLayerTopLevelInRangeLeftLayer_ReturnsExpectedWaternet()
+ public void Given2DSoilProfileWithContinuousInBetweenAquiferConsistingOfTwoLayersWithRightLayerTopLevelInRangeLeftLayer_WhenDeterminingLayerBoundaryPointsOfInBetweenAquifer_ThenExpectedCoordinatesReturned()
{
// Setup
SoilLayer2D soilLayer = CreateRectangularSoilLayer2D(0, -10, leftCoordinate, rightCoordinate, false);
@@ -617,59 +660,33 @@
soilProfile.Surfaces.Add(soilLayerInBetween);
soilProfile.Surfaces.Add(soilLayerAquiferBottom);
- PlLines plLines = CreateAllPlLines();
-
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
-
+ bool isInBetweenLayerPresent = PlLinesToWaternetConverter.AreInBetweenAquiferClustersPresent(soilProfile, out int count);
+ IEnumerable topLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.TopLayerInBetweenAquiferCluster, soilProfile, 0);
+ IEnumerable bottomLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.BottomLayerInBetweenAquiferCluster, soilProfile, 0);
+
// Assert
- AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
-
- Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
- AssertGeometry(plLines.Lines[PlLineType.Pl2].Points, waternet.HeadLineList[0].Points);
- 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));
-
- WaternetLine pl1WaternetLine = waternet.WaternetLineList[0];
- Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
- Point2D[] expectedWaternetLine1 =
+ Assert.Multiple(() =>
+ {
+ Assert.That(isInBetweenLayerPresent, Is.True);
+ Assert.That(count, Is.EqualTo(1));
+ });
+ GeometryPoint[] expectedTop =
[
- new Point2D(leftCoordinate, -9.999),
- new Point2D(rightCoordinate, -9.999)
+ new(leftCoordinate, -10),
+ new(middleXCoordinate, -10),
+ new(middleXCoordinate, -15),
+ new(rightCoordinate, -15)
];
- AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
-
- Point2D[] expectedBottomAquiferCoordinates =
- {
- bottomLeftInBetweenLayer,
- 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);
-
- 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 GeometryPoint(leftCoordinate, -10),
- new GeometryPoint(middleXCoordinate, -10),
- new GeometryPoint(middleXCoordinate, -15),
- new GeometryPoint(rightCoordinate, -15),
- new GeometryPoint(rightCoordinate, -21),
- new GeometryPoint(middleXCoordinate, -21),
- new GeometryPoint(middleXCoordinate, -20),
- new GeometryPoint(leftCoordinate, -20),
- new GeometryPoint(leftCoordinate, -10)
- ], pl4WaternetLine.Points);
+ GeometryPoint[] expectedBottom =
+ [
+ new(leftCoordinate, -20),
+ new(middleXCoordinate, -20),
+ new(middleXCoordinate, -21),
+ new(rightCoordinate, -21)
+ ];
+ AssertGeometry(topLevelInBetweenAquifer, expectedTop);
+ AssertGeometry(bottomLevelInBetweenAquifer, expectedBottom);
}
///
@@ -687,7 +704,7 @@
/// -------------------------------------------------------------- Level -30 m
///
[Test]
- public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerRightLayerBottomLevelInRangeLeftLayer_ReturnsExpectedWaternet()
+ public void Given2DSoilProfileWithContinuousInBetweenAquiferConsistingOfTwoLayersWithRightLayerBottomLevelInRangeLeftLayer_WhenDeterminingLayerBoundaryPointsOfInBetweenAquifer_ThenExpectedCoordinatesReturned()
{
// Setup
var topLeftUpperLayer = new Point2D(leftCoordinate, 0);
@@ -735,61 +752,32 @@
soilProfile.Surfaces.Add(soilLayerInBetween);
soilProfile.Surfaces.Add(soilLayerAquiferBottom);
- PlLines plLines = CreateAllPlLines();
-
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
-
+ bool isInBetweenLayerPresent = PlLinesToWaternetConverter.AreInBetweenAquiferClustersPresent(soilProfile, out int count);
+ IEnumerable topLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.TopLayerInBetweenAquiferCluster, soilProfile, 0);
+ IEnumerable bottomLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.BottomLayerInBetweenAquiferCluster, soilProfile, 0);
+
// Assert
- AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
-
- Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
- 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));
-
- WaternetLine pl1WaternetLine = waternet.WaternetLineList[0];
- Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
- Point2D[] expectedWaternetLine1 =
+ Assert.Multiple(() =>
+ {
+ Assert.That(isInBetweenLayerPresent, Is.True);
+ Assert.That(count, Is.EqualTo(1));
+ });
+ GeometryPoint[] expectedTop =
[
- new Point2D(leftCoordinate, -9.999),
- new Point2D(middleXCoordinate, -9.999),
- new Point2D(middleXCoordinate, -19.999),
- new Point2D(rightCoordinate, -19.999)
+ new(leftCoordinate, -10),
+ new(middleXCoordinate, -10),
+ new(middleXCoordinate, -5),
+ new(rightCoordinate, -5)
];
- AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
-
- var bottomRightInBetweenLayer = new Point2D(rightCoordinate, -25);
- var bottomLeftInBetweenLayer = new Point2D(leftCoordinate, -25);
- Point2D[] expectedBottomAquiferCoordinates =
+ GeometryPoint[] expectedBottom =
[
- bottomLeftInBetweenLayer,
- bottomRightInBetweenLayer
+ new(leftCoordinate, -20),
+ new(middleXCoordinate, -20),
+ new(rightCoordinate, -20)
];
-
- 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 pl4WaternetLine = waternet.WaternetLineList[3];
- Assert.That(pl4WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[2]));
- AssertGeometry(new[]
- {
- bottomLeftUpperLayer,
- bottomIntermediateLowerUpperLayer,
- bottomIntermediateUpperUpperLayer,
- bottomRightUpperLayer,
- new Point2D(rightCoordinate, -20),
- new Point2D(leftCoordinate, -20),
- bottomLeftUpperLayer
- }, pl4WaternetLine.Points);
+ AssertGeometry(topLevelInBetweenAquifer, expectedTop);
+ AssertGeometry(bottomLevelInBetweenAquifer, expectedBottom);
}
///
@@ -810,7 +798,7 @@
/// ------------------------------------------------------------- Level -30 m
///
[Test]
- public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerRightLayerEnvelopedByLeftLayer_ReturnsExpectedWaternet()
+ public void Given2DSoilProfileWithContinuousInBetweenAquiferConsistingOfTwoLayersWithRightLayerEnvelopedByLeftLayer_WhenDeterminingLayerBoundaryPointsOfInBetweenAquifer_ThenExpectedCoordinatesReturned()
{
// Setup
var topLeftUpperLayer = new Point2D(leftCoordinate, 0);
@@ -881,62 +869,33 @@
soilProfile.Surfaces.Add(soilLayerInBetween);
soilProfile.Surfaces.Add(soilLayerAquiferBottom);
- PlLines plLines = CreateAllPlLines();
-
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
-
+ bool isInBetweenLayerPresent = PlLinesToWaternetConverter.AreInBetweenAquiferClustersPresent(soilProfile, out int count);
+ IEnumerable topLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.TopLayerInBetweenAquiferCluster, soilProfile, 0);
+ IEnumerable bottomLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.BottomLayerInBetweenAquiferCluster, soilProfile, 0);
+
// Assert
- AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
-
- Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
- AssertGeometry(plLines.Lines[PlLineType.Pl2].Points, waternet.HeadLineList[0].Points);
- 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));
-
- WaternetLine pl1WaternetLine = waternet.WaternetLineList[0];
- Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
- Point2D[] expectedWaternetLine1 =
+ Assert.Multiple(() =>
+ {
+ Assert.That(isInBetweenLayerPresent, Is.True);
+ Assert.That(count, Is.EqualTo(1));
+ });
+ GeometryPoint[] expectedTop =
[
- new Point2D(leftCoordinate, -9.999),
- new Point2D(middleXCoordinate, -9.999),
- new Point2D(middleXCoordinate, -14.999),
- new Point2D(rightCoordinate, -14.999)
+ new(leftCoordinate, -10),
+ new(middleXCoordinate, -10),
+ new(middleXCoordinate, -15),
+ new(rightCoordinate, -15)
];
- AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
-
- Point2D[] expectedBottomAquiferCoordinates =
+ GeometryPoint[] expectedBottom =
[
- bottomLeftInBetweenLayer,
- bottomRightInBetweenLayer
+ new(leftCoordinate, -20),
+ new(middleXCoordinate, -20),
+ new(middleXCoordinate, -17),
+ new(rightCoordinate, -17)
];
-
- 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 pl4WaternetLine = waternet.WaternetLineList[3];
- Assert.That(pl4WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[2]));
- AssertGeometry(new[]
- {
- bottomLeftUpperLayer,
- bottomIntermediateUpperUpperLayer,
- bottomIntermediateLowerUpperLayer,
- bottomRightUpperLayer,
- new Point2D(rightCoordinate, -17),
- new Point2D(middleXCoordinate, -17),
- new Point2D(middleXCoordinate, -20),
- new Point2D(leftCoordinate, -20),
- bottomLeftUpperLayer
- }, pl4WaternetLine.Points);
+ AssertGeometry(topLevelInBetweenAquifer, expectedTop);
+ AssertGeometry(bottomLevelInBetweenAquifer, expectedBottom);
}
///
@@ -956,7 +915,7 @@
/// ------------------------------------------------------------- Level -30 m
///
[Test]
- public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerRightLayerEnvelopesLeftLayer_ReturnsExpectedWaternet()
+ public void Given2DSoilProfileWithContinuousInBetweenAquiferConsistingOfTwoLayersWithLeftLayerEnvelopedByRightLayer_WhenDeterminingLayerBoundaryPointsOfInBetweenAquifer_ThenExpectedCoordinatesReturned()
{
// Setup
var topLeftUpperLayer = new Point2D(leftCoordinate, 0);
@@ -1028,62 +987,33 @@
soilProfile.Surfaces.Add(soilLayerInBetween);
soilProfile.Surfaces.Add(soilLayerAquiferBottom);
- PlLines plLines = CreateAllPlLines();
-
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
-
+ bool isInBetweenLayerPresent = PlLinesToWaternetConverter.AreInBetweenAquiferClustersPresent(soilProfile, out int count);
+ IEnumerable topLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.TopLayerInBetweenAquiferCluster, soilProfile, 0);
+ IEnumerable bottomLevelInBetweenAquifer = PlLinesToWaternetConverter.DetermineLayerBoundaryPoints(PlLinesToWaternetConverter.LayerType.BottomLayerInBetweenAquiferCluster, soilProfile, 0);
+
// Assert
- AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
-
- Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
- AssertGeometry(plLines.Lines[PlLineType.Pl2].Points, waternet.HeadLineList[0].Points);
- 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));
-
- WaternetLine pl1WaternetLine = waternet.WaternetLineList[0];
- Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
- Point2D[] expectedWaternetLine1 =
+ Assert.Multiple(() =>
+ {
+ Assert.That(isInBetweenLayerPresent, Is.True);
+ Assert.That(count, Is.EqualTo(1));
+ });
+ GeometryPoint[] expectedTop =
[
- new Point2D(leftCoordinate, -9.999),
- new Point2D(middleXCoordinate, -9.999),
- new Point2D(middleXCoordinate, -20.999),
- new Point2D(rightCoordinate, -20.999)
+ new(leftCoordinate, -10),
+ new(middleXCoordinate, -10),
+ new(middleXCoordinate, -5),
+ new(rightCoordinate, -5)
];
- AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
-
- Point2D[] expectedBottomAquiferCoordinates =
- {
- bottomLeftInBetweenLayer,
- 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);
-
- 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[]
- {
- bottomLeftUpperLayer,
- bottomIntermediateUpperUpperLayer,
- bottomIntermediateLowerUpperLayer,
- bottomRightUpperLayer,
- new Point2D(rightCoordinate, -21),
- new Point2D(middleXCoordinate, -21),
- new Point2D(middleXCoordinate, -20),
- new Point2D(leftCoordinate, -20),
- bottomLeftUpperLayer
- }, pl4WaternetLine.Points);
+ GeometryPoint[] expectedBottom =
+ [
+ new(leftCoordinate, -20),
+ new(middleXCoordinate, -20),
+ new(middleXCoordinate, -21),
+ new(rightCoordinate, -21)
+ ];
+ AssertGeometry(topLevelInBetweenAquifer, expectedTop);
+ AssertGeometry(bottomLevelInBetweenAquifer, expectedBottom);
}
///
@@ -1100,7 +1030,7 @@
[Test]
[TestCase(true, false)]
[TestCase(false, true)]
- public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithDiscontinuousInBetweenAquiferLayer_ReturnsExpectedWaternet(
+ public void Given2DSoilProfileWithDiscontinuousInBetweenAquifer_WhenDeterminingInBetweenAquiferCount_ThenReturns0(
bool isLeftInBetweenLayerAquifer, bool isRightInBetweenLayerAquifer)
{
// Setup
@@ -1125,47 +1055,15 @@
soilProfile.Surfaces.Add(soilLayerInBetween);
soilProfile.Surfaces.Add(soilLayerAquiferBottom);
- PlLines plLines = CreateAllPlLines();
-
- // Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
-
+ // Call
+ bool isInBetweenLayerPresent = PlLinesToWaternetConverter.AreInBetweenAquiferClustersPresent(soilProfile, out int count);
+
// Assert
- AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
-
- Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
- AssertGeometry(plLines.Lines[PlLineType.Pl2].Points, waternet.HeadLineList[0].Points);
- 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(3));
-
- WaternetLine pl1WaternetLine = waternet.WaternetLineList[0];
- Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
- Point2D[] expectedWaternetLine1 =
- [
- new Point2D(leftCoordinate, -10.000),
- new Point2D(rightCoordinate, -10.000)
- ];
- AssertGeometry(expectedWaternetLine1, pl1WaternetLine.Points);
-
- var bottomRightInBetweenLayer = new Point2D(rightCoordinate, -25);
- var bottomLeftInBetweenLayer = new Point2D(leftCoordinate, -25);
- Point2D[] expectedBottomAquiferCoordinates =
- [
- bottomLeftInBetweenLayer,
- 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);
-
- WaternetLine pl3WaternetLine = waternet.WaternetLineList[2];
- Assert.That(pl3WaternetLine.HeadLine, Is.SameAs(waternet.HeadLineList[1]));
- AssertGeometry(expectedBottomAquiferCoordinates, pl3WaternetLine.Points);
+ Assert.Multiple(() =>
+ {
+ Assert.That(isInBetweenLayerPresent, Is.False);
+ Assert.That(count, Is.EqualTo(0));
+ });
}
///
@@ -1488,6 +1386,7 @@
yield return new TestCaseData(soilProfileFullAdjoin, new[]
{
new GeometryPoint(leftCoordinate, -10),
+ new GeometryPoint(middleXCoordinate, -10),
new GeometryPoint(rightCoordinate, -10)
}).SetName("Right aquifer fully adjoins left aquifer");
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs
===================================================================
diff -u -r4982 -r4986
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 4982)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 4986)
@@ -34,7 +34,7 @@
public static class PlLinesToWaternetConverter
{
- private enum LayerType
+ public enum LayerType
{
BottomAquifer,
TopLayerInBetweenAquiferCluster,
@@ -136,8 +136,7 @@
ThrowWhenPlLinesIsNull(plLines);
ThrowWhenSoilProfileIsNull(soilProfile);
- double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile);
- Point2D[] bottomAquiferCoordinates = DetermineLayerBoundaryCoordinates(LayerType.BottomAquifer, xCoordinates, soilProfile).ToArray();
+ Point2D[] bottomAquiferCoordinates = DetermineLayerBoundaryPoints(LayerType.BottomAquifer, soilProfile).ToArray();
var waternet = new Waternet();
PlLine plLine = plLines.Lines[PlLineType.Pl1];
@@ -252,29 +251,29 @@
return;
}
- double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile);
- if (!AreInBetweenAquiferClustersPresent(soilProfile, xCoordinates, out int inBetweenAquiferCount))
+ if (!AreInBetweenAquiferClustersPresent(soilProfile, out int inBetweenAquiferCount))
{
return;
}
for (var i = 0; i < inBetweenAquiferCount; i++)
{
- Point2D[] inBetweenAquiferUpperCoordinates = DetermineLayerBoundaryCoordinates(LayerType.TopLayerInBetweenAquiferCluster, xCoordinates, soilProfile, i).ToArray();
- Point2D[] inBetweenAquiferLowerCoordinates = DetermineLayerBoundaryCoordinates(LayerType.BottomLayerInBetweenAquiferCluster, xCoordinates, soilProfile, i).ToArray();
+ Point2D[] inBetweenAquiferUpperCoordinates = DetermineLayerBoundaryPoints(LayerType.TopLayerInBetweenAquiferCluster, soilProfile, i).ToArray();
+ Point2D[] inBetweenAquiferLowerCoordinates = DetermineLayerBoundaryPoints(LayerType.BottomLayerInBetweenAquiferCluster, soilProfile, i).ToArray();
if (inBetweenAquiferUpperCoordinates.Any() && inBetweenAquiferLowerCoordinates.Any())
{
WaternetLine waternetLine = CreateWaternetLine(inBetweenAquiferUpperCoordinates, inBetweenAquiferLowerCoordinates);
waternetLine.HeadLine = headLine;
- waternetLine.Name = waternetLine4Name + " (" + i + 1 + ")";
+ waternetLine.Name = waternetLine4Name + " (" + (i + 1) + ")";
waternet.WaternetLineList.Add(waternetLine);
}
}
}
- private static bool AreInBetweenAquiferClustersPresent(SoilProfile2D soilProfile, double[] xCoordinates, out int count)
+ internal static bool AreInBetweenAquiferClustersPresent(SoilProfile2D soilProfile, out int count)
{
+ double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile);
var currentCount = 0;
var previousCount = 0;
for (var i = 0; i < xCoordinates.Length; i++)
@@ -368,10 +367,22 @@
return line;
}
- private static IEnumerable DetermineLayerBoundaryCoordinates(LayerType layerType, double[] xCoordinates, SoilProfile2D soilProfile, int indexInBetweenAquifer = -1)
+ ///
+ /// Determines all the points of the layer boundary for the specified layer type:
+ /// - For LayerType = BottomAquifer, it will return the top boundary of the bottom aquifer (= waternet line for PL3)
+ /// - For TopLayerInBetweenAquiferCluster, it will return the top boundary of the in-between aquifer (= waternet line for PL4)
+ /// - For BottomLayerInBetweenAquiferCluster, it will return the bottom boundary of the in-between aquifer (= waternet line for PL4)
+ /// - For HighestAquifer, it will return the top boundary of the highest aquifer (= waternet line for PL1 for "Hydrostatic" waternet)
+ /// - For LowestLayer, it will return the bottom boundary of the lowest layer (= waternet line for PL1 for "Full hydrostatic" waternet)
+ ///
+ /// The type of layer boundary.
+ /// The soil profile 2D.
+ /// In case of several in-between aquifers, the index of the in-between aquifer must be specified.
+ /// All the points of the layer boundary.
+ internal static IEnumerable DetermineLayerBoundaryPoints(LayerType layerType, SoilProfile2D soilProfile, int indexInBetweenAquifer = -1)
{
+ double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile);
SoilLayer1D previousAquiferLayer = null;
- var coordinates = new List();
var xCoordinatesAll = new List();
foreach (double xCoordinate in xCoordinates)
{
@@ -386,6 +397,7 @@
}
}
+ var layerBoundaryPoints = new List();
foreach (double xCoordinate in xCoordinatesAll)
{
SoilProfile1D crossSection = soilProfile.GetSoilProfile1D(xCoordinate);
@@ -402,18 +414,18 @@
if (currentAquifer != null)
{
previousAquiferLayer = currentAquifer;
- coordinates.Add(layerType is LayerType.BottomLayerInBetweenAquiferCluster or LayerType.LowestLayer ? new Point2D(xCoordinate, currentAquifer.BottomLevel) : new Point2D(xCoordinate, currentAquifer.TopLevel));
+ layerBoundaryPoints.Add(layerType is LayerType.BottomLayerInBetweenAquiferCluster or LayerType.LowestLayer ? new Point2D(xCoordinate, currentAquifer.BottomLevel) : new Point2D(xCoordinate, currentAquifer.TopLevel));
}
}
// Perform a short validation that the coordinates are fully defined from the beginning to the end
// of the profile. If not, the layer is not continuous.
- if (!IsLayerBoundaryContinuous(coordinates, xCoordinates.First(), xCoordinates.Last()))
+ if (!IsLayerBoundaryContinuous(layerBoundaryPoints, xCoordinates.First(), xCoordinates.Last()))
{
return Enumerable.Empty();
}
- return coordinates;
+ return layerBoundaryPoints;
}
private static bool IsLayerBoundaryContinuous(List boundaryPoints, double leftGeometryBoundary, double rightGeometryBoundary)
@@ -517,8 +529,7 @@
}
case IntrusionVerticalWaterPressureType.HydroStatic:
{
- double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile2D);
- Point2D[] highestAquiferCoordinates = DetermineLayerBoundaryCoordinates(LayerType.HighestAquifer, xCoordinates, soilProfile2D).ToArray();
+ Point2D[] highestAquiferCoordinates = DetermineLayerBoundaryPoints(LayerType.HighestAquifer, soilProfile2D).ToArray();
return CreateWaternetLine(highestAquiferCoordinates);
}
case IntrusionVerticalWaterPressureType.Linear:
@@ -528,8 +539,7 @@
}
case IntrusionVerticalWaterPressureType.FullHydroStatic:
{
- double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile2D);
- Point2D[] lowestBoundaryCoordinates = DetermineLayerBoundaryCoordinates(LayerType.LowestLayer, xCoordinates, soilProfile2D).ToArray();
+ Point2D[] lowestBoundaryCoordinates = DetermineLayerBoundaryPoints(LayerType.LowestLayer, soilProfile2D).ToArray();
return CreateWaternetLine(lowestBoundaryCoordinates);
}
case null: