Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx =================================================================== diff -u -r1403 -r1586 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1403) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.resx (.../Resources.resx) (revision 1586) @@ -267,4 +267,10 @@ Location '{0}', subsoil scenario '{1}', design scenario '{2}': The calculation failed with error message '{3}' + + No input object defined for WBI Sellmeijer Revised + + + No output object defined for WBI Sellmeijer Revised + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapperTests.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapperTests.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapperTests.cs (revision 1586) @@ -0,0 +1,302 @@ +// 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.Collections.Generic; +using System.Data; +using Deltares.DamEngine.Calculators.KernelWrappers.Common; +using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces; +using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.KernelWrappers.WbiPipingSellmeijerRevised; +using Deltares.DamEngine.Data.Design; +using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.General.Results; +using Deltares.DamEngine.Data.Standard.Calculation; +using Deltares.DamEngine.Data.Standard.Logging; +using Deltares.DamEngine.TestHelpers.Factories; +using NUnit.Framework; + +namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.WbiPipingSellmeijerRevised +{ + [TestFixture] + public class WbiPipingSellmeijerRevisedKernelWrapperTests + { + [Test] + public void TestFullCalculation() + { + // expected results are based on test in Sellmeijer2011CalculatorTests, CalculateTestValues + // as performed in the Wti kernel itself. + + const double diff = 0.0001; + + var location = new Location("Location 1") + { + SurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(), + ModelFactors = + { + UpliftCriterionPiping = 1.0 + } + }; + + var designScenario = new DesignScenario + { + LocationScenarioID = "1", + Location = location, + }; + + var subSoilScenario = new SoilGeometryProbability + { + SoilProfile1D = FactoryForSoilProfiles.CreatePipingSellmeijerProfileWithOneSandlayer(), + SegmentFailureMechanismType = FailureMechanismSystemType.Piping + }; + var damFailureMechanismeCalculationSpecification = new DamFailureMechanismeCalculationSpecification() + { + FailureMechanismSystemType = FailureMechanismSystemType.Piping, + PipingModelType = PipingModelType.Wti2017 + }; + var damKernelInput = new DamKernelInput + { + Location = location, + SubSoilScenario = subSoilScenario, + RiverLevelHigh = 1.0, + DamFailureMechanismeCalculationSpecification = damFailureMechanismeCalculationSpecification + }; + + var kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + + // Prepare the wrapper. Result is input for the calculation dll + IKernelDataInput damPipingInput; + IKernelDataOutput kernelDataOutput; + kernelWrapper.Prepare(damKernelInput, 0, out damPipingInput, out kernelDataOutput); + + // Validate the input + List messages; + kernelWrapper.Validate(damPipingInput, kernelDataOutput, out messages); + Assert.AreEqual(0, messages.Count); + + // Run the dll + kernelWrapper.Execute(damPipingInput, kernelDataOutput, out messages); + var damPipingOutput = (WbiPipingSellmeijerRevisedOutput)kernelDataOutput; + Assert.AreEqual(0, messages.Count); + Assert.AreEqual(2719.6685415725829, damPipingOutput.FoSp, diff); + Assert.AreEqual(1087.8674166290334, damPipingOutput.Hc, diff); + + // Fill the design results + List results; + kernelWrapper.PostProcess(damKernelInput, damPipingOutput, designScenario, "", out results); + foreach (var result in results) + { + Assert.AreEqual(FailureMechanismSystemType.Piping, result.DamFailureMechanismeCalculation.FailureMechanismSystemType); + Assert.AreEqual(PipingModelType.Wti2017, result.DamFailureMechanismeCalculation.PipingModelType); + Assert.IsNotNullOrEmpty(result.LocationName); + Assert.IsNotNullOrEmpty(result.ScenarioName); + Assert.IsNotNullOrEmpty(result.ProfileName); + Assert.AreEqual(2719.6685415725829, result.PipingDesignResults.Wti2017Factor, diff); + Assert.AreEqual(1087.8674166290334, result.PipingDesignResults.Wti2017Hcritical, diff); + + Assert.AreEqual(50.5, result.PipingDesignResults.LocalExitPointX); + Assert.AreEqual(0.067957866123003738, result.PipingDesignResults.UpliftFactor); + Assert.AreEqual(true, result.PipingDesignResults.UpliftSituation != null && ((UpliftSituation)result.PipingDesignResults.UpliftSituation).IsUplift); + Assert.AreEqual(CalculationResult.Succeeded, result.CalculationResult); + + Assert.AreEqual(location.SurfaceLine, result.PipingDesignResults.RedesignedSurfaceLine); + } + } + + [Test] + public void TestPrepare() + { + const double diff = 0.0001; + + var location = new Location + { + SurfaceLine = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(), + ModelFactors = + { + UpliftCriterionPiping = 1.0 + } + }; + + var subSoilScenario = new SoilGeometryProbability + { + SoilProfile1D = FactoryForSoilProfiles.CreatePipingSellmeijerProfileWithOneSandlayer(), + SegmentFailureMechanismType = FailureMechanismSystemType.Piping + }; + var damFailureMechanismeCalculationSpecification = new DamFailureMechanismeCalculationSpecification() + { + FailureMechanismSystemType = FailureMechanismSystemType.Piping, + PipingModelType = PipingModelType.Wti2017 + }; + var damKernelInput = new DamKernelInput + { + Location = location, + SubSoilScenario = subSoilScenario, + RiverLevelHigh = 1.0, + DamFailureMechanismeCalculationSpecification = damFailureMechanismeCalculationSpecification + }; + var kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + IKernelDataInput kernelDataInput; + IKernelDataOutput kernelDataOutput; + kernelWrapper.Prepare(damKernelInput, 0, out kernelDataInput, out kernelDataOutput); + var damPipingInput = (WbiPipingSellmeijerRevisedInput)kernelDataInput; + 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.DAquifer, diff); + Assert.AreEqual(40.5, damPipingInput.SeepageLength, diff); + Assert.AreEqual(200.0, 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); + Assert.AreEqual(0.0001, damPipingInput.DarcyPermeability, diff); + } + + [Test] + public void TestValidate() + { + var kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + + // Validate without setting values. Expected error messages. + var damPipingInput = new WbiPipingSellmeijerRevisedInput(); + var damPipingOutput = new WbiPipingSellmeijerRevisedOutput(); + List messages; + kernelWrapper.Validate(damPipingInput, damPipingOutput, out messages); + Assert.IsTrue(messages.Count > 0); + + // Validate the input when valid input is provided. Expected no messages. + damPipingInput = new WbiPipingSellmeijerRevisedInput() + { + HRiver = 1.0, + HExit = 0.0, + Rc = 0.3, + DTotal = 2.0, + DAquifer = 8.0, + SeepageLength = 40.5, + D70 = 200.0, + WhitesDragCoefficient = 0.25, + BeddingAngle = 37.0, + KinematicViscosityWater = 1.33E-06, + DarcyPermeability = 0.0001 + }; + messages.Clear(); + kernelWrapper.Validate(damPipingInput, damPipingOutput, out messages); + Assert.AreEqual(0, messages.Count); + } + + [Test] + public void TestPostProcess() + { + var kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + + var subSoilScenario = new SoilGeometryProbability + { + SoilProfile1D = FactoryForSoilProfiles.CreatePipingSellmeijerProfileWithOneSandlayer(), + SegmentFailureMechanismType = FailureMechanismSystemType.Piping + }; + var damFailureMechanismeCalculationSpecification = new DamFailureMechanismeCalculationSpecification() + { + FailureMechanismSystemType = FailureMechanismSystemType.Piping, + PipingModelType = PipingModelType.Wti2017 + }; + var input = new DamKernelInput + { + Location = new Location(), + SubSoilScenario = subSoilScenario, + DamFailureMechanismeCalculationSpecification = damFailureMechanismeCalculationSpecification + }; + input.Location = new Location(); + + var upliftSituation = new UpliftSituation + { + IsUplift = true + }; + var calculationResult = CalculationResult.Succeeded; + var output = new WbiPipingSellmeijerRevisedOutput() + { + FoSp = 1.1, + Hc = 2.2, + ExitPointX = 3.3, + UpliftFactor = 4.4, + UpliftSituation = upliftSituation, + CalculationResult = calculationResult + }; + + var designScenario = new DesignScenario + { + Location = input.Location + }; + List results; + kernelWrapper.PostProcess(input, output, designScenario, "", out results); + foreach (var result in results) + { + Assert.AreEqual(output.FoSp, result.PipingDesignResults.Wti2017Factor); + Assert.AreEqual(output.Hc, result.PipingDesignResults.Wti2017Hcritical); + + Assert.AreEqual(output.ExitPointX, result.PipingDesignResults.LocalExitPointX); + Assert.AreEqual(output.UpliftFactor, result.PipingDesignResults.UpliftFactor); + Assert.AreEqual(output.UpliftSituation, result.PipingDesignResults.UpliftSituation); + Assert.AreEqual(output.CalculationResult, result.CalculationResult); + + Assert.AreEqual(input.Location.SurfaceLine, result.PipingDesignResults.RedesignedSurfaceLine); + } + } + + [Test] + [ExpectedException(typeof(NoNullAllowedException), ExpectedMessage = "Geen invoer object gedefinieerd voor WBI Sellmeijer Revised")] + [SetUICulture("nl-NL")] + public void TestLanguageNLThrowsExceptionInExecuteWhenInputIsNull() + { + var kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + List messages; + kernelWrapper.Execute(null, null, out messages); + } + + [Test] + [ExpectedException(typeof(NoNullAllowedException), ExpectedMessage = "No input object defined for WBI Sellmeijer Revised")] + [SetUICulture("en-US")] + public void TestLanguageENThrowsExceptionInExecuteWhenInputIsNull() + { + var kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + List messages; + kernelWrapper.Execute(null, null, out messages); + } + + [Test] + [ExpectedException(typeof(NoNullAllowedException), ExpectedMessage = "Geen uitvoer object gedefinieerd voor WBI Sellmeijer Revised")] + [SetUICulture("nl-NL")] + public void TestThrowsExceptionInPostProcessWhenOutputIsNull() + { + var kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + List results; + kernelWrapper.PostProcess(new DamKernelInput(), null, null, "", out results); + } + + [Test] + [ExpectedException(typeof(NoNullAllowedException), ExpectedMessage = "Geen invoer object gedefinieerd voor WBI Sellmeijer Revised")] + [SetUICulture("nl-NL")] + public void TestThrowsExceptionInPostProcessWhenInputIsNull() + { + var kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + List results; + kernelWrapper.PostProcess(null, new DamPipingSellmeijer4ForcesOutput(), null, "", out results); + } + } +} Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx =================================================================== diff -u -r1386 -r1586 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1386) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 1586) @@ -264,4 +264,10 @@ De nieuwe berm snijdt het dijkprofiel niet. Ofwel het dijkprofiel verloopt heel vreemd of de nieuwe bermlengte is te groot. + + Geen invoer object gedefinieerd voor WBI Sellmeijer Revised + + + Geen uitvoer object gedefinieerd voor WBI Sellmeijer Revised + \ No newline at end of file Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj =================================================================== diff -u -r1581 -r1586 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 1581) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/Deltares.DamEngine.Calculators.Tests.csproj (.../Deltares.DamEngine.Calculators.Tests.csproj) (revision 1586) @@ -49,6 +49,7 @@ + Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapper.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapper.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedKernelWrapper.cs (revision 1586) @@ -0,0 +1,327 @@ +// 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.Data; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Deltares.DamEngine.Calculators.DikesDesign; +using Deltares.DamEngine.Calculators.KernelWrappers.Common; +using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces; +using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.Properties; +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.Geometry; +using Deltares.DamEngine.Data.Geotechnics; +using Deltares.DamEngine.Data.Standard.Calculation; +using Deltares.DamEngine.Data.Standard.Logging; +using Deltares.DamPiping.Sellmeijer4ForcesCalculator; +using Deltares.WTIPiping; + +namespace Deltares.DamEngine.Calculators.KernelWrappers.WbiPipingSellmeijerRevised +{ + /// + /// Wrapper for Wbi Piping SellmeijerRevised kernel + /// + public class WbiPipingSellmeijerRevisedKernelWrapper: IKernelWrapper + { + private const double defaultMaxReturnValue = 90.0; + private const double defaultFluidisationGradient = 0.3; + + /// + /// Prepares the failure mechanism input based on general dam kernel input. + /// + /// The dam kernel input. + /// The number of the current iteration + /// The kernel data input. + /// The kernel data output. + /// + /// Result of the prepare + /// + public PrepareResult Prepare(DamKernelInput damKernelInput, int iterationIndex, out IKernelDataInput kernelDataInput, out IKernelDataOutput kernelDataOutput) + { + var damPipingOutput = new WbiPipingSellmeijerRevisedOutput() + { + FoSp = defaultMaxReturnValue + }; + kernelDataOutput = damPipingOutput; + if (damKernelInput.SubSoilScenario.SegmentFailureMechanismType == FailureMechanismSystemType.Piping) + { + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + var location = damKernelInput.Location; + double waterLevel = damKernelInput.RiverLevelHigh; + UpliftSituation upliftSituation; + var plLines = PlLinesHelper.CreatePlLinesForPiping(location, soilProfile1D, waterLevel, + damKernelInput.DamFailureMechanismeCalculationSpecification.AssessmentScenarioJobSettings.HydraulicShortcutType, + out upliftSituation); + EvaluateUpliftSituation(damKernelInput, out kernelDataInput, plLines, waterLevel, damPipingOutput); + return PrepareResult.Successful; + } + kernelDataInput = null; + return PrepareResult.NotRelevant; + } + + /// + /// Validates the kernel data input. + /// + /// The kernel data input. + /// The kernel data output. + /// The messages. + /// + /// Number of errors that prevent a calculation + /// + public int Validate(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, out List messages) + { + var wbiPipingSellmeijerRevisedOutput = (WbiPipingSellmeijerRevisedOutput)kernelDataOutput; + var calculator = CreatePipingCalculatorWbiSellmeijerRevised(kernelDataInput); + List kernelMessages = calculator.Validate(); + messages = new List(); + foreach (string stringMessage in kernelMessages) + { + messages.Add(new LogMessage() { Message = stringMessage, MessageType = LogMessageType.Error }); + } + if (messages.Count > 0) + { + wbiPipingSellmeijerRevisedOutput.CalculationResult = CalculationResult.InvalidInputData; + } + return messages.Count; + } + + /// + /// Performs a failure mechanism calculation based on the input. + /// + /// The kernel data input. + /// The kernel data output. + /// The messages. + public void Execute(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, out List messages) + { + var wbiPipingSellmeijerRevisedInput = kernelDataInput as WbiPipingSellmeijerRevisedInput; + var wbiPipingSellmeijerRevisedOutput = (WbiPipingSellmeijerRevisedOutput)kernelDataOutput; + ThrowWhenKernelInputNull(wbiPipingSellmeijerRevisedInput); + ThrowWhenKernelOutputNull(wbiPipingSellmeijerRevisedOutput); + PerformSingleCalculationWbiSellmeijerRevised(out messages, wbiPipingSellmeijerRevisedOutput, wbiPipingSellmeijerRevisedInput); + } + + public void PostProcess(DamKernelInput damKernelInput, IKernelDataOutput kernelDataOutput, DesignScenario designScenario, string resultMessage, out List designResults) + { + var damPipingOutput = kernelDataOutput as WbiPipingSellmeijerRevisedOutput; + ThrowWhenDamKernelInputNull(damKernelInput); + ThrowWhenKernelOutputNull(damPipingOutput); + + designResults = new List(); + var designResult = new DesignResult(damKernelInput.DamFailureMechanismeCalculationSpecification, + designScenario, damKernelInput.SubSoilScenario.SoilProfile1D, null) + { + CalculationResult = damPipingOutput.CalculationResult + }; + + var pipingDesignResults = new PipingDesignResults(PipingModelType.Wti2017); + designResult.PipingDesignResults = pipingDesignResults; + pipingDesignResults.ResultMessage = resultMessage; + pipingDesignResults.RedesignedSurfaceLine = damKernelInput.Location.SurfaceLine; + pipingDesignResults.Wti2017Factor = damPipingOutput.FoSp; + pipingDesignResults.Wti2017Hcritical = damPipingOutput.Hc; + pipingDesignResults.LocalExitPointX = damPipingOutput.ExitPointX; + pipingDesignResults.UpliftFactor = damPipingOutput.UpliftFactor; + pipingDesignResults.UpliftSituation = damPipingOutput.UpliftSituation; + designResults.Add(designResult); + } + + public ShoulderDesign CalculateDesignAtPoint(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, GeometryPoint point, out List messages) + { + throw new NotImplementedException(); + } + + public bool EvaluateDesign(DamKernelInput damKernelInput, IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, out DesignAdvise designAdvise, out string evaluationMessage) + { + throw new NotImplementedException(); + } + + public void PrepareDesign(IKernelDataInput kernelDataInput, IKernelDataOutput kernelDataOutput, DamKernelInput damKernelInput, int iterationIndex, out EmbankmentDesignParameters embankmentDesignParameters) + { + throw new NotImplementedException(); + } + + public DesignStrategy GetDesignStrategy(DamKernelInput damKernelInput) + { + throw new NotImplementedException(); + } + + private static void EvaluateUpliftSituation(DamKernelInput damKernelInput, out IKernelDataInput kernelDataInput, + PlLines plLines, double waterLevel, + WbiPipingSellmeijerRevisedOutput damPipingOutput) + { + const double upliftCriterionTolerance = 0.000000001; + var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile1D; + var surfaceLine = damKernelInput.Location.SurfaceLine; + var location = damKernelInput.Location; + var upliftSituation = new UpliftSituation(); + var upliftLocationDeterminator = new UpliftLocationDeterminator + { + PlLines = plLines, + SoilProfile = soilProfile1D, + SurfaceLine = surfaceLine, + DikeEmbankmentMaterial = location.GetDikeEmbankmentSoil(), + XSoilGeometry2DOrigin = location.XSoilGeometry2DOrigin + }; + // The tolerance is built in because after design it could be that the value that is designed to, is not reached by this margin + var upliftCriterion = location.UpliftCriterionPiping.Value - upliftCriterionTolerance; + var upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(upliftCriterion); + upliftSituation.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; + double? upliftFactor = null; + 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 * Physics.FactorMeterToMicroMeter; + + aquiferHeight = aquiferLayer.Height; + permeabilityKx = aquiferLayer.PermeabilityKx; + upliftFactor = upliftLocationAndResult.UpliftFactor; + } + 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; + } + + kernelDataInput = new WbiPipingSellmeijerRevisedInput() + { + HRiver = waterLevel, + HExit = referenceLevel, + Rc = defaultFluidisationGradient, + DTotal = dCoverLayer, + SeepageLength = seepageLength, + // specific Sellmeijer 4 Forces + KinematicViscosityWater = Physics.WaterViscosity, + WhitesDragCoefficient = inBetweenAquiferlayerSoil.WhitesConstant, + BeddingAngle = inBetweenAquiferlayerSoil.BeddingAngle, + D70 = d70, + DAquifer = aquiferHeight, + DarcyPermeability = permeabilityKx, + }; + damPipingOutput.ExitPointX = xExit; + damPipingOutput.UpliftFactor = upliftFactor; + damPipingOutput.UpliftSituation = upliftSituation; + } + + private static Sellmeijer2011Calculator CreatePipingCalculatorWbiSellmeijerRevised(IKernelDataInput kernelDataInput) + { + var wbiPipingSellmeijerRevisedInput = kernelDataInput as WbiPipingSellmeijerRevisedInput; + ThrowWhenKernelInputNull(wbiPipingSellmeijerRevisedInput); + var calculator = new Sellmeijer2011Calculator + { + HRiver = wbiPipingSellmeijerRevisedInput.HRiver, + HExit = wbiPipingSellmeijerRevisedInput.HExit, + Rc = wbiPipingSellmeijerRevisedInput.Rc, + DTotal = wbiPipingSellmeijerRevisedInput.DTotal, + DAquifer = wbiPipingSellmeijerRevisedInput.DAquifer, + SeepageLength = wbiPipingSellmeijerRevisedInput.SeepageLength, + D70 = wbiPipingSellmeijerRevisedInput.D70, + D70Mean = wbiPipingSellmeijerRevisedInput.D70Mean, + WhitesDragCoefficient = wbiPipingSellmeijerRevisedInput.WhitesDragCoefficient, + BeddingAngle = wbiPipingSellmeijerRevisedInput.BeddingAngle, + DarcyPermeability = wbiPipingSellmeijerRevisedInput.DarcyPermeability, + KinematicViscosityWater = wbiPipingSellmeijerRevisedInput.KinematicViscosityWater, + VolumetricWeightOfWater = wbiPipingSellmeijerRevisedInput.VolumetricWeightOfWater, + GammaSubParticles = wbiPipingSellmeijerRevisedInput.GammaSubParticles, + Gravity = wbiPipingSellmeijerRevisedInput.Gravity, + BottomLevelAquitardAboveExitPointZ = wbiPipingSellmeijerRevisedInput.BottomLevelAquitardAboveExitPointZ, + ModelFactorPiping = wbiPipingSellmeijerRevisedInput.ModelFactorPiping + }; + return calculator; + } + + private static void PerformSingleCalculationWbiSellmeijerRevised(out List messages, WbiPipingSellmeijerRevisedOutput wbiPipingOutput, + WbiPipingSellmeijerRevisedInput wbiPipingInput) + { + wbiPipingOutput.CalculationResult = CalculationResult.NoRun; + wbiPipingOutput.FoSp = defaultMaxReturnValue; + messages = new List(); + try + { + if (wbiPipingOutput.UpliftSituation.IsUplift) + { + var calculator = CreatePipingCalculatorWbiSellmeijerRevised(wbiPipingInput); + calculator.Calculate(); + wbiPipingOutput.FoSp = calculator.FoSp; + wbiPipingOutput.Hc = calculator.Hc; + wbiPipingOutput.CalculationResult = CalculationResult.Succeeded; + } + } + catch (Exception e) + { + wbiPipingOutput.CalculationResult = CalculationResult.UnexpectedError; + messages.Add(new LogMessage(LogMessageType.Error, null, e.Message)); + } + } + + private static void ThrowWhenKernelInputNull(WbiPipingSellmeijerRevisedInput wbiPipingInput) + { + if (wbiPipingInput == null) + { + throw new NoNullAllowedException(Resources.WbiPipingSellmeijerRevisedKernelWrapper_NoInputObjectDefined); + } + } + + private static void ThrowWhenKernelOutputNull(WbiPipingSellmeijerRevisedOutput wbiPipingOutput) + { + if (wbiPipingOutput == null) + { + throw new NoNullAllowedException(Resources.WbiPipingSellmeijerRevisedKernelWrapper_NoOutputObjectDefined); + } + } + + private static void ThrowWhenDamKernelInputNull(DamKernelInput damKernelInput) + { + if (damKernelInput == null) + { + throw new NoNullAllowedException(Resources.WbiPipingSellmeijerRevisedKernelWrapper_NoInputObjectDefined); + } + } + } +} Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/KernelWrapperHelper.cs =================================================================== diff -u -r1078 -r1586 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/KernelWrapperHelper.cs (.../KernelWrapperHelper.cs) (revision 1078) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/Common/KernelWrapperHelper.cs (.../KernelWrapperHelper.cs) (revision 1586) @@ -27,6 +27,7 @@ using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijer4Forces; using Deltares.DamEngine.Calculators.KernelWrappers.DamPipingSellmeijerVnk; using Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Calculators.KernelWrappers.WbiPipingSellmeijerRevised; using Deltares.DamEngine.Calculators.Properties; using Deltares.DamEngine.Data.General; @@ -75,7 +76,8 @@ kernelWrapper = new DamPipingSellmeijer4ForcesKernelWrapper(); break; case PipingModelType.Wti2017: - throw new NotImplementedException(Resources.DesignCalculatorKernelNotImplemented); + kernelWrapper = new WbiPipingSellmeijerRevisedKernelWrapper(); + break; } break; } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs =================================================================== diff -u -r1403 -r1586 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1403) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 1586) @@ -514,5 +514,23 @@ return ResourceManager.GetString("SurfaceLineShoulderAdapterNewShoulderNoIntersectionError", resourceCulture); } } + + /// + /// Looks up a localized string similar to No input object defined for WBI Sellmeijer Revised. + /// + internal static string WbiPipingSellmeijerRevisedKernelWrapper_NoInputObjectDefined { + get { + return ResourceManager.GetString("WbiPipingSellmeijerRevisedKernelWrapper_NoInputObjectDefined", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to No output object defined for WBI Sellmeijer Revised. + /// + internal static string WbiPipingSellmeijerRevisedKernelWrapper_NoOutputObjectDefined { + get { + return ResourceManager.GetString("WbiPipingSellmeijerRevisedKernelWrapper_NoOutputObjectDefined", resourceCulture); + } + } } } Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedOutput.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedOutput.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedOutput.cs (revision 1586) @@ -0,0 +1,113 @@ +// 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 Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Data.General; +using Deltares.DamEngine.Data.Standard.Calculation; + +namespace Deltares.DamEngine.Calculators.KernelWrappers.WbiPipingSellmeijerRevised +{ + /// + /// Output parameters for Wbi Piping SellmeijerRevised + /// + public class WbiPipingSellmeijerRevisedOutput: IKernelDataOutput + { + /// + /// Gets or sets the safetyfactor. + /// + /// + /// The fo sp. + /// + public double FoSp { get; set; } + + /// + /// Gets or sets the H-critical (critical head difference for piping). + /// + /// + /// The hc. + /// + public double Hc { get; set; } + + /// + /// Gets or sets the zp (limit state function). + /// + /// + /// The zp. + /// + // public double Zp { get; set; } DAM does not use this! + + /// + /// Gets or sets the HCP (critical water level for piping). + /// + /// + /// The HCP. + /// + //public double Hcp { get; set; } DAM does not use this! + + /// + /// Gets or sets the creep coefficient. + /// + /// + /// The ccreep. + /// + //public double Ccreep { get; set; } DAM does not use this! + + /// + /// Gets or sets the reduced fall. + /// + /// + /// The reduced fall. + /// + //public double ReducedFall { get; set; } DAM does not use this! + + /// + /// Gets or sets the calculation result. + /// + /// + /// The calculation result. + /// + public CalculationResult CalculationResult { get; set; } + + /// + /// Gets or sets the uplift factor. + /// + /// + /// The uplift factor. + /// + public double? UpliftFactor { get; set; } //#Bka needed?? For now, yes as we use DAM uplift. + + /// + /// Gets or sets the x-coordinate of the exit point. + /// + /// + /// The exit point x. + /// + public double ExitPointX { get; set; }//#Bka needed?? For now, yes + + /// + /// Gets or sets the uplift situation. + /// + /// + /// The uplift situation. + /// + public UpliftSituation UpliftSituation { get; set; }//#Bka needed?? For now, yes + } +} Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj =================================================================== diff -u -r1581 -r1586 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 1581) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 1586) @@ -44,6 +44,9 @@ ..\..\lib\FailureMechanisms\DamPiping\Deltares.DamPiping.SellmeijerVNKCalculator.dll + + ..\..\lib\FailureMechanisms\WbiPiping\Deltares.WTIPiping.dll + False ..\..\lib\log4net.2.0.3\log4net.dll @@ -66,7 +69,10 @@ + + + Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedInput.cs =================================================================== diff -u --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedInput.cs (revision 0) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/WbiPipingSellmeijerRevised/WbiPipingSellmeijerRevisedInput.cs (revision 1586) @@ -0,0 +1,169 @@ +// 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 Deltares.DamEngine.Calculators.KernelWrappers.Interfaces; +using Deltares.DamEngine.Data.General; +using Deltares.WTIPiping; + +namespace Deltares.DamEngine.Calculators.KernelWrappers.WbiPipingSellmeijerRevised +{ + /// + /// Input parameters for Wbi Piping SellmeijerRevised + /// + public class WbiPipingSellmeijerRevisedInput : IKernelDataInput + { + /// + /// Gets or sets the model factor piping. + /// + /// + /// The model factor piping. + /// + public double ModelFactorPiping { get; set; } = 1.0; + + /// + /// 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; } = WTIPipingConstants.RcDefault; + + /// + /// Gets or sets the total thickness of cover layer . + /// + /// + /// The d total. + /// + public double DTotal { get; set; } + + /// + /// The bottom level of the aquitard layer which is on a level above the exit point's + /// z-coordinate. A value of indicates that no such aquitard + /// layer exists. + /// + public double BottomLevelAquitardAboveExitPointZ { get; set; } = double.NaN; + + /// + /// Gets or sets the whites drag coefficient. + /// + /// + /// The whites drag coefficient. + /// + public double WhitesDragCoefficient { get; set; } = WTIPipingConstants.WhitesDragCoefficient; + + /// + /// Gets or sets the bedding angle. + /// + /// + /// The bedding angle. + /// + public double BeddingAngle { get; set; } = WTIPipingConstants.BeddingAngleSellmeijerRevised; + + /// + /// Gets or sets the gamma sub particles. + /// + /// + /// The gamma sub particles. + /// + public double GammaSubParticles { get; set; } = WTIPipingConstants.GammaSubParticles; + + /// + /// Gets or sets the volumetric weight of water. + /// + /// + /// The volumetric weight of water. + /// + public double VolumetricWeightOfWater { get; set; } = Physics.UnitWeightOfwater; + + /// + /// Gets or sets the kinematic viscosity of water. + /// + /// + /// The kinematic viscosity water. + /// + public double KinematicViscosityWater { get; set; } = Physics.WaterViscosity; + + /// + /// Gets or sets the gravity. + /// + /// + /// The gravity. + /// + public double Gravity { get; set; } = Physics.GravityConstant; + + /// + /// Gets or sets the D70. + /// + /// + /// The D70. + /// + public double D70 { get; set; } + + /// + /// Gets or sets the D70 mean. + /// + /// + /// The D70 mean. + /// + public double D70Mean { get; set; } = WTIPipingConstants.D70Mean; + + /// + /// Gets or sets the seepagelength. + /// + /// + /// The length of the seepage. + /// + public double SeepageLength { get; set; } + + /// + /// Gets or sets the darcy permeability. + /// + /// + /// The darcy permeability. + /// + public double DarcyPermeability { get; set; } + + /// + /// Gets or sets the height of the aquifer. + /// + /// + /// The height of the aquifer. + /// + public double DAquifer { get; set; } + + } +}