Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapperTests.cs =================================================================== diff -u -r1593 -r1621 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapperTests.cs (.../WbiPipingSellmeijerRevisedKernelWrapperTests.cs) (revision 1593) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapperTests.cs (.../WbiPipingSellmeijerRevisedKernelWrapperTests.cs) (revision 1621) @@ -86,6 +86,9 @@ IKernelDataOutput kernelDataOutput; kernelWrapper.Prepare(damKernelInput, 0, out damPipingInput, out kernelDataOutput); + // Original test in piping kernel uses the corrected D70 so use that here too + (damPipingInput as WbiPipingSellmeijerRevisedInput).D70 = (damPipingInput as WbiPipingSellmeijerRevisedInput).D70 * 1e6; + // Validate the input List messages; kernelWrapper.Validate(damPipingInput, kernelDataOutput, out messages); @@ -162,7 +165,7 @@ Assert.AreEqual(2.0, damPipingInput.DTotal, diff); Assert.AreEqual(8.0, damPipingInput.DAquifer, diff); Assert.AreEqual(40.5, damPipingInput.SeepageLength, diff); - Assert.AreEqual(200.0, damPipingInput.D70, diff); + Assert.AreEqual(0.000200, damPipingInput.D70, diff); Assert.AreEqual(0.25, damPipingInput.WhitesDragCoefficient, diff); Assert.AreEqual(37.0, damPipingInput.BeddingAngle, diff); Assert.AreEqual(1.33E-06, damPipingInput.KinematicViscosityWater, diff); Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedInputFile.xml =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedInputFile.xml (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedInputFile.xml (revision 1621) @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapper.cs =================================================================== diff -u -r1615 -r1621 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapper.cs (.../WbiPipingSellmeijerRevisedKernelWrapper.cs) (revision 1615) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapper.cs (.../WbiPipingSellmeijerRevisedKernelWrapper.cs) (revision 1621) @@ -36,6 +36,7 @@ using Deltares.DamEngine.Data.Standard.Calculation; using Deltares.DamEngine.Data.Standard.Logging; using Deltares.WTIPiping; +using UpliftLocationAndResult = Deltares.DamEngine.Calculators.Uplift.UpliftLocationAndResult; namespace Deltares.DamEngine.Calculators.KernelWrappers.WbiPipingSellmeijerRevised { @@ -149,12 +150,65 @@ public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) { - throw new NotImplementedException(); + messages = new List(); + var damPipingInput = kernelDataInput as WbiPipingSellmeijerRevisedInput; + var damPipingOutput = (WbiPipingSellmeijerRevisedOutput)kernelDataOutput; + ThrowWhenDamKernelInputNull(damKernelInput); + ThrowWhenKernelOutputNull(damPipingOutput); + Location location = damKernelInput.Location; + SoilProfile1D soilProfile = damKernelInput.SubSoilScenario.SoilProfile1D; + SurfaceLine2 surfaceLine = damKernelInput.Location.SurfaceLine; + + PlLines plLines; + UpliftLocationAndResult upliftLocationAndResult; + DamPipingHelper.DeterminePlLinesAndUpliftLocation(damKernelInput, point, out plLines, out upliftLocationAndResult); + + double requiredFoS = location.ModelFactors.RequiredSafetyFactorPiping.Value; + double upliftCriterion = location.UpliftCriterionPiping.Value; + // 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; + damPipingInput.SeepageLength = xExit - xEntry; + var topLevelAquifer = soilProfile.GetLayerWithName(upliftLocationAndResult.LayerWhereUpliftOccuresId).TopLevel; + + // The following 2 parameters are dependent on the position of the point and have to be recalculated for the current point + double dCoverLayer = DamPipingHelper.DetermineHeightCoverLayer(topLevelAquifer, point.Z); // point.Z is surfacelevel + damPipingInput.DTotal = dCoverLayer; + double referenceLevel = Math.Max(location.PolderLevel, point.Z); // point.Z is surfacelevel + damPipingInput.HExit = referenceLevel; + + // Calculate the piping safety factor using the level of the given point + PerformSingleCalculationWbiSellmeijerRevised(out messages, damPipingOutput, damPipingInput); + + // If too low, then determine required height and length (from uplift) + if (damPipingOutput.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 + ShoulderDesignHelper.CalculateExtraShoulderHeight(soilProfile, plLines, upliftLocationAndResult, upliftCriterion)); + return shoulderDesign; + } + } + return null; } public bool EvaluateDesign(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, out DesignAdvise designAdvise, out string evaluationMessage) { - throw new NotImplementedException(); + var damPipingInput = kernelDataInput as WbiPipingSellmeijerRevisedInput; + var damPipingOutput = (WbiPipingSellmeijerRevisedOutput)kernelDataOutput; + ThrowWhenKernelInputNull(damPipingInput); + ThrowWhenDamKernelInputNull(damKernelInput); + ThrowWhenKernelOutputNull(damPipingOutput); + double fosRequiered = damKernelInput.Location.ModelFactors.RequiredSafetyFactorPiping.Value; + double fosAchieved = damPipingOutput.FoSp; + evaluationMessage = String.Format(Resources.FactorAchievedVsFactorRequired, fosAchieved, fosRequiered); + designAdvise = DesignAdvise.None; + return (fosAchieved >= fosRequiered); } public void PrepareDesign(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, int iterationIndex, out EmbankmentDesignParameters embankmentDesignParameters) @@ -164,7 +218,7 @@ public DesignStrategy GetDesignStrategy(DamKernelInput damKernelInput) { - throw new NotImplementedException(); + return DesignStrategy.ShoulderPerPoint; } private static void EvaluateUpliftSituation(DamKernelInput damKernelInput, out IKernelDataInput kernelDataInput, @@ -204,7 +258,7 @@ dCoverLayer = DamPipingHelper.DetermineHeightCoverLayer(topLevelAquifer, surfaceLevel); var aquiferLayer = SoilProfile1DAquiferLayerCombiner.CombineLayers(soilProfile1D, upliftLocationAndResult.LayerWhereUpliftOccuresId); - d70 = aquiferLayer.D70 * Physics.FactorMeterToMicroMeter; + d70 = aquiferLayer.D70; aquiferHeight = aquiferLayer.Height; permeabilityKx = aquiferLayer.PermeabilityKx; Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedDesignHeightInputFile.xml =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedDesignHeightInputFile.xml (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedDesignHeightInputFile.xml (revision 1621) @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj =================================================================== diff -u -r1554 -r1621 --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 1554) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/Deltares.DamEngine.Interface.Tests.csproj (.../Deltares.DamEngine.Interface.Tests.csproj) (revision 1621) @@ -52,6 +52,7 @@ + @@ -187,6 +188,12 @@ PreserveNewest + + PreserveNewest + + + PreserveNewest + PreserveNewest @@ -196,6 +203,9 @@ PreserveNewest + + PreserveNewest + PreserveNewest Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedDesignInputFile.xml =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedDesignInputFile.xml (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/TestFiles/PipingVoorbeeld1_SellmeijerRevisedDesignInputFile.xml (revision 1621) @@ -0,0 +1,69 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerRevisedTests.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerRevisedTests.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Interface.Tests/PipingSellmeijerRevisedTests.cs (revision 1621) @@ -0,0 +1,164 @@ +// Copyright (C) Stichting Deltares 2018. All rights reserved. +// +// This file is part of the Dam Engine. +// +// The Dam Engine is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . +// +// All names, logos, and references to "Deltares" are registered trademarks of +// Stichting Deltares and remain full property of Stichting Deltares at all times. +// All rights reserved. + +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.Geotechnics; +using Deltares.DamEngine.Io; +using NUnit.Framework; + +namespace Deltares.DamEngine.Interface.Tests +{ + [TestFixture] + public class PipingSellmeijerRevisedTests + { + private const double tolerance = 0.0005; + + [Test] + public void CanPerformSellmeijer4RevisedDesignPipingVoorbeeld1() + { + // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingSellmeijerRevised.damx" + // Set Analysis type to "No Adaption" + const string fileName = @"TestFiles\PipingVoorbeeld1_SellmeijerRevisedInputFile.xml"; + string inputString = File.ReadAllText(fileName); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); + // Factor piping = 0.432 + // Kritische hoogte = 1.383 + // Factor opdrijven = 0.5825 + // Uittredepunt x-lokaal = 35.0 + // Opdrijven = true + // PL3 opdrijven = 0.0 + // PL3 stijghoogte aangepast = 0.0 + // PL3 locatie opdrijven lokaal = 0.0 + // PL4 opdrijven = 0.0 + // PL4 stijghoogte aangepast = 0.0 + // PL4 locatie opdrijven lokaal = 0.0 + + Assert.IsNotNull(outputString); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + Assert.AreEqual(0.432, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.Wbi2017Factor, tolerance); + Assert.AreEqual(1.383, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.Wbi2017Hcritical, tolerance); + Assert.AreEqual(35.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.ExitPointX, tolerance); + // The following values are not the same as in the classic UI + // The upliftfactor there is 0.351, but that is the Wti Upliftfactor + // The adjusted PL3/PL4 values there are not 0.0, but those are the values for stability; for piping no adjustment has to be made + Assert.AreEqual(0.5825, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftFactor, tolerance); + Assert.AreEqual(true, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.IsUplift); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3MinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3HeadAdjusted, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3LocationXMinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4MinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4HeadAdjusted, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4LocationXMinUplift, tolerance); + } + + [Test] + public void CanPerformSellmeijer4ForcesDesignWithAdaptionPipingVoorbeeld1() + { + // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingSellmeijerRevised.damx" + // Set Analysis type to "Adapt geometry" + const string fileName = @"TestFiles\PipingVoorbeeld1_SellmeijerRevisedDesignInputFile.xml"; + string inputString = File.ReadAllText(fileName); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); + SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].PipingDesignResults.RedesignedSurfaceLine; + // uplift = true + Assert.AreEqual(true, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.IsUplift); + // shoulder height = 1.995 + Assert.AreEqual(1.995, redesignedSurfaceLine.DetermineShoulderHeight(), tolerance); + // Note Bka: Anwers here are 17 meter longer shoulder than Sellmeijer4Forces from which these tests are derived. + // dike length = 66.986 + 17 + Assert.AreEqual(83.986, redesignedSurfaceLine.GetDikeLength(), tolerance); + + // ShoulderWidth = X_Kruin binnenberm - X_Insteek binnenberm = 65.01 + 17 - 29.01 = 53.0 + Assert.AreEqual(53.0, redesignedSurfaceLine.DetermineShoulderLength(), tolerance); + + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3MinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3HeadAdjusted, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3LocationXMinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4MinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4HeadAdjusted, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4LocationXMinUplift, tolerance); + + // ExitPointX = X_Teen dijk binnenwaarts = 76.986 + 17 + Assert.AreEqual(93.986, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.ExitPointX, tolerance); + + // expected value = 1.280 + Assert.AreEqual(1.280, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.Wbi2017Factor, tolerance); + // expected value = 4.097 + Assert.AreEqual(4.097, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.Wbi2017Hcritical, tolerance); + + // expected value = 0.582 + Assert.AreEqual(0.582, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftFactor, tolerance); + } + + [Test] + public void CanPerformSellmeijer4ForcesDesignWithAdaptionWithHeightPipingVoorbeeld1() + { + // Based on ".\data\DamEngineTestProjects\PipingVoorbeeld1\PipingSellmeijerRevised.damx" + // Set Analysis type to "Adapt geometry" + // Set DTH = 4.5 for location "profiel 1" + const string fileName = @"TestFiles\PipingVoorbeeld1_SellmeijerRevisedDesignHeightInputFile.xml"; + string inputString = File.ReadAllText(fileName); + EngineInterface engineInterface = new EngineInterface(inputString); + Assert.IsNotNull(engineInterface.DamProjectData); + string outputString = engineInterface.Run(); + Assert.IsNotNull(outputString); + var output = DamXmlSerialization.LoadOutputFromXmlString(outputString); + DamProjectData actualDamProjectData = FillDamFromXmlOutput.CreateDamProjectData(null, output); + SurfaceLine2 redesignedSurfaceLine = actualDamProjectData.DesignCalculations[0].PipingDesignResults.RedesignedSurfaceLine; + + // The following test are different from CanPerformSellmeijerRevisedDesignWithAdaptionPipingVoorbeeld1() + Assert.AreEqual(4.5, redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver).Z, tolerance); + Assert.AreEqual(4.5, redesignedSurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).Z, tolerance); + + // Note Bka: Anwers here are 17 meter longer shoulder than Sellmeijer4Forces from which these tests are derived. + // ShoulderWidth = X_Kruin binnenberm - X_Insteek binnenberm = 65.01 - 32.01 = 33.0 + 17 = 50 + // Read from PipingSellmeijer4Forces_Piping_CharacteristicPoints.csv by export surfacelines in Release + Assert.AreEqual(50.0, redesignedSurfaceLine.DetermineShoulderLength(), tolerance); + + // The following test are the same as for CanPerformSellmeijerRevisedDesignWithAdaptionPipingVoorbeeld1() + Assert.AreEqual(true, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.IsUplift); + Assert.AreEqual(1.995, redesignedSurfaceLine.DetermineShoulderHeight(), tolerance); + Assert.AreEqual(83.986, redesignedSurfaceLine.GetDikeLength(), tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3MinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3HeadAdjusted, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl3LocationXMinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4MinUplift, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4HeadAdjusted, tolerance); + Assert.AreEqual(0.0, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftSituation.Pl4LocationXMinUplift, tolerance); + Assert.AreEqual(1.280, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.Wbi2017Factor, tolerance); + Assert.AreEqual(4.097, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.Wbi2017Hcritical, tolerance); + Assert.AreEqual(0.582, output.Results.CalculationResults.DesignResults[0].PipingDesignResults.UpliftFactor, tolerance); + } + } +}