Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs
===================================================================
diff -u -r4959 -r4967
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 4959)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverterTests.cs (.../PlLinesToWaternetConverterTests.cs) (revision 4967)
@@ -80,10 +80,11 @@
Assert.That(waternet.WaternetLineList, Is.Empty);
}
- [TestCase(IntrusionVerticalWaterPressureType.Standard, -2.110, 5)]
- [TestCase(IntrusionVerticalWaterPressureType.Linear, 1.212, 5)]
- [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -2.110, 5)]
+ [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)
{
PlLines plLines = CreatePlLinesForTest();
@@ -136,76 +137,84 @@
Assert.That(waternet.HeadLineList[0].Points[1].X, Is.EqualTo(100).Within(precision3Decimals));
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(waternetLineCount));
- Assert.That(waternet.WaternetLineList[0].Name, Is.EqualTo("Waternet line phreatic line"));
- if (pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic)
+
+ 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));
+
+ WaternetLine waternetLinePl2 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Penetration zone lower aquifer");
+ if (pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent)
{
- 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"));
+ // 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);
+ }
- 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));
- Assert.That(waternet.WaternetLineList[0].Points[0].X, Is.EqualTo(0).Within(precision3Decimals));
- Assert.That(waternet.WaternetLineList[0].Points[0].Z, Is.EqualTo(levelWaternetPl1).Within(precision3Decimals));
- 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));
-
+ WaternetLine waternetLinePl3 = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet line lower aquifer");
+ WaternetLine waternetLinePl4Top = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet area in-between aquifer (1)");
+ WaternetLine waternetLinePl4Bottom = waternet.WaternetLineList.Find(waternetLine => waternetLine.Name == "Waternet area in-between aquifer (2)");
+
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 connected to pl3 has level -6.111
+ Assert.That(waternetLinePl3.HeadLine, Is.EqualTo(waternet.HeadLineList[1]));
+ Assert.That(waternetLinePl3.Points, Has.Count.EqualTo(2));
+ Assert.That(waternetLinePl3.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: highest waternet line connected to pl4 has level between -2.111 and -3.373
+ Assert.That(waternetLinePl4Top.HeadLine, Is.EqualTo(waternet.HeadLineList[2]));
+ Assert.That(waternetLinePl4Top.Points, Has.Count.EqualTo(5));
+ Assert.That(waternetLinePl4Top.Points[0].X, Is.EqualTo(0).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.Points[0].Z, Is.EqualTo(-2.111).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.Points[1].X, Is.EqualTo(100).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.Points[1].Z, Is.EqualTo(-2.111).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.Points[2].X, Is.EqualTo(100).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.Points[2].Z, Is.EqualTo(-3.373).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.Points[3].X, Is.EqualTo(0).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.Points[3].Z, Is.EqualTo(-3.373).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.Points[4].X, Is.EqualTo(0).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Top.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: lowest waternet line 4 connected to pl4 has level between -4.151 and -5.373
+ Assert.That(waternetLinePl4Bottom.HeadLine, Is.EqualTo(waternet.HeadLineList[2]));
+ Assert.That(waternetLinePl4Bottom.Points, Has.Count.EqualTo(5));
+ Assert.That(waternetLinePl4Bottom.Points[0].X, Is.EqualTo(0).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[0].Z, Is.EqualTo(-4.151).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[1].X, Is.EqualTo(100).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[1].Z, Is.EqualTo(-4.151).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[2].X, Is.EqualTo(100).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[2].Z, Is.EqualTo(-5.373).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[3].X, Is.EqualTo(0).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[3].Z, Is.EqualTo(-5.373).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[4].X, Is.EqualTo(0).Within(precision3Decimals));
+ Assert.That(waternetLinePl4Bottom.Points[4].Z, Is.EqualTo(-4.151).Within(precision3Decimals));
}
+ else
+ {
+ Assert.That(waternetLinePl3, Is.Null);
+ Assert.That(waternetLinePl4Top, Is.Null);
+ Assert.That(waternetLinePl4Bottom, Is.Null);
+ }
});
}
@@ -246,16 +255,16 @@
PlLines plLines = CreatePlLinesForTest();
SoilProfile1D soilProfile1D = CreateSoilProfile1DForTest(out GeometryPointString surfaceLine);
const double penetrateLength = 2.1;
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, 0, 0, IntrusionVerticalWaterPressureType.Standard);
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, 0, 0, IntrusionVerticalWaterPressureType.SemiTimeDependent);
Assert.Multiple(() =>
{
Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(5));
});
- // check that no waternetlines are added for pl3 when InBetweenAquiferLayer is null
+ // check that no waternet lines are added for pl4 when InBetweenAquiferLayer is null
soilProfile1D = CreateSoilProfile1DWith1AquiferForTest();
- waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, 0, 0, IntrusionVerticalWaterPressureType.Standard);
+ waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, 0, 0, IntrusionVerticalWaterPressureType.SemiTimeDependent);
Assert.Multiple(() =>
{
Assert.That(waternet.HeadLineList, Has.Count.EqualTo(3));
@@ -271,7 +280,7 @@
Assert.That(waternet.WaternetLineList[2].Points[0].Z, Is.EqualTo(-6.111).Within(precision3Decimals));
});
- // check that no waternetlines are added for pl2, pl3 and pl4 when BottomAquiferLayer is null
+ // check that no waternet lines are added for pl2, pl3 and pl4 when BottomAquiferLayer is null
soilProfile1D = CreateSoilProfile1DWithoutAquifersForTest();
waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile1D, surfaceLine, penetrateLength, 0, 0, IntrusionVerticalWaterPressureType.Standard);
Assert.Multiple(() =>
@@ -319,7 +328,7 @@
PlLines plLines = CreateAllPlLines(5);
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard);
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
// Assert
AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
@@ -391,7 +400,7 @@
PlLines plLines = CreateAllPlLines();
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard);
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
// Assert
AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
@@ -450,10 +459,11 @@
/// bottom aquifer layer
/// --------------------------------------------------- Level -30 m
///
- [TestCase(IntrusionVerticalWaterPressureType.Standard, -9.999, 4)]
- [TestCase(IntrusionVerticalWaterPressureType.Linear, 0, 4)]
- [TestCase(IntrusionVerticalWaterPressureType.HydroStatic, -9.999, 4)]
+ [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)]
public void CreateWaternetBasedOnPlLines_ValidPLLinesAndSoilProfile2DWithContinuousInBetweenAquiferLayerConsistOfOnePart_ReturnsExpectedWaternet(IntrusionVerticalWaterPressureType? pressureType, double levelWaternetPl1, int waternetLineCount)
{
// Setup
@@ -491,7 +501,7 @@
Assert.That(waternet.WaternetLineList, Has.Count.EqualTo(waternetLineCount));
- WaternetLine pl1WaternetLine = waternet.WaternetLineList[0];
+ WaternetLine pl1WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == waternet.PhreaticLine.Name);
Assert.That(pl1WaternetLine.HeadLine.Name, Is.SameAs(waternet.PhreaticLine.Name));
Point2D[] expectedWaternetLine1 =
[
@@ -508,19 +518,26 @@
bottomRightInBetweenLayer
];
- if (waternetLineCount > 1)
+ WaternetLine pl2WaternetLine = waternet.WaternetLineList.Find(w => w.HeadLine.Name == "Head line 2 (PL 2)");
+ if (pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent)
{
- 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);
+ }
+ else
+ {
+ Assert.That(pl2WaternetLine, Is.Null);
+ }
- WaternetLine pl3WaternetLine = waternet.WaternetLineList[2];
+ 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[3];
+ 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),
@@ -602,7 +619,7 @@
PlLines plLines = CreateAllPlLines();
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard);
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
// Assert
AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
@@ -720,13 +737,12 @@
PlLines plLines = CreateAllPlLines();
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard);
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
// 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);
@@ -867,7 +883,7 @@
PlLines plLines = CreateAllPlLines();
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard);
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
// Assert
AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
@@ -1014,7 +1030,7 @@
PlLines plLines = CreateAllPlLines();
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard);
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
// Assert
AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
@@ -1111,7 +1127,7 @@
PlLines plLines = CreateAllPlLines();
// Call
- Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.Standard);
+ Waternet waternet = PlLinesToWaternetConverter.CreateWaternetBasedOnPlLines(plLines, soilProfile, penetrationLength, IntrusionVerticalWaterPressureType.SemiTimeDependent);
// Assert
AssertGeometry(plLines.Lines[PlLineType.Pl1].Points, waternet.PhreaticLine.Points);
@@ -1307,7 +1323,7 @@
surfaceLine = new GeometryPointString();
surfaceLine.Points.Add(new PlLinePoint(0, topLevel));
surfaceLine.Points.Add(new PlLinePoint(100, topLevel));
-
+
var soilProfile1D = new SoilProfile1D
{
BottomLevel = -30.0
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs
===================================================================
diff -u -r4959 -r4967
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 4959)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/PlLinesToWaternetConverter.cs (.../PlLinesToWaternetConverter.cs) (revision 4967)
@@ -64,7 +64,7 @@
/// Right side of the 2D profile.
/// The type of distribution of the vertical water pressures.
///
- public static Waternet CreateWaternetBasedOnPlLines(PlLines plLines, SoilProfile1D soilProfile1D, GeometryPointString surfaceLine,
+ public static Waternet CreateWaternetBasedOnPlLines(PlLines plLines, SoilProfile1D soilProfile1D, GeometryPointString surfaceLine,
double penetrationLength, double xLeft, double xRight, IntrusionVerticalWaterPressureType? pressureType)
{
ThrowWhenPlLinesIsNull(plLines);
@@ -76,7 +76,7 @@
if (plLine != null && !IsBelowSoilProfile(soilProfile1D, plLine))
{
waternet.PhreaticLine = CreateLine(plLine, headLine1Name);
- WaternetLine waternetLine = CreateWaternetLineForPhreaticLine(soilProfile1D, surfaceLine, headLine, xLeft, xRight, pressureType);
+ WaternetLine waternetLine = CreateWaternetLineForPhreaticLine(soilProfile1D, surfaceLine, headLine, xLeft, xRight, pressureType, penetrationLength);
waternetLine.Name = waternetLine1Name;
waternetLine.HeadLine = headLine;
waternetLine.HeadLine.SyncCalcPoints();
@@ -88,7 +88,7 @@
if (headLine != null && !IsBelowSoilProfile(soilProfile1D, plLine))
{
waternet.HeadLineList.Add(headLine);
- if (soilProfile1D.BottomAquiferLayer != null && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic)
+ if (soilProfile1D.BottomAquiferLayer != null && pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent)
{
double level = soilProfile1D.BottomAquiferLayer.TopLevel + penetrationLength;
WaternetLine waternetLine = CreateWaternetLine(level, xLeft, xRight);
@@ -116,6 +116,7 @@
CreateWaternetLinesForInBetweenAquifers(waternet, soilProfile1D, xLeft, xRight, plLines.Lines[PlLineType.Pl4], pressureType);
AdjustWaternetLineOfPhreaticLineWhenCoincidingWithOtherWaternetLines(waternet);
+
return waternet;
}
@@ -143,7 +144,7 @@
{
var headLine = CreateLine(plLine, headLine1Name);
waternet.PhreaticLine = CreateLine(plLine, headLine1Name);
- WaternetLine waternetLine = CreateWaternetLineForPhreaticLine(soilProfile, plLine, pressureType);
+ WaternetLine waternetLine = CreateWaternetLineForPhreaticLine(soilProfile, plLine, pressureType, penetrationLength);
waternetLine.Name = waternetLine1Name;
waternetLine.HeadLine = headLine;
waternet.WaternetLineList.Add(waternetLine);
@@ -155,7 +156,7 @@
var headLine = CreateLine(plLine, headLine2Name);
waternet.HeadLineList.Add(headLine);
- if (bottomAquiferCoordinates.Any() && pressureType != IntrusionVerticalWaterPressureType.FullHydroStatic)
+ if (bottomAquiferCoordinates.Any() && pressureType == IntrusionVerticalWaterPressureType.SemiTimeDependent)
{
WaternetLine waternetLine = CreateWaternetLine(bottomAquiferCoordinates, penetrationLength);
waternetLine.Name = waternetLine2Name;
@@ -186,6 +187,15 @@
return waternet;
}
+ internal static WaternetLine CreateWaternetLine(double level, double xLeft, double xRight)
+ {
+ var waternetLine = new WaternetLine();
+ waternetLine.Points.Add(new GeometryPoint(xLeft, level));
+ waternetLine.Points.Add(new GeometryPoint(xRight, level));
+ waternetLine.SyncCalcPoints();
+ return waternetLine;
+ }
+
///
/// Determine all the xCoordinates to make cross-sections.
///
@@ -205,25 +215,27 @@
{
return;
}
-
+
waternet.HeadLineList.Add(headLine);
if (soilProfile1D.GetInBetweenAquiferClusters == null || pressureType == IntrusionVerticalWaterPressureType.FullHydroStatic)
{
return;
}
+ var number = 0;
foreach ((SoilLayer1D, SoilLayer1D) inBetweenAquiferCluster in soilProfile1D.GetInBetweenAquiferClusters.Where(layer => layer is { Item1: not null, Item2: not null }))
{
+ number++;
double levelTop = inBetweenAquiferCluster.Item1.TopLevel;
double levelBottom = inBetweenAquiferCluster.Item2.BottomLevel;
WaternetLine waternetLine = CreateWaternetLine(levelTop, levelBottom, xLeft, xRight);
- waternetLine.Name = waternetLine4Name;
+ waternetLine.Name = waternetLine4Name + " (" + number + ")";
waternetLine.HeadLine = headLine;
waternet.WaternetLineList.Add(waternetLine);
}
}
- private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile2D soilProfile, PlLine plLine4,
+ private static void CreateWaternetLinesForInBetweenAquifers(Waternet waternet, SoilProfile2D soilProfile, PlLine plLine4,
IntrusionVerticalWaterPressureType? pressureType)
{
if (plLine4 == null)
@@ -240,8 +252,7 @@
}
double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile);
- int inBetweenAquiferCount = DetermineInBetweenAquiferClusterCount(soilProfile, xCoordinates);
- if (inBetweenAquiferCount == 0)
+ if (!AreInBetweenAquiferClustersPresent(soilProfile, xCoordinates, out int inBetweenAquiferCount))
{
return;
}
@@ -255,13 +266,13 @@
{
WaternetLine waternetLine = CreateWaternetLine(inBetweenAquiferUpperCoordinates, inBetweenAquiferLowerCoordinates);
waternetLine.HeadLine = headLine;
- waternetLine.Name = waternetLine4Name;
+ waternetLine.Name = waternetLine4Name + " (" + i + 1 + ")";
waternet.WaternetLineList.Add(waternetLine);
}
}
}
- private static int DetermineInBetweenAquiferClusterCount(SoilProfile2D soilProfile, double[] xCoordinates)
+ private static bool AreInBetweenAquiferClustersPresent(SoilProfile2D soilProfile, double[] xCoordinates, out int count)
{
var currentCount = 0;
var previousCount = 0;
@@ -271,13 +282,15 @@
currentCount = crossSection.GetInBetweenAquiferClusters?.Count ?? 0;
if (i > 0 && currentCount != previousCount)
{
- return 0;
+ count = 0;
+ return false;
}
previousCount = currentCount;
}
- return currentCount;
+ count = currentCount;
+ return count > 0;
}
private static TLineType CreateLine(PlLine plLine, string name)
@@ -294,15 +307,6 @@
line.Name = name;
return line;
}
-
- internal static WaternetLine CreateWaternetLine(double level, double xLeft, double xRight)
- {
- var waternetLine = new WaternetLine();
- waternetLine.Points.Add(new GeometryPoint(xLeft, level));
- waternetLine.Points.Add(new GeometryPoint(xRight, level));
- waternetLine.SyncCalcPoints();
- return waternetLine;
- }
private static WaternetLine CreateWaternetLine(double levelTop, double levelBottom, double xLeft, double xRight)
{
@@ -397,7 +401,7 @@
if (currentAquifer != null)
{
previousAquiferLayer = currentAquifer;
- coordinates.Add(layerType is LayerType.BottomLayerInBetweenAquiferCluster or LayerType.LowestLayer? 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));
}
}
@@ -442,54 +446,76 @@
/// - 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.
+ /// - For Semi time dependent, idem DAM Standard.
///
///
///
///
///
///
///
+ ///
///
- private static WaternetLine CreateWaternetLineForPhreaticLine(SoilProfile1D soilProfile1D, GeometryPointString surfaceLine, HeadLine phreaticLine, double xLeft, double xRight, IntrusionVerticalWaterPressureType? pressureType)
+ private static WaternetLine CreateWaternetLineForPhreaticLine(SoilProfile1D soilProfile1D, GeometryPointString surfaceLine,
+ HeadLine phreaticLine, double xLeft, double xRight,
+ IntrusionVerticalWaterPressureType? pressureType, double penetrationLength)
{
- if (pressureType == IntrusionVerticalWaterPressureType.Linear)
+ switch (pressureType)
{
- List coordinates = surfaceLine.Points.Select(point => new Point2D(point.X, point.Z)).ToList();
- return CreateWaternetLine(coordinates);
+ case IntrusionVerticalWaterPressureType.Linear:
+ {
+ List coordinates = surfaceLine.Points.Select(point => new Point2D(point.X, point.Z)).ToList();
+ return CreateWaternetLine(coordinates);
+ }
+ case IntrusionVerticalWaterPressureType.HydroStatic:
+ {
+ double level = soilProfile1D.GetHighestAquifer().TopLevel;
+ return CreateWaternetLine(level, xLeft, xRight);
+ }
+ case IntrusionVerticalWaterPressureType.FullHydroStatic:
+ {
+ double level = soilProfile1D.Layers.Last().BottomLevel;
+ return CreateWaternetLine(level, xLeft, xRight);
+ }
+ case IntrusionVerticalWaterPressureType.Standard:
+ case IntrusionVerticalWaterPressureType.SemiTimeDependent:
+ {
+ double level = soilProfile1D.GetLayerAt(phreaticLine.GetMinZ()).BottomLevel;
+ return CreateWaternetLine(level, xLeft, xRight);
+ }
+ case null:
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(pressureType), pressureType, null);
}
- if (pressureType == IntrusionVerticalWaterPressureType.HydroStatic)
- {
- double topAquiferLevel = soilProfile1D.GetHighestAquifer().TopLevel;
- 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);
-
+ return null;
}
///
/// The position of the waternet line associated to the phreatic line depends on the water pressure type:
/// - 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.
+ /// - For Semi time dependent, idem DAM Standard.
///
///
///
///
+ ///
///
///
- private static WaternetLine CreateWaternetLineForPhreaticLine(SoilProfile2D soilProfile2D, PlLine plLine, IntrusionVerticalWaterPressureType? pressureType)
+ private static WaternetLine CreateWaternetLineForPhreaticLine(SoilProfile2D soilProfile2D, PlLine plLine,
+ IntrusionVerticalWaterPressureType? pressureType, double penetrationLength)
{
switch (pressureType)
{
+ case IntrusionVerticalWaterPressureType.Standard:
+ case IntrusionVerticalWaterPressureType.SemiTimeDependent:
+ {
+ return CreateWaternetLineForPhreaticLineForDamStandard(soilProfile2D, plLine);
+ }
case IntrusionVerticalWaterPressureType.HydroStatic:
{
double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile2D);
@@ -498,32 +524,27 @@
}
case IntrusionVerticalWaterPressureType.Linear:
{
- List coordinates = soilProfile2D.Geometry.SurfaceLine.Points.Select(point => new Point2D(point.X, point.Z)).ToList();
- return CreateWaternetLine(coordinates);
+ List xCoordinates = soilProfile2D.Geometry.SurfaceLine.Points.Select(point => new Point2D(point.X, point.Z)).ToList();
+ return CreateWaternetLine(xCoordinates);
}
- case IntrusionVerticalWaterPressureType.Standard:
- break;
case IntrusionVerticalWaterPressureType.FullHydroStatic:
{
double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile2D);
Point2D[] lowestBoundaryCoordinates = DetermineLayerBoundaryCoordinates(LayerType.LowestLayer, xCoordinates, soilProfile2D).ToArray();
return CreateWaternetLine(lowestBoundaryCoordinates);
}
- case IntrusionVerticalWaterPressureType.SemiTimeDependent:
- break;
case null:
break;
default:
throw new ArgumentOutOfRangeException(nameof(pressureType), pressureType, null);
}
- return CreateWaternetLineForPhreaticLineForDamStandard(soilProfile2D, plLine);
-
+ return null;
}
///
- /// Create the waternet line associated to the phreatic line (PL1).
- /// For the waternet type "Dam Standard", this line lies on the bottom of the soil layers “in which the phreatic plane lies”.
+ /// Create the waternet line associated to the phreatic line (PL1) for the waternet type "Dam Standard".
+ /// This line lies on the bottom of the soil layers “in which the phreatic plane lies”.
/// Where PL1 lies above the ground level, the line lies on the ground level.
/// As a consequence, the line can contain vertical "jumps" when layers have vertical parts.
///
@@ -664,17 +685,17 @@
///
/// Waternet lines can't coincide otherwise the program does not know which headline to use.
/// That's why when the waternet line of the phreatic line coincides with the waternet line of either PL2, PL3 or PL4,
- /// an adjustment of the waternet line of the phreatic line is performed by moving it 1 mm upwards.
+ /// an adjustment of the waternet line of the phreatic line is performed by moving it 1 mm upwards.
///
/// The waternet.
private static void AdjustWaternetLineOfPhreaticLineWhenCoincidingWithOtherWaternetLines(Waternet waternet)
{
const double minimumDistance = 0.001;
WaternetLine waternetLine1 = waternet.WaternetLineList.Find(w => w.Name == waternetLine1Name);
- foreach (GeometryPoint waternetLine1Point
- in from waternetLineOther in waternet.WaternetLineList.FindAll(w => w.Name != waternetLine1Name)
- from waternetLine1Point in waternetLine1.Points
- where waternetLineOther.Points.Any(point => Math.Abs(point.Z - waternetLine1Point.Z) < epsilon)
+ foreach (GeometryPoint waternetLine1Point
+ in from waternetLineOther in waternet.WaternetLineList.FindAll(w => w.Name != waternetLine1Name)
+ from waternetLine1Point in waternetLine1.Points
+ where waternetLineOther.Points.Any(point => Math.Abs(point.Z - waternetLine1Point.Z) < epsilon)
select waternetLine1Point)
{
waternetLine1Point.Z += minimumDistance;