// Copyright (C) Stichting Deltares 2017. All rights reserved. // // This file is part of the application DAM - UI. // // DAM - UI is free software: you can redistribute it and/or modify // it under the terms of the GNU 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 General Public License for more details. // // You should have received a copy of the GNU 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 Deltares.Dam.Data; using NUnit.Framework; using Deltares.Dam.TestHelper; using Deltares.Standard.TestUtils; namespace Deltares.Dam.Tests { [TestFixture, Category("Calculation")] 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 // TODO: DAMUI Start //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; return null; // TODO: DAMUI End } } /// /// Benchmark test 1 /// [Test] [Category(Categories.WorkInProgress)] // To be checked 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] [Category(Categories.WorkInProgress)] // To be checked 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] [Category(Categories.WorkInProgress)] // To be checked 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] [Category(Categories.WorkInProgress)] // To be checked 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] [Category(Categories.WorkInProgress)] // To be checked 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); } } }