public static void CalculatePiezometricHeadAtExit_CompleteInput_InputSetOnSubCalculator()
        {
            // Setup
            RoundedDouble assessmentLevel        = new Random(21).NextRoundedDouble();
            var           validPipingCalculation =
                SemiProbabilisticPipingCalculationTestFactory.CreateCalculationWithValidInput <TestSemiProbabilisticPipingCalculation>(
                    new TestHydraulicBoundaryLocation());
            PipingInput input = validPipingCalculation.InputParameters;

            using (new PipingSubCalculatorFactoryConfig())
            {
                // Call
                InputParameterCalculationService.CalculatePiezometricHeadAtExit(
                    assessmentLevel,
                    SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(input).GetDesignValue(),
                    PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue());

                // Assert
                var testFactory = (TestPipingSubCalculatorFactory)PipingSubCalculatorFactory.Instance;
                PiezoHeadCalculatorStub piezometricHeadAtExitCalculator = testFactory.LastCreatedPiezometricHeadAtExitCalculator;

                Assert.AreEqual(assessmentLevel.Value, piezometricHeadAtExitCalculator.HRiver);
                Assert.AreEqual(PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(),
                                piezometricHeadAtExitCalculator.PhiPolder,
                                input.PhreaticLevelExit.GetAccuracy());
                Assert.AreEqual(SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(input).GetDesignValue(),
                                piezometricHeadAtExitCalculator.RExit,
                                input.DampingFactorExit.GetAccuracy());
            }
        }
        public static void CalculateEffectiveThicknessCoverageLayer_CompleteInput_InputSetOnSubCalculator()
        {
            // Setup
            var validPipingCalculation =
                SemiProbabilisticPipingCalculationTestFactory.CreateCalculationWithValidInput <TestSemiProbabilisticPipingCalculation>(
                    new TestHydraulicBoundaryLocation());
            PipingInput input        = validPipingCalculation.InputParameters;
            var         generalInput = new GeneralPipingInput();

            using (new PipingSubCalculatorFactoryConfig())
            {
                // Call
                PipingInput inputParameters = validPipingCalculation.InputParameters;
                InputParameterCalculationService.CalculateEffectiveThicknessCoverageLayer(
                    generalInput.WaterVolumetricWeight,
                    PipingDesignVariableFactory.GetPhreaticLevelExit(inputParameters).GetDesignValue(),
                    inputParameters.ExitPointL,
                    inputParameters.SurfaceLine,
                    inputParameters.StochasticSoilProfile.SoilProfile);

                // Assert
                var testFactory = (TestPipingSubCalculatorFactory)PipingSubCalculatorFactory.Instance;
                EffectiveThicknessCalculatorStub effectiveThicknessCalculator = testFactory.LastCreatedEffectiveThicknessCalculator;

                Assert.AreEqual(input.ExitPointL.Value, effectiveThicknessCalculator.ExitPointXCoordinate);
                Assert.AreEqual(PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(),
                                effectiveThicknessCalculator.PhreaticLevel,
                                input.PhreaticLevelExit.GetAccuracy());
                AssertEqualSoilProfiles(input.StochasticSoilProfile.SoilProfile, effectiveThicknessCalculator.SoilProfile);
                AssertEqualSurfaceLines(input.SurfaceLine, effectiveThicknessCalculator.SurfaceLine);
                Assert.AreEqual(generalInput.WaterVolumetricWeight, effectiveThicknessCalculator.VolumicWeightOfWater);
            }
        }
Exemple #3
0
        public void GetPiezometricHeadExit_ValidInput_SetsParametersForCalculatorAndReturnsNotNaN()
        {
            // Setup
            var input = new TestPipingInput();

            using (new PipingSubCalculatorFactoryConfig())
            {
                // Setup
                var assessmentLevel = (RoundedDouble)1.1;

                // Call
                RoundedDouble piezometricHead = DerivedSemiProbabilisticPipingInput.GetPiezometricHeadExit(input, assessmentLevel);

                // Assert
                Assert.AreEqual(2, piezometricHead.NumberOfDecimalPlaces);
                Assert.IsFalse(double.IsNaN(piezometricHead));

                var factory = (TestPipingSubCalculatorFactory)PipingSubCalculatorFactory.Instance;
                PiezoHeadCalculatorStub piezometricHeadAtExitCalculator = factory.LastCreatedPiezometricHeadAtExitCalculator;

                Assert.AreEqual(assessmentLevel, piezometricHeadAtExitCalculator.HRiver, assessmentLevel.GetAccuracy());
                Assert.AreEqual(PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.PhiPolder,
                                input.PhreaticLevelExit.GetAccuracy());
                Assert.AreEqual(SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.RExit,
                                input.DampingFactorExit.GetAccuracy());
            }
        }
Exemple #4
0
        public void GetPhreaticLevelExit_PipingInputNull_ThrowsArgumentNullException()
        {
            // Call
            void Call() => PipingDesignVariableFactory.GetPhreaticLevelExit(null);

            // Assert
            var exception = Assert.Throws <ArgumentNullException>(Call);

            Assert.AreEqual("pipingInput", exception.ParamName);
        }
Exemple #5
0
        public void GetPhreaticLevelExit_ValidPipingInput_CreateDesignVariableForPhreaticLevelExit()
        {
            // Setup
            var pipingInput = new TestPipingInput();

            // Call
            DesignVariable <NormalDistribution> phreaticLevelExit = PipingDesignVariableFactory.GetPhreaticLevelExit(pipingInput);

            // Assert
            Assert.AreSame(pipingInput.PhreaticLevelExit, phreaticLevelExit.Distribution);
            AssertPercentile(0.05, phreaticLevelExit);
        }
        public static void CalculateEffectiveThicknessCoverageLayer_WithMultipleCharacteristicTypesOnSamePoint_ReturnsThickness()
        {
            // Setup
            var surfaceLine = new PipingSurfaceLine(string.Empty);

            surfaceLine.SetGeometry(new[]
            {
                new Point3D(0, 0, 10),
                new Point3D(20, 0, 10)
            });
            surfaceLine.SetDikeToeAtRiverAt(surfaceLine.Points.ElementAt(0));
            surfaceLine.SetDikeToeAtPolderAt(surfaceLine.Points.ElementAt(0));
            surfaceLine.SetDitchDikeSideAt(surfaceLine.Points.ElementAt(0));
            surfaceLine.SetBottomDitchPolderSideAt(surfaceLine.Points.ElementAt(1));
            surfaceLine.SetBottomDitchDikeSideAt(surfaceLine.Points.ElementAt(1));
            surfaceLine.SetDitchPolderSideAt(surfaceLine.Points.ElementAt(1));

            var stochasticSoilProfile = new PipingStochasticSoilProfile(
                0.0, new PipingSoilProfile(string.Empty, 0, new[]
            {
                new PipingSoilLayer(5)
                {
                    IsAquifer = true
                },
                new PipingSoilLayer(20)
                {
                    IsAquifer = false
                }
            }, SoilProfileType.SoilProfile1D));

            var input = new TestPipingInput
            {
                ExitPointL            = (RoundedDouble)10,
                SurfaceLine           = surfaceLine,
                StochasticSoilProfile = stochasticSoilProfile
            };

            var generalInput = new GeneralPipingInput();

            // Call
            double thickness = InputParameterCalculationService.CalculateEffectiveThicknessCoverageLayer(
                generalInput.WaterVolumetricWeight,
                PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(),
                input.ExitPointL,
                input.SurfaceLine,
                input.StochasticSoilProfile.SoilProfile);

            // Assert
            Assert.AreEqual(5, thickness);
        }
        public static void CalculatePiezometricHeadAtExit_Always_ReturnsResult()
        {
            // Setup
            var input = new TestPipingInput();

            // Call
            double result = InputParameterCalculationService.CalculatePiezometricHeadAtExit(
                (RoundedDouble)0.0,
                SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(input).GetDesignValue(),
                PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue());

            // Assert
            Assert.IsFalse(double.IsNaN(result));
        }
Exemple #8
0
        /// <summary>
        /// Gets the piezometric head at the exit point.
        /// [m]
        /// </summary>
        /// <param name="input">The input to calculate the derived piping input for.</param>
        /// <param name="assessmentLevel">The assessment level at stake.</param>
        /// <exception cref="ArgumentNullException">Thrown when <paramref name="input"/> is <c>null</c>.</exception>
        /// <returns>Returns the corresponding derived input value.</returns>
        public static RoundedDouble GetPiezometricHeadExit(PipingInput input, RoundedDouble assessmentLevel)
        {
            if (input == null)
            {
                throw new ArgumentNullException(nameof(input));
            }

            RoundedDouble dampingFactorExit = SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(input).GetDesignValue();
            RoundedDouble phreaticLevelExit = PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue();

            return(new RoundedDouble(2, InputParameterCalculationService.CalculatePiezometricHeadAtExit(assessmentLevel,
                                                                                                        dampingFactorExit,
                                                                                                        phreaticLevelExit)));
        }
        public static void CalculateEffectiveThicknessCoverageLayer_InvalidPipingCalculationWithOutput_ReturnsNaN()
        {
            // Setup
            var invalidPipingCalculation =
                SemiProbabilisticPipingCalculationTestFactory.CreateCalculationWithValidInput <TestSemiProbabilisticPipingCalculation>(
                    new TestHydraulicBoundaryLocation());

            // Make invalid by having surface line partially above soil profile:
            double highestLevelSurfaceLine = invalidPipingCalculation.InputParameters.SurfaceLine.Points.Max(p => p.Z);
            double soilProfileTop          = highestLevelSurfaceLine - 0.5;
            double soilProfileBottom       = soilProfileTop - 0.5;

            invalidPipingCalculation.InputParameters.StochasticSoilProfile = new PipingStochasticSoilProfile(
                0.0,
                new PipingSoilProfile("A", soilProfileBottom, new[]
            {
                new PipingSoilLayer(soilProfileTop)
                {
                    IsAquifer = true
                }
            }, SoilProfileType.SoilProfile1D));

            var generalInput = new GeneralPipingInput();

            // Call
            PipingInput input  = invalidPipingCalculation.InputParameters;
            double      result = InputParameterCalculationService.CalculateEffectiveThicknessCoverageLayer(
                generalInput.WaterVolumetricWeight,
                PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(),
                input.ExitPointL,
                input.SurfaceLine,
                input.StochasticSoilProfile.SoilProfile);

            // Assert
            Assert.IsNaN(result);
        }
        private static PipingCalculatorInput CreateInputFromData(SemiProbabilisticPipingInput input,
                                                                 GeneralPipingInput generalPipingInput,
                                                                 RoundedDouble normativeAssessmentLevel)
        {
            RoundedDouble effectiveAssessmentLevel = GetEffectiveAssessmentLevel(input, normativeAssessmentLevel);

            return(new PipingCalculatorInput(
                       new PipingCalculatorInput.ConstructionProperties
            {
                WaterVolumetricWeight = generalPipingInput.WaterVolumetricWeight,
                SaturatedVolumicWeightOfCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetSaturatedVolumicWeightOfCoverageLayer(input).GetDesignValue(),
                UpliftModelFactor = SemiProbabilisticPipingDesignVariableFactory.GetUpliftModelFactorDesignVariable(generalPipingInput).GetDesignValue(),
                AssessmentLevel = effectiveAssessmentLevel,
                PiezometricHeadExit = DerivedSemiProbabilisticPipingInput.GetPiezometricHeadExit(input, effectiveAssessmentLevel),
                DampingFactorExit = SemiProbabilisticPipingDesignVariableFactory.GetDampingFactorExit(input).GetDesignValue(),
                PhreaticLevelExit = PipingDesignVariableFactory.GetPhreaticLevelExit(input).GetDesignValue(),
                CriticalHeaveGradient = SemiProbabilisticPipingDesignVariableFactory.GetCriticalHeaveGradientDesignVariable(generalPipingInput).GetDesignValue(),
                ThicknessCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetThicknessCoverageLayer(input).GetDesignValue(),
                EffectiveThicknessCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetEffectiveThicknessCoverageLayer(input, generalPipingInput).GetDesignValue(),
                SellmeijerModelFactor = SemiProbabilisticPipingDesignVariableFactory.GetSellmeijerModelFactorDesignVariable(generalPipingInput).GetDesignValue(),
                SellmeijerReductionFactor = generalPipingInput.SellmeijerReductionFactor,
                SeepageLength = SemiProbabilisticPipingDesignVariableFactory.GetSeepageLength(input).GetDesignValue(),
                SandParticlesVolumicWeight = generalPipingInput.SandParticlesVolumicWeight,
                WhitesDragCoefficient = generalPipingInput.WhitesDragCoefficient,
                Diameter70 = SemiProbabilisticPipingDesignVariableFactory.GetDiameter70(input).GetDesignValue(),
                DarcyPermeability = SemiProbabilisticPipingDesignVariableFactory.GetDarcyPermeability(input).GetDesignValue(),
                WaterKinematicViscosity = generalPipingInput.WaterKinematicViscosity,
                Gravity = generalPipingInput.Gravity,
                ThicknessAquiferLayer = SemiProbabilisticPipingDesignVariableFactory.GetThicknessAquiferLayer(input).GetDesignValue(),
                MeanDiameter70 = generalPipingInput.MeanDiameter70,
                BeddingAngle = generalPipingInput.BeddingAngle,
                ExitPointXCoordinate = input.ExitPointL,
                SurfaceLine = input.SurfaceLine,
                SoilProfile = input.StochasticSoilProfile?.SoilProfile
            }));
        }