// 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 Deltares.DamEngine.Calculators.RegionalAssessment.Evaluator; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.TestHelpers.Factories; using NUnit.Framework; namespace Deltares.DamEngine.Calculators.Tests.RegionalAssessment.Evaluator { [TestFixture] public class UpliftEvaluatorTests { [Test] public void CanDetectUplift() { var upliftEvaluator = new UpliftEvaluator(); var surfaceLineTutorial1 = FactoryForSurfaceLines.CreateSurfaceLineTutorial1(); var location = CreateLocation(surfaceLineTutorial1); // Next adjustment to meet condition that all PL3 points removal is enabled (see PLLinesCreator.DetermineHowToActDueToDitch()) location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DitchPolderSide).X += 2.5; var soilProfile = FactoryForSoilProfiles.CreateClaySandProfile(); foreach (SoilLayer1D layer in soilProfile.Layers) { layer.Soil.DryUnitWeight = layer.Soil.AbovePhreaticLevel - 10; } Enum[] previousChoices = CreateChoices(); previousChoices[2] = DikeDrySensitivity.None; var uplifType = (UpliftType)upliftEvaluator.Evaluate(location, new SoilGeometry(soilProfile, null), previousChoices); Assert.AreEqual(UpliftType.NoUplift, uplifType); previousChoices[2] = DikeDrySensitivity.Dry; foreach (var layer in soilProfile.Layers) { layer.Soil.BelowPhreaticLevel = layer.Soil.BelowPhreaticLevel - 10; } uplifType = (UpliftType)upliftEvaluator.Evaluate(location, new SoilGeometry(soilProfile, null), previousChoices); Assert.AreEqual(UpliftType.Uplift, uplifType); } private Location CreateLocation(SurfaceLine2 surfaceline) { var location = new Location { Name = "Test location", DredgingDepth = -4.0, BoezemLevelTp = 2.0, BoezemLevelHbp = 1.8, PolderLevel = -1.0, PolderLevelLow = -1.0 }; location.HeadPl3 = location.BoezemLevelHbp - 0.1; location.HeadPl4 = location.BoezemLevelHbp - 0.1; location.SurfaceLine = surfaceline; location.LocalXZSheetPilePoint = location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver); location.ModelFactors.UpliftCriterionStability = 1.0; location.SheetPileLength = 0.0; return location; } private Enum[] CreateChoices() { Enum[] choices = new Enum[3]; choices[0] = HydraulicShortcutType.NoHydraulicShortcut; choices[1] = LoadSituation.Dry; choices[2] = DikeDrySensitivity.None; return choices; } } }