Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs =================================================================== diff -u -r4540 -r5471 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculatorCombinedSlopeAndShoulderAdaption.cs (.../DesignCalculatorCombinedSlopeAndShoulderAdaption.cs) (revision 5471) @@ -24,6 +24,7 @@ using System.Linq; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon; using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.Design; using Deltares.DamEngine.Data.General; @@ -90,7 +91,7 @@ location.AlignBoundaryPointsOfPl1LineWithAdaptedSurfaceLine(surfaceLine); List locationCalculationMessages; DesignCalculatorUtils.KernelCalculate(out kernelDataInput, kernelWrapper, out kernelDataOutput, damKernelInput, - iterationIndex, out locationCalculationMessages); + iterationIndex, out locationCalculationMessages); calculationMessages.AddRange(locationCalculationMessages); DesignAdvise designAdvise; string evaluationMessage; @@ -107,8 +108,12 @@ double maxFractionOfDikeHeightForShoulderHeight = location.UseNewMaxHeightShoulderAsFraction ? location.NewMaxHeightShoulderAsFraction : defaultMaxFractionOfDikeHeightForShoulderHeight; double maxShoulderLevel = DesignCalculatorUtils.CalculateMaximumShoulderLevel(surfaceLine, maxFractionOfDikeHeightForShoulderHeight); + var orgSoilProfile2D = damKernelInput.SubSoilScenario.SoilProfile2D.Clone(); + damKernelInput.CurrentEmbankmentSoil = location.GetDikeEmbankmentSoil(); while (isRedesignRequired && surfaceLine != null) { + // Always start with the original soil profile + damKernelInput.SubSoilScenario.SoilProfile2D = orgSoilProfile2D; iterationIndex++; DesignCalculatorUtils.ThrowWhenMaxIterationsExceeded(iterationIndex, maxRedesignIterations); @@ -169,7 +174,7 @@ Soil embankmentSoil = location.SoilList.GetSoilByName(embankmentDesignParameters.EmbankmentMaterialname); subSoilScenario.SoilProfile2D = - AdaptProfile2DToNewSurfaceLine(subSoilScenario.SoilProfile2D, surfaceLine, embankmentSoil); + MacroStabilityCommonHelper.CombineSoilProfileWithSurfaceLine(subSoilScenario, surfaceLine, embankmentSoil); } DesignCalculatorUtils.KernelCalculate(out kernelDataInput, kernelWrapper, out kernelDataOutput, damKernelInput, @@ -205,32 +210,4 @@ throw new DesignCalculatorException(Resources.DesignUnsuccessful + " " + errorMessage); } } - - private static SoilProfile2D AdaptProfile2DToNewSurfaceLine(SoilProfile2D soilProfile2D, SurfaceLine2 surfaceLine, Soil dikeEmbankmentSoil) - { - double topX = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X; - SoilProfile1D soilProfile1D = soilProfile2D.GetSoilProfile1D(topX); - var soilSurfaceProfile = new SoilSurfaceProfile - { - SoilProfile = soilProfile1D, - SurfaceLine2 = surfaceLine, - Name = soilProfile2D.Name, - DikeEmbankmentMaterial = dikeEmbankmentSoil - }; - // Convert the soilSurfaceProfile to a SoilProfile2D to be able to edit it properly. - SoilProfile2D soilProfile2DNew = soilSurfaceProfile.ConvertToSoilProfile2D(); - int numberOfCommonSurface = Math.Min(soilProfile2DNew.Surfaces.Count, soilProfile2D.Surfaces.Count); - for (var i = 0; i < numberOfCommonSurface; i++) - { - soilProfile2DNew.Surfaces[i].WaterpressureInterpolationModel = - soilProfile2D.Surfaces[i].WaterpressureInterpolationModel; - } - - for (int i = numberOfCommonSurface; i < soilProfile2DNew.Surfaces.Count; i++) - { - soilProfile2DNew.Surfaces[i].WaterpressureInterpolationModel = WaterpressureInterpolationModel.Automatic; - } - - return soilProfile2DNew; - } } \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs =================================================================== diff -u -r5466 -r5471 --- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 5466) +++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 5471) @@ -487,7 +487,7 @@ } [TestCase("SlopeAdaptionBeforeShoulderAdaption", 1.4, 1.515, 5)] - [TestCase("OptimizedSlopeAndShoulderAdaption", 1.4, 1.426, 3)] + [TestCase("OptimizedSlopeAndShoulderAdaption", 1.4, 1.581, 4)] public void GivenTutorialDesignDwp1_WhenRunWithGeometryAdaption_ThenGivesExpectedResults(string designMethod, double requiredSafetyFactor, double actualSafetyFactor, int iterationCount) {