public void GetDarcyPermeability_SingleAquiferLayerWithRandomMeanAndDeviation_ReturnsDistributionWithWeightedMean() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); var random = new Random(21); double permeabilityMean = 0.1 + random.NextDouble(); double permeabilityCoefficientOfVariation = random.NextDouble(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile("", -2.0, new[] { new PipingSoilLayer(1.0) { IsAquifer = true, Permeability = new VariationCoefficientLogNormalDistribution { Mean = (RoundedDouble)permeabilityMean, CoefficientOfVariation = (RoundedDouble)permeabilityCoefficientOfVariation } } }, SoilProfileType.SoilProfile1D)); // Call VariationCoefficientLogNormalDistribution result = DerivedPipingInput.GetDarcyPermeability(input); // Assert var expectedMean = new RoundedDouble(6, permeabilityMean); var expectedCoefficientOfVariation = new RoundedDouble(6, permeabilityCoefficientOfVariation); AssertDarcyPermeability(result, expectedMean, expectedCoefficientOfVariation); }
public void GetThicknessAquiferLayer_InputResultsInZeroAquiferThickness_ReturnsDistributionWithMeanNaN() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile(string.Empty, 0, new[] { new PipingSoilLayer(2.0) { IsAquifer = false }, new PipingSoilLayer(0.0) { IsAquifer = true } }, SoilProfileType.SoilProfile1D) ); // Call LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); // Assert AssertThicknessAquiferLayer(thicknessAquiferLayer); }
/// <summary> /// Creates the design variable for the total thickness of the aquifer layers at the exit point. /// </summary> /// <param name="pipingInput">The piping input.</param> /// <returns>The created <see cref="DesignVariable{LogNormalDistribution}"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="pipingInput"/> is <c>null</c>.</exception> public static DesignVariable <LogNormalDistribution> GetThicknessAquiferLayer(PipingInput pipingInput) { return(new LogNormalDistributionDesignVariable(DerivedPipingInput.GetThicknessAquiferLayer(pipingInput)) { Percentile = 0.95 }); }
/// <summary> /// Creates the design variable for the Darcy-speed with which water flows through the aquifer layer. /// </summary> /// <param name="pipingInput">The piping input.</param> /// <returns>The created <see cref="VariationCoefficientDesignVariable{VariationCoefficientLogNormalDistribution}"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="pipingInput"/> is <c>null</c>.</exception> public static VariationCoefficientDesignVariable <VariationCoefficientLogNormalDistribution> GetDarcyPermeability(PipingInput pipingInput) { return(new VariationCoefficientLogNormalDistributionDesignVariable(DerivedPipingInput.GetDarcyPermeability(pipingInput)) { Percentile = 0.95 }); }
private static void AssertCalculatorInput(GeneralPipingInput generalInput, ProbabilisticPipingInput input, double sectionLength, PipingCalculationInput actualInput) { LogNormalDistribution effectiveThicknessCoverageLayer = DerivedPipingInput.GetEffectiveThicknessCoverageLayer(input, generalInput); LogNormalDistribution saturatedVolumicWeightOfCoverageLayer = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(input); VariationCoefficientLogNormalDistribution seepageLength = DerivedPipingInput.GetSeepageLength(input); LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); VariationCoefficientLogNormalDistribution darcyPermeability = DerivedPipingInput.GetDarcyPermeability(input); VariationCoefficientLogNormalDistribution diameterD70 = DerivedPipingInput.GetDiameterD70(input); var expectedInput = new PipingCalculationInput( 1300001, sectionLength, input.PhreaticLevelExit.Mean, input.PhreaticLevelExit.StandardDeviation, generalInput.WaterVolumetricWeight, effectiveThicknessCoverageLayer.Mean, effectiveThicknessCoverageLayer.StandardDeviation, saturatedVolumicWeightOfCoverageLayer.Mean, saturatedVolumicWeightOfCoverageLayer.StandardDeviation, saturatedVolumicWeightOfCoverageLayer.Shift, generalInput.UpliftModelFactor.Mean, generalInput.UpliftModelFactor.StandardDeviation, input.DampingFactorExit.Mean, input.DampingFactorExit.StandardDeviation, seepageLength.Mean, seepageLength.CoefficientOfVariation, thicknessAquiferLayer.Mean, thicknessAquiferLayer.StandardDeviation, generalInput.SandParticlesVolumicWeight, generalInput.SellmeijerModelFactor.Mean, generalInput.SellmeijerModelFactor.StandardDeviation, generalInput.BeddingAngle, generalInput.WhitesDragCoefficient, generalInput.WaterKinematicViscosity, darcyPermeability.Mean, darcyPermeability.CoefficientOfVariation, diameterD70.Mean, diameterD70.CoefficientOfVariation, generalInput.Gravity, generalInput.CriticalHeaveGradient.Mean, generalInput.CriticalHeaveGradient.StandardDeviation); HydraRingDataEqualityHelper.AreEqual(expectedInput, actualInput); }
public void GetSaturatedVolumicWeightOfCoverageLayer_SingleLayer_ReturnsDistributionWithParametersFromLayer() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); var random = new Random(21); double belowPhreaticLevelMean = 0.1 + random.NextDouble(); double deviation = random.NextDouble(); double shift = random.NextDouble(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile("", 0.0, new[] { new PipingSoilLayer(2.5) { BelowPhreaticLevel = new LogNormalDistribution { Mean = (RoundedDouble)belowPhreaticLevelMean, StandardDeviation = (RoundedDouble)deviation, Shift = (RoundedDouble)shift } }, new PipingSoilLayer(0.5) { IsAquifer = true } }, SoilProfileType.SoilProfile1D)); // Call LogNormalDistribution result = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(input); // Assert AssertSaturatedVolumicWeightOfCoverageLayer(result, belowPhreaticLevelMean, deviation, shift); }
/// <summary> /// Creates the design variable for the sieve size through which 70% of the grains of the top part of the aquifer pass. /// </summary> /// <param name="pipingInput">The piping input.</param> /// <returns>The created <see cref="VariationCoefficientDesignVariable{VariationCoefficientLogNormalDistribution}"/>.</returns> /// <exception cref="ArgumentNullException">Thrown when <paramref name="pipingInput"/> is <c>null</c>.</exception> public static VariationCoefficientDesignVariable <VariationCoefficientLogNormalDistribution> GetDiameter70(PipingInput pipingInput) { return(new VariationCoefficientLogNormalDistributionDesignVariable(DerivedPipingInput.GetDiameterD70(pipingInput)) { Percentile = 0.05 }); }
public void GetThicknessAquiferLayer_SurfaceLineHalfWayProfileLayer_ReturnsDistributionWithMeanSetToLayerHeightUnderSurfaceLine() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile(string.Empty, 0, new[] { new PipingSoilLayer(2.5) { IsAquifer = true }, new PipingSoilLayer(1.5) { IsAquifer = true } }, SoilProfileType.SoilProfile1D) ); // Call LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); // Assert AssertThicknessAquiferLayer(thicknessAquiferLayer, 2.0); }
private static IEnumerable <string> GetThicknessCoverageLayerWarning(PipingInput input) { if (double.IsNaN(DerivedPipingInput.GetThicknessCoverageLayer(input).Mean)) { yield return(Resources.PipingCalculationService_ValidateInput_No_coverage_layer_at_ExitPointL_under_SurfaceLine); } }
public void GetDiameterD70_SingleAquiferLayers_ReturnsDistributionWithParametersFromLayer() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); var random = new Random(21); double diameterD70Mean = 0.1 + random.NextDouble(); double diameterD70CoefficientOfVariation = random.NextDouble(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile("", -2.0, new[] { new PipingSoilLayer(1.0) { IsAquifer = true, DiameterD70 = new VariationCoefficientLogNormalDistribution { Mean = (RoundedDouble)diameterD70Mean, CoefficientOfVariation = (RoundedDouble)diameterD70CoefficientOfVariation } } }, SoilProfileType.SoilProfile1D)); // Call VariationCoefficientLogNormalDistribution result = DerivedPipingInput.GetDiameterD70(input); // Assert AssertDiameterD70(result, diameterD70Mean, diameterD70CoefficientOfVariation); }
public void GetDarcyPermeability_MultipleAquiferLayersWithDifferentMeanAndDeviation_ReturnsDistributionWithParametersNaN() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); input.StochasticSoilProfile = new PipingStochasticSoilProfile( 0.0, new PipingSoilProfile("", -2.0, new[] { new PipingSoilLayer(1.0) { IsAquifer = true, Permeability = new VariationCoefficientLogNormalDistribution { Mean = (RoundedDouble)0.5, CoefficientOfVariation = (RoundedDouble)0.2 } }, new PipingSoilLayer(0.0) { IsAquifer = true, Permeability = new VariationCoefficientLogNormalDistribution { Mean = (RoundedDouble)12.5, CoefficientOfVariation = (RoundedDouble)2.3 } } }, SoilProfileType.SoilProfile1D)); // Call VariationCoefficientLogNormalDistribution result = DerivedPipingInput.GetDarcyPermeability(input); // Assert AssertDarcyPermeability(result); }
public void GetSaturatedVolumicWeightOfCoverageLayer_InputNull_ThrowsArgumentNullException() { // Call void Call() => DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("input", exception.ParamName); }
public void GetSeepageLength_InputNull_ThrowsArgumentNullException() { // Call void Call() => DerivedPipingInput.GetSeepageLength(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("input", exception.ParamName); }
public void GetEffectiveThicknessCoverageLayer_GeneralInputNull_ThrowsArgumentNullException() { // Call void Call() => DerivedPipingInput.GetEffectiveThicknessCoverageLayer(new TestPipingInput(), null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("generalInput", exception.ParamName); }
public void GetDarcyPermeability_InputNull_ThrowsArgumentNullException() { // Call void Call() => DerivedPipingInput.GetDarcyPermeability(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("input", exception.ParamName); }
public void GetThicknessAquiferLayer_InputNull_ThrowsArgumentNullException() { // Call void Call() => DerivedPipingInput.GetThicknessAquiferLayer(null); // Assert var exception = Assert.Throws <ArgumentNullException>(Call); Assert.AreEqual("input", exception.ParamName); }
public void GetSeepageLength_ValidData_ReturnsDistributionWithExpectedMean() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); // Call VariationCoefficientLogNormalDistribution seepageLength = DerivedPipingInput.GetSeepageLength(input); // Assert AssertSeepageLength(seepageLength, 0.5); }
private static IEnumerable <string> ValidateCoverageLayers(PipingInput input, GeneralPipingInput generalInput) { if (!double.IsNaN(DerivedPipingInput.GetThicknessCoverageLayer(input).Mean)) { LogNormalDistribution saturatedVolumicWeightOfCoverageLayer = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(input); if (saturatedVolumicWeightOfCoverageLayer.Shift < generalInput.WaterVolumetricWeight) { yield return(Resources.ProbabilisticPipingCalculationService_ValidateInput_SaturatedVolumicWeightCoverageLayer_shift_must_be_larger_than_WaterVolumetricWeight); } } }
public void GetEffectiveThicknessCoverageLayer_SoilProfileSingleAquiferAboveSurfaceLine_ReturnsDistributionWithMeanNaN(double deltaAboveSurfaceLine) { // Setup PipingInput input = PipingInputFactory.CreateInputWithSingleAquiferLayerAboveSurfaceLine(deltaAboveSurfaceLine); // Call LogNormalDistribution effectiveThicknessCoverageLayer = DerivedPipingInput.GetEffectiveThicknessCoverageLayer(input, new GeneralPipingInput()); // Assert AssertEffectiveThicknessCoverageLayer(effectiveThicknessCoverageLayer); }
public void GetEffectiveThicknessCoverageLayer_SoilProfileSingleAquiferAndCoverageUnderSurfaceLine_ReturnsDistributionWithExpectedMean() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer <TestPipingInput>(); // Call LogNormalDistribution effectiveThicknessCoverageLayer = DerivedPipingInput.GetEffectiveThicknessCoverageLayer(input, new GeneralPipingInput()); // Assert AssertEffectiveThicknessCoverageLayer(effectiveThicknessCoverageLayer, 2.0); }
public void GetThicknessAquiferLayer_SoilProfileMultipleAquiferUnderSurfaceLine_ReturnsDistributionWithMeanSetToConsecutiveAquiferLayerThickness() { // Setup PipingInput input = PipingInputFactory.CreateInputWithMultipleAquiferLayersUnderSurfaceLine(out double expectedThickness); // Call LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); // Assert AssertThicknessAquiferLayer(thicknessAquiferLayer, expectedThickness); }
public void GetThicknessAquiferLayer_SoilProfileSingleAquiferUnderSurfaceLine_ReturnsDistributionWithExpectedMean() { // Setup PipingInput input = PipingInputFactory.CreateInputWithAquifer(); // Call LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); // Assert AssertThicknessAquiferLayer(thicknessAquiferLayer, 1.0); }
private static IEnumerable <string> ValidateCoverageLayers(PipingInput input) { if (!double.IsNaN(DerivedPipingInput.GetThicknessCoverageLayer(input).Mean)) { LogNormalDistribution saturatedVolumicWeightOfCoverageLayer = DerivedPipingInput.GetSaturatedVolumicWeightOfCoverageLayer(input); if (IsInvalidDistributionValue(saturatedVolumicWeightOfCoverageLayer.Mean) || IsInvalidDistributionValue(saturatedVolumicWeightOfCoverageLayer.StandardDeviation)) { yield return(Resources.PipingCalculationService_ValidateInput_Cannot_derive_SaturatedVolumicWeight); } } }
public void GetThicknessAquiferLayer_SoilProfileSingleAquiferAboveSurfaceLine_ReturnsDistributionWithMeanNaN(double deltaAboveSurfaceLine) { // Setup PipingInput input = PipingInputFactory.CreateInputWithSingleAquiferLayerAboveSurfaceLine(deltaAboveSurfaceLine); // Call LogNormalDistribution thicknessAquiferLayer = DerivedPipingInput.GetThicknessAquiferLayer(input); // Assert AssertThicknessAquiferLayer(thicknessAquiferLayer); }
private static IEnumerable <string> ValidateCoverageLayers(PipingInput input, GeneralPipingInput generalInput) { if (!double.IsNaN(DerivedPipingInput.GetThicknessCoverageLayer(input).Mean)) { RoundedDouble saturatedVolumicWeightOfCoverageLayer = SemiProbabilisticPipingDesignVariableFactory.GetSaturatedVolumicWeightOfCoverageLayer(input).GetDesignValue(); if (!double.IsNaN(saturatedVolumicWeightOfCoverageLayer) && saturatedVolumicWeightOfCoverageLayer < generalInput.WaterVolumetricWeight) { yield return(Resources.SemiProbabilisticPipingCalculationService_ValidateInput_SaturatedVolumicWeightCoverageLayer_must_be_larger_than_WaterVolumetricWeight); } } }
/// <summary> /// Performs a section specific calculation. /// </summary> /// <param name="calculation">The calculation containing the input for the section specific calculation.</param> /// <param name="generalInput">The general piping calculation input parameters.</param> /// <param name="sectionLength">The length of the section.</param> /// <param name="hydraulicBoundaryDatabaseFilePath">The path which points to the hydraulic boundary database file.</param> /// <param name="usePreprocessor">Indicator whether to use the preprocessor in the calculation.</param> /// <returns>A <see cref="PartialProbabilisticFaultTreePipingOutput"/>.</returns> /// <exception cref="HydraRingCalculationException">Thrown when an error occurs while performing the calculation.</exception> private IPartialProbabilisticPipingOutput CalculateSectionSpecific(ProbabilisticPipingCalculation calculation, GeneralPipingInput generalInput, double sectionLength, string hydraulicBoundaryDatabaseFilePath, bool usePreprocessor) { NotifyProgress(string.Format(Resources.ProbabilisticPipingCalculationService_Calculate_Executing_calculation_of_type_0, Resources.ProbabilisticPipingCalculationService_SectionSpecific), 2, numberOfCalculators); PipingCalculationInput sectionSpecificCalculationInput = CreateInput( calculation, generalInput, sectionLength, hydraulicBoundaryDatabaseFilePath, usePreprocessor); PerformCalculation(() => sectionSpecificCalculator.Calculate(sectionSpecificCalculationInput), () => sectionSpecificCalculator.LastErrorFileContent, () => sectionSpecificCalculator.OutputDirectory, calculation.Name, Resources.ProbabilisticPipingCalculationService_SectionSpecific); LogNormalDistribution thicknessCoverageLayer = DerivedPipingInput.GetThicknessCoverageLayer(calculation.InputParameters); GeneralResult <TopLevelFaultTreeIllustrationPoint> faultTreeGeneralResult = null; GeneralResult <TopLevelSubMechanismIllustrationPoint> subMechanismGeneralResult = null; if (calculation.InputParameters.ShouldSectionSpecificIllustrationPointsBeCalculated) { try { if (double.IsNaN(thicknessCoverageLayer.Mean)) { subMechanismGeneralResult = ConvertSubMechanismIllustrationPointsResult( sectionSpecificCalculator.IllustrationPointsResult, sectionSpecificCalculator.IllustrationPointsParserErrorMessage); } else { faultTreeGeneralResult = ConvertFaultTreeIllustrationPointsResult( sectionSpecificCalculator.IllustrationPointsResult, sectionSpecificCalculator.IllustrationPointsParserErrorMessage); } } catch (ArgumentException e) { log.WarnFormat(Resources.ProbabilisticPipingCalculationService_Calculate_Error_in_reading_illustrationPoints_for_CalculationName_0_CalculationType_1_with_ErrorMessage_2, calculation.Name, Resources.ProbabilisticPipingCalculationService_SectionSpecific, e.Message); } } return(double.IsNaN(thicknessCoverageLayer.Mean) ? (IPartialProbabilisticPipingOutput) new PartialProbabilisticSubMechanismPipingOutput( sectionSpecificCalculator.ExceedanceProbabilityBeta, subMechanismGeneralResult) : new PartialProbabilisticFaultTreePipingOutput( sectionSpecificCalculator.ExceedanceProbabilityBeta, faultTreeGeneralResult)); }
public void GetThicknessAquiferLayer_ValidPipingInput_CreateDesignVariableForThicknessAquiferLayer() { // Setup var pipingInput = new TestPipingInput(); // Call DesignVariable <LogNormalDistribution> thicknessAquiferLayer = SemiProbabilisticPipingDesignVariableFactory.GetThicknessAquiferLayer(pipingInput); // Assert DistributionAssert.AreEqual(DerivedPipingInput.GetThicknessAquiferLayer(pipingInput), thicknessAquiferLayer.Distribution); AssertPercentile(0.95, thicknessAquiferLayer); }
public void GetDiameter70_ValidPipingInput_CreateDesignVariableForDiameter70() { // Setup var pipingInput = new TestPipingInput(); // Call VariationCoefficientDesignVariable <VariationCoefficientLogNormalDistribution> d70 = SemiProbabilisticPipingDesignVariableFactory.GetDiameter70(pipingInput); // Assert DistributionAssert.AreEqual(DerivedPipingInput.GetDiameterD70(pipingInput), d70.Distribution); AssertPercentile(0.05, d70); }
public void GetDarcyPermeability_ValidPipingInput_CreateDesignVariableForDarcyPermeability() { // Setup var pipingInput = new TestPipingInput(); // Call VariationCoefficientDesignVariable <VariationCoefficientLogNormalDistribution> darcyPermeability = SemiProbabilisticPipingDesignVariableFactory.GetDarcyPermeability(pipingInput); // Assert DistributionAssert.AreEqual(DerivedPipingInput.GetDarcyPermeability(pipingInput), darcyPermeability.Distribution); AssertPercentile(0.95, darcyPermeability); }
public void GetSeepageLength_ValidPipingInput_CreateDesignVariableForSeepageLength() { // Setup var pipingInput = new TestPipingInput(); // Call VariationCoefficientDesignVariable <VariationCoefficientLogNormalDistribution> seepageLength = SemiProbabilisticPipingDesignVariableFactory.GetSeepageLength(pipingInput); // Assert DistributionAssert.AreEqual(DerivedPipingInput.GetSeepageLength(pipingInput), seepageLength.Distribution); AssertPercentile(0.05, seepageLength); }