Exemplo n.º 1
0
        public void ConstructorWithGridsAndTangent_ExpectedValues()
        {
            // Setup
            var    random            = new Random(11);
            double tangentZTop       = random.NextDouble();
            double tangentZBottom    = random.NextDouble();
            int    tangentLineNumber = random.Next();

            UpliftVanGrid leftGrid  = UpliftVanGridTestFactory.Create();
            UpliftVanGrid rightGrid = UpliftVanGridTestFactory.Create();

            // Call
            var slipPlane = new UpliftVanSlipPlane(leftGrid, rightGrid, tangentZTop, tangentZBottom, tangentLineNumber);

            // Assert
            Assert.IsFalse(slipPlane.GridAutomaticDetermined);
            Assert.AreSame(leftGrid, slipPlane.LeftGrid);
            Assert.AreSame(rightGrid, slipPlane.RightGrid);
            Assert.IsFalse(slipPlane.TangentLinesAutomaticAtBoundaries);
            Assert.AreEqual(tangentZTop, slipPlane.TangentZTop);
            Assert.AreEqual(tangentZBottom, slipPlane.TangentZBottom);
            Assert.AreEqual(tangentLineNumber, slipPlane.TangentLineNumber);
            Assert.AreEqual(4, slipPlane.TangentLineNumberOfRefinements);
            Assert.AreEqual(0, slipPlane.GridNumberOfRefinements);
        }
        public void Convert_MacroStabilityInwardsGridDeterminationTypeAutomatic_ReturnUpliftVanSlipPlane()
        {
            // Setup
            var input = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties
            {
                TangentLineZTop    = 1,
                TangentLineZBottom = 0
            })
            {
                GridDeterminationType        = MacroStabilityInwardsGridDeterminationType.Automatic,
                TangentLineDeterminationType = MacroStabilityInwardsTangentLineDeterminationType.Specified,
                TangentLineNumber            = 10
            };

            // Precondition
            Assert.IsNotNull(input.LeftGrid);
            Assert.IsNotNull(input.RightGrid);

            // Call
            UpliftVanSlipPlane slipPlane = UpliftVanSlipPlaneConverter.Convert(input);

            // Assert
            Assert.IsTrue(slipPlane.GridAutomaticDetermined);
            Assert.IsNull(slipPlane.LeftGrid);
            Assert.IsNull(slipPlane.RightGrid);
            Assert.IsTrue(slipPlane.TangentLinesAutomaticAtBoundaries);
            Assert.IsNaN(slipPlane.TangentZTop);
            Assert.IsNaN(slipPlane.TangentZBottom);
            Assert.AreEqual(0, slipPlane.TangentLineNumber);
        }
Exemplo n.º 3
0
        private static UpliftVanCalculatorInput Create(UpliftVanSlipPlane slipPlane)
        {
            MacroStabilityInwardsSurfaceLine surfaceLine = CreateValidSurfaceLine();

            return(new UpliftVanCalculatorInput(new UpliftVanCalculatorInput.ConstructionProperties
            {
                AssessmentLevel = -1,
                SurfaceLine = surfaceLine,
                SoilProfile = CreateValidSoilProfile(),
                DrainageConstruction = new DrainageConstruction(),
                PhreaticLineOffsetsExtreme = new PhreaticLineOffsets(),
                PhreaticLineOffsetsDaily = new PhreaticLineOffsets(),
                SlipPlane = slipPlane,
                SlipPlaneConstraints = new UpliftVanSlipPlaneConstraints(1, 0.7),
                WaterLevelRiverAverage = -1,
                WaterLevelPolderExtreme = -1,
                WaterLevelPolderDaily = -1,
                MinimumLevelPhreaticLineAtDikeTopRiver = 0.1,
                MinimumLevelPhreaticLineAtDikeTopPolder = 0.2,
                LeakageLengthOutwardsPhreaticLine3 = 1.3,
                LeakageLengthInwardsPhreaticLine3 = 1.4,
                LeakageLengthOutwardsPhreaticLine4 = 1.5,
                LeakageLengthInwardsPhreaticLine4 = 1.6,
                PiezometricHeadPhreaticLine2Outwards = 0.3,
                PiezometricHeadPhreaticLine2Inwards = 0.4,
                PenetrationLengthExtreme = 0.5,
                PenetrationLengthDaily = 0.6,
                AdjustPhreaticLine3And4ForUplift = true,
                DikeSoilScenario = MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay,
                MoveGrid = false,
                MaximumSliceWidth = 1
            }));
        }
Exemplo n.º 4
0
        public void Create_SlipPlaneGridsAutomatic_ReturnSlipPlaneUpliftVan()
        {
            // Setup
            var slipPlane = new UpliftVanSlipPlane();

            // Call
            UpliftVanCalculationGrid upliftVanCalculationGrid = UpliftVanCalculationGridCreator.Create(slipPlane);

            // Assert
            Assert.IsNotNull(upliftVanCalculationGrid.LeftGrid);
            Assert.AreEqual(0, upliftVanCalculationGrid.LeftGrid.GridXLeft);
            Assert.AreEqual(0, upliftVanCalculationGrid.LeftGrid.GridXRight);
            Assert.AreEqual(0, upliftVanCalculationGrid.LeftGrid.GridZTop);
            Assert.AreEqual(0, upliftVanCalculationGrid.LeftGrid.GridZBottom);
            Assert.AreEqual(0, upliftVanCalculationGrid.LeftGrid.GridXNumber);
            Assert.AreEqual(0, upliftVanCalculationGrid.LeftGrid.GridZNumber);
            Assert.IsNotNull(upliftVanCalculationGrid.RightGrid);
            Assert.AreEqual(0, upliftVanCalculationGrid.RightGrid.GridXLeft);
            Assert.AreEqual(0, upliftVanCalculationGrid.RightGrid.GridXRight);
            Assert.AreEqual(0, upliftVanCalculationGrid.RightGrid.GridZTop);
            Assert.AreEqual(0, upliftVanCalculationGrid.RightGrid.GridZBottom);
            Assert.AreEqual(0, upliftVanCalculationGrid.RightGrid.GridXNumber);
            Assert.AreEqual(0, upliftVanCalculationGrid.RightGrid.GridZNumber);
            Assert.IsNull(upliftVanCalculationGrid.TangentLines); // Irrelevant - Only for output
        }
Exemplo n.º 5
0
        /// <summary>
        /// Creates a <see cref="UpliftVanCalculationGrid"/> based on the given <paramref name="slipPlane"/>,
        /// which can be used by <see cref="IUpliftVanKernel"/>.
        /// </summary>
        /// <param name="slipPlane">The <see cref="UpliftVanCalculationGrid"/> to get the information from.</param>
        /// <returns>A new <see cref="UpliftVanCalculationGrid"/> with the given information from <paramref name="slipPlane"/>.</returns>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="slipPlane"/> is <c>null</c>.</exception>
        public static UpliftVanCalculationGrid Create(UpliftVanSlipPlane slipPlane)
        {
            if (slipPlane == null)
            {
                throw new ArgumentNullException(nameof(slipPlane));
            }

            var upliftVanCalculationGrid = new UpliftVanCalculationGrid
            {
                LeftGrid  = CreateGrid(slipPlane, slipPlane.LeftGrid),
                RightGrid = CreateGrid(slipPlane, slipPlane.RightGrid)
            };

            return(upliftVanCalculationGrid);
        }
Exemplo n.º 6
0
        public void ParameterlessConstructor_ExpectedValues()
        {
            // Call
            var slipPlane = new UpliftVanSlipPlane();

            // Assert
            Assert.IsTrue(slipPlane.GridAutomaticDetermined);
            Assert.IsNull(slipPlane.LeftGrid);
            Assert.IsNull(slipPlane.RightGrid);
            Assert.IsTrue(slipPlane.TangentLinesAutomaticAtBoundaries);
            Assert.IsNaN(slipPlane.TangentZTop);
            Assert.IsNaN(slipPlane.TangentZBottom);
            Assert.AreEqual(0, slipPlane.TangentLineNumber);
            Assert.AreEqual(4, slipPlane.TangentLineNumberOfRefinements);
            Assert.AreEqual(1, slipPlane.GridNumberOfRefinements);
        }
Exemplo n.º 7
0
        private static CalculationGrid CreateGrid(UpliftVanSlipPlane slipPlane, UpliftVanGrid grid)
        {
            var calculationGrid = new CalculationGrid();

            if (!slipPlane.GridAutomaticDetermined)
            {
                calculationGrid.GridXLeft   = grid.XLeft;
                calculationGrid.GridXRight  = grid.XRight;
                calculationGrid.GridZTop    = grid.ZTop;
                calculationGrid.GridZBottom = grid.ZBottom;
                calculationGrid.GridXNumber = grid.NumberOfHorizontalPoints;
                calculationGrid.GridZNumber = grid.NumberOfVerticalPoints;
            }

            return(calculationGrid);
        }
        public void Convert_MacroStabilityInwardsGridDeterminationTypeManualAndTangentLineDeterminationTypeLayerSeparated_ReturnUpliftVanSlipPlane()
        {
            // Setup
            var random = new Random(11);
            var input  = new MacroStabilityInwardsInput(new MacroStabilityInwardsInput.ConstructionProperties
            {
                LeftGridXLeft   = random.NextRoundedDouble(0.0, 1.0),
                LeftGridXRight  = random.NextRoundedDouble(2.0, 3.0),
                LeftGridZTop    = random.NextRoundedDouble(2.0, 3.0),
                LeftGridZBottom = random.NextRoundedDouble(0.0, 1.0),

                RightGridXLeft   = random.NextRoundedDouble(0.0, 1.0),
                RightGridXRight  = random.NextRoundedDouble(2.0, 3.0),
                RightGridZTop    = random.NextRoundedDouble(2.0, 3.0),
                RightGridZBottom = random.NextRoundedDouble(0.0, 1.0),

                TangentLineZTop    = 1,
                TangentLineZBottom = 0
            })
            {
                GridDeterminationType = MacroStabilityInwardsGridDeterminationType.Manual,
                LeftGrid =
                {
                    NumberOfVerticalPoints   = random.Next(1, 100),
                    NumberOfHorizontalPoints = random.Next(1, 100)
                },
                RightGrid =
                {
                    NumberOfVerticalPoints   = random.Next(1, 100),
                    NumberOfHorizontalPoints = random.Next(1, 100)
                },
                TangentLineDeterminationType = MacroStabilityInwardsTangentLineDeterminationType.LayerSeparated,
                TangentLineNumber            = 10
            };

            // Call
            UpliftVanSlipPlane slipPlane = UpliftVanSlipPlaneConverter.Convert(input);

            // Assert
            Assert.IsFalse(slipPlane.GridAutomaticDetermined);
            AssertGrid(input.LeftGrid, slipPlane.LeftGrid);
            AssertGrid(input.RightGrid, slipPlane.RightGrid);
            Assert.IsTrue(slipPlane.TangentLinesAutomaticAtBoundaries);
            Assert.IsNaN(slipPlane.TangentZTop);
            Assert.IsNaN(slipPlane.TangentZBottom);
            Assert.AreEqual(0, slipPlane.TangentLineNumber);
        }
        public void Constructor_EmptyConstructionProperties_ExpectedValues()
        {
            // Setup
            var surfaceLine          = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var soilProfile          = new TestSoilProfile();
            var drainageConstruction = new DrainageConstruction();
            var phreaticLineOffsets  = new PhreaticLineOffsets();
            var slipPlane            = new UpliftVanSlipPlane();
            var slipPlaneConstraints = new UpliftVanSlipPlaneConstraints(double.NaN, double.NaN);

            // Call
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                SurfaceLine                = surfaceLine,
                SoilProfile                = soilProfile,
                DrainageConstruction       = drainageConstruction,
                PhreaticLineOffsetsExtreme = phreaticLineOffsets,
                PhreaticLineOffsetsDaily   = phreaticLineOffsets,
                SlipPlane            = slipPlane,
                SlipPlaneConstraints = slipPlaneConstraints
            });

            // Assert
            Assert.IsNaN(input.AssessmentLevel);
            Assert.IsNaN(input.WaterLevelRiverAverage);
            Assert.IsNaN(input.WaterLevelPolderExtreme);
            Assert.IsNaN(input.WaterLevelPolderDaily);
            Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.IsNaN(input.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.IsNaN(input.LeakageLengthOutwardsPhreaticLine3);
            Assert.IsNaN(input.LeakageLengthInwardsPhreaticLine3);
            Assert.IsNaN(input.LeakageLengthOutwardsPhreaticLine4);
            Assert.IsNaN(input.LeakageLengthInwardsPhreaticLine4);
            Assert.IsNaN(input.PiezometricHeadPhreaticLine2Outwards);
            Assert.IsNaN(input.PiezometricHeadPhreaticLine2Inwards);
            Assert.IsNaN(input.PenetrationLengthDaily);
            Assert.IsNaN(input.PenetrationLengthExtreme);
            Assert.IsNaN(input.MaximumSliceWidth);
            Assert.IsNaN(input.WaterVolumetricWeight);

            Assert.IsFalse(input.AdjustPhreaticLine3And4ForUplift);
            Assert.IsFalse(input.MoveGrid);

            Assert.AreEqual(MacroStabilityInwardsDikeSoilScenario.ClayDikeOnClay, input.DikeSoilScenario);
        }
Exemplo n.º 10
0
        public void ConstructorWithGrids_ExpectedValues()
        {
            // Setup
            UpliftVanGrid leftGrid  = UpliftVanGridTestFactory.Create();
            UpliftVanGrid rightGrid = UpliftVanGridTestFactory.Create();

            // Call
            var slipPlane = new UpliftVanSlipPlane(leftGrid, rightGrid);

            // Assert
            Assert.IsFalse(slipPlane.GridAutomaticDetermined);
            Assert.AreSame(leftGrid, slipPlane.LeftGrid);
            Assert.AreSame(rightGrid, slipPlane.RightGrid);
            Assert.IsTrue(slipPlane.TangentLinesAutomaticAtBoundaries);
            Assert.IsNaN(slipPlane.TangentZTop);
            Assert.IsNaN(slipPlane.TangentZBottom);
            Assert.AreEqual(0, slipPlane.TangentLineNumber);
            Assert.AreEqual(4, slipPlane.TangentLineNumberOfRefinements);
            Assert.AreEqual(0, slipPlane.GridNumberOfRefinements);
        }
Exemplo n.º 11
0
        public void Create_WithSlipPlane_ReturnUpliftVanCalculationGrid()
        {
            // Setup
            var    random           = new Random(21);
            double leftGridXLeft    = random.NextDouble();
            double leftGridXRight   = random.NextDouble();
            double leftGridZTop     = random.NextDouble();
            double leftGridZBottom  = random.NextDouble();
            int    leftGridXNumber  = random.Next();
            int    leftGridZNumber  = random.Next();
            double rightGridXLeft   = random.NextDouble();
            double rightGridXRight  = random.NextDouble();
            double rightGridZTop    = random.NextDouble();
            double rightGridZBottom = random.NextDouble();
            int    rightGridXNumber = random.Next();
            int    rightGridZNumber = random.Next();

            var leftGrid  = new UpliftVanGrid(leftGridXLeft, leftGridXRight, leftGridZTop, leftGridZBottom, leftGridXNumber, leftGridZNumber);
            var rightGrid = new UpliftVanGrid(rightGridXLeft, rightGridXRight, rightGridZTop, rightGridZBottom, rightGridXNumber, rightGridZNumber);
            var slipPlane = new UpliftVanSlipPlane(leftGrid, rightGrid);

            // Call
            UpliftVanCalculationGrid upliftVanCalculationGrid = UpliftVanCalculationGridCreator.Create(slipPlane);

            // Assert
            Assert.AreEqual(leftGridXLeft, upliftVanCalculationGrid.LeftGrid.GridXLeft);
            Assert.AreEqual(leftGridXRight, upliftVanCalculationGrid.LeftGrid.GridXRight);
            Assert.AreEqual(leftGridZTop, upliftVanCalculationGrid.LeftGrid.GridZTop);
            Assert.AreEqual(leftGridZBottom, upliftVanCalculationGrid.LeftGrid.GridZBottom);
            Assert.AreEqual(leftGridXNumber, upliftVanCalculationGrid.LeftGrid.GridXNumber);
            Assert.AreEqual(leftGridZNumber, upliftVanCalculationGrid.LeftGrid.GridZNumber);
            Assert.AreEqual(rightGridXLeft, upliftVanCalculationGrid.RightGrid.GridXLeft);
            Assert.AreEqual(rightGridXRight, upliftVanCalculationGrid.RightGrid.GridXRight);
            Assert.AreEqual(rightGridZTop, upliftVanCalculationGrid.RightGrid.GridZTop);
            Assert.AreEqual(rightGridZBottom, upliftVanCalculationGrid.RightGrid.GridZBottom);
            Assert.AreEqual(rightGridXNumber, upliftVanCalculationGrid.RightGrid.GridXNumber);
            Assert.AreEqual(rightGridZNumber, upliftVanCalculationGrid.RightGrid.GridZNumber);
            Assert.IsNull(upliftVanCalculationGrid.TangentLines); // Irrelevant - Only for output
        }
        public void Constructor_WithConstructionProperties_PropertiesAreSet()
        {
            // Setup
            var random = new Random(11);

            double hRiverValue             = random.NextDouble();
            var    surfaceLine             = new MacroStabilityInwardsSurfaceLine(string.Empty);
            var    soilProfile             = new TestSoilProfile();
            var    drainageConstruction    = new DrainageConstruction();
            var    phreaticLineOffsets     = new PhreaticLineOffsets();
            var    slipPlane               = new UpliftVanSlipPlane();
            var    slipPlaneConstraints    = new UpliftVanSlipPlaneConstraints(random.NextDouble(), random.NextDouble());
            double waterLevelRiverAverage  = random.NextDouble();
            double waterLevelPolderExtreme = random.NextDouble();
            double waterLevelPolderDaily   = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopRiver  = random.NextDouble();
            double minimumLevelPhreaticLineAtDikeTopPolder = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine3      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine3       = random.NextDouble();
            double leakageLengthOutwardsPhreaticLine4      = random.NextDouble();
            double leakageLengthInwardsPhreaticLine4       = random.NextDouble();
            double piezometricHeadPhreaticLine2Outwards    = random.NextDouble();
            double piezometricHeadPhreaticLine2Inwards     = random.NextDouble();
            double penetrationLengthExtreme         = random.NextDouble();
            double penetrationLengthDaily           = random.NextDouble();
            bool   adjustPhreaticLine3And4ForUplift = random.NextBoolean();
            var    dikeSoilScenario      = random.NextEnumValue <MacroStabilityInwardsDikeSoilScenario>();
            bool   moveGrid              = random.NextBoolean();
            double maximumSliceWidth     = random.NextDouble();
            double waterVolumetricWeight = random.NextDouble();

            // Call
            var input = new UpliftVanCalculatorInput(
                new UpliftVanCalculatorInput.ConstructionProperties
            {
                AssessmentLevel            = hRiverValue,
                SurfaceLine                = surfaceLine,
                SoilProfile                = soilProfile,
                DrainageConstruction       = drainageConstruction,
                PhreaticLineOffsetsExtreme = phreaticLineOffsets,
                PhreaticLineOffsetsDaily   = phreaticLineOffsets,
                SlipPlane               = slipPlane,
                SlipPlaneConstraints    = slipPlaneConstraints,
                WaterLevelRiverAverage  = waterLevelRiverAverage,
                WaterLevelPolderExtreme = waterLevelPolderExtreme,
                WaterLevelPolderDaily   = waterLevelPolderDaily,
                MinimumLevelPhreaticLineAtDikeTopRiver  = minimumLevelPhreaticLineAtDikeTopRiver,
                MinimumLevelPhreaticLineAtDikeTopPolder = minimumLevelPhreaticLineAtDikeTopPolder,
                LeakageLengthOutwardsPhreaticLine3      = leakageLengthOutwardsPhreaticLine3,
                LeakageLengthInwardsPhreaticLine3       = leakageLengthInwardsPhreaticLine3,
                LeakageLengthOutwardsPhreaticLine4      = leakageLengthOutwardsPhreaticLine4,
                LeakageLengthInwardsPhreaticLine4       = leakageLengthInwardsPhreaticLine4,
                PiezometricHeadPhreaticLine2Outwards    = piezometricHeadPhreaticLine2Outwards,
                PiezometricHeadPhreaticLine2Inwards     = piezometricHeadPhreaticLine2Inwards,
                PenetrationLengthExtreme         = penetrationLengthExtreme,
                PenetrationLengthDaily           = penetrationLengthDaily,
                AdjustPhreaticLine3And4ForUplift = adjustPhreaticLine3And4ForUplift,
                DikeSoilScenario      = dikeSoilScenario,
                MoveGrid              = moveGrid,
                MaximumSliceWidth     = maximumSliceWidth,
                WaterVolumetricWeight = waterVolumetricWeight
            });

            // Assert
            Assert.AreEqual(hRiverValue, input.AssessmentLevel);
            Assert.AreSame(surfaceLine, input.SurfaceLine);
            Assert.AreSame(soilProfile, input.SoilProfile);
            Assert.AreSame(drainageConstruction, input.DrainageConstruction);
            Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsetsDaily);
            Assert.AreSame(phreaticLineOffsets, input.PhreaticLineOffsetsExtreme);
            Assert.AreSame(slipPlane, input.SlipPlane);
            Assert.AreSame(slipPlaneConstraints, input.SlipPlaneConstraints);

            Assert.AreEqual(waterLevelRiverAverage, input.WaterLevelRiverAverage);
            Assert.AreEqual(waterLevelPolderExtreme, input.WaterLevelPolderExtreme);
            Assert.AreEqual(waterLevelPolderDaily, input.WaterLevelPolderDaily);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopRiver, input.MinimumLevelPhreaticLineAtDikeTopRiver);
            Assert.AreEqual(minimumLevelPhreaticLineAtDikeTopPolder, input.MinimumLevelPhreaticLineAtDikeTopPolder);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine3, input.LeakageLengthOutwardsPhreaticLine3);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine3, input.LeakageLengthInwardsPhreaticLine3);
            Assert.AreEqual(leakageLengthOutwardsPhreaticLine4, input.LeakageLengthOutwardsPhreaticLine4);
            Assert.AreEqual(leakageLengthInwardsPhreaticLine4, input.LeakageLengthInwardsPhreaticLine4);
            Assert.AreEqual(piezometricHeadPhreaticLine2Outwards, input.PiezometricHeadPhreaticLine2Outwards);
            Assert.AreEqual(piezometricHeadPhreaticLine2Inwards, input.PiezometricHeadPhreaticLine2Inwards);
            Assert.AreEqual(penetrationLengthExtreme, input.PenetrationLengthExtreme);
            Assert.AreEqual(penetrationLengthDaily, input.PenetrationLengthDaily);
            Assert.AreEqual(adjustPhreaticLine3And4ForUplift, input.AdjustPhreaticLine3And4ForUplift);

            Assert.AreEqual(dikeSoilScenario, input.DikeSoilScenario);
            Assert.AreEqual(moveGrid, input.MoveGrid);
            Assert.AreEqual(maximumSliceWidth, input.MaximumSliceWidth);
            Assert.AreEqual(waterVolumetricWeight, input.WaterVolumetricWeight);
        }