Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r543 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 543) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 624) @@ -83,20 +83,19 @@ /// /// Looks up a localized string similar to No input object defined for Sellmeijer 4 Forces. /// - internal static string DamPipingSellmeijer4ForcesKernelWrapper_PipingCalculatorSellmeijer4Forces_NoInputObjectDefinedForSellmeijer4Forces { + internal static string DamPipingSellmeijer4ForcesKernelWrapper_NoInputObjectDefinedForSellmeijer4Forces { get { - return ResourceManager.GetString("DamPipingSellmeijer4ForcesKernelWrapper_PipingCalculatorSellmeijer4Forces_NoInput" + - "ObjectDefinedForSellmeijer4Forces", resourceCulture); + return ResourceManager.GetString("DamPipingSellmeijer4ForcesKernelWrapper_NoInputObjectDefinedForSellmeijer4Forces", resourceCulture); } } /// /// Looks up a localized string similar to No output object defined for Sellmeijer 4 Forces. /// - internal static string DamPipingSellmeijer4ForcesKernelWrapper_PostProcess_NoOutputObjectDefinedForSellmeijer4Forces { + internal static string DamPipingSellmeijer4ForcesKernelWrapper_NoOutputObjectDefinedForSellmeijer4Forces { get { - return ResourceManager.GetString("DamPipingSellmeijer4ForcesKernelWrapper_PostProcess_NoOutputObjectDefinedForSellm" + - "eijer4Forces", resourceCulture); + return ResourceManager.GetString("DamPipingSellmeijer4ForcesKernelWrapper_NoOutputObjectDefinedForSellmeijer4Forces" + + "", resourceCulture); } } } Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r543 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 543) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 624) @@ -123,10 +123,10 @@ Geen invoer object gedefinieerd voor Macrostabiliteit - + Geen invoer object gedefinieerd voor Sellmeijer 4 Krachten - + Geen uitvoer object gedefinieerd voor Sellmeijer 4 Krachten \ No newline at end of file Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r543 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 543) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 624) @@ -117,10 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + No input object defined for Sellmeijer 4 Forces - + No output object defined for Sellmeijer 4 Forces Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/DamPipingHelper.cs (revision 624) @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Deltares.DamEngine.Calculators.PlLinesCreator; +using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.General.PlLines; +using Deltares.DamEngine.Data.Geotechnics; + +namespace Deltares.DamEngine.Calculators.KernelWrappers.Common +{ + public static class DamPipingHelper + { + /// + /// Creates the pl lines. + /// + /// The location. + /// The soil profile. + /// The water level. + /// + public static PLLines CreatePlLines(Location location, SoilProfile1D soilProfile, double waterLevel) + { + var plLineCreator = new PLLinesCreator + { + WaterLevelRiverHigh = waterLevel, + SurfaceLine = location.SurfaceLine, + 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. + /// + public static 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/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs =================================================================== diff -u -r604 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 604) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingBligh/DamPipingBlighKernelWrapper.cs (.../DamPipingBlighKernelWrapper.cs) (revision 624) @@ -3,11 +3,8 @@ 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; @@ -37,7 +34,7 @@ var surfaceLine = damKernelInput.Location.SurfaceLine; var location = damKernelInput.Location; double riverLevel = damKernelInput.DesignScenario.RiverLevel; - var plLines = CreatePlLines(location, soilProfile1D, riverLevel); + var plLines = DamPipingHelper.CreatePlLines(location, soilProfile1D, riverLevel); UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator { PLLines = plLines, @@ -60,7 +57,7 @@ SoilLayer1D heaveLayer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId); d70 = heaveLayer.Soil.DiameterD70; var topLevelAquifer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId).TopLevel; - dCoverLayer = DetermineHeightCoverLayer(topLevelAquifer, surfaceLevel); + dCoverLayer = DamPipingHelper.DetermineHeightCoverLayer(topLevelAquifer, surfaceLevel); } double seepageLength = xExit - xEntry; damPipingBlighInput.HRiver = riverLevel; @@ -183,52 +180,5 @@ 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.SurfaceLine, - 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.Data/Geotechnics/SoilProfile1D.cs =================================================================== diff -u -r600 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 600) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1D.cs (.../SoilProfile1D.cs) (revision 624) @@ -603,7 +603,7 @@ /// /// The layer. /// The index, -1 if not found - private int GetLayerIndexAt(SoilLayer1D layer) + public int GetLayerIndexAt(SoilLayer1D layer) { if (layer == null) { Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj =================================================================== diff -u -r583 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 583) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 624) @@ -86,6 +86,7 @@ + Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesInput.cs =================================================================== diff -u -r511 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesInput.cs (.../DamPipingSellmeijer4ForcesInput.cs) (revision 511) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesInput.cs (.../DamPipingSellmeijer4ForcesInput.cs) (revision 624) @@ -4,16 +4,100 @@ { public class DamPipingSellmeijer4ForcesInput : 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 height of the aquifer. + /// + /// + /// The height of the aquifer. + /// public double AquiferHeight { 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 the whites constant. + /// + /// + /// The whites constant. + /// public double WhitesConstant { get; set; } + + /// + /// Gets or sets the bedding angle. + /// + /// + /// The bedding angle. + /// public double BeddingAngle { get; set; } + + /// + /// Gets or sets the permeability kx. + /// + /// + /// The permeability kx. + /// public double PermeabilityKx { get; set; } + + /// + /// Gets or sets the water viscosity. + /// + /// + /// The water viscosity. + /// public double WaterViscosity { 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.Tests/DamPipingSellmeijer4ForcesTests.cs =================================================================== diff -u -r565 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/DamPipingSellmeijer4ForcesTests.cs (.../DamPipingSellmeijer4ForcesTests.cs) (revision 565) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators.Tests/DamPipingSellmeijer4ForcesTests.cs (.../DamPipingSellmeijer4ForcesTests.cs) (revision 624) @@ -23,7 +23,11 @@ using System.Data; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces; +using Deltares.DamEngine.Data.Design; +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; using NUnit.Framework; @@ -44,9 +48,24 @@ const double diff = 0.0001; - // ToDo Fill input - var damKernelInput = new DamKernelInput(); + var designScenario = new DesignScenario(); + designScenario.Location = new Location(); + designScenario.RiverLevel = 1.0; + designScenario.ModelFactors.UpliftCriterionPiping = 1.0; + var location = new Location(); + location.SurfaceLine = CreateSurfaceLineTutorial1(); + + var subSoilScenario = new SoilGeometryProbability(); + subSoilScenario.SoilProfile1D = CreatePipingSellmeijerProfileWithOneSandlayer(); + + var damKernelInput = new DamKernelInput + { + DesignScenario = designScenario, + Location = location, + SubSoilScenario = subSoilScenario + }; + var kernelWrapper = new DamPipingSellmeijer4ForcesKernelWrapper(); // Prepare the wrapper. Result is input for the calculation dll @@ -65,12 +84,49 @@ // Fill the design results DesignResult result; - kernelWrapper.PostProcess(null, output, out result); + kernelWrapper.PostProcess(damKernelInput, output, out result); Assert.AreEqual(11.899117458988471, result.PipingDesignResults.Sellmeijer4ForcesFactor, diff); Assert.AreEqual(4.7596469835953883, result.PipingDesignResults.Sellmeijer4ForcesHcritical, diff); } [Test] + public void TestPrepare() + { + const double diff = 0.0001; + + var designScenario = new DesignScenario(); + designScenario.Location = new Location(); + designScenario.RiverLevel = 1.0; + designScenario.ModelFactors.UpliftCriterionPiping = 1.0; + + var location = new Location(); + location.SurfaceLine = CreateSurfaceLineTutorial1(); + + var subSoilScenario = new SoilGeometryProbability(); + subSoilScenario.SoilProfile1D = CreatePipingSellmeijerProfileWithOneSandlayer(); + + var damKernelInput = new DamKernelInput + { + DesignScenario = designScenario, + Location = location, + SubSoilScenario = subSoilScenario + }; + var kernelWrapper = new DamPipingSellmeijer4ForcesKernelWrapper(); + var damPipingInput = (DamPipingSellmeijer4ForcesInput)kernelWrapper.Prepare(damKernelInput); + Assert.AreEqual(1.0, damPipingInput.HRiver, diff); + Assert.AreEqual(0.0, damPipingInput.HExit, diff); + Assert.AreEqual(0.3, damPipingInput.Rc, diff); + Assert.AreEqual(2.0, damPipingInput.DTotal, diff); + Assert.AreEqual(8.0, damPipingInput.AquiferHeight, diff); + Assert.AreEqual(40.5, damPipingInput.SeepageLength, diff); + Assert.AreEqual(200.0, damPipingInput.D70, diff); + Assert.AreEqual(0.25, damPipingInput.WhitesConstant, diff); + Assert.AreEqual(37.0, damPipingInput.BeddingAngle, diff); + Assert.AreEqual(1.33E-06, damPipingInput.WaterViscosity, diff); + Assert.AreEqual(0.0001, damPipingInput.PermeabilityKx, diff); + } + + [Test] public void TestValidate() { var kernelWrapper = new DamPipingSellmeijer4ForcesKernelWrapper(); @@ -106,12 +162,22 @@ { var kernelWrapper = new DamPipingSellmeijer4ForcesKernelWrapper(); - DamPipingSellmeijer4ForcesOutput output = new DamPipingSellmeijer4ForcesOutput(); - output.FoSp = 1.1; - output.Hc = 2.2; + var input = new DamKernelInput + { + DesignScenario = new DesignScenario(), + Location = new Location(), + SubSoilScenario = new SoilGeometryProbability() + }; + input.DesignScenario.Location = new Location(); + DamPipingSellmeijer4ForcesOutput output = new DamPipingSellmeijer4ForcesOutput + { + FoSp = 1.1, + Hc = 2.2 + }; + DesignResult result; - kernelWrapper.PostProcess(null, output, out result); + kernelWrapper.PostProcess(input, output, out result); Assert.AreEqual(output.FoSp, result.PipingDesignResults.Sellmeijer4ForcesFactor); Assert.AreEqual(output.Hc, result.PipingDesignResults.Sellmeijer4ForcesHcritical); } @@ -145,5 +211,60 @@ DesignResult result; kernelWrapper.PostProcess(null, null, out result); } + + public static SoilProfile1D CreatePipingSellmeijerProfileWithOneSandlayer() + { + SoilProfile1D soilProfile1D = new SoilProfile1D(); + SoilLayer1D soilLayer1D1 = new SoilLayer1D(); + soilLayer1D1.Name = "L0"; + soilLayer1D1.TopLevel = 10.0; + soilLayer1D1.Soil = new Soil("Topmaterial", 1.0, 1.0); + soilLayer1D1.Soil.PermeabKx = 0.0003; + soilLayer1D1.Soil.DiameterD70 = 0.0003; + soilLayer1D1.Soil.WhitesConstant = 0.5; + soilLayer1D1.Soil.BeddingAngle = 57.0; + soilLayer1D1.IsAquifer = false; + soilProfile1D.Layers.Add(soilLayer1D1); + + SoilLayer1D soilLayer1D2 = new SoilLayer1D(); + soilLayer1D2.Name = "L1"; + soilLayer1D2.TopLevel = -2.0; + soilLayer1D2.Soil = new Soil("Sand", 22.0, 20.0); + soilLayer1D2.Soil.PermeabKx = 0.0001; + soilLayer1D2.Soil.DiameterD70 = 0.0002; + soilLayer1D2.Soil.WhitesConstant = 0.25; + soilLayer1D2.Soil.BeddingAngle = 37.0; + soilLayer1D2.IsAquifer = true; + soilProfile1D.Layers.Add(soilLayer1D2); + soilProfile1D.BottomLevel = -10.0; + return soilProfile1D; + } + + public static SurfaceLine2 CreateSurfaceLineTutorial1(bool includingTraffic = false) + { + SurfaceLine2 surfaceLine2 = new SurfaceLine2(); + surfaceLine2.Name = "Tutorial1"; + surfaceLine2.Geometry = new GeometryPointString(); + surfaceLine2.CharacteristicPoints.GeometryMustContainPoint = true; + SurfaceLine2 line = surfaceLine2; + line.EnsurePointOfType(0.0, 0.0, CharacteristicPointType.SurfaceLevelOutside); + line.EnsurePointOfType(10.0, 0.0, CharacteristicPointType.DikeToeAtRiver); + line.EnsurePointOfType(34.5, 5.0, CharacteristicPointType.DikeTopAtRiver); + if (includingTraffic) + { + line.EnsurePointOfType(35.0, 5.0, CharacteristicPointType.TrafficLoadOutside); + line.EnsurePointOfType(38.5, 5.0, CharacteristicPointType.TrafficLoadInside); + } + line.EnsurePointOfType(40.5, 5.0, CharacteristicPointType.DikeTopAtPolder); + line.EnsurePointOfType(50.5, 0.0, CharacteristicPointType.DikeToeAtPolder); + line.EnsurePointOfType(58.5, 0.0, CharacteristicPointType.DitchDikeSide); + line.EnsurePointOfType(59.5, -2.0, CharacteristicPointType.BottomDitchDikeSide); + line.EnsurePointOfType(61.5, -2.0, CharacteristicPointType.BottomDitchPolderSide); + line.EnsurePointOfType(61.5, 0.0, CharacteristicPointType.DitchPolderSide); + line.EnsurePointOfType(75.0, 0.0, CharacteristicPointType.SurfaceLevelInside); + line.Geometry.SyncCalcPoints(); + return line; + } + } } Index: dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombiner.cs =================================================================== diff -u --- dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombiner.cs (revision 0) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Geotechnics/SoilProfile1DAquiferLayerCombiner.cs (revision 624) @@ -0,0 +1,50 @@ +using System; + +namespace Deltares.DamEngine.Data.Geotechnics +{ + public static class SoilProfile1DAquiferLayerCombiner + { + public struct AquiferLayerProperties + { + public double D70; + public double Height; + public double PermeabilityKx; + } + + /// + /// Combines the aquifer layers. + /// + /// The 1D soil profile. + /// Name of the top layer. + /// Properties of the combined aquifer layers + /// InconsistentWaterpressureInterpolationModel + public static AquiferLayerProperties CombineLayers(SoilProfile1D soilProfile1D, string topLayerName) + { + SoilLayer1D layerWithName = soilProfile1D.GetLayerWithName(topLayerName); + double num1 = 0.0; + double diameterD70 = layerWithName.Soil.DiameterD70; + double num2 = 0.0; + int layerIndexAt = soilProfile1D.GetLayerIndexAt(layerWithName); + WaterpressureInterpolationModel interpolationModel = layerWithName.WaterpressureInterpolationModel; + for (; layerIndexAt < soilProfile1D.LayerCount && soilProfile1D.Layers[layerIndexAt].IsAquifer; ++layerIndexAt) + { + if (interpolationModel != soilProfile1D.Layers[layerIndexAt].WaterpressureInterpolationModel) + { + // ToDo move to resources + // throw new GeotechnicsUtilitiesException(string.Format(LocalizationManager.GetTranslatedText(this.GetType(), "InconsistentWaterpressureInterpolationModel"), (object)this.soilProfile1D.Name)); + throw new Exception("InconsistentWaterpressureInterpolationModel"); + } + double layerHeight = soilProfile1D.GetLayerHeight(soilProfile1D.Layers[layerIndexAt]); + num1 += layerHeight; + num2 += layerHeight * soilProfile1D.Layers[layerIndexAt].Soil.PermeabKx; + } + AquiferLayerProperties aquiferLayer = new AquiferLayerProperties(); + aquiferLayer.D70 = diameterD70; + aquiferLayer.Height = num1; + aquiferLayer.PermeabilityKx = num2 / num1; + return aquiferLayer; + } + + + } +} Index: dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs =================================================================== diff -u -r586 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs (.../DamPipingSellmeijer4ForcesKernelWrapper.cs) (revision 586) +++ dam engine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/DamPipingSellmeijer4Forces/DamPipingSellmeijer4ForcesKernelWrapper.cs (.../DamPipingSellmeijer4ForcesKernelWrapper.cs) (revision 624) @@ -1,9 +1,10 @@ -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.Properties; -using Deltares.DamEngine.Data.Design; +using Deltares.DamEngine.Calculators.Uplift; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.General.Results; using Deltares.DamEngine.Data.Geotechnics; @@ -12,29 +13,87 @@ namespace Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces { + public class DamPipingSellmeijer4ForcesKernelWrapper : IKernelWrapper { + private const double DefaultFluidisationGradient = 0.3; + public const double DefaultMaxReturnValue = 90.0; + /// /// Prepares the specified dam kernel input. /// /// The dam kernel input. /// public IKernelDataInput Prepare(DamKernelInput damKernelInput) { - // TODO: this is just fake data + const double cDefaultWaterViscosity = 1.33E-06; + const double factorMeterToMicroMeter = 1000000.0; + + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + var surfaceLine = damKernelInput.Location.SurfaceLine; + var location = damKernelInput.Location; + var riverLevel = damKernelInput.DesignScenario.RiverLevel; + var plLines = DamPipingHelper.CreatePlLines(location, soilProfile1D, riverLevel); + var upliftLocationDeterminator = new UpliftLocationDeterminator + { + PLLines = plLines, + SoilProfile = soilProfile1D, + SurfaceLine = surfaceLine, + DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), + XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin + }; + var upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(damKernelInput.DesignScenario.GetUpliftCriterionPiping(null)); + var isUplift = (upliftLocationAndResult != null); + var xEntry = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver).X; + var xExit = 0.0; + var surfaceLevel = 0.0; + var dCoverLayer = 0.0; + var d70 = 0.0; + var aquiferHeight = 0.0; + var permeabilityKx = 0.0; + if (upliftLocationAndResult != null) + { + xExit = upliftLocationAndResult.X; + surfaceLevel = surfaceLine.Geometry.GetZatX(upliftLocationAndResult.X); + var topLevelAquifer = soilProfile1D.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId).TopLevel; + dCoverLayer = DamPipingHelper.DetermineHeightCoverLayer(topLevelAquifer, surfaceLevel); + + var aquiferLayer = SoilProfile1DAquiferLayerCombiner.CombineLayers(soilProfile1D, upliftLocationAndResult.LayerWhereUpliftOccuresId); + d70 = aquiferLayer.D70 * factorMeterToMicroMeter; + + aquiferHeight = aquiferLayer.Height; + permeabilityKx = aquiferLayer.PermeabilityKx; + } + var seepageLength = xExit - xEntry; + + // 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); + + Soil inBetweenAquiferlayerSoil = soilProfile1D.BottomAquiferLayer.Soil; + if (soilProfile1D.InBetweenAquiferLayer != null) + { + inBetweenAquiferlayerSoil = soilProfile1D.InBetweenAquiferLayer.Soil; + } + return new DamPipingSellmeijer4ForcesInput() { - HRiver = 1.0, - HExit = 0.0, - Rc = 0.3, - DTotal = 2.0, - AquiferHeight = 8.0, - SeepageLength = 40.5, - D70 = 200.0, - WhitesConstant = 0.25, - BeddingAngle = 37.0, - WaterViscosity = 1.33E-06, - PermeabilityKx = 0.0001 + HRiver = riverLevel, + HExit = referenceLevel, + Rc = DefaultFluidisationGradient, + DTotal = dCoverLayer, + SeepageLength = seepageLength, + IsUplift = isUplift, + // specific Sellmeijer 4 Forces + WaterViscosity = cDefaultWaterViscosity, + WhitesConstant = inBetweenAquiferlayerSoil.WhitesConstant, + BeddingAngle = inBetweenAquiferlayerSoil.BeddingAngle, + D70 = d70, + AquiferHeight = aquiferHeight, + PermeabilityKx = permeabilityKx, }; } @@ -46,7 +105,7 @@ /// public int Validate(IKernelDataInput kernelDataInput, out List messages) { - var calculator = PipingCalculatorSellmeijer4Forces(kernelDataInput); + var calculator = CreatePipingCalculatorSellmeijer4Forces(kernelDataInput); List kernelMessages = calculator.Validate(); messages = new List(); foreach (string stringMessage in kernelMessages) @@ -61,24 +120,36 @@ /// /// The kernel data input. /// The return messages. + /// No input object defined /// public IKernelDataOutput Execute(IKernelDataInput kernelDataInput, out List messages) { - var calculator = PipingCalculatorSellmeijer4Forces(kernelDataInput); - calculator.Calculate(); - var damPipingOutput = new DamPipingSellmeijer4ForcesOutput(); - damPipingOutput.FoSp = calculator.FoSp; - damPipingOutput.Hc = calculator.Hc; + DamPipingSellmeijer4ForcesInput damPipingInput = kernelDataInput as DamPipingSellmeijer4ForcesInput; + if (damPipingInput == null) + { + throw new NoNullAllowedException(Resources.DamPipingSellmeijer4ForcesKernelWrapper_NoInputObjectDefinedForSellmeijer4Forces); + } messages = new List(); + var damPipingOutput = new DamPipingSellmeijer4ForcesOutput() + { + FoSp = DefaultMaxReturnValue + }; + if (damPipingInput.IsUplift) + { + var calculator = CreatePipingCalculatorSellmeijer4Forces(kernelDataInput); + calculator.Calculate(); + damPipingOutput.FoSp = calculator.FoSp; + damPipingOutput.Hc = calculator.Hc; + } return damPipingOutput; } - private static PipingCalculatorSellmeijer4Forces PipingCalculatorSellmeijer4Forces(IKernelDataInput kernelDataInput) + private static PipingCalculatorSellmeijer4Forces CreatePipingCalculatorSellmeijer4Forces(IKernelDataInput kernelDataInput) { DamPipingSellmeijer4ForcesInput damPipingInput = kernelDataInput as DamPipingSellmeijer4ForcesInput; if (damPipingInput == null) { - throw new NoNullAllowedException(Resources.DamPipingSellmeijer4ForcesKernelWrapper_PipingCalculatorSellmeijer4Forces_NoInputObjectDefinedForSellmeijer4Forces); + throw new NoNullAllowedException(Resources.DamPipingSellmeijer4ForcesKernelWrapper_NoInputObjectDefinedForSellmeijer4Forces); } var calculator = new PipingCalculatorSellmeijer4Forces { @@ -103,28 +174,30 @@ /// The dam kernel input. /// The kernel data output. /// The design result. - /// + /// No input or output object defined public void PostProcess(DamKernelInput damKernelInput, IKernelDataOutput kernelDataOutput, out DesignResult designResult) { DamPipingSellmeijer4ForcesOutput damPipingOutput = kernelDataOutput as DamPipingSellmeijer4ForcesOutput; if (damPipingOutput == null) { - throw new NoNullAllowedException(Resources.DamPipingSellmeijer4ForcesKernelWrapper_PostProcess_NoOutputObjectDefinedForSellmeijer4Forces); + throw new NoNullAllowedException(Resources.DamPipingSellmeijer4ForcesKernelWrapper_NoOutputObjectDefinedForSellmeijer4Forces); } + if (damKernelInput == null) + { + throw new NoNullAllowedException(Resources.DamPipingSellmeijer4ForcesKernelWrapper_NoInputObjectDefinedForSellmeijer4Forces); + } - // TODO: this is just fake data - string id = "id"; - string soilProfile2DName = "soilProfile2DName"; + string soilProfile2DName = ""; var d = new DamFailureMechanismeCalculationSpecification(); - var s = new DesignScenario(); - s.Location = new Location(); - var p = new SoilProfile1D(); - designResult = new DesignResult(d, s, p, soilProfile2DName, AnalysisType.NoAdaption, 0); + var designScenario = damKernelInput.DesignScenario; + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + designResult = new DesignResult(d, designScenario, soilProfile1D, soilProfile2DName, AnalysisType.NoAdaption, 0); var pipingDesignResults = new PipingDesignResults(PipingModelType.Sellmeijer4Forces); pipingDesignResults.Sellmeijer4ForcesFactor = damPipingOutput.FoSp; pipingDesignResults.Sellmeijer4ForcesHcritical = damPipingOutput.Hc; designResult.PipingDesignResults = pipingDesignResults; } + } } Index: dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj =================================================================== diff -u -r529 -r624 --- dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 529) +++ dam engine/trunk/src/Deltares.DamEngine.Data/Deltares.DamEngine.Data.csproj (.../Deltares.DamEngine.Data.csproj) (revision 624) @@ -124,6 +124,7 @@ +