using System;
using System.Linq;
using Deltares.Geometry;
using Deltares.Geotechnics.Soils;
using Deltares.Geotechnics.SurfaceLines;
using Deltares.Geotechnics.TestUtils;
using NUnit.Framework;
namespace Deltares.Geotechnics.WaternetCreator.Tests
{
[TestFixture]
public class PlLinesCreatorTests
{
///
/// Test if PL1 created correctly if PolderLevel above toe at polder
///
[Test]
public void CreatePL1WithPolderLevelHigherDikeToeAtPolder()
{
const double cTolerance = 0.0001;
var plLineCreator = new PlLinesCreator();
plLineCreator.Inwards = true;
var location = new Location();
Assert.IsNotNull(plLineCreator);
location.SoilProfile1D = FactoryForSoilProfileTests.CreateComplexProfile();
location.WaterLevelRiver = 4.0;
location.LeakageLengthInwardsPl3 = 12.3;
location.LeakageLengthOutwardsPl3 = 12.3;
location.PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeLinearInDike;
location.SoilProfile1D = FactoryForSoilProfileTests.CreateClaySandClaySandProfile();
location.Surfaceline = FactoryForSoilProfileTests.CreateSurfacelineSimpleDike();
location.WaterLevelPolder = location.Surfaceline.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z + 1.0;
var plLine = plLineCreator.CreatePLLine1ByExpertKnowledge(location);
Assert.AreEqual(4, plLine.Points.Count);
Assert.AreEqual(0.0, plLine.Points[0].X, cTolerance);
Assert.AreEqual(4.0, plLine.Points[0].Z, cTolerance);
Assert.AreEqual(3.0, plLine.Points[1].X, cTolerance);
Assert.AreEqual(4.0, plLine.Points[1].Z, cTolerance);
Assert.AreEqual(9.25, plLine.Points[2].X, cTolerance);
Assert.AreEqual(location.WaterLevelPolder, plLine.Points[2].Z, cTolerance);
Assert.AreEqual(12, plLine.Points[3].X, cTolerance);
Assert.AreEqual(location.WaterLevelPolder, plLine.Points[3].Z, cTolerance);
location.PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRrd;
location.PlLineOffsetBelowDikeTopAtRiver = 0.5;
location.PlLineOffsetBelowDikeTopAtPolder = 1.5;
plLine = plLineCreator.CreatePLLine1ByExpertKnowledge(location);
Assert.AreEqual(6, plLine.Points.Count);
Assert.AreEqual(0.0, plLine.Points[0].X, cTolerance);
Assert.AreEqual(4.0, plLine.Points[0].Z, cTolerance);
Assert.AreEqual(3.0, plLine.Points[1].X, cTolerance);
Assert.AreEqual(4.0, plLine.Points[1].Z, cTolerance);
Assert.AreEqual(4.0, plLine.Points[2].X, cTolerance);
Assert.AreEqual(3.5, plLine.Points[2].Z, cTolerance);
Assert.AreEqual(7.0, plLine.Points[3].X, cTolerance);
Assert.AreEqual(2.5, plLine.Points[3].Z, cTolerance);
Assert.AreEqual(9.25, plLine.Points[4].X, cTolerance); // this point and following points are raised to match polderlevel
Assert.AreEqual(location.WaterLevelPolder, plLine.Points[4].Z, cTolerance);
Assert.AreEqual(12, plLine.Points[5].X, cTolerance);
Assert.AreEqual(location.WaterLevelPolder, plLine.Points[5].Z, cTolerance);
}
///
/// Test if the cetrated phreatic line is below the dike line
///
[Test]
public void CreatePL1BelowDikeLine()
{
const double cTolerance = 0.0001;
var plLineCreator = new PlLinesCreator();
plLineCreator.Inwards = true;
var location = new Location();
Assert.IsNotNull(plLineCreator);
location.WaterLevelRiver = 4.0;
location.WaterLevelPolder = 0.7;
location.PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeLinearInDike;
location.SoilProfile1D = FactoryForSoilProfileTests.CreateClaySandClaySandProfile();
location.Surfaceline = FactoryForSoilProfileTests.CreateSchematizedSurfaceLineWithDepressions();
var plLine = plLineCreator.CreatePLLine1ByExpertKnowledge(location);
double dikeTopX = location.Surfaceline.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).X;
foreach (GeometryPoint point in plLine.Points)
{
if (point.X > dikeTopX)
{
double plZ = point.Z;
double gZ = location.Surfaceline.Geometry.GetZAtX(point.X);
Assert.IsTrue(plZ <= Math.Max(location.WaterLevelPolder, gZ + cTolerance));
}
}
}
[Test]
public void CreateWaternetBm2_7Test()
{
SoilProfile2D profile2D = FactoryForSoilProfileTests.CreateSoilProfile2Dbm2_7();
SurfaceLine2 surfaceLine = FactoryForSoilProfileTests.CreateSurfaceLineBm2_7();
var waternet = new Waternet();
var location = new Location()
{
HeadInPLLine2Outwards = 13.0,
HeadInPLLine2Inwards = 3.0,
HeadInPLLine3 = 4.5,
HeadInPLLine4 = 4.0,
WaterLevelRiver = 5.0,
WaterLevelRiverLow = double.NaN,
WaterLevelPolder = 1.0,
PenetrationLength = 1.0,
LeakageLengthInwardsPl3 = 0.3,
LeakageLengthOutwardsPl3 = 0.4,
PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRrd,
SoilProfile2D = profile2D,
Surfaceline = surfaceLine,
AdjustPl3And4ForUplift = true
};
var creator = new WaternetCreator();
creator.UpdateWaternet(waternet, location);
var waternetLinePl3 = waternet.WaternetLineList.First(w => w.Name == "pl3");
var headLinePl3 = waternetLinePl3.HeadLine;
// check phreatic level
Assert.AreEqual(location.WaterLevelRiver, waternet.PhreaticLine.Points[0].Z);
Assert.AreEqual(6, waternet.WaternetLineList.Count);
Assert.IsNotNull(waternetLinePl3.HeadLine);
}
[Test]
public void DetermineTopSurfaceGeometryTest()
{
SoilProfile2D profile2D = FactoryForSoilProfileTests.CreateSoilProfile2D();
GeometryPointString gString = profile2D.Surfaces[1].GeometrySurface.DetermineTopGeometrySurface();
Assert.AreEqual(0, gString.GetMinX(), 0);
Assert.AreEqual(20, gString.GetMaxX(), 0);
}
[Test]
[ExpectedException(typeof(System.Exception))]
public void PllinesCreatorThrowsExceptionWhenSoilProfileIsNull()
{
var plLineCreator = new PlLinesCreator();
var location = new Location();
Assert.IsNotNull(plLineCreator);
location.WaterLevelRiverAverage = 4.0;
location.LeakageLengthInwardsPl3 = 0.3;
location.LeakageLengthOutwardsPl3 = 0.4;
location.PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRrd;
location.SoilProfile1D = null;
location.Surfaceline = FactoryForSoilProfileTests.CreateSurfacelineSimpleDike();
location.WaterLevelPolder = location.Surfaceline.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z + 1.0;
var plLine = plLineCreator.CreatePLLine3ByExpertKnowledge(location);
}
///
/// Old Benchmark 4-01a: Automatic creation of the PL-lines for case A: Clay Dike on Clay with 4 clusters (2 top aquitards + 1 in between aquifer +
/// 1 aquitard + 1 deep aquifer, "RRD" creation method, uplift occurs for PL 4 but not for PL 3
/// Expected results come from an Excel spreadsheet
///
[Test]
public void WaternetCreatorTest_OldBenchmark4_01a_ClayDikeOnClay()
{
// setup
var location = new Location();
location.Surfaceline = FactoryForSurfaceLineTests.CreateSurfaceLineBm4_01();
location.SoilProfile2D = FactoryForSoilProfileTests.Create2DProfileBenchmark4_01a();
location.DikeSoilScenario = DikeSoilScenario.ClayDikeOnClay;
location.PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRrd;
location.HeadInPLLine2Inwards = 0.4;
location.HeadInPLLine2Outwards = 0.8;
location.LeakageLengthInwardsPl3 = 30;
location.LeakageLengthInwardsPl4 = 50;
location.LeakageLengthOutwardsPl3 = 50;
location.LeakageLengthOutwardsPl4 = 800;
location.PenetrationLength = 0.3;
location.WaterLevelPolder = -0.2;
location.WaterLevelRiver = 2.8;
location.WaterLevelRiverAverage = 2.6;
location.WaterLevelRiverLow = 0.8;
location.PlLineOffsetBelowDikeTopAtRiver = 0.6;
location.PlLineOffsetBelowDikeTopAtPolder = 1.3;
location.PlLineOffsetBelowShoulderBaseInside = 0.1;
location.PlLineOffsetBelowDikeToeAtPolder = 0.2;
location.AdjustPl3And4ForUplift = true;
// output
var waternetCreator = new WaternetCreator();
var waternet = new Waternet();
waternetCreator.UpdateWaternet(waternet, location);
var phrl = waternet.PhreaticLine;
// Coordinates of the created phreatic line (method = RRD)
Assert.AreEqual(9, phrl.Points.Count);
Assert.AreEqual(0, phrl.Points[0].X);
Assert.AreEqual(2.8, phrl.Points[0].Z);
Assert.AreEqual(9.720, phrl.Points[1].X, 0.001);
Assert.AreEqual(2.8, phrl.Points[1].Z, 0.001);
Assert.AreEqual(10, phrl.Points[2].X, 0.001);
Assert.AreEqual(2.2, phrl.Points[2].Z, 0.001);
Assert.AreEqual(13, phrl.Points[3].X, 0.001);
Assert.AreEqual(1.5, phrl.Points[3].Z, 0.001);
Assert.AreEqual(15.6, phrl.Points[4].X, 0.001);
Assert.AreEqual(1.1, phrl.Points[4].Z, 0.001);
Assert.AreEqual(18.6, phrl.Points[5].X, 0.001);
Assert.AreEqual(0, phrl.Points[5].Z, 0.001);
Assert.AreEqual(24.636, phrl.Points[6].X, 0.001);
Assert.AreEqual(-0.2, phrl.Points[6].Z, 0.001);
// Point 7 (intersection ditch polder side and circle) is not checked because not calculated in the spreadsheet
Assert.AreEqual(45, phrl.Points[8].X, 0.001);
Assert.AreEqual(-0.2, phrl.Points[8].Z, 0.001);
// Coordinates of Head 2
var head2 = waternet.HeadLineList.FirstOrDefault(h => h.Name == "Head 2");
Assert.AreEqual(0, head2[0].X);
Assert.AreEqual(0.8, head2[0].Z);
Assert.AreEqual(45, head2[1].X);
Assert.AreEqual(0.4, head2[1].Z);
// Coordinates of Head 3
var head3 = waternet.HeadLineList.FirstOrDefault(h => h.Name == "Head 3");
Assert.AreEqual(0, head3[0].X);
Assert.AreEqual(2.8, head3[0].Z);
Assert.AreEqual(4, head3[1].X);
Assert.AreEqual(2.8, head3[1].Z);
Assert.AreEqual(10, head3[2].X);
Assert.AreEqual(0.786, head3[2].Z, 0.001);
// Point 3 (X=13) is not checked because not calculated in the spreadsheet
Assert.AreEqual(18.6, head3[4].X);
Assert.AreEqual(0.691, head3[4].Z, 0.001);
// Point 5 (X=23) is not checked because not calculated in the spreadsheet
// Point 6 (X=26) is not checked because not calculated in the spreadsheet
// Point 7 (X=28.5) is not checked because not calculated in the spreadsheet
// Point 8 (X=31) is not checked because not calculated in the spreadsheet
Assert.AreEqual(38.6, head3[9].X);
Assert.AreEqual(0.486, head3[9].Z, 0.001);
Assert.AreEqual(45, head3[10].X);
Assert.AreEqual(0.423, head3[10].Z, 0.001);
//Coordinates of Head 4
var head4 = waternet.HeadLineList.FirstOrDefault(h => h.Name == "Head 4");
Assert.AreEqual(0, head4[0].X);
Assert.AreEqual(2.8, head4[0].Z);
Assert.AreEqual(4, head4[1].X);
Assert.AreEqual(2.8, head4[1].Z);
Assert.AreEqual(10, head4[2].X);
Assert.AreEqual(0.723, head4[2].Z, 0.001);
// Point 3 (X=13) is not checked because not calculated in the spreadsheet
Assert.AreEqual(18.6, head4[4].X);
Assert.AreEqual(0.645, head4[4].Z, 0.001);
// Point 5 (X=23) is not checked because not calculated in the spreadsheet
Assert.AreEqual(24.1, head4[6].X);
Assert.AreEqual(0.491, head4[6].Z, 0.001);
// Point 7 (X=26) is not checked because not calculated in the spreadsheet
// Point 8 (X=28.5) is not checked because not calculated in the spreadsheet
// Point 9 (X=31) is not checked because not calculated in the spreadsheet
Assert.AreEqual(44.1, head4[10].X);
Assert.AreEqual(0.414, head4[10].Z, 0.001);
Assert.AreEqual(45, head4[11].X);
Assert.AreEqual(0.4, head4[11].Z);
// Waternet line "surface line"
var surfLine = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "Surface line");
Assert.AreEqual(0, surfLine[0].X);
Assert.AreEqual(0.1, surfLine[0].Z);
Assert.AreEqual(4, surfLine[1].X);
Assert.AreEqual(0, surfLine[1].Z);
Assert.AreEqual(6.4, surfLine[2].X);
Assert.AreEqual(1.3, surfLine[2].Z);
Assert.AreEqual(7.9, surfLine[3].X);
Assert.AreEqual(1.5, surfLine[3].Z);
Assert.AreEqual(10, surfLine[4].X);
Assert.AreEqual(3, surfLine[4].Z);
Assert.AreEqual(13, surfLine[5].X);
Assert.AreEqual(3.2, surfLine[5].Z);
Assert.AreEqual(15.6, surfLine[6].X);
Assert.AreEqual(1.2, surfLine[6].Z);
Assert.AreEqual(17, surfLine[7].X);
Assert.AreEqual(1, surfLine[7].Z);
Assert.AreEqual(18.6, surfLine[8].X);
Assert.AreEqual(0.2, surfLine[8].Z);
Assert.AreEqual(23, surfLine[9].X);
Assert.AreEqual(0.1, surfLine[9].Z);
Assert.AreEqual(26, surfLine[10].X);
Assert.AreEqual(-0.45, surfLine[10].Z);
Assert.AreEqual(28.5, surfLine[11].X);
Assert.AreEqual(-0.48, surfLine[11].Z);
Assert.AreEqual(31, surfLine[12].X);
Assert.AreEqual(0, surfLine[12].Z);
Assert.AreEqual(45, surfLine[13].X);
Assert.AreEqual(0.1, surfLine[13].Z);
Assert.AreEqual("Phreatic Line", surfLine.HeadLine.Name);
// Waternet line "penetration zone in the toppest aquitard"
const double penetLen = 0.3;
var pl2above = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "Penetration zone 3");
Assert.AreEqual(0, pl2above[0].X);
Assert.AreEqual(-0.9 + penetLen, pl2above[0].Z);
Assert.AreEqual(45, pl2above[1].X);
Assert.AreEqual(-1.5 + penetLen, pl2above[1].Z);
Assert.AreEqual("Head 2", pl2above.HeadLine.Name);
// Waternet line "top of the toppest aquifer"
var WaternetInBetweenAquifer = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "In between aquifer");
Assert.AreEqual(0, WaternetInBetweenAquifer[0].X);
Assert.AreEqual(-0.9, WaternetInBetweenAquifer[0].Z);
Assert.AreEqual(45, WaternetInBetweenAquifer[1].X);
Assert.AreEqual(-1.5, WaternetInBetweenAquifer[1].Z);
Assert.AreEqual(45, WaternetInBetweenAquifer[2].X);
Assert.AreEqual(-2.4, WaternetInBetweenAquifer[2].Z);
Assert.AreEqual(0, WaternetInBetweenAquifer[3].X);
Assert.AreEqual(-2.5, WaternetInBetweenAquifer[3].Z);
Assert.AreEqual(0, WaternetInBetweenAquifer[4].X);
Assert.AreEqual(-0.9, WaternetInBetweenAquifer[4].Z);
Assert.AreEqual("Head 4", WaternetInBetweenAquifer.HeadLine.Name);
// Waternet line "penetration zone at the top of the deepest aquitard"
var pl2deepTop = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "Penetration zone 2");
Assert.AreEqual(0, pl2deepTop[0].X);
Assert.AreEqual(-2.5 - penetLen, pl2deepTop[0].Z);
Assert.AreEqual(45, pl2deepTop[1].X);
Assert.AreEqual(-2.4 - penetLen, pl2deepTop[1].Z);
Assert.AreEqual("Head 2", pl2deepTop.HeadLine.Name);
// Waternet line "penetration zone at the bottom of the deepest aquitard"
var pl2deepBottom = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "Penetration zone 1");
Assert.AreEqual(0, pl2deepBottom[0].X);
Assert.AreEqual(-3.7 + penetLen, pl2deepBottom[0].Z);
Assert.AreEqual(45, pl2deepBottom[1].X);
Assert.AreEqual(-4 + penetLen, pl2deepBottom[1].Z);
Assert.AreEqual("Head 2", pl2deepBottom.HeadLine.Name);
// Waternet line "top of the deepest aquifer"
var pl3 = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "pl3");
Assert.AreEqual(0, pl3[0].X);
Assert.AreEqual(-3.7, pl3[0].Z);
Assert.AreEqual(45, pl3[1].X);
Assert.AreEqual(-4, pl3[1].Z);
Assert.AreEqual("Head 3", pl3.HeadLine.Name);
}
///
/// Old Benchmark 4-01b: Automatic creation of the PL-lines for case B: Sand Dike on Clay with 1 top aquifer + 2 aquitards + 2 deep aquifers)
/// Expected results come from an Excel spreadsheet
///
[Test]
public void WaternetCreatorTest_OldBenchmark4_01b_SandDikeOnClay()
{
// setup
var location = new Location();
location.Surfaceline = FactoryForSurfaceLineTests.CreateSurfaceLineBm4_01();
location.SoilProfile2D = FactoryForSoilProfileTests.Create2DProfileBenchmark4_01b();
location.DikeSoilScenario = DikeSoilScenario.SandDikeOnClay;
location.PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRrd;
location.HeadInPLLine2Inwards = 0.4;
location.HeadInPLLine2Outwards = 0.8;
location.LeakageLengthInwardsPl3 = 30;
location.LeakageLengthInwardsPl4 = 50;
location.LeakageLengthOutwardsPl3 = 50;
location.LeakageLengthOutwardsPl4 = 800;
location.PenetrationLength = 0.3;
location.WaterLevelPolder = -0.2;
location.WaterLevelRiver = 2.8;
location.WaterLevelRiverAverage = 2.6;
location.WaterLevelRiverLow = 0.8;
location.PlLineOffsetBelowDikeTopAtRiver = 0.6;
location.PlLineOffsetBelowDikeTopAtPolder = 1.3;
location.PlLineOffsetBelowShoulderBaseInside = 0.1;
location.PlLineOffsetBelowDikeToeAtPolder = 0.2;
location.AdjustPl3And4ForUplift = true;
// output
var penetLen = location.PenetrationLength;
var waternetCreator = new WaternetCreator();
var waternet = new Waternet();
waternetCreator.UpdateWaternet(waternet, location);
var phrl = waternet.PhreaticLine;
Assert.AreEqual(2, waternet.HeadLineList.Count);
Assert.AreEqual(3, waternet.WaternetLineList.Count);
// Coordinates of the created phreatic line (method = RRD)
Assert.AreEqual(9, phrl.Points.Count);
Assert.AreEqual(0, phrl.Points[0].X);
Assert.AreEqual(2.8, phrl.Points[0].Z);
Assert.AreEqual(9.720, phrl.Points[1].X, 0.0005);
Assert.AreEqual(2.8, phrl.Points[1].Z);
Assert.AreEqual(10, phrl.Points[2].X);
Assert.AreEqual(2.2, phrl.Points[2].Z, 0.0005);
Assert.AreEqual(13, phrl.Points[3].X);
Assert.AreEqual(1.5, phrl.Points[3].Z, 0.0005);
Assert.AreEqual(15.6, phrl.Points[4].X);
Assert.AreEqual(1.1, phrl.Points[4].Z, 0.0005);
Assert.AreEqual(18.6, phrl.Points[5].X);
Assert.AreEqual(0, phrl.Points[5].Z);
Assert.AreEqual(24.636, phrl.Points[6].X, 0.0005);
Assert.AreEqual(-0.2, phrl.Points[6].Z);
// Point 7 (intersection ditch polder side and circle) is not checked because not calculated in the spreadsheet
Assert.AreEqual(45, phrl.Points[8].X);
Assert.AreEqual(-0.2, phrl.Points[8].Z);
// Coordinates of Head 2
var head2 = waternet.HeadLineList.FirstOrDefault(h => h.Name == "Head 2");
Assert.AreEqual(0, head2[0].X);
Assert.AreEqual(0.8, head2[0].Z);
Assert.AreEqual(45, head2[1].X);
Assert.AreEqual(0.4, head2[1].Z);
// Coordinates of Head 3
var head3 = waternet.HeadLineList.FirstOrDefault(h => h.Name == "Head 3");
Assert.AreEqual(0, head3[0].X);
Assert.AreEqual(2.8, head3[0].Z);
Assert.AreEqual(4, head3[1].X);
Assert.AreEqual(2.8, head3[1].Z);
Assert.AreEqual(10, head3[2].X);
Assert.AreEqual(0.786, head3[2].Z, 0.001);
// Point 3 (X=13) is not checked because not calculated in the spreadsheet
Assert.AreEqual(18.6, head3[4].X);
Assert.AreEqual(0.691, head3[4].Z, 0.001);
// Point 5 (X=23) is not checked because not calculated in the spreadsheet
Assert.AreEqual(26.0, head3[6].X);
Assert.AreEqual(0.613, head3[6].Z, 0.001);
// Point 7 (X=26) is not checked because not calculated in the spreadsheet
// Point 8 (X=28.5) is not checked because not calculated in the spreadsheet
// Point 9 (X=31) is not checked because not calculated in the spreadsheet
Assert.AreEqual(45.0, head3[10].X);
Assert.AreEqual(0.423, head3[10].Z, 0.001);
// Waternet line "surface line"
var surfLine = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "Surface line");
Assert.AreEqual(0, surfLine[0].X);
Assert.AreEqual(0.1, surfLine[0].Z);
Assert.AreEqual(4, surfLine[1].X);
Assert.AreEqual(0, surfLine[1].Z);
Assert.AreEqual(6.4, surfLine[2].X);
Assert.AreEqual(1.3, surfLine[2].Z);
Assert.AreEqual(7.9, surfLine[3].X);
Assert.AreEqual(1.5, surfLine[3].Z);
Assert.AreEqual(10, surfLine[4].X);
Assert.AreEqual(3, surfLine[4].Z);
Assert.AreEqual(13, surfLine[5].X);
Assert.AreEqual(3.2, surfLine[5].Z);
Assert.AreEqual(15.6, surfLine[6].X);
Assert.AreEqual(1.2, surfLine[6].Z);
Assert.AreEqual(17, surfLine[7].X);
Assert.AreEqual(1, surfLine[7].Z);
Assert.AreEqual(18.6, surfLine[8].X);
Assert.AreEqual(0.2, surfLine[8].Z);
Assert.AreEqual(23, surfLine[9].X);
Assert.AreEqual(0.1, surfLine[9].Z);
Assert.AreEqual(26, surfLine[10].X);
Assert.AreEqual(-0.45, surfLine[10].Z);
Assert.AreEqual(28.5, surfLine[11].X);
Assert.AreEqual(-0.48, surfLine[11].Z);
Assert.AreEqual(31, surfLine[12].X);
Assert.AreEqual(0, surfLine[12].Z);
Assert.AreEqual(45, surfLine[13].X);
Assert.AreEqual(0.1, surfLine[13].Z);
Assert.AreEqual("Phreatic Line", surfLine.HeadLine.Name);
// Waternet line "penetration zone at the bottom of the deepest aquitard"
var pl2deepBottom = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "Penetration zone 1");
Assert.AreEqual(0, pl2deepBottom[0].X);
Assert.AreEqual(-2.5 + penetLen, pl2deepBottom[0].Z);
Assert.AreEqual(45, pl2deepBottom[1].X);
Assert.AreEqual(-2.4 + penetLen, pl2deepBottom[1].Z);
Assert.AreEqual("Head 2", pl2deepBottom.HeadLine.Name);
// Waternet line "top of the deepest aquifer"
var pl3 = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "pl3");
Assert.AreEqual(0, pl3[0].X);
Assert.AreEqual(-2.5, pl3[0].Z);
Assert.AreEqual(45, pl3[1].X);
Assert.AreEqual(-2.4, pl3[1].Z);
Assert.AreEqual("Head 3", pl3.HeadLine.Name);
}
///
/// Old Benchmark 4-01c: Automatic creation of the PL-lines for case C: Clay Dike on Sand with 4 clusters (top aquitard + in between cluster of aquifers (x2) +
/// 1 aquitard + 1 deep aquifer, "RRD" creation method
/// Expected results come from an Excel spreadsheet
///
[Test]
public void WaternetCreatorTest_OldBenchmark4_01c_ClayDikeOnSand()
{
// setup
var location = new Location();
location.Surfaceline = FactoryForSurfaceLineTests.CreateSurfaceLineBm4_01();
location.SoilProfile2D = FactoryForSoilProfileTests.Create2DProfileBenchmark4_01c();
location.DikeSoilScenario = DikeSoilScenario.ClayDikeOnSand;
location.PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRrd;
location.HeadInPLLine2Inwards = 0.4;
location.HeadInPLLine2Outwards = 0.8;
location.LeakageLengthInwardsPl3 = 30;
location.LeakageLengthInwardsPl4 = 50;
location.LeakageLengthOutwardsPl3 = 50;
location.LeakageLengthOutwardsPl4 = 800;
location.PenetrationLength = 0.3;
location.WaterLevelPolder = -0.2;
location.WaterLevelRiver = 2.8;
location.WaterLevelRiverAverage = 2.6;
location.WaterLevelRiverLow = 0.8;
location.PlLineOffsetBelowDikeTopAtRiver = 0.6;
location.PlLineOffsetBelowDikeTopAtPolder = 1.3;
location.PlLineOffsetBelowShoulderBaseInside = 0.1;
location.PlLineOffsetBelowDikeToeAtPolder = 0.2;
location.AdjustPl3And4ForUplift = true;
// output
var penetLen = location.PenetrationLength;
var waternetCreator = new WaternetCreator();
var waternet = new Waternet();
waternetCreator.UpdateWaternet(waternet, location);
var phrl = waternet.PhreaticLine;
Assert.AreEqual(2, waternet.HeadLineList.Count);
Assert.AreEqual(3, waternet.WaternetLineList.Count);
// Coordinates of the created phreatic line (method = RRD)
Assert.AreEqual(9, phrl.Points.Count);
Assert.AreEqual(0, phrl.Points[0].X);
Assert.AreEqual(2.8, phrl.Points[0].Z);
Assert.AreEqual(9.720, phrl.Points[1].X, 0.0005);
Assert.AreEqual(2.8, phrl.Points[1].Z);
Assert.AreEqual(10, phrl.Points[2].X);
Assert.AreEqual(2.2, phrl.Points[2].Z, 0.0005);
Assert.AreEqual(13, phrl.Points[3].X);
Assert.AreEqual(1.5, phrl.Points[3].Z, 0.0005);
Assert.AreEqual(15.6, phrl.Points[4].X);
Assert.AreEqual(1.1, phrl.Points[4].Z, 0.0005);
Assert.AreEqual(18.6, phrl.Points[5].X);
Assert.AreEqual(0, phrl.Points[5].Z);
Assert.AreEqual(24.636, phrl.Points[6].X, 0.0005);
Assert.AreEqual(-0.2, phrl.Points[6].Z);
// Point 7 (intersection ditch polder side and circle) is not checked because not calculated in the spreadsheet
Assert.AreEqual(45, phrl.Points[8].X);
Assert.AreEqual(-0.2, phrl.Points[8].Z);
// Coordinates of Head 2
var head2 = waternet.HeadLineList.FirstOrDefault(h => h.Name == "Head 2");
Assert.AreEqual(0, head2[0].X);
Assert.AreEqual(0.8, head2[0].Z);
Assert.AreEqual(45, head2[1].X);
Assert.AreEqual(0.4, head2[1].Z);
// Coordinates of Head 3
var head3 = waternet.HeadLineList.FirstOrDefault(h => h.Name == "Head 3");
Assert.AreEqual(0, head3[0].X);
Assert.AreEqual(2.8, head3[0].Z);
Assert.AreEqual(4, head3[1].X);
Assert.AreEqual(2.8, head3[1].Z, 0.001);
Assert.AreEqual(18.6, head3[2].X);
Assert.AreEqual(0.2, head3[2].Z, 0.001);
Assert.AreEqual(45, head3[3].X);
Assert.AreEqual(0.1, head3[3].Z, 0.001);
// Waternet line "surface line"
var surfLine = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "Surface line");
Assert.AreEqual(0, surfLine[0].X);
Assert.AreEqual(0.1, surfLine[0].Z);
Assert.AreEqual(4, surfLine[1].X);
Assert.AreEqual(0, surfLine[1].Z);
Assert.AreEqual(6.4, surfLine[2].X);
Assert.AreEqual(1.3, surfLine[2].Z);
Assert.AreEqual(7.9, surfLine[3].X);
Assert.AreEqual(1.5, surfLine[3].Z);
Assert.AreEqual(10, surfLine[4].X);
Assert.AreEqual(3, surfLine[4].Z);
Assert.AreEqual(13, surfLine[5].X);
Assert.AreEqual(3.2, surfLine[5].Z);
Assert.AreEqual(15.6, surfLine[6].X);
Assert.AreEqual(1.2, surfLine[6].Z);
Assert.AreEqual(17, surfLine[7].X);
Assert.AreEqual(1, surfLine[7].Z);
Assert.AreEqual(18.6, surfLine[8].X);
Assert.AreEqual(0.2, surfLine[8].Z);
Assert.AreEqual(23, surfLine[9].X);
Assert.AreEqual(0.1, surfLine[9].Z);
Assert.AreEqual(26, surfLine[10].X);
Assert.AreEqual(-0.45, surfLine[10].Z);
Assert.AreEqual(28.5, surfLine[11].X);
Assert.AreEqual(-0.48, surfLine[11].Z);
Assert.AreEqual(31, surfLine[12].X);
Assert.AreEqual(0, surfLine[12].Z);
Assert.AreEqual(45, surfLine[13].X);
Assert.AreEqual(0.1, surfLine[13].Z);
Assert.AreEqual("Phreatic Line", surfLine.HeadLine.Name);
// Waternet line "penetration zone at the bottom of the top aquitard"
var pl2deepBottom = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "Penetration zone 1");
Assert.AreEqual(0, pl2deepBottom[0].X, 0.000005);
Assert.AreEqual(-3.4, pl2deepBottom[0].Z, 0.000005);
Assert.AreEqual(45, pl2deepBottom[1].X, 0.000005);
Assert.AreEqual(-3.7, pl2deepBottom[1].Z, 0.000005);
Assert.AreEqual("Head 2", pl2deepBottom.HeadLine.Name);
// Waternet line "top of the deepest aquifer"
var pl3 = waternet.WaternetLineList.FirstOrDefault(h => h.Name == "pl3");
Assert.AreEqual(0, pl3[0].X);
Assert.AreEqual(-3.7, pl3[0].Z);
Assert.AreEqual(45, pl3[1].X);
Assert.AreEqual(-4, pl3[1].Z);
Assert.AreEqual("Head 3", pl3.HeadLine.Name);
}
///
/// Old Benchmark 4-01b: Automatic creation of the PL-lines for case B: Sand Dike on Clay with 1 top aquifer + 2 aquitards + 2 deep aquifers)
/// Expected results come from an Excel spreadsheet
///
[Test]
public void WaternetCreatorTest_OldBenchmark4_01b_SandDikeOnSand()
{
// setup
var location = new Location();
location.Surfaceline = FactoryForSurfaceLineTests.CreateSurfaceLineBm4_01();
location.SoilProfile2D = FactoryForSoilProfileTests.Create2DProfileBenchmark4_01b();
location.DikeSoilScenario = DikeSoilScenario.SandDikeOnSand;
location.PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRrd;
location.HeadInPLLine2Inwards = 0.4;
location.HeadInPLLine2Outwards = 0.8;
location.LeakageLengthInwardsPl3 = 30;
location.LeakageLengthInwardsPl4 = 50;
location.LeakageLengthOutwardsPl3 = 50;
location.LeakageLengthOutwardsPl4 = 800;
location.PenetrationLength = 0.3;
location.WaterLevelPolder = -0.2;
location.WaterLevelRiver = 2.8;
location.WaterLevelRiverAverage = 2.6;
location.WaterLevelRiverLow = 0.8;
location.PlLineOffsetBelowDikeTopAtRiver = 0.6;
location.PlLineOffsetBelowDikeTopAtPolder = 1.3;
location.PlLineOffsetBelowShoulderBaseInside = 0.1;
location.PlLineOffsetBelowDikeToeAtPolder = 0.2;
location.AdjustPl3And4ForUplift = true;
// output
var waternetCreator = new WaternetCreator();
var waternet = new Waternet();
waternetCreator.UpdateWaternet(waternet, location);
Assert.AreEqual(0, waternet.HeadLineList.Count);
Assert.AreEqual(1, waternet.WaternetLineList.Count);
}
}
}