Index: DamEngine/trunk/xsd/DamStabilityParameters.xsd =================================================================== diff -u -r5703 -r5720 --- DamEngine/trunk/xsd/DamStabilityParameters.xsd (.../DamStabilityParameters.xsd) (revision 5703) +++ DamEngine/trunk/xsd/DamStabilityParameters.xsd (.../DamStabilityParameters.xsd) (revision 5720) @@ -45,6 +45,7 @@ + Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs =================================================================== diff -u -r5702 -r5720 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs (.../UpliftVanGridCreator.cs) (revision 5702) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreator.cs (.../UpliftVanGridCreator.cs) (revision 5720) @@ -40,7 +40,7 @@ var upliftVanCalculationGrid = new UpliftVanCalculationGrid { IsGridsAutomatic = slipCircleDefinition.UpliftVanGridSizeDetermination == GridSizeDetermination.Automatic, - IsTangentLinesAutomatic = slipCircleDefinition.UpliftVanTangentLinesDefinition == TangentLinesDefinition.OnBoundaryLines, + TangentLinesCreationMethod = slipCircleDefinition.UpliftVanTangentLinesDefinition, RightGridXLeft = 0, RightGridXRight = 0, RightGridXCount = 0, @@ -120,17 +120,11 @@ public static void DetermineTangentLines(UpliftVanCalculationGrid upliftVanCalculationGrid, SlipCircleDefinition slipCircleDefinition, SoilProfile1D soilProfile1D) { - switch (slipCircleDefinition.UpliftVanTangentLinesDefinition) + upliftVanCalculationGrid.TangentLinesCreationMethod = slipCircleDefinition.UpliftVanTangentLinesDefinition; + if (slipCircleDefinition.UpliftVanTangentLinesDefinition == TangentLinesDefinition.Specified) { - case TangentLinesDefinition.OnBoundaryLines: - // In the Macrostability kernel, the automatic tangent lines are set to the boundaries, no need to do anything here. - upliftVanCalculationGrid.IsTangentLinesAutomatic = true; - break; - case TangentLinesDefinition.Specified: - upliftVanCalculationGrid.IsTangentLinesAutomatic = false; - DetermineTangentLinesSpecified(upliftVanCalculationGrid, soilProfile1D, - slipCircleDefinition.UpliftVanTangentLinesDistance); - break; + DetermineTangentLinesSpecified(upliftVanCalculationGrid, soilProfile1D, + slipCircleDefinition.UpliftVanTangentLinesDistance); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs =================================================================== diff -u -r5702 -r5720 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 5702) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 5720) @@ -372,8 +372,10 @@ private void TransferUpliftVanSearchAreaSettings(SearchAreaConditions kernelSearchAreaConditions) { - kernelSearchAreaConditions.AutoTangentLines = UpliftVanCalculationGrid.IsTangentLinesAutomatic; + kernelSearchAreaConditions.AutoTangentLines = UpliftVanCalculationGrid.TangentLinesCreationMethod is TangentLinesDefinition.Automatic or TangentLinesDefinition.OnBoundaryLines; kernelSearchAreaConditions.AutoSearchArea = UpliftVanCalculationGrid.IsGridsAutomatic; + kernelSearchAreaConditions.OnlyAbovePleistoceen = UpliftVanCalculationGrid.TangentLinesCreationMethod == TangentLinesDefinition.Automatic; + kernelSearchAreaConditions.MaxSpacingBetweenBoundaries = 0.8; kernelSearchAreaConditions.TangentLineNumber = UpliftVanCalculationGrid.TangentLineCount; kernelSearchAreaConditions.TangentLineZTop = UpliftVanCalculationGrid.TangentLineZTop; kernelSearchAreaConditions.TangentLineZBottom = UpliftVanCalculationGrid.TangentLineZBottom; @@ -429,7 +431,7 @@ GridZBottom = UpliftVanCalculationGrid.RightGridZBottom }; - if (!UpliftVanCalculationGrid.IsTangentLinesAutomatic) + if (UpliftVanCalculationGrid.TangentLinesCreationMethod == TangentLinesDefinition.Specified) { kernelUpliftVanCalculationGrid.TangentLines = UpliftVanCalculationGrid.TangentLineLevels.ToArray(); } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreatorTests.cs =================================================================== diff -u -r5702 -r5720 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreatorTests.cs (.../UpliftVanGridCreatorTests.cs) (revision 5702) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityInwards/UpliftVanGridCreatorTests.cs (.../UpliftVanGridCreatorTests.cs) (revision 5720) @@ -41,7 +41,7 @@ public void GivenGridSpecified_WhenDetermineGridsFromSettings_ThenGridsAreAsExpected() { // Given - SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(true, true); + SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(true); SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateSurfaceLineForTestingGrid(10.0, 80.0); // When UpliftVanCalculationGrid upliftVanCalculationGrid = UpliftVanGridCreator.DetermineGridsFromSettings(slipCircleDefinition, surfaceLine); @@ -62,7 +62,7 @@ public void GivenGridSpecifiedWithRightGridOverRightBoundary_WhenDetermineGridsFromSettings_ThenRightGridLimitedToRightBoundary() { // Given - SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(true, true); + SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(true); SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateSurfaceLineForTestingGrid(10.0, 65.0); // When UpliftVanCalculationGrid upliftVanCalculationGrid = UpliftVanGridCreator.DetermineGridsFromSettings(slipCircleDefinition, surfaceLine); @@ -80,7 +80,7 @@ public void GivenGridSpecifiedWithUpliftPoint_WhenDetermineGridsFromSettings_ThenRightGridStartsAsExpected() { // Given - SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(true, true); + SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(true); slipCircleDefinition.XCoordinateLowestUpliftFactorPoint = 75.0; SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateSurfaceLineForTestingGrid(10.0, 80.0); // When @@ -102,7 +102,7 @@ public void GivenGridAutomatic_WhenDetermineGridsFromSettings_ThenIsGridsAutomatic() { // Given - SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(false, true); + SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(false); SurfaceLine2 surfaceLine = FactoryForSurfaceLines.CreateSurfaceLineForTestingGrid(10.0, 80.0); // When UpliftVanCalculationGrid upliftVanCalculationGrid = UpliftVanGridCreator.DetermineGridsFromSettings(slipCircleDefinition, surfaceLine); @@ -113,12 +113,13 @@ } [Test] - [TestCase(true)] - [TestCase(false)] - public void GivenSlipCircleDefinitionAndSoilProfile1D_WhenDetermineTangentLines_ThenTangentLinesAreAsExpected(bool isTangentLinesSpecified) + [TestCase(TangentLinesDefinition.OnBoundaryLines)] + [TestCase(TangentLinesDefinition.Specified)] + [TestCase(TangentLinesDefinition.Automatic)] + public void GivenSlipCircleDefinitionAndSoilProfile1D_WhenDetermineTangentLines_ThenTangentLinesAreAsExpected(TangentLinesDefinition tangentLinesDefinition) { // Given - SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(true, isTangentLinesSpecified); + SlipCircleDefinition slipCircleDefinition = CreateSlipCircleDefinitionSpecified(true, tangentLinesDefinition); SoilProfile1D soilProfile1D = FactoryForSoilProfiles.CreateClaySandProfile(out _, surfaceLevelSoilProfile1D, bottomLayerSoilProfile1D); // When @@ -127,7 +128,6 @@ // Then Assert.Multiple(() => { - Assert.That(upliftVanCalculationGrid.IsTangentLinesAutomatic, Is.Not.EqualTo(isTangentLinesSpecified)); CheckValuesTangentLines(upliftVanCalculationGrid); }); } @@ -190,7 +190,7 @@ var expectedZTop = 0.0; var expectedCount = 0; - if (!upliftVanCalculationGrid.IsTangentLinesAutomatic) + if (upliftVanCalculationGrid.TangentLinesCreationMethod == TangentLinesDefinition.Specified) { expectedZBottom = bottomLayerSoilProfile1D - specifiedTangentDistance; expectedCount = (int) Math.Round((surfaceLevelSoilProfile1D - expectedZBottom) / specifiedTangentDistance) + 1; @@ -206,7 +206,7 @@ }); } - private static SlipCircleDefinition CreateSlipCircleDefinitionSpecified(bool isGridSpecified, bool isTangentLinesSpecified) + private static SlipCircleDefinition CreateSlipCircleDefinitionSpecified(bool isGridSpecified, TangentLinesDefinition tangentLinesDefinition = TangentLinesDefinition.Automatic) { var slipCircleDefinition = new SlipCircleDefinition { @@ -219,7 +219,7 @@ UpliftVanRightGridVerticalPointDistance = 2, UpliftVanRightGridHorizontalPointCount = 6, UpliftVanRightGridHorizontalPointDistance = 2, - UpliftVanTangentLinesDefinition = isTangentLinesSpecified ? TangentLinesDefinition.Specified: TangentLinesDefinition.OnBoundaryLines, + UpliftVanTangentLinesDefinition = tangentLinesDefinition, UpliftVanTangentLinesDistance = specifiedTangentDistance }; return slipCircleDefinition; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs =================================================================== diff -u -r5702 -r5720 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs (.../FillEngineFromMacroStabilityWrapperInput.cs) (revision 5702) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillEngineFromMacroStabilityWrapperInput.cs (.../FillEngineFromMacroStabilityWrapperInput.cs) (revision 5720) @@ -178,7 +178,7 @@ if (kernelSearchAreaConditions.AutoTangentLines) { - SlipCircleDefinition.UpliftVanTangentLinesDefinition = TangentLinesDefinition.OnBoundaryLines; + SlipCircleDefinition.UpliftVanTangentLinesDefinition = kernelSearchAreaConditions.OnlyAbovePleistoceen ? TangentLinesDefinition.Automatic : TangentLinesDefinition.OnBoundaryLines; } else { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapperTests.cs =================================================================== diff -u -r5702 -r5720 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapperTests.cs (.../MacroStabilityInwardsKernelWrapperTests.cs) (revision 5702) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapperTests.cs (.../MacroStabilityInwardsKernelWrapperTests.cs) (revision 5720) @@ -501,16 +501,24 @@ }); } + /// + /// For a given search method and a given grid determination method, expected is that tangent lines Automatic give a lower + /// safety factor than On boundary lines because there are extra tangent lines. + /// [Test] [TestCase(MStabSearchMethod.Grid, GridSizeDetermination.Specified, TangentLinesDefinition.OnBoundaryLines, 1.2812, 4)] - [TestCase(MStabSearchMethod.Grid, GridSizeDetermination.Automatic, TangentLinesDefinition.OnBoundaryLines, 1.4752, 3)] - [TestCase(MStabSearchMethod.BeeSwarm, GridSizeDetermination.Specified, TangentLinesDefinition.OnBoundaryLines, 2.2763, 3)] - [TestCase(MStabSearchMethod.BeeSwarm, GridSizeDetermination.Automatic, TangentLinesDefinition.OnBoundaryLines, 1.1205, 926)] + [TestCase(MStabSearchMethod.Grid, GridSizeDetermination.Specified, TangentLinesDefinition.Automatic, 1.2360, 2)] [TestCase(MStabSearchMethod.Grid, GridSizeDetermination.Specified, TangentLinesDefinition.Specified, 0.4909, 24)] + [TestCase(MStabSearchMethod.Grid, GridSizeDetermination.Automatic, TangentLinesDefinition.OnBoundaryLines, 1.4752, 3)] + [TestCase(MStabSearchMethod.Grid, GridSizeDetermination.Automatic, TangentLinesDefinition.Automatic, 1.1437, 3)] [TestCase(MStabSearchMethod.Grid, GridSizeDetermination.Automatic, TangentLinesDefinition.Specified, 1.1475, 3)] + [TestCase(MStabSearchMethod.BeeSwarm, GridSizeDetermination.Specified, TangentLinesDefinition.OnBoundaryLines, 2.2763, 3)] + [TestCase(MStabSearchMethod.BeeSwarm, GridSizeDetermination.Specified, TangentLinesDefinition.Automatic, 2.0267, 3)] [TestCase(MStabSearchMethod.BeeSwarm, GridSizeDetermination.Specified, TangentLinesDefinition.Specified, 1.7680, 3)] + [TestCase(MStabSearchMethod.BeeSwarm, GridSizeDetermination.Automatic, TangentLinesDefinition.OnBoundaryLines, 1.1205, 926)] + [TestCase(MStabSearchMethod.BeeSwarm, GridSizeDetermination.Automatic, TangentLinesDefinition.Automatic, 1.1123, 800)] [TestCase(MStabSearchMethod.BeeSwarm, GridSizeDetermination.Automatic, TangentLinesDefinition.Specified, 1.1146, 826)] - public void TestFullCalculationSucceedsWithUpliftVan(MStabSearchMethod searchMethod, GridSizeDetermination gridSizeDetermination, TangentLinesDefinition tangentLinesDefinition, double expectedSafetyFactor, int expectedLogMessageCount) + public void GivenUpliftVanModel_WhenCalculatingWithDifferentSearchAreaSettings_ReturnsLogicalResults(MStabSearchMethod searchMethod, GridSizeDetermination gridSizeDetermination, TangentLinesDefinition tangentLinesDefinition, double expectedSafetyFactor, int expectedLogMessageCount) { // Prepare the wrapper. Result is input for the calculation dll DamKernelInput kernelInput = CreateDamKernelInputForTest(MStabModelType.UpliftVan, searchMethod, gridSizeDetermination, tangentLinesDefinition); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/UpliftVanCalculationGrid.cs =================================================================== diff -u -r4540 -r5720 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/UpliftVanCalculationGrid.cs (.../UpliftVanCalculationGrid.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/UpliftVanCalculationGrid.cs (.../UpliftVanCalculationGrid.cs) (revision 5720) @@ -20,6 +20,7 @@ // All rights reserved. using System.Collections.Generic; +using Deltares.DamEngine.Data.General; namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon; @@ -77,13 +78,13 @@ /// Gets or sets the right grid z count. /// The right grid z count. public int RightGridZCount { get; set; } + + /// Gets or sets the tangent line creation method: automatic, specified or on boundary lines. + /// The tangent line creation setting . + public TangentLinesDefinition TangentLinesCreationMethod { get; set; } /// Gets or sets the tangent line z top. /// The tangent line z top. - /// Gets or sets the tangent line creation automatic or specified. - /// The tangent line creation setting . - public bool IsTangentLinesAutomatic { get; set; } - public double TangentLineZTop { get; set; } /// Gets or sets the tangent line z bottom. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs =================================================================== diff -u -r5702 -r5720 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 5702) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 5720) @@ -152,7 +152,7 @@ RightGridZBottom = random.NextDouble(), RightGridXCount = random.Next(), RightGridZCount = random.Next(), - IsTangentLinesAutomatic = true, + TangentLinesCreationMethod = TangentLinesDefinition.OnBoundaryLines, TangentLineZBottom = 0, TangentLineZTop = 10, TangentLineCount = 10 Index: DamEngine/trunk/src/Deltares.DamEngine.Data/General/StabilityEnumerations.cs =================================================================== diff -u -r4540 -r5720 --- DamEngine/trunk/src/Deltares.DamEngine.Data/General/StabilityEnumerations.cs (.../StabilityEnumerations.cs) (revision 4540) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/General/StabilityEnumerations.cs (.../StabilityEnumerations.cs) (revision 5720) @@ -22,7 +22,7 @@ namespace Deltares.DamEngine.Data.General; /// -/// Types of (calculation) models for Stability. +/// Types of (calculation) model. /// public enum MStabModelType { @@ -41,7 +41,7 @@ } /// -/// Types of Intrusion Vertical Water Pressures +/// Types of intrusion vertical water pressure. /// public enum IntrusionVerticalWaterPressureType { @@ -53,7 +53,7 @@ } /// -/// Types of MStab Shear Strength models +/// Types of shear strength model. /// public enum MStabShearStrength { @@ -66,7 +66,7 @@ } /// -/// Types of MStab Search Methods +/// Types of search method. /// public enum MStabSearchMethod { @@ -76,7 +76,7 @@ } /// -/// Types of MStab Grid Positions +/// Types of grid position. /// public enum MStabGridPosition { @@ -85,7 +85,7 @@ } /// -/// Types of MStab Zones +/// Types of zone. /// public enum MStabZonesType { @@ -94,16 +94,17 @@ } /// -/// Types of tangent lines definitions. +/// Types of tangent lines definition. /// public enum TangentLinesDefinition { OnBoundaryLines = 0, - Specified = 1 + Specified = 1, + Automatic = 2 } /// -/// Types of GridSize Determinations +/// Types of grid size determination. /// public enum GridSizeDetermination {