// Copyright (C) Stichting Deltares 2025. 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.IO; using Deltares.DamEngine.Calculators.KernelWrappers.Common; using Deltares.DamEngine.Calculators.Tests.KernelWrappers.TestHelpers; using Deltares.DamEngine.Data.General; using Deltares.DamEngine.Data.Geotechnics; using Deltares.DamEngine.TestHelpers.Factories; using NUnit.Framework; namespace Deltares.DamEngine.Calculators.Tests.KernelWrappers.Common; [TestFixture] public class UpliftHelperTests { [Test] public void TestDetermineUpliftSituationWithSoilProfile2D() { SoilProfile2D soilProfile2D = DamEngineDataTestFactory.CreateSoilProfile2D(null); DamKernelInput damKernelInput = CreateDamKernelInput(); damKernelInput.SubSoilScenario.SoilProfileType = SoilProfileType.ProfileType2D; damKernelInput.SubSoilScenario.SoilProfile2D = soilProfile2D; damKernelInput.Location.CurrentScenario.UpliftCriterionStability = 1.2; UpliftHelper.DeterminePlLinesForStability(damKernelInput, false, out UpliftSituation upliftSituation, out _); Assert.That(upliftSituation.IsUplift, Is.True); damKernelInput.Location.CurrentScenario.UpliftCriterionStability = 0.8; UpliftHelper.DeterminePlLinesForStability(damKernelInput, false, out upliftSituation, out _); Assert.That(upliftSituation.IsUplift, Is.False); } private static DamKernelInput CreateDamKernelInput() { const string testFolder = @"KernelWrappers\Common\TestFiles"; string projectPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), testFolder)); Location location = DamEngineDataTestFactory.CreateLocation(FactoryForSurfaceLines.CreateSurfaceLineTutorial1()); location.StabilityOptions = new StabilityOptions(); location.StabilityOptions.TrafficLoad = 10.0; location.CurrentScenario.RequiredSafetyFactorStabilityInnerSlope = 1.1; var subSoilScenario = new SoilGeometryProbability(); subSoilScenario.SegmentFailureMechanismType = SegmentFailureMechanismType.Stability; var damKernelInput = new DamKernelInput(); damKernelInput.Location = location; damKernelInput.SubSoilScenario = subSoilScenario; damKernelInput.ProjectDir = projectPath; damKernelInput.RiverLevelLow = null; damKernelInput.DamFailureMechanismeCalculationSpecification = new DamFailureMechanismeCalculationSpecification(); return damKernelInput; } }