using System; using System.Collections.Generic; using System.IO; using Deltares.Dam.Data; using NUnit.Framework; using Deltares.Dam.TestHelper; using Deltares.Standard.TestUtils; namespace Deltares.Dam.Tests { [TestFixture] public class DamPipingBenchmarkTest { const string CmstabProgramPath = ".\\DGeoStability.exe"; const double cTolerance = 0.0005; /// /// Compute project /// /// /// private static List> ComputeProject(string projectFilename) { // Read dikering using (var damProjectData = ProjectLoader.LoadProjectData(projectFilename)) { Assert.AreEqual(1, damProjectData.WaterBoard.Dikes.Count); var dike = damProjectData.WaterBoard.Dikes[0]; Assert.AreEqual(1, dike.Locations.Count); // Calculate dijkring var damProjectCalculator = new DamProjectCalculator(damProjectData); damProjectCalculator.CalculationBaseDirectory = Path.Combine(Path.GetDirectoryName(Path.GetFullPath(projectFilename)), "CalculationFiles"); damProjectCalculator.MStabProgramPath = CmstabProgramPath; var allCalculationresults = damProjectCalculator.Calculate(damProjectData, dike.Scenarios); return allCalculationresults; } } /// /// Benchmark test 1 /// [Test] [Ignore("No effort to be put in Dam Piping Failure mechanism, it will be replaced by WBI piping")] public void Bm01OneAquiferOneLayer() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 1\Integratietest piping 1.damx"; var allCalculationresults = ComputeProject(projectFilename); double expectedPipingFactor = 0.506; // This is calculated according to spreadsheet double expectedHCritical = 1.618839023; // This is calculated according to spreadsheet double expectedLocalPipingExitPointX = 35; // This is just taken from the calculation result itself double expectedPl3HeadAdjusted = 1.2619775739041792; // This is just taken from the calculation result itself double expectedPl4HeadAdjusted = 0.0; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); Assert.AreEqual(expectedHCritical, allCalculationresults[0][0].Sellmeijer4ForcesHCritical.Value, cTolerance); Assert.AreEqual(true, allCalculationresults[0][0].IsUplift.Value); Assert.AreEqual(expectedLocalPipingExitPointX, allCalculationresults[0][0].LocalPipingExitPointX.Value, cTolerance); Assert.AreEqual(expectedPl3HeadAdjusted, allCalculationresults[0][0].Pl3HeadAdjusted.Value, cTolerance); Assert.AreEqual(expectedPl4HeadAdjusted, allCalculationresults[0][0].Pl4HeadAdjusted.Value, cTolerance); expectedPipingFactor = 0.3774; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); expectedPipingFactor = 0.36395601533789024; // This is just taken from the calculation result itself expectedHCritical = 1.3830328582839828; // This is just taken from the calculation result itself expectedLocalPipingExitPointX = 35; // This is just taken from the calculation result itself expectedPl3HeadAdjusted = 0.0; // This is just taken from the calculation result itself expectedPl4HeadAdjusted = 0.0; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); Assert.AreEqual(expectedHCritical, allCalculationresults[0][0].Wti2017HCritical.Value, cTolerance); Assert.AreEqual(true, allCalculationresults[0][0].IsUplift.Value); Assert.AreEqual(expectedLocalPipingExitPointX, allCalculationresults[0][0].LocalPipingExitPointX.Value, cTolerance); //Assert.AreEqual(expectedPl3HeadAdjusted, allCalculationresults[0][0].Pl3HeadAdjusted.Value, cTolerance); //Assert.AreEqual(expectedPl4HeadAdjusted, allCalculationresults[0][0].Pl4HeadAdjusted.Value, cTolerance); } /// /// Benchmark test 2 /// [Test] [Ignore("No effort to be put in Dam Piping Failure mechanism, it will be replaced by WBI piping")] public void Bm02OneAquiferTwoLayers() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 2\Integratietest piping 2.damx"; var allCalculationresults = ComputeProject(projectFilename); double expectedPipingFactor = 0.489; // This is calculated according to spreadsheet Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.3688; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); expectedPipingFactor = 0.35572120356770748; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); } /// /// Benchmark test 3 /// [Test] [Ignore("No effort to be put in Dam Piping Failure mechanism, it will be replaced by WBI piping")] public void Bm03OneAquiferThreeLayers() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 3\Integratietest piping 3.damx"; var allCalculationresults = ComputeProject(projectFilename); double expectedPipingFactor = 0.494; // This is calculated according to spreadsheet Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.3733; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); expectedPipingFactor = 0.36005969460534598; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); } /// /// Benchmark test 4 /// [Test] [Ignore("No effort to be put in Dam Piping Failure mechanism, it will be replaced by WBI piping")] public void Bm04TwoAquifersOneLayer() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 4\Integratietest piping 4.damx"; var allCalculationresults = ComputeProject(projectFilename); double expectedPipingFactor = 0.608; // This is calculated according to spreadsheet Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.4410; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); expectedPipingFactor = 0.42527879109125538; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); } /// /// Benchmark test 5 /// [Test] [Ignore("No effort to be put in Dam Piping Failure mechanism, it will be replaced by WBI piping")] public void Bm05TwoAquifersTwoLayers() { string projectFilename = @"..\..\..\data\Dam\Benchmarks\Piping\Test 5\Integratietest piping 5.damx"; var allCalculationresults = ComputeProject(projectFilename); double expectedPipingFactor = 0.618; // This is calculated according to spreadsheet Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer4ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.4494; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Sellmeijer2ForcesPipingFactor.Value, cTolerance); expectedPipingFactor = 0.5208; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].BlighPipingFactor.Value, cTolerance); expectedPipingFactor = 0.43345922746899618; // This is just taken from the calculation result itself Assert.AreEqual(expectedPipingFactor, allCalculationresults[0][0].Wti2017PipingFactor.Value, cTolerance); } } }