Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/PipingBlighTests.cs =================================================================== diff -u -r6010 -r6077 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/PipingBlighTests.cs (.../PipingBlighTests.cs) (revision 6010) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/PipingBlighTests.cs (.../PipingBlighTests.cs) (revision 6077) @@ -183,8 +183,13 @@ Assert.That(output.Results.CalculationResults, Has.Length.EqualTo(2)); Assert.Multiple(() => { + Assert.That(ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[0].CalculationResult), Is.EqualTo(CalculationResult.Succeeded)); Assert.That(output.Results.CalculationResults[0].PipingDesignResults.BlighFactor, Is.EqualTo(1.299).Within(tolerance)); + Assert.That(output.Results.CalculationResults[0].PipingDesignResults.ResultMessage, Is.EqualTo("")); + + Assert.That(ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults[1].CalculationResult), Is.EqualTo(CalculationResult.RunFailed)); Assert.That(output.Results.CalculationResults[1].PipingDesignResults.BlighFactor, Is.EqualTo(-1.000).Within(tolerance)); + Assert.That(output.Results.CalculationResults[1].PipingDesignResults.ResultMessage, Is.EqualTo("The design was not successful. Factor achieved = 1.103, Factor required = 1.200.")); }); } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r6009 -r6077 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 6009) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 6077) @@ -23,6 +23,7 @@ using System.Collections.Generic; using System.Linq; using Deltares.DamEngine.Calculators.KernelWrappers.Common; +using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Calculators.Uplift; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Gauges; @@ -45,9 +46,8 @@ private double? waterLevelRiverLow; - private PlLine currentPl1Line; // is needed when calculating uplift reduction for PL3 and Pl4 - // Output - + internal PlLine CurrentPl1Line; // is needed when calculating uplift reduction for PL3 and Pl4 + /// /// Constructor /// @@ -450,7 +450,7 @@ /// /// The intersection point of the surface line (often ditch) with the aquifer. /// The PL-line. - private void ReducePlLineToPl1(GeometryPoint intersectionAquifer, PlLine plLine) + internal void ReducePlLineToPl1(GeometryPoint intersectionAquifer, PlLine plLine) { if (IsDitchIntersectedByPl1(intersectionAquifer, out GeometryPoint intersectDitchPl1)) { @@ -459,7 +459,7 @@ } else { - double pl1Level = currentPl1Line.ZFromX(intersectionAquifer.X); + double pl1Level = CurrentPl1Line.ZFromX(intersectionAquifer.X); plLine.Points.Add(new PlLinePoint(intersectionAquifer.X, pl1Level)); plLine.Points.Add(new PlLinePoint(SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X, pl1Level)); } @@ -835,9 +835,9 @@ private void ConfigureUpliftCalculator(UpliftCalculator upliftCalculator, GeometryPoint surfacePoint) { upliftCalculator.SurfaceLevel = surfacePoint.Z; - if (currentPl1Line != null) + if (CurrentPl1Line != null) { - upliftCalculator.PhreaticLevel = currentPl1Line.ZFromX(surfacePoint.X); + upliftCalculator.PhreaticLevel = CurrentPl1Line.ZFromX(surfacePoint.X); // set phreatic level to calculate uplift factor } else @@ -947,7 +947,7 @@ // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4 if (plLineType == PlLineType.Pl1) { - currentPl1Line = plLines.Lines[plLineType]; + CurrentPl1Line = plLines.Lines[plLineType]; } } @@ -974,7 +974,7 @@ // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4 if (plLineType == PlLineType.Pl1) { - currentPl1Line = plLines.Lines[plLineType]; + CurrentPl1Line = plLines.Lines[plLineType]; } } @@ -1650,7 +1650,7 @@ ValidatePhreaticBelowDike(phreaticLine); // currentPL1Line is needed when calculating uplift reduction for PL3 and Pl4 - currentPl1Line = phreaticLine; + CurrentPl1Line = phreaticLine; return phreaticLine; } @@ -1722,7 +1722,7 @@ validator.ValidateSoilProfileForPlLinesCreator(); } - private bool IsSurfaceLineIntersectedByAquiferAtPolder(PlLineType plLineType, out GeometryPoint intersectionPoint) + internal bool IsSurfaceLineIntersectedByAquiferAtPolder(PlLineType plLineType, out GeometryPoint intersectionPoint) { // If all the layers below the dike toe at polder are aquifer, no intersection point can be found SoilProfile1D relevantSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); @@ -1741,17 +1741,20 @@ } // Soil profile 1D - double topAquifer = GetRelevantAquiferLayer(plLineType, relevantSoilProfile).TopLevel; - int indexStartSearch = SurfaceLine.Geometry.Points.FindIndex(p => p.X.IsNearEqual(xStartSearch, toleranceAlmostEquals)); - double xIntersection = SurfaceLine.Geometry.GetXatZStartingAt(indexStartSearch, topAquifer); - if (!double.IsNaN(xIntersection)) + SoilLayer1D aquifer = GetRelevantAquiferLayer(plLineType, relevantSoilProfile); + if (aquifer != null) { - intersectionPoint = new GeometryPoint + int indexStartSearch = SurfaceLine.Geometry.Points.FindIndex(p => p.X.IsNearEqual(xStartSearch, toleranceAlmostEquals)); + double xIntersection = SurfaceLine.Geometry.GetXatZStartingAt(indexStartSearch, aquifer.TopLevel); + if (!double.IsNaN(xIntersection)) { - X = xIntersection, - Z = topAquifer - }; - return true; + intersectionPoint = new GeometryPoint + { + X = xIntersection, + Z = aquifer.TopLevel + }; + return true; + } } intersectionPoint = null; @@ -1760,44 +1763,49 @@ /// - /// The intersection of PL 1 with the ditch is found starting the search at . - /// If PL 1 (polder level) is higher than , search in the outward direction. - /// If PL 1 (polder level) is lower than , search in the inward direction. - /// Return the first intersection point found as . - /// - /// The intersection point of the ditch with the aquifer. - /// Returns the intersection point of the ditch with PL 1. If no intersection point is - /// found, returns null. - /// true if the ditch intersects the polder level; otherwise, false. - private bool IsDitchIntersectedByPl1(GeometryPoint intersectionDitchAquifer, out GeometryPoint intersectionDitchPl1) + /// The intersection of PL 1 with the ditch is found starting the search at . + /// If PL 1 (polder level) is higher than , search in the outward direction. + /// If PL 1 (polder level) is lower than , search in the inward direction. + /// Return the first intersection point found as . + /// + /// The intersection point of the ditch with the aquifer. + /// Returns the intersection point of the ditch with PL 1. If no intersection point is + /// found, returns null. + /// true if the ditch intersects the polder level; otherwise, false. + internal bool IsDitchIntersectedByPl1(GeometryPoint intersectionDitchAquifer, out GeometryPoint intersectionDitchPl1) + { + intersectionDitchPl1 = new GeometryPoint(); + bool isPl1AboveAquifer = CurrentPl1Line.Points.Last().Z.IsGreaterThanOrEqualTo(intersectionDitchAquifer.Z, toleranceAlmostEquals); + GeometryPoint dikeToeAtPolder = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); + double xStart = SurfaceLine.Geometry.Points.First(p => p.X.IsGreaterThanOrEqualTo(intersectionDitchAquifer.X, toleranceAlmostEquals)).X; + int indexStart = SurfaceLine.Geometry.Points.FindIndex(p => p.X.AlmostEquals(xStart, toleranceAlmostEquals)) - 1; + int indexDikeToeAtPolder = SurfaceLine.Geometry.Points.FindIndex(p => p.X.AlmostEquals(dikeToeAtPolder.X, toleranceAlmostEquals)); + int indexEnd = isPl1AboveAquifer ? indexDikeToeAtPolder : SurfaceLine.Geometry.Points.Count - 1; + + if ((isPl1AboveAquifer && indexStart < indexEnd) || (!isPl1AboveAquifer && indexStart > indexEnd)) { - intersectionDitchPl1 = new GeometryPoint(); - bool isPl1AboveAquifer = currentPl1Line.Points.Last().Z.IsGreaterThanOrEqualTo(intersectionDitchAquifer.Z, toleranceAlmostEquals); - GeometryPoint dikeToeAtPolder = SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder); - double xStart = SurfaceLine.Geometry.Points.First(p => p.X.IsGreaterThanOrEqualTo(intersectionDitchAquifer.X, toleranceAlmostEquals)).X; - int indexStart = SurfaceLine.Geometry.Points.FindIndex(p => p.X.AlmostEquals(xStart, toleranceAlmostEquals)) - 1; - int indexDikeToeAtPolder = SurfaceLine.Geometry.Points.FindIndex(p => p.X.AlmostEquals(dikeToeAtPolder.X, toleranceAlmostEquals)); - int indexEnd = isPl1AboveAquifer ? indexDikeToeAtPolder : SurfaceLine.Geometry.Points.Count - 1; + throw new PlLinesCreatorException(Resources.PlLinesCreator_ErrorDuringIsDitchIntersectedByPl1); + } - int index = indexStart; - while (index != indexEnd) + int index = indexStart; + while (index != indexEnd) + { + GeometryPoint currentPoint = SurfaceLine.Geometry.Points[index]; + GeometryPoint nextPoint = SurfaceLine.Geometry.Points[index + 1]; + var surfaceLineSegment = new Line(); + surfaceLineSegment.SetBeginAndEndPoints(new Point2D(currentPoint.X, currentPoint.Z), new Point2D(nextPoint.X, nextPoint.Z)); + var phreaticPolderPartialLine = new Line(); + PlLinePoint endPl1 = CurrentPl1Line.Points.First(p => p.X.IsGreaterThanOrEqualTo(currentPoint.X, toleranceAlmostEquals)); + PlLinePoint beginPl1 = CurrentPl1Line.Points.Last(p => p.X.IsLessThan(currentPoint.X, toleranceAlmostEquals)); + phreaticPolderPartialLine.SetBeginAndEndPoints(new Point2D(beginPl1.X, beginPl1.Z), new Point2D(endPl1.X, endPl1.Z)); + if (LineHelper.DetermineStrictIntersectionPoint(surfaceLineSegment, phreaticPolderPartialLine, ref intersectionDitchPl1)) { - GeometryPoint currentPoint = SurfaceLine.Geometry.Points[index]; - GeometryPoint nextPoint = SurfaceLine.Geometry.Points[index + 1]; - var surfaceLineSegment = new Line(); - surfaceLineSegment.SetBeginAndEndPoints(new Point2D(currentPoint.X, currentPoint.Z), new Point2D(nextPoint.X, nextPoint.Z)); - var phreaticPolderPartialLine = new Line(); - PlLinePoint endPl1 = currentPl1Line.Points.First(p => p.X.IsGreaterThanOrEqualTo(currentPoint.X, toleranceAlmostEquals)); - PlLinePoint beginPl1 = currentPl1Line.Points.Last(p => p.X.IsLessThan(currentPoint.X, toleranceAlmostEquals)); - phreaticPolderPartialLine.SetBeginAndEndPoints(new Point2D(beginPl1.X, beginPl1.Z), new Point2D(endPl1.X, endPl1.Z)); - if (LineHelper.DetermineStrictIntersectionPoint(surfaceLineSegment, phreaticPolderPartialLine, ref intersectionDitchPl1)) - { - return true; - } - index = isPl1AboveAquifer ? index - 1 : index + 1; + return true; } - - intersectionDitchPl1 = null; - return false; + index = isPl1AboveAquifer ? index - 1 : index + 1; } - } \ No newline at end of file + + intersectionDitchPl1 = null; + return false; + } +} \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r5456 -r6077 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 5456) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 6077) @@ -351,6 +351,12 @@ } } + internal static string PlLinesCreator_ErrorDuringIsDitchIntersectedByPl1 { + get { + return ResourceManager.GetString("PlLinesCreator_ErrorDuringDeterminationIsDitchIntersectedByPl1", resourceCulture); + } + } + /// /// Looks up a localized string similar to No pl-lines object defined. /// Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/SoilProfile2DHelper.cs =================================================================== diff -u -r6023 -r6077 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/SoilProfile2DHelper.cs (.../SoilProfile2DHelper.cs) (revision 6023) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/SoilProfile2DHelper.cs (.../SoilProfile2DHelper.cs) (revision 6077) @@ -65,7 +65,6 @@ /// true if the aquifer intersects the surface line; otherwise, false. public static bool IsSurfaceLineIntersectedByAquifer(LayerType aquiferType, SoilProfile2D soilProfile, double xStart, out GeometryPoint intersectionPoint) { - intersectionPoint = new GeometryPoint(); double[] xCoordinates = DetermineAllXCoordinatesOfSoilProfile(soilProfile); foreach (double xCoordinate in xCoordinates.Where(xCoordinate => xCoordinate.IsGreaterThanOrEqualTo(xStart))) { @@ -74,12 +73,15 @@ { case LayerType.BottomAquiferCluster when crossSection.Layers.All(layer => layer.IsAquifer): case LayerType.InBetweenAquiferCluster when crossSection.Layers[0].IsAquifer && crossSection.Layers.Any(layer => !layer.IsAquifer): - intersectionPoint.X = xCoordinate; - intersectionPoint.Z = crossSection.TopLevel; + intersectionPoint = new GeometryPoint + { + X = xCoordinate, + Z = crossSection.TopLevel + }; return true; } } - + intersectionPoint = null; return false; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/PlLinesCreatorTest.cs =================================================================== diff -u -r6009 -r6077 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/PlLinesCreatorTest.cs (.../PlLinesCreatorTest.cs) (revision 6009) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/PlLinesCreator/PlLinesCreatorTest.cs (.../PlLinesCreatorTest.cs) (revision 6077) @@ -2038,7 +2038,178 @@ Assert.That(plLines.Lines[PlLineType.Pl4].Points, Is.Empty); }); } + + /// + /// _______ Level 10 m + /// / Clay \ + /// /---------\ Level 6 m + /// / Aquifer \ + /// /-------------\ X=58.5 Level 2 m + /// -----------/ Layer 3 \------\ /-------- Level 0 m + /// -----------------------------------\ /--------- Level -2 m + /// Layer 4 \ / + /// -------------------------------------\ /----------- Level -4 m + /// Layer 5 \---------/ Level -5 m + /// X=59.5 + /// ------------------------------------------------------------- Level -6 m + /// Bottom aquifer + /// ------------------------------------------------------------- Level -10 m + /// + [Test] + [TestCase(1, SoilProfileType.ProfileType1D, true, true, true)] // All layers at polder are aquifers, so no intersection found + [TestCase(2, SoilProfileType.ProfileType1D, false, true, false)] // In-between aquifer intersects ditch at Z = -2 + [TestCase(3, SoilProfileType.ProfileType2D, false, false, true)] // Bottom aquifer intersects ditch at Z = -4 + [TestCase(4, SoilProfileType.ProfileType1D, false, false, false)] // Aquifer is below ditch, so no intersection found + public void GivenSoilProfile_WhenDeterminingIfSurfaceLineIsIntersectedByAquifersAtPolder_ThenExpectedResultReturned(int caseNr, SoilProfileType soilProfileType, bool isLayer3Aquifer, bool isLayer4Aquifer, bool isLayer5Aquifer) + { + SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateSurfaceLineWithDikeAndDitch(10, -5); + SoilProfile1D soilProfile1D = FactoryForSoilProfiles.CreateClaySandClaySandClaySandProfile(10, 6, 2, 0 - 2, -4, -6); + soilProfile1D.Layers[2].IsAquifer = isLayer3Aquifer; + soilProfile1D.Layers[3].IsAquifer = isLayer4Aquifer; + soilProfile1D.Layers[4].IsAquifer = isLayer5Aquifer; + soilProfile1D.BottomLevel = -10; + var soilSurfaceProfile = new SoilSurfaceProfile + { + SoilProfile = soilProfile1D, + SurfaceLine2 = surfaceLine, + DikeEmbankmentMaterial = new Soil(), + Name = "Test" + }; + SoilProfile2D soilProfile2D = soilSurfaceProfile.ConvertToSoilProfile2D(); + + var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator + { + ModelParametersForPlLines = + { + PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRRD + }, + SoilProfile = soilProfileType == SoilProfileType.ProfileType1D ? soilProfile1D : null, + SoilProfile2D = soilProfileType == SoilProfileType.ProfileType2D ? soilProfile2D : null, + SoilProfileType = soilProfileType, + SurfaceLine = surfaceLine + }; + + // Call + bool isIntersectionWithBottomAquifer = plLineCreator.IsSurfaceLineIntersectedByAquiferAtPolder(PlLineType.Pl3, out GeometryPoint intersectionPointBottomAquifer); + bool isIntersectionWithInBetweenAquifer = plLineCreator.IsSurfaceLineIntersectedByAquiferAtPolder(PlLineType.Pl4, out GeometryPoint intersectionPointInBetweenAquifer); + + // Assert + Assert.Multiple(() => + { + Assert.That(isIntersectionWithBottomAquifer, Is.EqualTo(caseNr == 3)); + Assert.That(isIntersectionWithInBetweenAquifer, Is.EqualTo(caseNr == 2)); + }); + switch (caseNr) + { + case 1 or 4: + Assert.Multiple(() => + { + Assert.That(intersectionPointBottomAquifer, Is.Null); + Assert.That(intersectionPointInBetweenAquifer, Is.Null); + }); + break; + case 2: + Assert.Multiple(() => + { + Assert.That(intersectionPointBottomAquifer, Is.Null); + Assert.That(intersectionPointInBetweenAquifer.X, Is.EqualTo(58.9).Within(tolerance4Decimals)); + Assert.That(intersectionPointInBetweenAquifer.Z, Is.EqualTo(-2).Within(tolerance4Decimals)); + }); + break; + case 3: + Assert.Multiple(() => + { + Assert.That(intersectionPointInBetweenAquifer, Is.Null); + Assert.That(intersectionPointBottomAquifer.X, Is.EqualTo(59.3).Within(tolerance4Decimals)); + Assert.That(intersectionPointBottomAquifer.Z, Is.EqualTo(-4).Within(tolerance4Decimals)); + }); + break; + } + } + + [Test] + [TestCase(-6.0, 59.25)] // PL 1 intersects the ditch + [TestCase(-9.0, 59.00)] // PL 1 below ditch + public void GivenSoilProfile2DWithAquifersCuttingTheDitch_WhenReducingPl3ToPl1_ThenExpectedPlLine3Returned(double pl1Level, double expectedXPl3) + { + SoilProfile2D soilProfile2D = CreateSoilProfile2DWithLayersCuttingTheDitch(false, out SurfaceLine2 surfaceLine); + var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator + { + ModelParametersForPlLines = + { + PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRRD + }, + SoilProfile2D = soilProfile2D, + SoilProfileType = SoilProfileType.ProfileType2D, + SurfaceLine = surfaceLine, + CurrentPl1Line = new PlLine() + }; + plLineCreator.CurrentPl1Line.Points.Add(new PlLinePoint(0, pl1Level)); + plLineCreator.CurrentPl1Line.Points.Add(new PlLinePoint(75, pl1Level)); + var pl3 = new PlLine(); + var intersectionDitchWithAquifer = new GeometryPoint(59, -4); + + // Call + plLineCreator.ReducePlLineToPl1(intersectionDitchWithAquifer, pl3); + + // Assert + Assert.That(pl3.Points, Has.Count.EqualTo(2)); + Assert.Multiple(() => + { + Assert.That(pl3.Points[0].X, Is.EqualTo(expectedXPl3).Within(tolerance4Decimals)); + Assert.That(pl3.Points[0].Z, Is.EqualTo(pl1Level).Within(tolerance4Decimals)); + Assert.That(pl3.Points[1].X, Is.EqualTo(75).Within(tolerance4Decimals)); + Assert.That(pl3.Points[1].Z, Is.EqualTo(pl1Level).Within(tolerance4Decimals)); + }); + } + [Test] + [TestCase(-2.0, 58.75)] // PL 1 intersects the ditch and is above intersection point ditch/aquifer + [TestCase(-6.0, 59.25)] // PL 1 intersects the ditch and is below intersection point ditch/aquifer + [TestCase(-9.0, double.NaN)] // PL 1 below ditch + [TestCase(2.0, double.NaN)] // PL 1 above ditch + public void GivenSoilProfile2DWithDitch_WhenDeterminingIfDitchIsIntersectedByPl1_ThenExpectedResultReturned(double pl1Level, double expectedXIntersection) + { + SoilProfile2D soilProfile2D = CreateSoilProfile2DWithLayersCuttingTheDitch(false, out SurfaceLine2 surfaceLine); + var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator + { + ModelParametersForPlLines = + { + PlLineCreationMethod = PlLineCreationMethod.ExpertKnowledgeRRD + }, + SoilProfile2D = soilProfile2D, + SoilProfileType = SoilProfileType.ProfileType2D, + SurfaceLine = surfaceLine, + CurrentPl1Line = new PlLine() + }; + plLineCreator.CurrentPl1Line.Points.Add(new PlLinePoint(0, pl1Level)); + plLineCreator.CurrentPl1Line.Points.Add(new PlLinePoint(75, pl1Level)); + var intersectionDitchWithAquifer = new GeometryPoint(59, -4); + + // Call + bool isDitchIntersectedByPl1 = plLineCreator.IsDitchIntersectedByPl1(intersectionDitchWithAquifer, out GeometryPoint intersectionDitchPl1); + + // Assert + if (double.IsNaN(expectedXIntersection)) + { + Assert.Multiple(() => + { + Assert.That(isDitchIntersectedByPl1, Is.False); + Assert.That(intersectionDitchPl1, Is.Null); + }); + } + else + { + Assert.Multiple(() => + { + Assert.That(isDitchIntersectedByPl1, Is.True); + Assert.That(intersectionDitchPl1, Is.Not.Null); + Assert.That(intersectionDitchPl1.X, Is.EqualTo(expectedXIntersection).Within(tolerance4Decimals)); + Assert.That(intersectionDitchPl1.Z, Is.EqualTo(pl1Level).Within(tolerance4Decimals)); + }); + } + } + /// /// _______ Level 10 m /// / Clay \ @@ -2064,18 +2235,7 @@ [TestCase(true, -9.0, 59.250, 58.750)] // PL 1 below ditch public void GivenSoilProfile2DWithAquifersCuttingTheDitch_WhenCreatingPlLines_ThenExpectedPlLinesReturned(bool isInBetweenLayerAquifer, double waterLevelPolder, double expectedXPl3, double expectedXPl4 = 0) { - SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateSurfaceLineWithDikeAndDitch(10, -8); - SoilProfile1D soilProfile1D = FactoryForSoilProfiles.CreateClaySandClaySandClaySandProfile(10, 6, 2, 0 -2, -4, -6); - soilProfile1D.Layers[3].IsAquifer = isInBetweenLayerAquifer; - soilProfile1D.BottomLevel = -10; - var soilSurfaceProfile = new SoilSurfaceProfile - { - SoilProfile = soilProfile1D, - SurfaceLine2 = surfaceLine, - DikeEmbankmentMaterial = new Soil(), - Name = "Test" - }; - SoilProfile2D soilProfile2D = soilSurfaceProfile.ConvertToSoilProfile2D(); + SoilProfile2D soilProfile2D = CreateSoilProfile2DWithLayersCuttingTheDitch(isInBetweenLayerAquifer, out SurfaceLine2 surfaceLine); var plLineCreator = new Calculators.PlLinesCreator.PlLinesCreator { ModelParametersForPlLines = @@ -2214,6 +2374,38 @@ }); } + /// + /// _______ Level 10 m + /// / Clay \ + /// /---------\ Level 6 m + /// / Aquifer \ + /// /-------------\ X=58.5 Level 2 m + /// -----------/ Clay \------\ /-------- Level 0 m + /// -----------------------------------\ /--------- Level -2 m + /// In between layer \ / + /// -------------------------------------\ /----------- Level -4 m + /// Clay \ / + /// ---------------------------------------\ /------------- Level -6 m + /// \_____/ Level -8 m + /// Bottom aquifer X=59.5 + /// ------------------------------------------------------------- Level -10 m + /// + private static SoilProfile2D CreateSoilProfile2DWithLayersCuttingTheDitch(bool isInBetweenLayerAquifer, out SurfaceLine2 surfaceLine) + { + surfaceLine = FactoryForSurfaceLines.CreateSurfaceLineWithDikeAndDitch(10, -8); + SoilProfile1D soilProfile1D = FactoryForSoilProfiles.CreateClaySandClaySandClaySandProfile(10, 6, 2, 0 - 2, -4, -6); + soilProfile1D.Layers[3].IsAquifer = isInBetweenLayerAquifer; + soilProfile1D.BottomLevel = -10; + var soilSurfaceProfile = new SoilSurfaceProfile + { + SoilProfile = soilProfile1D, + SurfaceLine2 = surfaceLine, + DikeEmbankmentMaterial = new Soil(), + Name = "Test" + }; + return soilSurfaceProfile.ConvertToSoilProfile2D(); + } + private void CheckPl3For1DGeometryWithExpertKnowledgeRrd(PlLine plLine) { // PlLine is supposed to have adjusted points at both banks of the ditch Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r5456 -r6077 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 5456) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 6077) @@ -294,6 +294,9 @@ Het ondergrondprofiel bevat geen waterkerende laag. + + Er is een onverwachte fout opgetreden bij het bepalen van het snijpunt tussen de sloot en PL 1. + Er is een onverwachte fout opgetreden bij het bepalen van de boven- en ondergrenzen van de tussenliggende watervoerende laag. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r5456 -r6077 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 5456) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 6077) @@ -292,6 +292,9 @@ The soil profile contains no aquitard layer. + + An unexpected error occurs during the determination of the intersection point between the ditch and PL 1. + An unexpected error occured during the determination of the top and bottom boundaries of the in-between aquifer layer.