Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs =================================================================== diff -u -r5755 -r5811 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 5755) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 5811) @@ -111,8 +111,6 @@ damKernelInput.CurrentEmbankmentSoil = location.GetShoulderEmbankmentSoil(); while (isRedesignRequired && surfaceLine != null) { - // Always start with the original soil profile - damKernelInput.SubSoilScenario.SoilProfile2D = damKernelInput.OriginalSoilProfile2D; iterationIndex++; DesignCalculatorUtils.ThrowWhenMaxIterationsExceeded(iterationIndex, maxRedesignIterations); @@ -170,8 +168,8 @@ kernelWrapper.PrepareDesign(kernelDataInput, kernelDataOutput, damKernelInput, iterationIndex, out embankmentDesignParameters); if (subSoilScenario.SoilProfileType == SoilProfileType.ProfileType2D) { - Soil embankmentSoil = - location.SoilList.GetSoilByName(embankmentDesignParameters.EmbankmentMaterialname); + damKernelInput.SubSoilScenario.SoilProfile2D = damKernelInput.OriginalSoilProfile2D.Clone(); + Soil embankmentSoil = location.SoilList.GetSoilByName(embankmentDesignParameters.EmbankmentMaterialname); subSoilScenario.SoilProfile2D = MacroStabilityCommonHelper.CombineSoilProfileWithSurfaceLine(subSoilScenario, surfaceLine, embankmentSoil, location.XSoilGeometry2DOrigin); } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r5755 -r5811 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs (.../MacroStabilityInwardsKernelWrapper.cs) (revision 5755) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs (.../MacroStabilityInwardsKernelWrapper.cs) (revision 5811) @@ -104,6 +104,12 @@ model = MStabModelType.Bishop; } + if (damKernelInput.OriginalSoilProfile2D != null) + { + // Clone the original soil profile for design iterations + damKernelInput.SubSoilScenario.SoilProfile2D = damKernelInput.OriginalSoilProfile2D.Clone(); + } + MacroStabilityCommonHelper.CombineSoilProfileWithSurfaceLine(damKernelInput.SubSoilScenario, damKernelInput.Location.SurfaceLine, damKernelInput.CurrentEmbankmentSoil, damKernelInput.Location.XSoilGeometry2DOrigin); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityOutwards/MacroStabilityOutwardsKernelWrapper.cs =================================================================== diff -u -r5755 -r5811 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityOutwards/MacroStabilityOutwardsKernelWrapper.cs (.../MacroStabilityOutwardsKernelWrapper.cs) (revision 5755) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityOutwards/MacroStabilityOutwardsKernelWrapper.cs (.../MacroStabilityOutwardsKernelWrapper.cs) (revision 5811) @@ -99,6 +99,11 @@ throw new NotImplementedException(); } + if (damKernelInput.OriginalSoilProfile2D != null) + { + damKernelInput.SubSoilScenario.SoilProfile2D = damKernelInput.OriginalSoilProfile2D.Clone(); + } + MacroStabilityCommonHelper.CombineSoilProfileWithSurfaceLine(damKernelInput.SubSoilScenario, damKernelInput.Location.SurfaceLine, damKernelInput.CurrentEmbankmentSoil, damKernelInput.Location.XSoilGeometry2DOrigin); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs =================================================================== diff -u -r5534 -r5811 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 5534) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs (.../DesignCalculatorFirstSlopeAdaptionThenShoulderAdaption.cs) (revision 5811) @@ -120,7 +120,7 @@ while (isRedesignRequired && (coTangent < endCoTangent)) { // Always start with the original soil profile - damKernelInput.SubSoilScenario.SoilProfile2D = damKernelInput.OriginalSoilProfile2D; + damKernelInput.SubSoilScenario.SoilProfile2D = damKernelInput.OriginalSoilProfile2D.Clone(); iterationIndex++; DesignCalculatorUtils.ThrowWhenMaxIterationsExceeded(iterationIndex, maxRedesignIterations); @@ -153,7 +153,7 @@ while (isRedesignRequired && surfaceLine != null) { // Always start with the original soil profile - damKernelInput.SubSoilScenario.SoilProfile2D = damKernelInput.OriginalSoilProfile2D; + damKernelInput.SubSoilScenario.SoilProfile2D = damKernelInput.OriginalSoilProfile2D.Clone(); iterationIndex++; DesignCalculatorUtils.ThrowWhenMaxIterationsExceeded(iterationIndex, maxRedesignIterations); Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r5778 -r5811 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 5778) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 5811) @@ -44,7 +44,7 @@ private const double tolerance = 0.00051; private const string mapTestFiles = @"TestFiles\"; private const string tutorialStability2D = @"TestFiles\InputTutorialStability2D.xml"; - + [Test, Category(Categories.Slow)] public void TestRunMacroStabilityTutorialDesignUpliftVan() { @@ -332,7 +332,6 @@ }); } - [Test, Category(Categories.Slow), Ignore("Work in progress")] public void DesignBishopOptimizedSlopeAndShoulderAdaptionWithScenariosForHeadPL3CalculatesCorrect() { @@ -400,11 +399,10 @@ // Set UseNewMinDistanceDikeToeStartDitch(Use new allowed distance toe-ditch) = true (to force value to be written to XML) // // Parameters: CalcDir - StabilityModel - DesignStrategy - CalculationResult - FoS - EntryPointX - ExitPointX - DikeLength - ShoulderHeight - Iterations - ResultMessage - [TestCase("TestStabInwardsBishopDesignSequential", "Bishop", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.476, 45.387, 2.799, 5, "")] - [TestCase("TestStabInwardsBishopDesignOptimized", "Bishop", "OptimizedSlopeAndShoulderAdaption", CalculationResult.Succeeded, 1.466, 43.760, 3.889, 4, "")] - [TestCase("TestStabInwardsUpliftVanDesignSequential", "UpliftVan", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.437, 47.737, 3.132, 6, "")] - //ToDo MWDAM-2474 UpliftVan Optimized does not give expected result - // [TestCase("TestStabInwardsUpliftVanDesignOptimized", "UpliftVan", "OptimizedSlopeAndShoulderAdaption", CalculationResult.RunFailed, 1.214, 0.0, 0.0, 4, "The new shoulder height with topslope exceeds the allowed maximum height.")] + [TestCase("TestStabInwardsBishopDesignSequential", "Bishop", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.437, 45.387, 2.799, 5, "")] + [TestCase("TestStabInwardsBishopDesignOptimized", "Bishop", "OptimizedSlopeAndShoulderAdaption", CalculationResult.Succeeded, 1.420, 43.760, 3.889, 4, "")] + [TestCase("TestStabInwardsUpliftVanDesignSequential", "UpliftVan", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.415, 47.737, 3.132, 6, "")] + [TestCase("TestStabInwardsUpliftVanDesignOptimized", "UpliftVan", "OptimizedSlopeAndShoulderAdaption", CalculationResult.Succeeded, 1.405, 80.402, 4.545, 20, "")] public void CanPerformStabilityInwardsDesignTutorialDesignOptimizedSlopeAndShoulderAdaption_OneLocation( string calcDir, string stabilityModel, string designStrategy, CalculationResult calculationResult, double expectedSafetyFactor, @@ -439,12 +437,16 @@ SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].StabilityDesignResults.RedesignedSurfaceLine; if (redesignedSurfaceLine != null) { - Assert.That(redesignedSurfaceLine.GetDikeLength(), Is.EqualTo(expectedDikeLength).Within(tolerance)); + double? actualDikeLength = redesignedSurfaceLine.GetDikeLength(); GeometryPoint pointShoulderBaseInside = redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); - if (pointShoulderBaseInside != null) + Assert.Multiple(() => { - Assert.That(pointShoulderBaseInside.Z, Is.EqualTo(expectedShoulderHeight).Within(tolerance)); - } + Assert.That(actualDikeLength, Is.EqualTo(expectedDikeLength).Within(tolerance)); + if (pointShoulderBaseInside != null) + { + Assert.That(pointShoulderBaseInside.Z, Is.EqualTo(expectedShoulderHeight).Within(tolerance)); + } + }); } } @@ -481,9 +483,9 @@ const string analysisType = "AdaptGeometry"; // Test just to see if calculation works in this case as it should do. Output output = GetOutputStringForProject(analysisType, true); - + Assert.That(output.Results.CalculationResults, Is.Not.Null, "No results available"); - Assert.That(output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Is.EqualTo(1.268).Within(0.0005)); + Assert.That(output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Is.EqualTo(1.356).Within(0.0005)); } [Test] @@ -826,7 +828,7 @@ Assert.That(File.Exists(file), Is.False, file + " does exist"); } } - + /// /// This test uses the location DWP 1 of the Design Tutorial Stability. /// Different values for the degree of consolidation (DoC) of the layers due to the traffic load are tested. @@ -849,6 +851,7 @@ { Directory.Delete(calcDir, true); } + string inputString = File.ReadAllText(tutorialStability2D); string[] locations = ["DWP_1"]; inputString = XmlAdapter.SelectLocations(inputString, locations); @@ -935,18 +938,18 @@ }); } - [TestCase("DWP_1", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.4, 1.493, 5)] - [TestCase("DWP_1", "OptimizedSlopeAndShoulderAdaption",CalculationResult.Succeeded, 1.4, 1.571, 4)] - [TestCase("DWP_2", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.5, 1.546, 9)] - [TestCase("DWP_2", "OptimizedSlopeAndShoulderAdaption", CalculationResult.RunFailed, 1.5, 1.027, 17)] - [TestCase("DWP_13", "OptimizedSlopeAndShoulderAdaption", CalculationResult.RunFailed, 1.5, 0.936, 23, "The characteristic points of the surfaceline are not ascending in X-direction.")] + [TestCase("DWP_1", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.Succeeded, 1.4, 1.456, 5)] + [TestCase("DWP_1", "OptimizedSlopeAndShoulderAdaption", CalculationResult.Succeeded, 1.4, 1.520, 4)] + [TestCase("DWP_2", "SlopeAdaptionBeforeShoulderAdaption", CalculationResult.RunFailed, 1.5, 1.348, 14, "After height adaption ditch does not fit inside surfaceline anymore.")] + [TestCase("DWP_2", "OptimizedSlopeAndShoulderAdaption", CalculationResult.RunFailed, 1.5, 1.072, 17)] + [TestCase("DWP_13", "OptimizedSlopeAndShoulderAdaption", CalculationResult.RunFailed, 1.5, 0.943, 23, "The characteristic points of the surfaceline are not ascending in X-direction.")] public void GivenTutorialDesign_WhenSpecifiedLocationRunWithGeometryAdaption_ThenGivesExpectedResults(string locationId, string designMethod, - CalculationResult calculationResult, double requiredSafetyFactor, double actualSafetyFactor, int iterationCount, string errorMessage= "") + CalculationResult calculationResult, double requiredSafetyFactor, double actualSafetyFactor, int iterationCount, string errorMessage = "") { // Create xml with Tutorial project // Select location DWP_1 // Calculation options: Stability Inside - Bishop - string calcDir = $"TestStabInwardsBishop_AdaptGeometry_{locationId}_{designMethod}_{requiredSafetyFactor.ToString(CultureInfo.InvariantCulture)}"; + var calcDir = $"TestStabInwardsBishop_AdaptGeometry_{locationId}_{designMethod}_{requiredSafetyFactor.ToString(CultureInfo.InvariantCulture)}"; if (Directory.Exists(calcDir)) { Directory.Delete(calcDir, true); // delete previous results @@ -975,10 +978,12 @@ if (calculationResult == CalculationResult.Succeeded) { Assert.That(output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Is.GreaterThanOrEqualTo(requiredSafetyFactor)); - } else if (!errorMessage.Equals("")) + } + else if (!errorMessage.Equals("")) { Assert.That(output.Results.CalculationMessages.Last().Message1, Does.Contain(errorMessage)); } + Assert.That(output.Results.CalculationResults[0].StabilityDesignResults.SafetyFactor, Is.EqualTo(actualSafetyFactor).Within(tolerance)); Assert.That(output.Results.CalculationResults[0].StabilityDesignResults.NumberOfIterations, Is.EqualTo(iterationCount)); }); @@ -1009,7 +1014,7 @@ inputString = XmlAdapter.ChangeValueInXml(inputString, "DikeTableHeight", "5.9"); inputString = XmlAdapter.ChangeValueInXml(inputString, "RiverLevel", "5.5"); inputString = XmlAdapter.ChangeValueInXml(inputString, "RequiredSafetyFactorStabilityInnerSlope", "1.2"); - + return GeneralHelper.RunAfterInputValidation(inputString, isSuccessful); }