// 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.IO; using Deltares.Dam.Data.DataPlugins.Configuration; using Deltares.Dam.TestHelper; namespace Deltares.Dam.Tests { using System.Collections.Generic; using Deltares.Dam.Data; using NUnit.Framework; [TestFixture, Category("Calculation")] public class DamStabilityNWOIntegrationTest { const string cmstabProgramPath = ".\\DGeoStability.exe"; const string cDikeFolder = @"TestData\StabilityNWO"; const string defxFile = @"\Import.defx"; [Test, Ignore("This test does not work and has to be fixed; failed after implementing new csv importer")] public void DesignNWOStabilityCalculation() { const double cTolerance = 0.001; // Read dikering using (var damProjectData = new DamProjectData()) { damProjectData.WaterBoard = WaterBoardImporter.ImportAllData(cDikeFolder, DataSourceContainer.Deserialize(cDikeFolder + defxFile), DamType.Regional, DamProjectType.Design, null); var dike = damProjectData.WaterBoard.Dikes[0]; // TODO NonWaterRetainingObjects is not for Dam 1.0 // dike.NonWaterRetainingObjects[0].StepSizeX = 1.25; dike.Validate(); Assert.AreEqual(4, dike.Locations.Count); // Specify calculation MStabParameters mstabParameters = FactoryForStabilityTests.CreateMStabParameters(); mstabParameters.GridPosition = MStabGridPosition.Left; mstabParameters.SearchMethod = MStabSearchMethod.Grid; mstabParameters.SoilDatabaseName = dike.SoilDatabaseName; var damCalculationSpecification = new DamFailureMechanismeCalculationSpecification() { FailureMechanismSystemType = FailureMechanismSystemType.StabilityOutside, FailureMechanismeParamatersMStab = new FailureMechanismeParamatersMStab() { MStabParameters = mstabParameters } }; DamProjectCalculationSpecification.SelectedAnalysisType = AnalysisType.AdaptNWO; damProjectData.DamProjectCalculationSpecification.SelectedProbabilisticType = ProbabilisticType.Deterministic; damProjectData.DamProjectCalculationSpecification.DamCalculationSpecifications.Add(damCalculationSpecification); // Calculate dijkring // TODO: DAMUI Start //var damProjectCalculator = new DamProjectCalculator(damProjectData); //damProjectCalculator.CalculationBaseDirectory = Path.GetFullPath(Path.Combine(cDikeFolder, "CalculationFiles")); //damProjectCalculator.MStabProgramPath = cmstabProgramPath; //damProjectCalculator.ProjectDataDirectory = cDikeFolder; //List> allCalculationresults = damProjectCalculator.Calculate(damProjectData, dike.Scenarios); List> allCalculationresults = null; // TODO: DAMUI End //#Bka#Bka Bij multicore wordt niet altijd de juiste 2D ondergrond gebruikt, dit ondanks dar volgenns de naam van sti-file dat wel gebeurt. zie TEST NWO in losse zooi die weg kan, bishop versus // bishop multi core, dwp02-4 sommen 0 t/m 10 gebruiken 10Y_005_STBI ipv de (in de naam genoemde) 10Y_024_STBI. iter 11 gebruikt dan opeens wel de juiste 2d. Single core gaat wel goed! Assert.AreEqual(1.673, allCalculationresults[0][0].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(1.548, allCalculationresults[0][10].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(1.6, allCalculationresults[1][0].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(1.619, allCalculationresults[1][7].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(1.462, allCalculationresults[1][11].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(1.755, allCalculationresults[2][0].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(1.669, allCalculationresults[2][18].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(2.067, allCalculationresults[3][0].StabilitySafetyFactor.Value, cTolerance); Assert.AreEqual(2.069, allCalculationresults[3][7].StabilitySafetyFactor.Value, cTolerance); } } } }