Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/EngineToMacroStabilityKernelInputTests.cs =================================================================== diff -u -r6465 -r6521 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/EngineToMacroStabilityKernelInputTests.cs (.../EngineToMacroStabilityKernelInputTests.cs) (revision 6465) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/EngineToMacroStabilityKernelInputTests.cs (.../EngineToMacroStabilityKernelInputTests.cs) (revision 6521) @@ -448,7 +448,7 @@ } }; // When - FillMacroStabilityKernelInputFromEngine.TransferSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); + FillMacroStabilityKernelInputFromEngine.DetermineSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); Assert.Multiple(() => { // Then @@ -470,7 +470,7 @@ } }; // When - FillMacroStabilityKernelInputFromEngine.TransferSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); + FillMacroStabilityKernelInputFromEngine.DetermineSlipPlaneConstraints(damKernelInput.Location, macroStabilityInput.StabilityModel.SlipPlaneConstraints); Assert.Multiple(() => { // Then Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InputConversionHelper.cs =================================================================== diff -u -r6420 -r6521 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InputConversionHelper.cs (.../InputConversionHelper.cs) (revision 6420) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InputConversionHelper.cs (.../InputConversionHelper.cs) (revision 6521) @@ -179,6 +179,9 @@ Data.Geotechnics.CharacteristicPointType.DitchPolderSide, CharacteristicPointType.DitchPolderSide }, { + Data.Geotechnics.CharacteristicPointType.DikeLine, CharacteristicPointType.None + }, + { Data.Geotechnics.CharacteristicPointType.None, CharacteristicPointType.None }, { Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs =================================================================== diff -u -r6506 -r6521 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 6506) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelper.cs (.../MacroStabilityCommonHelper.cs) (revision 6521) @@ -89,7 +89,7 @@ /// Fills the traffic load. /// /// The dam kernel input. - /// + /// Filled traffic load public static TrafficLoad FillTrafficLoad(DamKernelInput damKernelInput) { TrafficLoad trafficLoad = null; @@ -110,10 +110,10 @@ } /// - /// Fills the bishop calculation grid. + /// Fills the bishop calculation grid and tangent lines. /// /// The dam kernel input. - /// + /// Filled grid and tangent lines public static BishopCalculationGrid FillBishopCalculationGrid(DamKernelInput damKernelInput) { SlipCircleDefinition slipCircleDefinition = damKernelInput.DamFailureMechanismeCalculationSpecification @@ -152,7 +152,7 @@ /// /// /// - /// + /// Filled UpliftVan calculation grids (left and right) and tangent lines public static UpliftVanCalculationGrid FillUpliftVanCalculationGrid(DamKernelInput damKernelInput, double xCoordinateLastUpliftPoint) { SlipCircleDefinition slipCircleDefinition = damKernelInput.DamFailureMechanismeCalculationSpecification Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelperTests.cs =================================================================== diff -u -r6404 -r6521 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelperTests.cs (.../MacroStabilityCommonHelperTests.cs) (revision 6404) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityCommonHelperTests.cs (.../MacroStabilityCommonHelperTests.cs) (revision 6521) @@ -21,6 +21,7 @@ using System; using System.Linq; +using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geometry; @@ -274,6 +275,57 @@ Assert.Throws(() => { MacroStabilityCommonHelper.CombineSoilProfileWithSurfaceLine(soilGeometryProbability, surfaceLine, new Soil()); }); } + [Test] + public void GivenDamEngineDataModelWhenFillingUpliftVanCalculationGridThenCorrectUpliftVanCalculationGridIsCreated() + { + // Given DamEngine data (DamProjectData) + DamProjectData expectedDamProjectData = FactoryForDamProjectData.CreateExampleDamProjectData(); + expectedDamProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications[0] + .StabilityModelType = StabilityModelType.UpliftVan; + + Location expectedLocation = expectedDamProjectData.Dike.Locations[0]; + SurfaceLine2 expectedSurfaceLine2D = expectedLocation.SurfaceLine; + var damKernelInput = new DamKernelInput + { + SubSoilScenario = expectedLocation.Segment.SoilProfileProbabilities[0], + Location = expectedLocation, + DamFailureMechanismeCalculationSpecification = expectedDamProjectData.DamProjectCalculationSpecification.CurrentSpecification + }; + + // Determine the proper values for grid and traffic load using the helper methods + double xCoordinateLowestUpliftFactorPoint = (expectedSurfaceLine2D.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeTopAtPolder).X + + expectedSurfaceLine2D.CharacteristicPoints.GetPoint2D(CharacteristicPointType.DikeToeAtPolder).X) * 0.5; + UpliftVanCalculationGrid expectedUpliftVanCalculationGrid = FillExpectedUpliftVanCalculationGrid(); + UpliftVanCalculationGrid createdUpliftVanCalculationGrid = MacroStabilityCommonHelper.FillUpliftVanCalculationGrid(damKernelInput, xCoordinateLowestUpliftFactorPoint); + CompareHelper.CompareUpliftVanCalculationGrid(expectedUpliftVanCalculationGrid, createdUpliftVanCalculationGrid, true); + } + + private static UpliftVanCalculationGrid FillExpectedUpliftVanCalculationGrid() + { + UpliftVanCalculationGrid upliftVanCalculationGrid = new UpliftVanCalculationGrid + { + IsGridsAutomatic = false, + LeftGridXCount = 6, + LeftGridXLeft = 11, + LeftGridXRight = 14.5, + LeftGridZBottom = 5.2667, + LeftGridZCount = 3, + LeftGridZTop = 7.8666, + RightGridXCount = 8, + RightGridXLeft = 18, + RightGridXRight = 24, + RightGridZBottom = 1.2, + RightGridZCount = 11, + RightGridZTop = 2.6, + TangentLineCount = 0, + TangentLineZBottom = 0, + TangentLineZTop = 0, + TangentLinesCreationMethod = TangentLinesDefinition.OnBoundaryLines, + TangentLineLevels = [] + }; + return upliftVanCalculationGrid; + } + private static SoilGeometryProbability CreateSoilGeometryProbabilityWithSoilProfile2DWithSurfaceLineDitchDike() { SoilGeometryProbability soilGeometryProbability = FactoryForSoilGeometryProbabilities.CreateSoilGeometryProbabilityWithSoilProfile1D(); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InputConversionHelperTests.cs =================================================================== diff -u -r6404 -r6521 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InputConversionHelperTests.cs (.../InputConversionHelperTests.cs) (revision 6404) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/InputConversionHelperTests.cs (.../InputConversionHelperTests.cs) (revision 6521) @@ -186,6 +186,7 @@ [TestCase(Data.Geotechnics.CharacteristicPointType.DikeTopAtRiver, CharacteristicPointType.DikeTopAtRiver)] [TestCase(Data.Geotechnics.CharacteristicPointType.DitchDikeSide, CharacteristicPointType.DitchDikeSide)] [TestCase(Data.Geotechnics.CharacteristicPointType.DitchPolderSide, CharacteristicPointType.DitchPolderSide)] + [TestCase(Data.Geotechnics.CharacteristicPointType.DikeLine, CharacteristicPointType.None)] [TestCase(Data.Geotechnics.CharacteristicPointType.None, CharacteristicPointType.None)] [TestCase(Data.Geotechnics.CharacteristicPointType.ShoulderBaseInside, CharacteristicPointType.ShoulderBaseInside)] [TestCase(Data.Geotechnics.CharacteristicPointType.ShoulderBaseOutside, CharacteristicPointType.ShoulderBaseOutside)] Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/CompareHelper.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/CompareHelper.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/CompareHelper.cs (revision 6521) @@ -0,0 +1,55 @@ +// Copyright (C) Stichting Deltares 2025. All rights reserved. +// +// This file is part of the Dam Engine. +// +// The Dam Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon; +using NUnit.Framework; + +namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.MacroStabilityCommon; + +public static class CompareHelper +{ + public static void CompareUpliftVanCalculationGrid(UpliftVanCalculationGrid expectedSlipPlaneUpliftVan, + UpliftVanCalculationGrid actualSlipPlaneUpliftVan, bool areTangentLineSpecified) + { + const double tolerance = 1e-3; + Assert.Multiple(() => + { + Assert.That(actualSlipPlaneUpliftVan.LeftGridXLeft, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridXLeft).Within(tolerance)); + Assert.That(actualSlipPlaneUpliftVan.LeftGridXRight, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridXRight).Within(tolerance)); + Assert.That(actualSlipPlaneUpliftVan.LeftGridZTop, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridZTop).Within(tolerance)); + Assert.That(actualSlipPlaneUpliftVan.LeftGridZBottom, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridZBottom).Within(tolerance)); + Assert.That(actualSlipPlaneUpliftVan.LeftGridXCount, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridXCount)); + Assert.That(actualSlipPlaneUpliftVan.LeftGridZCount, Is.EqualTo(expectedSlipPlaneUpliftVan.LeftGridZCount)); + + Assert.That(actualSlipPlaneUpliftVan.RightGridXLeft, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridXLeft).Within(tolerance)); + Assert.That(actualSlipPlaneUpliftVan.RightGridXRight, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridXRight).Within(tolerance)); + Assert.That(actualSlipPlaneUpliftVan.RightGridZTop, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridZTop).Within(tolerance)); + Assert.That(actualSlipPlaneUpliftVan.RightGridZBottom, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridZBottom).Within(tolerance)); + Assert.That(actualSlipPlaneUpliftVan.RightGridXCount, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridXCount)); + Assert.That(actualSlipPlaneUpliftVan.RightGridZCount, Is.EqualTo(expectedSlipPlaneUpliftVan.RightGridZCount)); + }); + + if (areTangentLineSpecified) + { + Assert.That(actualSlipPlaneUpliftVan.TangentLineLevels, Is.EqualTo(expectedSlipPlaneUpliftVan.TangentLineLevels).AsCollection.Within(tolerance)); + } + } +} \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityKernelInputFromEngine.cs =================================================================== diff -u -r6476 -r6521 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityKernelInputFromEngine.cs (.../FillMacroStabilityKernelInputFromEngine.cs) (revision 6476) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityKernelInputFromEngine.cs (.../FillMacroStabilityKernelInputFromEngine.cs) (revision 6521) @@ -291,7 +291,7 @@ throw new NotImplementedException(nameof(mStabParameters.Model)); } - TransferSlipPlaneConstraints(damKernelInput.Location, kernelStabilityInput.SlipPlaneConstraints); + DetermineSlipPlaneConstraints(damKernelInput.Location, kernelStabilityInput.SlipPlaneConstraints); TransferStabilityModelProperties(mStabParameters, kernelStabilityInput); kernelStabilityInput.ConstructionStages[0] = new ConstructionStageInputType(); @@ -372,7 +372,7 @@ kernelStabilityInput.NumberOfRefinementsTangentLines = 2; } - internal static void TransferSlipPlaneConstraints(Location damLocation, SlipPlaneConstraintsType kernelSlipPlaneConstraints) + internal static void DetermineSlipPlaneConstraints(Location damLocation, SlipPlaneConstraintsType kernelSlipPlaneConstraints) { if (damLocation.StabilityOptions == null) {