Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs =================================================================== diff -u -r1007 -r1026 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs (.../MacroStabilityTests.cs) (revision 1007) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/MacroStabilityTests.cs (.../MacroStabilityTests.cs) (revision 1026) @@ -88,6 +88,17 @@ // Profile name = DWP_1.sti Assert.AreEqual("DWP_1.sti", output.Results.CalculationResults.DesignResults[0].ProfileName); + // Uplift + var upliftSituation = output.Results.CalculationResults.DesignResults[0].StabilityDesignResults.UpliftSituation; + Assert.IsNotNull(upliftSituation); + Assert.AreEqual(true, upliftSituation.IsUplift); + Assert.AreEqual(1.141, upliftSituation.Pl3MinUplift, tolerance); + Assert.AreEqual(4.4, upliftSituation.Pl3HeadAdjusted, tolerance); + Assert.AreEqual(60.64, upliftSituation.Pl3LocationXMinUplift, tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4MinUplift, tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4HeadAdjusted, tolerance); + Assert.AreEqual(0.0, upliftSituation.Pl4LocationXMinUplift, tolerance); + // Calculation Result Assert.AreEqual(CalculationResult.Succeeded, ConversionHelper.ConvertToCalculationResult(output.Results.CalculationResults.DesignResults[0].CalculationResult)); } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs =================================================================== diff -u -r877 -r1026 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs (.../PlLinesHelper.cs) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/PlLinesHelper.cs (.../PlLinesHelper.cs) (revision 1026) @@ -45,12 +45,12 @@ /// The uplift situation. /// public static PLLines CreatePlLinesForStability(Location location, SoilGeometryProbability subSoilScenario, - double waterLevel, string soilGeometry2DName, double waterLevelRiverLow, out UpliftSituation upliftSituation) + double waterLevel, string soilGeometry2DName, double? waterLevelRiverLow, out UpliftSituation upliftSituation) { var plLinesCreator = new PLLinesCreator { WaterLevelRiverLow = waterLevelRiverLow, - IsUseLowWaterLevel = !double.IsNaN(waterLevelRiverLow), + IsUseLowWaterLevel = (waterLevelRiverLow != null), WaterLevelRiverHigh = waterLevel, SurfaceLine = location.SurfaceLine, WaterLevelPolder = location.PolderLevel, Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/DamMacroStabilityOutput.cs =================================================================== diff -u -r877 -r1026 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/DamMacroStabilityOutput.cs (.../DamMacroStabilityOutput.cs) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/DamMacroStabilityOutput.cs (.../DamMacroStabilityOutput.cs) (revision 1026) @@ -21,6 +21,7 @@ using System.Collections.Generic; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Standard.Calculation; namespace Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon @@ -47,5 +48,13 @@ /// public List StabilityOutputItems { get; set; } + /// + /// Gets or sets the uplift situation. + /// + /// + /// The uplift situation. + /// + public UpliftSituation UpliftSituation { get; set; } + } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/MStabXmlDoc.cs =================================================================== diff -u -r1007 -r1026 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 1007) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityCommon/MStabXmlDoc.cs (.../MStabXmlDoc.cs) (revision 1026) @@ -180,7 +180,7 @@ } // Make sure riverlevel is correct with respect to surfaceline - double riverLevelLow = double.NaN; + double? riverLevelLow = null; if (failureMechanismParametersMStab.MStabParameters.GridPosition == MStabGridPosition.Left && scenario.RiverLevelLow.HasValue) { riverLevelLow = scenario.RiverLevelLow.Value; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r1012 -r1026 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1012) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1026) @@ -28,8 +28,11 @@ using Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityCommon; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; using Deltares.DamEngine.Calculators.Properties; +using Deltares.DamEngine.Calculators.Uplift; using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; using Deltares.DamMacroStability.Calculator; @@ -94,6 +97,11 @@ FailureMechanismParametersMStab = FailureMechanismParametersMStab }; + // Determine whether there is uplift + var upliftSituation = DetermineStabilityUplift(damKernelInput); + damMacroStabilityOutput.UpliftSituation = upliftSituation; + kernelDataOutput = damMacroStabilityOutput; + // Check the model to see what is to be calculted and how many calculations are required switch (FailureMechanismParametersMStab.MStabParameters.Model) { @@ -162,6 +170,47 @@ return PrepareResult.NotRelevant; } + private UpliftSituation DetermineStabilityUplift(DamKernelInput damKernelInput) + { + var location = damKernelInput.Location; + var upliftCriterion = damKernelInput.DesignScenario.GetUpliftCriterionStability(location.ModelFactors.UpliftCriterionStability); + var riverLevel = damKernelInput.DesignScenario.RiverLevel; + double? riverLevelLow = null; // Use value only for Outside + var soilGeometry2DName = damKernelInput.SubSoilScenario.FullStiFileName; + UpliftSituation upliftSituation; + var plLines = PlLinesHelper.CreatePlLinesForStability(location, damKernelInput.SubSoilScenario, riverLevel, + soilGeometry2DName, riverLevelLow, out upliftSituation); + if (plLines != null) + { + var surfaceLineWithNewHeight = location.SurfaceLine; + double? upliftFactor = GetLowestUpliftFactor(surfaceLineWithNewHeight, + damKernelInput.SubSoilScenario.SoilProfile1D, soilGeometry2DName, plLines, location); + upliftSituation.IsUplift = (upliftFactor < upliftCriterion); + } + else + { + upliftSituation.IsUplift = false; + } + return upliftSituation; + } + + private double? GetLowestUpliftFactor(SurfaceLine2 surfaceLine, SoilProfile1D soilProfile, string soilGeometry2DName, + PLLines plLines, Location location) + { + var upliftLocationDeterminator = new UpliftLocationDeterminator() + { + SurfaceLine = surfaceLine, + SoilProfile = soilProfile, + SoilGeometry2DName = soilGeometry2DName, + SoilList = location.SoilList, + DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), + PLLines = plLines, + XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin + }; + UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAtWithLowestUpliftFactor(); + return upliftLocationAndResult?.UpliftFactor; + } + /// /// Validates the specified kernel data input. /// @@ -313,7 +362,8 @@ /// The result message. /// The design results. /// - public void PostProcess(DamKernelInput damKernelInput, IKernelDataOutput kernelDataOutput, string resultMessage, out List designResults) + public void PostProcess(DamKernelInput damKernelInput, IKernelDataOutput kernelDataOutput, + string resultMessage, out List designResults) { if (damKernelInput == null) { @@ -335,6 +385,7 @@ { FillDesignResult(damMacroStabilityOutputItem, designResult); designResult.CalculationResult = damMacroStabilityOutputItem.CalculationResult; + designResult.StabilityDesignResults.UpliftSituation = damMacroStabilityOutput.UpliftSituation; designResults.Add(designResult); } } @@ -388,7 +439,6 @@ damMacroStabilityOutputItem.Zone1Results.CircleSurfacePointRightXCoordinate; designResult.StabilityDesignResults.SafetyFactor = designResult.StabilityDesignResults.Zone1SafetyFactor; - if (damMacroStabilityOutputItem.Zone2Results != null) { var zone2 = (DamMacroStabilityOutputItem.ResultsSingleZone) damMacroStabilityOutputItem.Zone2Results; @@ -397,6 +447,8 @@ designResult.StabilityDesignResults.LocalZone2ExitPointX = zone2.CircleSurfacePointRightXCoordinate; designResult.StabilityDesignResults.SafetyFactor = Math.Min(damMacroStabilityOutputItem.Zone1Results.SafetyFactor, zone2.SafetyFactor); } + + designResult.StabilityDesignResults.UpliftSituation = damMacroStabilityOutputItem.UpliftSituation; } } }