Index: DamClients/DamUI/trunk/src/Dam/Tests/DamPipingBenchmarkTest.cs =================================================================== diff -u -r934 -r1040 --- DamClients/DamUI/trunk/src/Dam/Tests/DamPipingBenchmarkTest.cs (.../DamPipingBenchmarkTest.cs) (revision 934) +++ DamClients/DamUI/trunk/src/Dam/Tests/DamPipingBenchmarkTest.cs (.../DamPipingBenchmarkTest.cs) (revision 1040) @@ -53,6 +53,11 @@ damProjectData.DamProjectCalculationSpecification.CurrentSpecification.PipingModelType = pipingModel; DamEngine.Io.XmlInput.Input input = FillXmlInputFromDamUi.CreateInput(damProjectData); + + // Next 2 lines for debugging + const string inputFilename = "InputFile.xml"; + DamXmlSerialization.SaveInputAsXmlFile(inputFilename, input); + string inputXml = DamXmlSerialization.SaveInputAsXmlString(input); var damEnginInterface = new EngineInterface(inputXml); @@ -63,6 +68,11 @@ // only if validation is ok, then string outputXml = damEnginInterface.Run(); var output = DamXmlSerialization.LoadOutputFromXmlString(outputXml); + + // Next 2 lines for debugging + const string outputFilename = "OutputFile.xml"; + DamXmlSerialization.SaveOutputAsXmlFile(outputFilename, output); + FillDamUiFromXmlOutput.AddOutputToDamProjectData(damProjectData, output); } var allCalculationresults = damProjectData.DesignCalculations; Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs =================================================================== diff -u -r1028 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs (.../DamMacroStabilityOutwardsKernelWrapper.cs) (revision 1028) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityOutwards/DamMacroStabilityOutwardsKernelWrapper.cs (.../DamMacroStabilityOutwardsKernelWrapper.cs) (revision 1040) @@ -33,6 +33,8 @@ using Deltares.DamEngine.Data.Standard.Logging; using Deltares.DamMacroStability.Calculator; using System.IO; +using Deltares.DamEngine.Data.Geometry; +using Deltares.DamEngine.Data.Geotechnics; namespace Deltares.DamEngine.Calculators.KernelWrappers.DamMacroStabilityOutwards { @@ -296,6 +298,22 @@ designResult.CalculationSubDir = DamMacroStabilityUtils.GetCalculationSubDir(damKernelInput.DamFailureMechanismeCalculationSpecification.StabilityModelType); } designResults.Add(designResult); - } + } + + /// + /// Calculates the design at point. + /// + /// The dam kernel input. + /// The kernel data input. + /// The kernel data output. + /// The point. + /// The messages. + /// + /// + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + { + throw new NotImplementedException(); + } + } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/ShoulderDesign.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/ShoulderDesign.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/ShoulderDesign.cs (revision 1040) @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Deltares.DamEngine.Calculators.KernelWrappers.Common +{ + public class ShoulderDesign + { + public double ShoulderLengthFromToe { get; set; } + public double ShoulderHeightFromToe { get; set; } + /// + /// Constructor + /// + /// + /// + public ShoulderDesign(double shoulderLengthFromToe, double shoulderHeight) + { + ShoulderLengthFromToe = shoulderLengthFromToe; + ShoulderHeightFromToe = shoulderHeight; + } + } +} Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ThrowHelper.cs =================================================================== diff -u -r971 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ThrowHelper.cs (.../ThrowHelper.cs) (revision 971) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Standard/ThrowHelper.cs (.../ThrowHelper.cs) (revision 1040) @@ -43,5 +43,17 @@ throw exception; } + /// + /// Throws if argument null. + /// + /// The value. + /// The message. + /// + public static void ThrowIfArgumentNull(object value, string message) + { + if (value == null) + throw new ArgumentNullException(message); + } + } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs =================================================================== diff -u -r1024 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 1024) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/DikesDesign/DesignCalculator.cs (.../DesignCalculator.cs) (revision 1040) @@ -22,12 +22,15 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Geometry; +using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Logging; namespace Deltares.DamEngine.Calculators.DikesDesign @@ -86,12 +89,12 @@ switch (analysisType) { case AnalysisType.AdaptGeometry: -// PerformDesignCalculation(kernelWrapper, kernelDataInput, kernelDataOutput, -// damKernelInput, calculationMessages, damProjectData.DesignCalculations); -// break; + PerformDesignCalculation(kernelWrapper, kernelDataInput, kernelDataOutput, + damKernelInput, calculationMessages, damProjectData.DesignCalculations); + break; case AnalysisType.NoAdaption: PerformSingleCalculation(kernelWrapper, kernelDataInput, kernelDataOutput, - damKernelInput, calculationMessages, damProjectData.DesignCalculations); + damKernelInput, calculationMessages, damProjectData.DesignCalculations); break; } @@ -101,18 +104,18 @@ if (prepareResult == PrepareResult.NotRelevant) { calculationMessages.Add(new LogMessage(LogMessageType.Info, null, - string.Format(Resources.DesignCalculatorIrrelevant, - location.Name, - soiProfileProbability.ToString(), - damKernelInput.DesignScenario.LocationScenarioID))); + string.Format(Resources.DesignCalculatorIrrelevant, + location.Name, + soiProfileProbability.ToString(), + damKernelInput.DesignScenario.LocationScenarioID))); } if (prepareResult == PrepareResult.Failed) { calculationMessages.Add(new LogMessage(LogMessageType.Error, null, - string.Format(Resources.DesignCalculatorPrepareError, - location.Name, - soiProfileProbability.ToString(), - damKernelInput.DesignScenario.LocationScenarioID))); + string.Format(Resources.DesignCalculatorPrepareError, + location.Name, + soiProfileProbability.ToString(), + damKernelInput.DesignScenario.LocationScenarioID))); } } @@ -174,7 +177,7 @@ } private static void PerformSingleCalculation(IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, - List calculationMessages, List designCalculations) + List calculationMessages, List designCalculations) { // Perform validation List locationCalculationMessages = new List(); @@ -211,10 +214,78 @@ } } + /// + /// Ensures that the points on the surface line are never more than cDiff (0.5) apart. + /// + /// + /// + private static IEnumerable GetCheckedSurfaceLine(IEnumerable originalLine) + { + const double cDiff = 0.5; + var newLine = new List(); + double X = originalLine.First().X; + foreach (var point in originalLine) + { + while (point.X > X + cDiff) + { + var newPoint = new GeometryPoint(point) + { + X = X + cDiff + }; + if (newPoint.X > newLine.Last().X) + { + newPoint.Z = newLine.Last().Z + ((newPoint.X - newLine.Last().X) / (point.X - newLine.Last().X)) * + (point.Z - newLine.Last().Z); + newLine.Add(newPoint); + } + X = newPoint.X; + } + newLine.Add(point); + } + return newLine; + } + private static void PerformDesignCalculation(IKernelWrapper kernelWrapper, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, List calculationMessages, List designCalculations) { - + List locationCalculationMessages = new List(); + var surfaceLine = damKernelInput.Location.SurfaceLine; + GeometryPoint startSurfacePoint = surfaceLine.GetDikeToeInward(); + + IEnumerable relevantSurfacePointsList = from GeometryPoint point in surfaceLine.Geometry.Points + where point.X >= startSurfacePoint.X + orderby point.X ascending + select point; + relevantSurfacePointsList = GetCheckedSurfaceLine(relevantSurfacePointsList); + double oldDesiredShoulderLength = 0.0; + double desiredShoulderLength; + double desiredShoulderHeight; + double oldDesiredShoulderHeight = 0.0; + int pointCount = 0; + foreach (var point in relevantSurfacePointsList) + { + pointCount++; + // Determine calculation filename to output piping calculation file + //pipingCalculator.PipingCalculationDirectory = GetPipingCalculationBaseDirectory(); + //string fileNameCalculation =String.Format("Calc({0})_Loc({1})_Pro({2})_Pnt({3}))", + // pipingCalculator.CalculationModelIdentifier, scenario.Location.Name, soilProfileProbability.SoilProfile.Name, pointCount.ToString("d4")); ; + //pipingCalculator.FilenameCalculation = Path.Combine(pipingCalculator.PipingCalculationDirectory, fileNameCalculation); + + // Calculate the piping design at the given point. This returns the required adaption (berm length and height) if any. + var pipingDesign = kernelWrapper.CalculateDesignAtPoint(damKernelInput, kernelDataInput, kernelDataOutput, point, out locationCalculationMessages); + if (pipingDesign != null) + { + // Piping is an issue so adapt the surfaceline for it + desiredShoulderLength = pipingDesign.ShoulderLengthFromToe; + desiredShoulderLength = Math.Max(desiredShoulderLength, oldDesiredShoulderLength); + oldDesiredShoulderLength = desiredShoulderLength; + // shoulder height is height above surfacelevel!! + desiredShoulderHeight = pipingDesign.ShoulderHeightFromToe; + desiredShoulderHeight = Math.Max(desiredShoulderHeight, oldDesiredShoulderHeight); + oldDesiredShoulderHeight = desiredShoulderHeight; + + } + } } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r1036 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1036) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1040) @@ -215,5 +215,41 @@ return ResourceManager.GetString("MStabXmlDoc_CreateMStabXmlDoc_RiverLevelHighIsBelowSurfaceLevelOutside", resourceCulture); } } + + /// + /// Looks up a localized string similar to The lowest layer is not an aquifer in soilprofile '{0}'.. + /// + internal static string NoBottomAquiferLayer { + get { + return ResourceManager.GetString("NoBottomAquiferLayer", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No toe of dike has been defined in the surfaceline for location '{0}'.. + /// + internal static string NoDikeToeDefinedForLocation { + get { + return ResourceManager.GetString("NoDikeToeDefinedForLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No 1D soilprofile has been defined for location '{0}'.. + /// + internal static string NoSoilProfile1DDefinedForLocation { + get { + return ResourceManager.GetString("NoSoilProfile1DDefinedForLocation", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No surfaceline has been defined for location '{0}'.. + /// + internal static string NoSurfaceLineDefinedForLocation { + get { + return ResourceManager.GetString("NoSurfaceLineDefinedForLocation", resourceCulture); + } + } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r1036 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1036) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1040) @@ -168,4 +168,16 @@ Model horizontal balance does not support 2d-geometries. + + No toe of dike has been defined in the surfaceline for location '{0}'. + + + No 1D soilprofile has been defined for location '{0}'. + + + No surfaceline has been defined for location '{0}'. + + + The lowest layer is not an aquifer in soilprofile '{0}'. + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj =================================================================== diff -u -r1036 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 1036) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 1040) @@ -63,6 +63,7 @@ + Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs =================================================================== diff -u -r1034 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1034) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityInwards/DamMacroStabilityInwardsKernelWrapper.cs (.../DamMacroStabilityInwardsKernelWrapper.cs) (revision 1040) @@ -30,6 +30,7 @@ using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; using Deltares.DamMacroStability.Calculator; @@ -399,6 +400,21 @@ } } + /// + /// Calculates the design at point. + /// + /// The dam kernel input. + /// The kernel data input. + /// The kernel data output. + /// The point. + /// The messages. + /// + /// + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + { + throw new NotImplementedException(); + } + private DesignResult NewDesignResult(DamKernelInput damKernelInput) { string soilProfile2DName = damKernelInput.SubSoilScenario.ToString(); Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamKernelInput.cs =================================================================== diff -u -r1024 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamKernelInput.cs (.../DamKernelInput.cs) (revision 1024) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamKernelInput.cs (.../DamKernelInput.cs) (revision 1040) @@ -83,7 +83,7 @@ /// Gets or sets the dam failure mechanisme calculation specification. /// /// - /// The dam failure mechanisme calculation specification. + /// The dam failure mechanism calculation specification. /// public DamFailureMechanismeCalculationSpecification DamFailureMechanismeCalculationSpecification { get; set; } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs =================================================================== diff -u -r877 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs (.../IKernelWrapper.cs) (revision 877) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Interfaces/IKernelWrapper.cs (.../IKernelWrapper.cs) (revision 1040) @@ -21,7 +21,10 @@ using System.Collections.Generic; using Deltares.DamEngine.Calculators.KernelWrappers.Common; +using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Geometry; +using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Logging; namespace Deltares.DamEngine.Calculators.KernelWrappers.Interfaces @@ -82,5 +85,16 @@ /// The result message. /// The design results void PostProcess(DamKernelInput damKernelInput, IKernelDataOutput kernelDataOutput, string resultMessage, out List designResults); + + /// + /// Calculates the design at point. + /// + /// The dam kernel input. + /// The kernel data input. + /// The kernel data output. + /// The point. + /// The messages. + /// + ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages); } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityHorizontalBalance/DamMacroStabilityHorizontalBalanceKernelWrapper.cs =================================================================== diff -u -r1036 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityHorizontalBalance/DamMacroStabilityHorizontalBalanceKernelWrapper.cs (.../DamMacroStabilityHorizontalBalanceKernelWrapper.cs) (revision 1036) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamMacroStabilityHorizontalBalance/DamMacroStabilityHorizontalBalanceKernelWrapper.cs (.../DamMacroStabilityHorizontalBalanceKernelWrapper.cs) (revision 1040) @@ -30,6 +30,7 @@ using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; using Deltares.DamMacroStability.Calculator; @@ -199,6 +200,20 @@ designResults.Add(designResult); } + /// + /// Calculates the design at point. + /// + /// The dam kernel input. + /// The kernel data input. + /// The kernel data output. + /// The point. + /// The messages. + /// + /// + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + { + throw new NotImplementedException(); + } /// /// Creates the mstab dam XML document. Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs =================================================================== diff -u -r1024 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 1024) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 1040) @@ -26,8 +26,11 @@ using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Calculators.Uplift; +using Deltares.DamEngine.Data.Standard; using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.General.PlLines; using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; @@ -69,62 +72,70 @@ var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; var surfaceLine = damKernelInput.Location.SurfaceLine; var location = damKernelInput.Location; - double riverLevel = damKernelInput.RiverLevelHigh; + double waterLevel = damKernelInput.RiverLevelHigh; UpliftSituation upliftSituation; - var plLines = PlLinesHelper.CreatePlLines(location, soilProfile1D, riverLevel, out upliftSituation); - UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator - { - PLLines = plLines, - SoilProfile = soilProfile1D, - SurfaceLine = surfaceLine, - DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), - XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin - }; - var upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(damKernelInput.DesignScenario.GetUpliftCriterionPiping(null)); - upliftSituation.IsUplift = (upliftLocationAndResult != null); - double xEntry = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; - double xExit = 0.0; - double surfaceLevel = 0.0; - double d70 = 0.0; - double dCoverLayer = 0.0; - double? upliftFactor = null; - if (upliftLocationAndResult != null) - { - xExit = upliftLocationAndResult.X; - surfaceLevel = surfaceLine.Geometry.GetZatX(upliftLocationAndResult.X); - SoilLayer1D heaveLayer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId); - d70 = Physics.FactorMeterToMicroMeter * heaveLayer.Soil.DiameterD70; - var topLevelAquifer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId).TopLevel; - dCoverLayer = DamPipingHelper.DetermineHeightCoverLayer(topLevelAquifer, surfaceLevel); - upliftFactor = upliftLocationAndResult.UpliftFactor; - } - double seepageLength = xExit - xEntry; - damPipingBlighInput.HRiver = riverLevel; - // Reference level is highest value of surfaceLevel or PolderLevel - // Uit TR Zandmeevoerende wellen (1999): "Het verval dH is gelijk aan het verschil tussen buitenwaterstand (het ontwerppeil(OP)) - // bij zeedijken en de maatgevende hoogwaterstand (MHW bij rivierdijken) en de waterstand binnendijks ter plaatse van het uittredepunt, - // rekening houdend met zeespiegelrijzing etc.(zie paragraaf 3.7.2). In dien ter plaatse van het uittreepunt of de opbarstlocatie - // geen vrije waterstand heerst kan gerekend worden met het maaiveldniveau, rekening houdend met eventuele maaiveld daling (zie paragraaf 3.7.2)." - var referenceLevel = Math.Max(location.PolderLevel, surfaceLevel); - kernelDataInput = new DamPipingBlighInput() - { - HRiver = riverLevel, - HExit = referenceLevel, - Rc = defaultFluidisationGradient, - DTotal = dCoverLayer, - SeepageLength = seepageLength, - D70 = d70, - - }; - damPipingBlighOutput.ExitPointX = xExit; - damPipingBlighOutput.UpliftFactor = upliftFactor; - damPipingBlighOutput.UpliftSituation = upliftSituation; + PLLines plLines = PlLinesHelper.CreatePlLines(location, soilProfile1D, waterLevel, out upliftSituation); + EvaluateUpliftSituation(damKernelInput, out kernelDataInput, plLines, damPipingBlighInput, waterLevel, damPipingBlighOutput); return PrepareResult.Successful; } kernelDataInput = null; return PrepareResult.NotRelevant; } + private static void EvaluateUpliftSituation(DamKernelInput damKernelInput, out IKernelDataInput kernelDataInput, PLLines plLines, DamPipingBlighInput damPipingBlighInput, double waterLevel, DamPipingBlighOutput damPipingBlighOutput) + { + SoilProfile1D soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + SurfaceLine2 surfaceLine = damKernelInput.Location.SurfaceLine; + Location location = damKernelInput.Location; + UpliftSituation upliftSituation = new UpliftSituation(); + UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator + { + PLLines = plLines, + SoilProfile = soilProfile1D, + SurfaceLine = surfaceLine, + DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), + XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin + }; + var upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(damKernelInput.DesignScenario.GetUpliftCriterionPiping(null)); + upliftSituation.IsUplift = (upliftLocationAndResult != null); + double xEntry = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + double xExit = 0.0; + double surfaceLevel = 0.0; + double d70 = 0.0; + double dCoverLayer = 0.0; + double? upliftFactor = null; + if (upliftLocationAndResult != null) + { + xExit = upliftLocationAndResult.X; + surfaceLevel = surfaceLine.Geometry.GetZatX(upliftLocationAndResult.X); + SoilLayer1D heaveLayer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId); + d70 = Physics.FactorMeterToMicroMeter * heaveLayer.Soil.DiameterD70; + var topLevelAquifer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId).TopLevel; + dCoverLayer = DamPipingHelper.DetermineHeightCoverLayer(topLevelAquifer, surfaceLevel); + upliftFactor = upliftLocationAndResult.UpliftFactor; + } + double seepageLength = xExit - xEntry; + damPipingBlighInput.HRiver = waterLevel; + // Reference level is highest value of surfaceLevel or PolderLevel + // Uit TR Zandmeevoerende wellen (1999): "Het verval dH is gelijk aan het verschil tussen buitenwaterstand (het ontwerppeil(OP)) + // bij zeedijken en de maatgevende hoogwaterstand (MHW bij rivierdijken) en de waterstand binnendijks ter plaatse van het uittredepunt, + // rekening houdend met zeespiegelrijzing etc.(zie paragraaf 3.7.2). In dien ter plaatse van het uittreepunt of de opbarstlocatie + // geen vrije waterstand heerst kan gerekend worden met het maaiveldniveau, rekening houdend met eventuele maaiveld daling (zie paragraaf 3.7.2)." + var referenceLevel = Math.Max(location.PolderLevel, surfaceLevel); + kernelDataInput = new DamPipingBlighInput() + { + HRiver = waterLevel, + HExit = referenceLevel, + Rc = defaultFluidisationGradient, + DTotal = dCoverLayer, + SeepageLength = seepageLength, + D70 = d70, + }; + damPipingBlighOutput.ExitPointX = xExit; + damPipingBlighOutput.UpliftFactor = upliftFactor; + damPipingBlighOutput.UpliftSituation = upliftSituation; + } + /// /// Validates the kernel data input. /// @@ -174,12 +185,16 @@ { throw new NoNullAllowedException(Resources.DamPipingBlighKernelWrapper_NoOutputObjectDefinedForBligh); } + PerformSingleCalculationBligh(out messages, damPipingBlighOutput, damPipingBlighInput); + } + + private static void PerformSingleCalculationBligh(out List messages, DamPipingBlighOutput damPipingBlighOutput, DamPipingBlighInput damPipingBlighInput) + { damPipingBlighOutput.CalculationResult = CalculationResult.NoRun; damPipingBlighOutput.FoSp = defaultMaxReturnValue; messages = new List(); try { - if (damPipingBlighOutput.UpliftSituation.IsUplift) { var calculatorBligh = CreatePipingCalculatorBligh(damPipingBlighInput); @@ -232,14 +247,8 @@ public void PostProcess(DamKernelInput damKernelInput, IKernelDataOutput kernelDataOutput, string resultMessage, out List designResults) { DamPipingBlighOutput damPipingBlighOutput = kernelDataOutput as DamPipingBlighOutput; - if (damKernelInput == null) - { - throw new NoNullAllowedException(Resources.DamPipingBlighKernelWrapper_NoInputObjectDefinedForBligh); - } - if (damPipingBlighOutput == null) - { - throw new NoNullAllowedException(Resources.DamPipingBlighKernelWrapper_NoOutputObjectDefinedForBligh); - } + ThrowWhenKernelInputNull(damKernelInput); + ThrowWhenKernelOutputNull(damPipingBlighOutput); designResults = new List(); var designResult = new DesignResult(damKernelInput.DamFailureMechanismeCalculationSpecification, @@ -261,5 +270,112 @@ designResults.Add(designResult); } + private static void ThrowWhenKernelOutputNull(DamPipingBlighOutput damPipingBlighOutput) + { + if (damPipingBlighOutput == null) + { + throw new NoNullAllowedException(Resources.DamPipingBlighKernelWrapper_NoOutputObjectDefinedForBligh); + } + } + + private static void ThrowWhenKernelInputNull(DamKernelInput damKernelInput) + { + if (damKernelInput == null) + { + throw new NoNullAllowedException(Resources.DamPipingBlighKernelWrapper_NoInputObjectDefinedForBligh); + } + } + + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + { + messages = new List(); + DamPipingBlighInput damPipingBlighInput = kernelDataInput as DamPipingBlighInput; + DamPipingBlighOutput damPipingBlighOutput = (DamPipingBlighOutput)kernelDataOutput; + ThrowWhenKernelInputNull(damKernelInput); + ThrowWhenKernelOutputNull(damPipingBlighOutput); + + // ============================ Start of SetupCalculationAtGivePoint() + Location location = damKernelInput.Location; + SoilProfile1D soilProfile = damKernelInput.SubSoilScenario.SoilProfile1D; + double waterLevel = damKernelInput.RiverLevelHigh; + SurfaceLine2 surfaceLine = damKernelInput.Location.SurfaceLine; + + ThrowHelper.ThrowWhenConditionIsTrue( + string.Format(Resources.NoSoilProfile1DDefinedForLocation, location.Name), + () => (soilProfile == null || soilProfile.Layers.Count < 1)); + ThrowHelper.ThrowIfArgumentNull(soilProfile, string.Format(Resources.NoSurfaceLineDefinedForLocation, location.Name)); + + GeometryPoint entryPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); + + ThrowHelper.ThrowIfArgumentNull(entryPoint, string.Format(Resources.NoDikeToeDefinedForLocation, location.Name)); + ThrowHelper.ThrowIfArgumentNull(soilProfile.BottomAquiferLayer, string.Format(Resources.NoBottomAquiferLayer, soilProfile.Name)); + + PLLines plLines = CreatePlLines(damKernelInput); + + UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator + { + PLLines = plLines, + SoilProfile = soilProfile, + SurfaceLine = surfaceLine, + DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), + XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin + }; + UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetUpliftFactorAtPoint(point); + // ============================ End of SetupCalculationAtGivePoint() + double requiredFoS = damKernelInput.DesignScenario.GetRequiredSafetyFactorPiping(null); + double upliftCriterion = damKernelInput.DesignScenario.GetUpliftCriterionPiping(null); + // if there is no uplift, then there is no piping so return null + if (upliftLocationAndResult != null) + { + double xEntry = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + double xExit = upliftLocationAndResult.X; + damPipingBlighInput.SeepageLength = xExit - xEntry; + // Calculate the piping safety factor using the level of the given point + PerformSingleCalculationBligh(out messages, damPipingBlighOutput, damPipingBlighInput); + //var sp = CalculatePipingFactorAtLevel(location, waterLevel, point.Z); + + // If too low, then determine required height and length (from uplift) + if (damPipingBlighOutput.FoSp < requiredFoS) + { + // Finally, determine the required shoulderheight + double currentShoulderHeight = upliftLocationAndResult.Z - + surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder).Z; + var shoulderDesign = new ShoulderDesign( + upliftLocationAndResult.X - surfaceLine.GetDikeToeInward().X, + currentShoulderHeight + CalculateExtraShoulderHeight(soilProfile, plLines, upliftLocationAndResult, upliftCriterion)); + return shoulderDesign; + } + } + return null; + } + + protected double CalculateExtraShoulderHeight(SoilProfile1D soilProfile, PLLines plLines, UpliftLocationAndResult upliftLocationAndResult, double upliftCriterion) + { + var calculator = new UpliftCalculator(); + calculator.SoilProfile = soilProfile; + calculator.SurfaceLevel = upliftLocationAndResult.Z; + calculator.PhreaticLevel = plLines.Lines[PLLineType.PL1].ZFromX(upliftLocationAndResult.X); + calculator.TopOfLayerToBeEvaluated = soilProfile.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId).TopLevel; + PLLine plLine; + if (upliftLocationAndResult.LayerWhereUpliftOccuresId == soilProfile.BottomAquiferLayer.Name) + { + plLine = plLines.Lines[PLLineType.PL3]; + } + else + { + plLine = plLines.Lines[PLLineType.PL4]; + } + return calculator.CalculateExtraHeight(plLine.ZFromX(upliftLocationAndResult.X), upliftCriterion); + } + + private PLLines CreatePlLines(DamKernelInput damKernelInput) + { + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + var location = damKernelInput.Location; + double waterLevel = damKernelInput.RiverLevelHigh; + UpliftSituation upliftSituation; + PLLines plLines = PlLinesHelper.CreatePlLines(location, soilProfile1D, waterLevel, out upliftSituation); + return plLines; + } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs =================================================================== diff -u -r967 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 967) +++ DamEngine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SurfaceLine2Extensions.cs (.../SurfaceLine2Extensions.cs) (revision 1040) @@ -514,7 +514,30 @@ return 0.0; } + /// + /// Determines the width of the shoulder for this surfaceline. + /// + /// shoulder width + /// Method requires the existenc of the following characteristic points when + /// and + /// are defined: + /// + /// + /// + /// + /// + /// + public static double DetermineShoulderWidth(this SurfaceLine2 line) + { + var shoulderTopInside = line.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.ShoulderTopInside); + if (shoulderTopInside != null && HasAnnotation(line, CharacteristicPointType.ShoulderBaseInside)) + { + return line.DetermineShoulderLengthForGivenShoulderTopInside(shoulderTopInside); + } + return 0.0; + } + #region Private methods /// /// Create a horizontal line from a given starting X coordinate and ending at the Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r1036 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1036) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1040) @@ -168,4 +168,16 @@ De buitenwaartse waterstand ({0}) ligt onder het buitenwaartse maaiveld ({1}). + + De onderste laag is geen watervoerende laag in grondprofiel '{0}'. + + + Er is geen teen van de dijk voor de hoogtegeometrie gedfinieerd in locatie '{0}'. + + + Er is geen 1D grondprofiel gedefinieerd voor locatie '{0}'. + + + Er is geen hoogtegeometrie gedefinieerd voor locatie '{0}'. + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs =================================================================== diff -u -r1024 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs (.../DamPipingSellmeijer4ForcesKernelWrapper.cs) (revision 1024) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs (.../DamPipingSellmeijer4ForcesKernelWrapper.cs) (revision 1040) @@ -28,6 +28,7 @@ using Deltares.DamEngine.Calculators.Uplift; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; @@ -259,5 +260,20 @@ designResults.Add(designResult); } + /// + /// Calculates the design at point. + /// + /// The dam kernel input. + /// The kernel data input. + /// The kernel data output. + /// The point. + /// The messages. + /// + /// + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + { + throw new NotImplementedException(); + } + } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijerVnk/DamPipingSellmeijerVnkKernelWrapper.cs =================================================================== diff -u -r1024 -r1040 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijerVnk/DamPipingSellmeijerVnkKernelWrapper.cs (.../DamPipingSellmeijerVnkKernelWrapper.cs) (revision 1024) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijerVnk/DamPipingSellmeijerVnkKernelWrapper.cs (.../DamPipingSellmeijerVnkKernelWrapper.cs) (revision 1040) @@ -31,6 +31,7 @@ using Deltares.DamPiping.SellmeijerVNKCalculator; using System.Data; using Deltares.DamEngine.Calculators.Properties; +using Deltares.DamEngine.Data.Geometry; using Deltares.DamEngine.Data.Standard.Calculation; namespace Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijerVnk @@ -245,6 +246,21 @@ designResults.Add(designResult); } + /// + /// Calculates the design at point. + /// + /// The dam kernel input. + /// The kernel data input. + /// The kernel data output. + /// The point. + /// The messages. + /// + /// + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + { + throw new NotImplementedException(); + } + private static PipingCalculatorSellmeijerVNK CreatePipingCalculatorSellmeijerVnk(IKernelDataInput kernelDataInput) { DamPipingSellmeijerVnkInput damPipingInput = kernelDataInput as DamPipingSellmeijerVnkInput;