Index: dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs =================================================================== diff -u -r452 -r587 --- dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 452) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 587) @@ -141,6 +141,21 @@ } /// + /// Gets layer with the specified name. + /// + /// The name. + /// + public SoilLayer1D GetLayerWithName(string name) + { + return this.layers.FirstOrDefault((Func)(layer => + { + if (layer.Name != null) + return layer.Name.Equals(name); + return false; + })); + } + + /// /// The highest aquifer layer, can be null if not aquifer is present /// [Validate] Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs =================================================================== diff -u -r586 -r587 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 586) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 587) @@ -1,9 +1,13 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using System.Data; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.PlLinesCreator; +using Deltares.DamEngine.Calculators.Uplift; using Deltares.DamEngine.Data.Design; 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.Logging; @@ -17,6 +21,8 @@ /// public class DamPipingBlighKernelWrapper : IKernelWrapper { + private const double defaultFluidisationGradient = 0.3; + public const double defaultMaxReturnValue = 90.0; /// /// Create the kernel input. @@ -25,15 +31,54 @@ /// public IKernelDataInput Prepare(DamKernelInput damKernelInput) { - // TODO: this is just fake data + var damPipingBlighInput = new DamPipingBlighInput(); + + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + var surfaceLine = damKernelInput.Location.LocalXZSurfaceLine2; + var location = damKernelInput.Location; + double riverLevel = damKernelInput.DesignScenario.RiverLevel; + var plLines = CreatePlLines(location, soilProfile1D, riverLevel); + UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator + { + PLLines = plLines, + SoilProfile = soilProfile1D, + SurfaceLine = surfaceLine, + DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), + XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin + }; + var upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(damKernelInput.DesignScenario.GetUpliftCriterionPiping(null)); + bool 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; + if (upliftLocationAndResult != null) + { + xExit = upliftLocationAndResult.X; + surfaceLevel = surfaceLine.Geometry.GetZatX(upliftLocationAndResult.X); + SoilLayer1D heaveLayer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId); + d70 = heaveLayer.Soil.DiameterD70; + var topLevelAquifer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId).TopLevel; + dCoverLayer = DetermineHeightCoverLayer(topLevelAquifer, surfaceLevel); + } + 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); return new DamPipingBlighInput() { - HRiver = 2.0, - HExit = 0.0, - Rc = 0.3, - DTotal = 5.0, - SeepageLength = 40.5, - D70 = 180.0 + HRiver = riverLevel, + HExit = referenceLevel, + Rc = defaultFluidisationGradient, + DTotal = dCoverLayer, + SeepageLength = seepageLength, + D70 = d70, + IsUplift = isUplift }; } @@ -45,12 +90,15 @@ /// public int Validate(IKernelDataInput kernelDataInput, out List messages) { - var calculatorBligh = PipingCalculatorBligh(kernelDataInput); + var calculatorBligh = CreatePipingCalculatorBligh(kernelDataInput); List kernelMessages = calculatorBligh.Validate(); messages = new List(); foreach (string stringMessage in kernelMessages) { - messages.Add(new LogMessage() {Message = stringMessage , MessageType = LogMessageType.Error}); + messages.Add(new LogMessage() + { + Message = stringMessage, MessageType = LogMessageType.Error + }); } return messages.Count; } @@ -63,16 +111,33 @@ /// public IKernelDataOutput Execute(IKernelDataInput kernelDataInput, out List messages) { - var calculatorBligh = PipingCalculatorBligh(kernelDataInput); - calculatorBligh.Calculate(); - var damPipingBlighOutput = new DamPipingBlighOutput(); - damPipingBlighOutput.FoSp = calculatorBligh.FoSp; - damPipingBlighOutput.Hc = calculatorBligh.Hc; + DamPipingBlighInput damPipingBlighInput = kernelDataInput as DamPipingBlighInput; + if (damPipingBlighInput == null) + { + throw new NoNullAllowedException("No input object defined for Bligh"); + } messages = new List(); + var damPipingBlighOutput = new DamPipingBlighOutput() + { + FoSp = defaultMaxReturnValue + }; + if (damPipingBlighInput.IsUplift) + { + var calculatorBligh = CreatePipingCalculatorBligh(kernelDataInput); + calculatorBligh.Calculate(); + damPipingBlighOutput.FoSp = calculatorBligh.FoSp; + damPipingBlighOutput.Hc = calculatorBligh.Hc; + } return damPipingBlighOutput; } - private static PipingCalculatorBligh PipingCalculatorBligh(IKernelDataInput kernelDataInput) + /// + /// Creates the piping calculator bligh based on kernel input. + /// + /// The kernel data input. + /// + /// No input object defined for Bligh + private static PipingCalculatorBligh CreatePipingCalculatorBligh(IKernelDataInput kernelDataInput) { DamPipingBlighInput damPipingBlighInput = kernelDataInput as DamPipingBlighInput; if (damPipingBlighInput == null) @@ -118,5 +183,52 @@ designResult.PipingDesignResults = pipingDesignResults; } + /// + /// Creates the pl lines. + /// + /// The location. + /// The soil profile. + /// The water level. + /// + private PLLines CreatePlLines(Location location, SoilProfile1D soilProfile, double waterLevel) + { + var plLineCreator = new PLLinesCreator + { + WaterLevelRiverHigh = waterLevel, + SurfaceLine = location.SurfaceLine2, + WaterLevelPolder = location.PolderLevel, + HeadInPLLine2 = location.HeadPl2, + HeadInPLLine3 = location.HeadPl3, + HeadInPLLine4 = location.HeadPl4, + ModelParametersForPLLines = location.ModelParametersForPLLines, + SoilProfile = soilProfile, + GaugePLLines = null, // TODO: Operational + Gauges = null, // TODO: Operational + IsAdjustPL3AndPL4SoNoUpliftWillOccurEnabled = false, // for piping this must be set to false + PlLineOffsetBelowDikeTopAtRiver = location.PlLineOffsetBelowDikeTopAtRiver, + PlLineOffsetBelowDikeTopAtPolder = location.PlLineOffsetBelowDikeTopAtPolder, + DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), + IsHydraulicShortcut = false, // TODO: Regional + XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin + }; + return plLineCreator.CreateAllPLLines(location); + } + /// + /// Determines the total thickness of the cover layer. + /// + /// The top level aquifer. + /// The surface level. + /// + private double DetermineHeightCoverLayer(double topLevelAquifer, double surfaceLevel) + { + topLevelAquifer = Math.Min(topLevelAquifer, surfaceLevel); + var d = surfaceLevel - topLevelAquifer; + + // if d negative is negative then top of aquifer is higher then surface layer. + // This means that the aquifer is exposed on the surface. + // In this case d = 0 + d = Math.Max(0, d); + return d; + } } } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs =================================================================== diff -u -r564 -r587 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs (.../DesignCalculator.cs) (revision 564) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Dikes Design/DesignCalculator.cs (.../DesignCalculator.cs) (revision 587) @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using System.Collections.Generic; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingBligh; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; @@ -12,29 +8,48 @@ namespace Deltares.DamEngine.Calculators.Dikes_Design { + /// + /// The Dam Engine design calculator + /// public class DesignCalculator { - public List Execute(DamProjectData damProjectData) + /// + /// Performs the design calculation + /// + /// The dam project data. + /// + public List Execute(DamProjectData damProjectData) { + var calculationMessages = new List(); for (int locationIndex = 0; locationIndex < damProjectData.Dike.Locations.Count; locationIndex++) { var location = damProjectData.Dike.Locations[locationIndex]; - for (int designScenarioIndex = 0; designScenarioIndex < location.Scenarios.Count; designScenarioIndex++) + for (int subSoilScenarioIndex = 0; subSoilScenarioIndex < location.Segment.SoilProfileProbabilities.Count; subSoilScenarioIndex++) { - var calculationMessages = new List(); - IKernelWrapper kernelWrapper = new DamPipingBlighKernelWrapper(); - var damKernelInput = new DamKernelInput(); - damKernelInput.Location = location; - damKernelInput.DesignScenario = location.Scenarios[designScenarioIndex]; - IKernelDataInput kernelDataInput = kernelWrapper.Prepare(damKernelInput); - IKernelDataOutput kernelDataOutput = new DamPipingBlighOutput(); - kernelWrapper.Execute(kernelDataInput, out calculationMessages); - DesignResult designResult; - kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, out designResult); - } + var soiProfileProbability = location.Segment.SoilProfileProbabilities[subSoilScenarioIndex]; + for (int designScenarioIndex = 0; designScenarioIndex < location.Scenarios.Count; designScenarioIndex++) + { + IKernelWrapper kernelWrapper = new DamPipingBlighKernelWrapper(); + // Prepare input + var damKernelInput = new DamKernelInput(); + damKernelInput.Location = location; + damKernelInput.SubSoilScenario = soiProfileProbability; + damKernelInput.DesignScenario = location.Scenarios[designScenarioIndex]; + IKernelDataInput kernelDataInput = kernelWrapper.Prepare(damKernelInput); + + // Perform calculation + List locationCalculationMessages; + IKernelDataOutput kernelDataOutput = kernelWrapper.Execute(kernelDataInput, out locationCalculationMessages); + calculationMessages.AddRange(locationCalculationMessages); + + // Process output + DesignResult designResult; + kernelWrapper.PostProcess(damKernelInput, kernelDataOutput, out designResult); + } + } } - return null; + return calculationMessages; } } } Index: dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_BlighInputFile.xml =================================================================== diff -u -r562 -r587 --- dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_BlighInputFile.xml (.../PipingVoorbeeld1_BlighInputFile.xml) (revision 562) +++ dam engine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_BlighInputFile.xml (.../PipingVoorbeeld1_BlighInputFile.xml) (revision 587) @@ -33,4 +33,19 @@ + + + + + + + + + + + + + + + \ No newline at end of file Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighInput.cs =================================================================== diff -u -r500 -r587 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighInput.cs (.../DamPipingBlighInput.cs) (revision 500) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighInput.cs (.../DamPipingBlighInput.cs) (revision 587) @@ -2,13 +2,60 @@ namespace Deltares.DamEngine.Calculators.KernelWrappers.DamPipingBligh { + /// + /// Input parameters for Piping bligh + /// + /// public class DamPipingBlighInput : IKernelDataInput { + /// + /// Gets or sets the River level . + /// + /// + /// The h river. + /// public double HRiver { get; set; } + /// + /// Gets or sets the head at exitpoint. + /// + /// + /// The h exit. + /// public double HExit { get; set; } + /// + /// Gets or sets the reduction factor. + /// + /// + /// The rc. + /// public double Rc { get; set; } + /// + /// Gets or sets the total thickness of cover layer . + /// + /// + /// The d total. + /// public double DTotal { get; set; } + /// + /// Gets or sets the seepagelength. + /// + /// + /// The length of the seepage. + /// public double SeepageLength { get; set; } + /// + /// Gets or sets the D70. + /// + /// + /// The D70. + /// public double D70 { get; set; } + /// + /// Gets or sets a value indicating whether uplift occurs. + /// + /// + /// true if this instance is uplift; otherwise, false. + /// + public bool IsUplift { get; set; } } } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamKernelInput.cs =================================================================== diff -u -r502 -r587 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamKernelInput.cs (.../DamKernelInput.cs) (revision 502) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamKernelInput.cs (.../DamKernelInput.cs) (revision 587) @@ -3,11 +3,32 @@ namespace Deltares.DamEngine.Calculators.KernelWrappers.Common { + /// + /// Input that all dam kernels share + /// public class DamKernelInput { + /// + /// Gets or sets the location. + /// + /// + /// The location. + /// public Location Location { get; set; } + /// + /// Gets or sets the design scenario. + /// + /// + /// The design scenario. + /// public DesignScenario DesignScenario { get; set; } - public SoilGeometryProbability SubSoilScenario { get; set; } // To be implemented; should be replacement of SoilGeometryProbability + /// + /// Gets or sets the sub soil scenario. + /// + /// + /// The sub soil scenario. + /// + public SoilGeometryProbability SubSoilScenario { get; set; } } }