Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs =================================================================== diff -u -r165068d9499f2282a744a79877d0af4461106d9d -r2363244674e6b7b97bead9a6855806420d368d80 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs (.../PipingCalculationScenarioCreateExtensionsTest.cs) (revision 165068d9499f2282a744a79877d0af4461106d9d) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Create/Piping/PipingCalculationScenarioCreateExtensionsTest.cs (.../PipingCalculationScenarioCreateExtensionsTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -123,13 +123,6 @@ Assert.AreEqual(input.PhreaticLevelExit.StandardDeviation.Value, entity.PhreaticLevelExitStandardDeviation); Assert.AreEqual(input.DampingFactorExit.Mean.Value, entity.DampingFactorExitMean); Assert.AreEqual(input.DampingFactorExit.StandardDeviation.Value, entity.DampingFactorExitStandardDeviation); - Assert.AreEqual(input.SaturatedVolumicWeightOfCoverageLayer.Mean.Value, entity.SaturatedVolumicWeightOfCoverageLayerMean); - Assert.AreEqual(input.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation.Value, entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation); - Assert.AreEqual(input.SaturatedVolumicWeightOfCoverageLayer.Shift.Value, entity.SaturatedVolumicWeightOfCoverageLayerShift); - Assert.AreEqual(input.Diameter70.Mean.Value, entity.Diameter70Mean); - Assert.AreEqual(input.Diameter70.StandardDeviation.Value, entity.Diameter70StandardDeviation); - Assert.AreEqual(input.DarcyPermeability.Mean.Value, entity.DarcyPermeabilityMean); - Assert.AreEqual(input.DarcyPermeability.StandardDeviation.Value, entity.DarcyPermeabilityStandardDeviation); Assert.AreEqual(order, entity.Order); Assert.AreEqual(0, entity.PipingCalculationEntityId); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs =================================================================== diff -u -r165068d9499f2282a744a79877d0af4461106d9d -r2363244674e6b7b97bead9a6855806420d368d80 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs (.../PipingCalculationEntityReadExtensionsTest.cs) (revision 165068d9499f2282a744a79877d0af4461106d9d) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Read/Piping/PipingCalculationEntityReadExtensionsTest.cs (.../PipingCalculationEntityReadExtensionsTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -117,13 +117,6 @@ AssertRoundedDouble(entity.PhreaticLevelExitStandardDeviation, calculation.InputParameters.PhreaticLevelExit.StandardDeviation); AssertRoundedDouble(entity.DampingFactorExitMean, calculation.InputParameters.DampingFactorExit.Mean); AssertRoundedDouble(entity.DampingFactorExitStandardDeviation, calculation.InputParameters.DampingFactorExit.StandardDeviation); - AssertRoundedDouble(entity.SaturatedVolumicWeightOfCoverageLayerMean, calculation.InputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean); - AssertRoundedDouble(entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation, calculation.InputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation); - AssertRoundedDouble(entity.SaturatedVolumicWeightOfCoverageLayerShift, calculation.InputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift); - AssertRoundedDouble(entity.Diameter70Mean, calculation.InputParameters.Diameter70.Mean); - AssertRoundedDouble(entity.Diameter70StandardDeviation, calculation.InputParameters.Diameter70.StandardDeviation); - AssertRoundedDouble(entity.DarcyPermeabilityMean, calculation.InputParameters.DarcyPermeability.Mean); - AssertRoundedDouble(entity.DarcyPermeabilityStandardDeviation, calculation.InputParameters.DarcyPermeability.StandardDeviation); Assert.IsNull(calculation.InputParameters.SurfaceLine); Assert.IsNull(calculation.InputParameters.HydraulicBoundaryLocation); Index: Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingCalculationScenarioUpdateExtensionsTest.cs =================================================================== diff -u -r165068d9499f2282a744a79877d0af4461106d9d -r2363244674e6b7b97bead9a6855806420d368d80 --- Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingCalculationScenarioUpdateExtensionsTest.cs (.../PipingCalculationScenarioUpdateExtensionsTest.cs) (revision 165068d9499f2282a744a79877d0af4461106d9d) +++ Application/Ringtoets/test/Application.Ringtoets.Storage.Test/Update/Piping/PipingCalculationScenarioUpdateExtensionsTest.cs (.../PipingCalculationScenarioUpdateExtensionsTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -174,13 +174,6 @@ Assert.AreEqual(inputParameters.PhreaticLevelExit.StandardDeviation.Value, entity.PhreaticLevelExitStandardDeviation); Assert.AreEqual(inputParameters.DampingFactorExit.Mean.Value, entity.DampingFactorExitMean); Assert.AreEqual(inputParameters.DampingFactorExit.StandardDeviation.Value, entity.DampingFactorExitStandardDeviation); - Assert.AreEqual(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean.Value, entity.SaturatedVolumicWeightOfCoverageLayerMean); - Assert.AreEqual(inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation.Value, entity.SaturatedVolumicWeightOfCoverageLayerStandardDeviation); - Assert.AreEqual(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift.Value, entity.SaturatedVolumicWeightOfCoverageLayerShift); - Assert.AreEqual(inputParameters.Diameter70.Mean.Value, entity.Diameter70Mean); - Assert.AreEqual(inputParameters.Diameter70.StandardDeviation.Value, entity.Diameter70StandardDeviation); - Assert.AreEqual(inputParameters.DarcyPermeability.Mean.Value, entity.DarcyPermeabilityMean); - Assert.AreEqual(inputParameters.DarcyPermeability.StandardDeviation.Value, entity.DarcyPermeabilityStandardDeviation); registry.RemoveUntouched(context); CollectionAssert.Contains(context.PipingCalculationEntities, entity); Index: Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs =================================================================== diff -u -r5167dd4fffff91f50e650fef63eac209225a1e9f -r2363244674e6b7b97bead9a6855806420d368d80 --- Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision 5167dd4fffff91f50e650fef63eac209225a1e9f) +++ Demo/Ringtoets/src/Demo.Ringtoets/Commands/AddNewDemoAssessmentSectionCommand.cs (.../AddNewDemoAssessmentSectionCommand.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -139,9 +139,9 @@ using (var embeddedResourceFileWriter = new EmbeddedResourceFileWriter(GetType().Assembly, true, "DR6.soil")) { - var surfaceLinesImporter = new PipingSoilProfilesImporter(); + var soilProfilesImporter = new PipingSoilProfilesImporter(); var context = new StochasticSoilModelContext(pipingFailureMechanism.StochasticSoilModels, pipingFailureMechanism, demoAssessmentSection); - surfaceLinesImporter.Import(context, Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6.soil")); + soilProfilesImporter.Import(context, Path.Combine(embeddedResourceFileWriter.TargetFolderPath, "DR6.soil")); } var calculation = new PipingCalculationScenario(pipingFailureMechanism.GeneralInput); Index: Demo/Ringtoets/src/Demo.Ringtoets/Resources/DR6.soil =================================================================== diff -u -ra8d92ed8a79b45075e5e3a388da73d0ea40a25e3 -r2363244674e6b7b97bead9a6855806420d368d80 Binary files differ Index: Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs =================================================================== diff -u -r165068d9499f2282a744a79877d0af4461106d9d -r2363244674e6b7b97bead9a6855806420d368d80 --- Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 165068d9499f2282a744a79877d0af4461106d9d) +++ Demo/Ringtoets/test/Demo.Ringtoets.Test/Commands/AddNewDemoAssessmentSectionCommandTest.cs (.../AddNewDemoAssessmentSectionCommandTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -209,6 +209,7 @@ private static void AssertExpectedPipingInput(PipingInput inputParameters) { + Console.WriteLine("{0} en {1}", Math.Exp(-0.5), Math.Sqrt((Math.Exp(1) - 1)*Math.Exp(1))); Assert.AreEqual(1.0, inputParameters.UpliftModelFactor, 1e-3); Assert.AreEqual(1.0, inputParameters.SellmeijerModelFactor, 1e-3); @@ -235,6 +236,8 @@ GetAccuracy(inputParameters.Diameter70)); Assert.AreEqual(2.345281, PipingSemiProbabilisticDesignValueFactory.GetDarcyPermeability(inputParameters).GetDesignValue(), GetAccuracy(inputParameters.DarcyPermeability)); + Assert.AreEqual(17.5, PipingSemiProbabilisticDesignValueFactory.GetSaturatedVolumicWeightOfCoverageLayer(inputParameters).GetDesignValue(), + GetAccuracy(inputParameters.SaturatedVolumicWeightOfCoverageLayer)); Assert.AreEqual(4.45, inputParameters.PiezometricHeadExit, 1e-2); Assert.AreEqual(106.13, inputParameters.ExitPointL, 1e-2); Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs =================================================================== diff -u -r35db69dfe64b7e7deeaf9ef85d4df42ff6009b11 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs (.../DerivedPipingInput.cs) (revision 35db69dfe64b7e7deeaf9ef85d4df42ff6009b11) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/DerivedPipingInput.cs (.../DerivedPipingInput.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -20,11 +20,13 @@ // All rights reserved. using System; +using System.Linq; using Core.Common.Base.Data; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.HydraRing.Data; using Ringtoets.Piping.InputParameterCalculation; using Ringtoets.Piping.Primitives; +using Ringtoets.Piping.Primitives.Exceptions; namespace Ringtoets.Piping.Data { @@ -65,7 +67,8 @@ } /// - /// Gets the piezometric head exit. + /// Gets the piezometric head at the exit point. + /// [m] /// public RoundedDouble PiezometricHeadExit { @@ -79,7 +82,8 @@ } /// - /// Gets the seepage length. + /// Gets the horizontal distance between entry and exit point. + /// [m] /// public LogNormalDistribution SeepageLength { @@ -96,99 +100,272 @@ } /// - /// Gets the thickness coverage layer. + /// Gets the total thickness of the coverage layers at the exit point. + /// [m] /// public LogNormalDistribution ThicknessCoverageLayer { get { LogNormalDistribution thicknessCoverageLayer = new LogNormalDistribution(2) { + Mean = (RoundedDouble) double.NaN, StandardDeviation = (RoundedDouble) 0.5 }; - if (input.SurfaceLine != null && input.StochasticSoilProfile != null && input.StochasticSoilProfile.SoilProfile != null & !double.IsNaN(input.ExitPointL)) - { - TrySetThicknessCoverageLayer(thicknessCoverageLayer); - } - else - { - thicknessCoverageLayer.Mean = (RoundedDouble) double.NaN; - } + UpdateThicknessCoverageLayerMean(thicknessCoverageLayer); return thicknessCoverageLayer; } } /// - /// gets the thickness aquifer layer. + /// Gets the total thickness of the aquifer layers at the exit point. + /// [m] /// public LogNormalDistribution ThicknessAquiferLayer { get { LogNormalDistribution thicknessAquiferLayer = new LogNormalDistribution(2) { + Mean = (RoundedDouble) double.NaN, StandardDeviation = (RoundedDouble) 0.5 }; + UpdateThicknessAquiferLayerMean(thicknessAquiferLayer); - StochasticSoilProfile stochasticSoilProfile = input.StochasticSoilProfile; + return thicknessAquiferLayer; + } + } - RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine; - RoundedDouble exitPointL = input.ExitPointL; + /// + /// Gets the sieve size through which 70% fraction of the grains of the top part of the aquifer passes. + /// [m] + /// + public LogNormalDistribution DiameterD70 + { + get + { + var distribution = new LogNormalDistribution(6) + { + Mean = (RoundedDouble) double.NaN, + StandardDeviation = (RoundedDouble) double.NaN + }; + UpdateDiameterD70Parameters(distribution); - if (stochasticSoilProfile != null && stochasticSoilProfile.SoilProfile != null && surfaceLine != null && !double.IsNaN(exitPointL)) + return distribution; + } + } + + /// + /// Gets or sets the Darcy-speed with which water flows through the aquifer layer. + /// [m/s] + /// + public LogNormalDistribution DarcyPermeability + { + get + { + var distribution = new LogNormalDistribution(6) { - double thicknessTopAquiferLayer = GetThicknessTopAquiferLayer(stochasticSoilProfile.SoilProfile, surfaceLine, exitPointL); - TrySetThicknessAquiferLayerMean(thicknessAquiferLayer, thicknessTopAquiferLayer); + Mean = (RoundedDouble) double.NaN, + StandardDeviation = (RoundedDouble) double.NaN + }; + UpdateDarcyPermeabilityParameters(distribution); + + return distribution; + } + } + + /// + /// Gets or sets the volumic weight of the saturated coverage layer. + /// + public ShiftedLogNormalDistribution SaturatedVolumicWeightOfCoverageLayer + { + get + { + var distribution = new ShiftedLogNormalDistribution(2) + { + Mean = (RoundedDouble) double.NaN, + StandardDeviation = (RoundedDouble) double.NaN, + Shift = (RoundedDouble) double.NaN + }; + UpdateSaturatedVolumicWeightOfCoverageLayerParameters(distribution); + + return distribution; + } + } + + private void UpdateThicknessAquiferLayerMean(LogNormalDistribution thicknessAquiferLayer) + { + StochasticSoilProfile stochasticSoilProfile = input.StochasticSoilProfile; + RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine; + RoundedDouble exitPointL = input.ExitPointL; + + if (stochasticSoilProfile != null && stochasticSoilProfile.SoilProfile != null && surfaceLine != null && !double.IsNaN(exitPointL)) + { + var thicknessTopAquiferLayer = new RoundedDouble(thicknessAquiferLayer.Mean.NumberOfDecimalPlaces, + GetThicknessTopAquiferLayer(stochasticSoilProfile.SoilProfile, surfaceLine, exitPointL)); + + if (thicknessTopAquiferLayer > 0) + { + thicknessAquiferLayer.Mean = thicknessTopAquiferLayer; } - else + } + } + + private void UpdateThicknessCoverageLayerMean(LogNormalDistribution thicknessCoverageLayerDistribution) + { + if (input.SurfaceLine != null && input.StochasticSoilProfile != null && input.StochasticSoilProfile.SoilProfile != null && !double.IsNaN(input.ExitPointL)) + { + var weightedMean = new RoundedDouble(thicknessCoverageLayerDistribution.Mean.NumberOfDecimalPlaces, + InputParameterCalculationService.CalculateThicknessCoverageLayer( + input.WaterVolumetricWeight, + PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), + input.ExitPointL, + input.SurfaceLine, + input.StochasticSoilProfile.SoilProfile)); + + if (weightedMean > 0) { - thicknessAquiferLayer.Mean = (RoundedDouble) double.NaN; + thicknessCoverageLayerDistribution.Mean = weightedMean; } + } + } - return thicknessAquiferLayer; + private void UpdateDiameterD70Parameters(LogNormalDistribution diameterD70Distribution) + { + PipingSoilLayer topMostAquiferLayer = GetConsecutiveAquiferLayers().FirstOrDefault(); + if (topMostAquiferLayer != null) + { + var diameterD70Mean = new RoundedDouble(diameterD70Distribution.Mean.NumberOfDecimalPlaces, topMostAquiferLayer.DiameterD70Mean); + + if (diameterD70Mean > 0) + { + diameterD70Distribution.Mean = diameterD70Mean; + } + diameterD70Distribution.StandardDeviation = (RoundedDouble) topMostAquiferLayer.DiameterD70Deviation; } } - private static void TrySetThicknessAquiferLayerMean(LogNormalDistribution thicknessAquiferLayer, double thicknessTopAquiferLayer) + private void UpdateDarcyPermeabilityParameters(LogNormalDistribution darcyPermeabilityDistribution) { - if (thicknessTopAquiferLayer > 0) + PipingSoilLayer topMostAquiferLayer = GetConsecutiveAquiferLayers().FirstOrDefault(); + if (topMostAquiferLayer != null) { - thicknessAquiferLayer.Mean = (RoundedDouble) thicknessTopAquiferLayer; + var darcyPermeabilityMean = new RoundedDouble(darcyPermeabilityDistribution.Mean.NumberOfDecimalPlaces, topMostAquiferLayer.PermeabilityMean); + + if (darcyPermeabilityMean > 0) + { + darcyPermeabilityDistribution.Mean = darcyPermeabilityMean; + } + darcyPermeabilityDistribution.StandardDeviation = (RoundedDouble) topMostAquiferLayer.PermeabilityDeviation; } - else + } + + + private void UpdateSaturatedVolumicWeightOfCoverageLayerParameters(ShiftedLogNormalDistribution volumicWeightDistribution) + { + PipingSoilLayer[] aquitardLayers = GetConsecutiveAquitardLayers(); + + if (HasUniqueShiftAndDeviationSaturatedWeightDefinition(aquitardLayers)) { - thicknessAquiferLayer.Mean = (RoundedDouble) double.NaN; + PipingSoilLayer topMostAquitardLayer = aquitardLayers.First(); + volumicWeightDistribution.Shift = (RoundedDouble) topMostAquitardLayer.BelowPhreaticLevelShift; + volumicWeightDistribution.StandardDeviation = (RoundedDouble) topMostAquitardLayer.BelowPhreaticLevelDeviation; + + var weightedMean = new RoundedDouble(volumicWeightDistribution.Mean.NumberOfDecimalPlaces, + GetWeightedMeanForVolumicWeightOfCoverageLayer( + aquitardLayers, + input.StochasticSoilProfile.SoilProfile, + input.SurfaceLine.GetZAtL(input.ExitPointL))); + + if (weightedMean > 0) + { + volumicWeightDistribution.Mean = weightedMean; + } } } - private static double GetThicknessTopAquiferLayer(PipingSoilProfile soilProfile, RingtoetsPipingSurfaceLine surfaceLine, RoundedDouble exitPointL) + private static double GetWeightedMeanForVolumicWeightOfCoverageLayer(PipingSoilLayer[] aquitardLayers, PipingSoilProfile profile, double surfaceLevel) { - try + double totalThickness = 0.0; + double weighedTotal = 0.0; + + foreach (var layer in aquitardLayers) { - var zAtL = surfaceLine.GetZAtL(exitPointL); - return soilProfile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(zAtL); + double layerThickness = profile.GetLayerThickness(layer); + double bottom = layer.Top - layerThickness; + double thicknessUnderSurface = Math.Min(layer.Top, surfaceLevel) - bottom; + + totalThickness += thicknessUnderSurface; + weighedTotal += layer.BelowPhreaticLevelMean*thicknessUnderSurface; } - catch (ArgumentException) + + return weighedTotal/totalThickness; + } + + private bool HasUniqueShiftAndDeviationSaturatedWeightDefinition(PipingSoilLayer[] consecutiveAquitardLayers) + { + if (!consecutiveAquitardLayers.Any()) { - return double.NaN; + return false; } + if (consecutiveAquitardLayers.Length == 1) + { + return true; + } + + return consecutiveAquitardLayers.All(al => + AlmostEquals(al.BelowPhreaticLevelDeviation, consecutiveAquitardLayers[0].BelowPhreaticLevelDeviation) + && AlmostEquals(al.BelowPhreaticLevelShift, consecutiveAquitardLayers[0].BelowPhreaticLevelShift)); } + + private PipingSoilLayer[] GetConsecutiveAquiferLayers() + { + RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine; + PipingSoilProfile soilProfile = input.StochasticSoilProfile != null ? input.StochasticSoilProfile.SoilProfile : null; + RoundedDouble exitPointL = input.ExitPointL; - private void TrySetThicknessCoverageLayer(LogNormalDistribution thicknessCoverageLayer) + if (surfaceLine != null && soilProfile != null && !double.IsNaN(exitPointL)) + { + return soilProfile.GetConsecutiveAquiferLayersBelowLevel(surfaceLine.GetZAtL(exitPointL)).ToArray(); + } + + return new PipingSoilLayer[0]; + } + + private PipingSoilLayer[] GetConsecutiveAquitardLayers() { + RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine; + PipingSoilProfile soilProfile = input.StochasticSoilProfile != null ? input.StochasticSoilProfile.SoilProfile : null; + RoundedDouble exitPointL = input.ExitPointL; + + if (surfaceLine != null && soilProfile != null && !double.IsNaN(exitPointL)) + { + return soilProfile.GetConsecutiveAquitardLayersBelowLevel(surfaceLine.GetZAtL(exitPointL)).ToArray(); + } + + return new PipingSoilLayer[0]; + } + + private bool AlmostEquals(double a, double b) + { + return Math.Abs(a - b) < 1e-6; + } + + private static double GetThicknessTopAquiferLayer(PipingSoilProfile soilProfile, RingtoetsPipingSurfaceLine surfaceLine, RoundedDouble exitPointL) + { try { - thicknessCoverageLayer.Mean = (RoundedDouble) InputParameterCalculationService.CalculateThicknessCoverageLayer( - input.WaterVolumetricWeight, - PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), - input.ExitPointL, - input.SurfaceLine, - input.StochasticSoilProfile.SoilProfile); + double zAtL = surfaceLine.GetZAtL(exitPointL); + return soilProfile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(zAtL); } - catch (ArgumentOutOfRangeException) + catch (Exception e) { - thicknessCoverageLayer.Mean = (RoundedDouble) double.NaN; + if (e is RingtoetsPipingSurfaceLineException || e is InvalidOperationException || e is ArgumentException) + { + return double.NaN; + } + throw; } } } Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs =================================================================== diff -u -r165068d9499f2282a744a79877d0af4461106d9d -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 165068d9499f2282a744a79877d0af4461106d9d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingInput.cs (.../PipingInput.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -43,9 +43,6 @@ private readonly GeneralPipingInput generalInputParameters; private readonly NormalDistribution phreaticLevelExit; private readonly LogNormalDistribution dampingFactorExit; - private readonly ShiftedLogNormalDistribution saturatedVolumicWeightOfCoverageLayer; - private readonly LogNormalDistribution darcyPermeability; - private readonly LogNormalDistribution diameter70; private RoundedDouble exitPointL; private RoundedDouble entryPointL; private RingtoetsPipingSurfaceLine surfaceLine; @@ -75,14 +72,6 @@ Mean = (RoundedDouble)0.7, StandardDeviation = (RoundedDouble)0.0 }; - saturatedVolumicWeightOfCoverageLayer = new ShiftedLogNormalDistribution(2) - { - Mean = (RoundedDouble)17.5, - StandardDeviation = (RoundedDouble)0, - Shift = (RoundedDouble)10 - }; - diameter70 = new LogNormalDistribution(6); - darcyPermeability = new LogNormalDistribution(6); } /// @@ -442,13 +431,8 @@ { get { - return diameter70; + return new DerivedPipingInput(this).DiameterD70; } - set - { - diameter70.Mean = value.Mean; - diameter70.StandardDeviation = value.StandardDeviation; - } } /// @@ -459,17 +443,12 @@ { get { - return darcyPermeability; + return new DerivedPipingInput(this).DarcyPermeability; } - set - { - darcyPermeability.Mean = value.Mean; - darcyPermeability.StandardDeviation = value.StandardDeviation; - } } /// - /// Gets or sets the thickness of the aquifer layer. + /// Gets or sets the total thickness of the aquifer layers at the exit point. /// [m] /// public LogNormalDistribution ThicknessAquiferLayer @@ -515,14 +494,8 @@ { get { - return saturatedVolumicWeightOfCoverageLayer; + return new DerivedPipingInput(this).SaturatedVolumicWeightOfCoverageLayer; } - set - { - saturatedVolumicWeightOfCoverageLayer.Mean = value.Mean; - saturatedVolumicWeightOfCoverageLayer.StandardDeviation = value.StandardDeviation; - saturatedVolumicWeightOfCoverageLayer.Shift = value.Shift; - } } #endregion Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs =================================================================== diff -u --- Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs (revision 0) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/PipingSoilProfileExtensions.cs (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -0,0 +1,115 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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 System.Collections.Generic; +using System.Linq; +using Ringtoets.Piping.Data.Properties; +using Ringtoets.Piping.Primitives; + +namespace Ringtoets.Piping.Data +{ + public static class PipingSoilProfileExtensions + { + /// + /// Retrieves the thickness of the consecutive aquifer layers (if any) under a certain . + /// Only the thickness of the part of the aquifer layer under the level is determined. + /// Aquifer layers above are not considered. + /// + /// The soil profile containing to consider. + /// The level under which the aquifer layers are sought. + /// The thickness of the part of the consecutive aquifer layer(s) under the . + /// is less than . + public static double GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(this PipingSoilProfile soilProfile, double level) + { + var aquiferLayers = soilProfile.GetConsecutiveAquiferLayersBelowLevel(level).ToArray(); + + if (aquiferLayers.Length == 0) + { + return double.NaN; + } + + var bottomLayer = aquiferLayers.Last(); + var topLayer = aquiferLayers.First(); + + return Math.Min(topLayer.Top, level) - (bottomLayer.Top - soilProfile.GetLayerThickness(bottomLayer)); + } + + /// + /// Retrieves the collection of aquifer layers below a certain . + /// + /// The soil profile containing to consider. + /// The level under which the aquifer layers are sought. + /// The collection of consecutive aquifer layer(s) under the . + public static IEnumerable GetConsecutiveAquiferLayersBelowLevel(this PipingSoilProfile soilProfile, double level) + { + return GetConsecutiveLayers(soilProfile, level, true); + } + + + /// + /// Retrieves the collection of aquitard layers below a certain . + /// + /// The soil profile containing to consider. + /// The level under which the aquitard layers are sought. + /// The collection of consecutive aquitard layer(s) under the . + public static IEnumerable GetConsecutiveAquitardLayersBelowLevel(this PipingSoilProfile soilProfile, double level) + { + return GetConsecutiveLayers(soilProfile, level, false); + } + + /// + /// Gets consecutive layers in the which have an aquifer property of . + /// + /// The soil profile containing to consider. + /// The level under which the aquitard layers are sought. + /// Value indicating whether the consecutive layers should be aquifer or aquitard. + /// The collection of consecutive layer(s) with an aquifer property equal to + /// under the . + private static IEnumerable GetConsecutiveLayers(PipingSoilProfile soilProfile, double level, bool isAquifer) + { + if (level < soilProfile.Bottom) + { + yield break; + } + + var yielding = false; + foreach (var pipingSoilLayer in soilProfile.Layers) + { + if (pipingSoilLayer.IsAquifer == isAquifer && IsSoilLayerPartlyBelowLevel(soilProfile, pipingSoilLayer, level)) + { + yielding = true; + yield return pipingSoilLayer; + } + + if (yielding && pipingSoilLayer.IsAquifer != isAquifer) + { + yield break; + } + } + } + + private static bool IsSoilLayerPartlyBelowLevel(PipingSoilProfile soilProfile, PipingSoilLayer pipingSoilLayer, double level) + { + return (pipingSoilLayer.Top < level || pipingSoilLayer.Top - soilProfile.GetLayerThickness(pipingSoilLayer) < level); + } + } +} \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj =================================================================== diff -u -rce94b8228bc7e51779b3754217580f13cb35e475 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) +++ Ringtoets/Piping/src/Ringtoets.Piping.Data/Ringtoets.Piping.Data.csproj (.../Ringtoets.Piping.Data.csproj) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -58,6 +58,7 @@ + True Index: Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs =================================================================== diff -u -rf98409152d5ccbaf5429791f7e3042d7884a050d -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs (.../PipingInputContextProperties.cs) (revision f98409152d5ccbaf5429791f7e3042d7884a050d) +++ Ringtoets/Piping/src/Ringtoets.Piping.Forms/PropertyClasses/PipingInputContextProperties.cs (.../PipingInputContextProperties.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -297,11 +297,6 @@ { return PipingSemiProbabilisticDesignValueFactory.GetDarcyPermeability(data.WrappedData); } - set - { - data.WrappedData.DarcyPermeability = value.Distribution; - data.WrappedData.NotifyObservers(); - } } [TypeConverter(typeof(LogNormalDistributionDesignVariableTypeConverter))] @@ -314,11 +309,6 @@ { return PipingSemiProbabilisticDesignValueFactory.GetDiameter70(data.WrappedData); } - set - { - data.WrappedData.Diameter70 = value.Distribution; - data.WrappedData.NotifyObservers(); - } } [TypeConverter(typeof(ShiftedLogNormalDistributionDesignVariableTypeConverter))] @@ -331,11 +321,6 @@ { return PipingSemiProbabilisticDesignValueFactory.GetSaturatedVolumicWeightOfCoverageLayer(data.WrappedData); } - set - { - data.WrappedData.SaturatedVolumicWeightOfCoverageLayer = value.Distribution; - data.WrappedData.NotifyObservers(); - } } #endregion Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs =================================================================== diff -u -r1b269dccd0ad017fd308a5c9e6639d9a6867b018 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs (.../PipingSoilLayer.cs) (revision 1b269dccd0ad017fd308a5c9e6639d9a6867b018) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilLayer.cs (.../PipingSoilLayer.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -43,6 +43,7 @@ MaterialName = string.Empty; BelowPhreaticLevelMean = double.NaN; BelowPhreaticLevelDeviation = double.NaN; + BelowPhreaticLevelShift = double.NaN; DiameterD70Mean = double.NaN; DiameterD70Deviation = double.NaN; PermeabilityMean = double.NaN; Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs =================================================================== diff -u -rb6432b2cbcb2db9bd326d9f006fb2d8b2528d263 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision b6432b2cbcb2db9bd326d9f006fb2d8b2528d263) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/PipingSoilProfile.cs (.../PipingSoilProfile.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -94,6 +94,8 @@ /// public SoilProfileType SoilProfileType { get; private set; } + public long StorageId { get; set; } + /// /// Gets the thickness of the given layer in the . /// Thickness of a layer is determined by its top and the top of the layer below it. @@ -116,51 +118,6 @@ throw new ArgumentException("Layer not found in profile."); } - /// - /// Retrieves the thickness of the consecutive aquifer layers (if any) under a certain . - /// Only the thickness of the part of the aquifer layer under the level is determined. - /// Aquifer layers above are not considered. - /// - /// The level under which the aquifer layer is sought. - /// The thickness of the part of the consecutive aquifer layer(s) under the . - /// is less than . - public double GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(double level) - { - ValidateLevelToBottom(level); - - PipingSoilLayer previousAquiferLayer = null; - var aquiferLayerThickness = 0.0; - foreach (var pipingSoilLayer in Layers) - { - if (pipingSoilLayer.Top > level) - { - previousAquiferLayer = null; - if (!pipingSoilLayer.IsAquifer) - { - aquiferLayerThickness = 0.0; - } - } - - if (!pipingSoilLayer.IsAquifer) - { - if (previousAquiferLayer != null) - { - break; - } - continue; - } - - previousAquiferLayer = pipingSoilLayer; - var layerThickness = GetLayerThicknessBelowLevel(pipingSoilLayer, level); - if (!double.IsNaN(layerThickness)) - { - aquiferLayerThickness += layerThickness; - } - } - - return previousAquiferLayer == null ? double.NaN : aquiferLayerThickness; - } - public override string ToString() { return Name; @@ -193,27 +150,5 @@ throw new ArgumentException(Resources.PipingSoilProfile_Layers_Layer_top_below_profile_bottom); } } - - private void ValidateLevelToBottom(double level) - { - if (level < Bottom) - { - var message = string.Format(Resources.PipingSoilProfile_GetTopAquiferLayerThicknessBelowLevel_Level_0_below_Bottom_1_, level, Bottom); - throw new ArgumentException(message); - } - } - - private double GetLayerThicknessBelowLevel(PipingSoilLayer layer, double level) - { - var thickness = double.NaN; - if (layer != null) - { - double thicknessAboveLevel = Math.Max(0, layer.Top - level); - thickness = GetLayerThickness(layer) - thicknessAboveLevel; - } - return thickness; - } - - public long StorageId { get; set; } } } \ No newline at end of file Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs =================================================================== diff -u -r4e49e3da1fa385207c70c8cc28ed04cda530bc61 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 4e49e3da1fa385207c70c8cc28ed04cda530bc61) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.17929 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -207,15 +207,6 @@ } /// - /// Looks up a localized string similar to Level {0} is below the bottom of the soil profile {1}.. - /// - public static string PipingSoilProfile_GetTopAquiferLayerThicknessBelowLevel_Level_0_below_Bottom_1_ { - get { - return ResourceManager.GetString("PipingSoilProfile_GetTopAquiferLayerThicknessBelowLevel_Level_0_below_Bottom_1_", resourceCulture); - } - } - - /// /// Looks up a localized string similar to Eén of meerdere lagen hebben een top onder de bodem van de ondergrondschematisatie.. /// public static string PipingSoilProfile_Layers_Layer_top_below_profile_bottom { Index: Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx =================================================================== diff -u -r4e49e3da1fa385207c70c8cc28ed04cda530bc61 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 4e49e3da1fa385207c70c8cc28ed04cda530bc61) +++ Ringtoets/Piping/src/Ringtoets.Piping.Primitives/Properties/Resources.resx (.../Resources.resx) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -186,9 +186,6 @@ Eén of meerdere lagen hebben een top onder de bodem van de ondergrondschematisatie. - - Level {0} is below the bottom of the soil profile {1}. - Kan de dikte van het watervoerend pakket niet afleiden op basis van de invoer. Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs =================================================================== diff -u -rc33fbb6a840ef596c665774b609f82b948f3b512 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (.../DerivedPipingInputTest.cs) (revision c33fbb6a840ef596c665774b609f82b948f3b512) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/DerivedPipingInputTest.cs (.../DerivedPipingInputTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -537,5 +537,445 @@ Assert.IsNaN(seepageLength.Mean); Assert.IsNaN(seepageLength.StandardDeviation); } + + [Test] + public void SaturatedVolumicWeightOfCoverageLayer_NoSoilProfile_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile.SoilProfile = null; + + // Call + var result = derivedInput.SaturatedVolumicWeightOfCoverageLayer; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.Shift); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void SaturatedVolumicWeightOfCoverageLayer_NoStochasticSoilProfile_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile = null; + + // Call + var result = derivedInput.SaturatedVolumicWeightOfCoverageLayer; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.Shift); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void SaturatedVolumicWeightOfCoverageLayer_NoSurfaceLine_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.SurfaceLine = null; + + // Call + var result = derivedInput.SaturatedVolumicWeightOfCoverageLayer; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.Shift); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void SaturatedVolumicWeightOfCoverageLayer_NoExitPointL_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.ExitPointL = (RoundedDouble) double.NaN; + + // Call + var result = derivedInput.SaturatedVolumicWeightOfCoverageLayer; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.Shift); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void SaturatedVolumicWeightOfCoverageLayer_NoAquitardLayers_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new [] + { + new PipingSoilLayer(1.0) + { + IsAquifer = true + } + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.SaturatedVolumicWeightOfCoverageLayer; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.Shift); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void SaturatedVolumicWeightOfCoverageLayer_SingleLayer_ReturnsWithParametersFromLayer() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + var random = new Random(21); + double belowPhreaticLevelMean = random.NextDouble(); + double deviation = random.NextDouble(); + double shift = random.NextDouble(); + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", 0.0, new[] + { + new PipingSoilLayer(2.5) + { + BelowPhreaticLevelDeviation = deviation, + BelowPhreaticLevelShift = shift, + BelowPhreaticLevelMean = belowPhreaticLevelMean + }, + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.SaturatedVolumicWeightOfCoverageLayer; + + // Assert + Assert.AreEqual(belowPhreaticLevelMean, result.Mean, result.Mean.GetAccuracy()); + Assert.AreEqual(shift, result.Shift, result.Shift.GetAccuracy()); + Assert.AreEqual(deviation, result.StandardDeviation, result.StandardDeviation.GetAccuracy()); + } + + [Test] + public void SaturatedVolumicWeightOfCoverageLayer_MultipleLayersEqualShiftAndStandardDeviation_ReturnsWithWeightedMean() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + var random = new Random(21); + var belowPhreaticLevelMeanA = random.NextDouble(); + var belowPhreaticLevelMeanB = random.NextDouble(); + double deviation = random.NextDouble(); + double shift = random.NextDouble(); + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[] + { + new PipingSoilLayer(2.5) + { + BelowPhreaticLevelDeviation = deviation, + BelowPhreaticLevelShift = shift, + BelowPhreaticLevelMean = belowPhreaticLevelMeanA + }, + new PipingSoilLayer(-0.5) + { + BelowPhreaticLevelDeviation = deviation, + BelowPhreaticLevelShift = shift, + BelowPhreaticLevelMean = belowPhreaticLevelMeanB + } + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.SaturatedVolumicWeightOfCoverageLayer; + + // Assert + Assert.AreEqual((belowPhreaticLevelMeanA * 2.5 + belowPhreaticLevelMeanB * 1.5) / 4, result.Mean, result.Mean.GetAccuracy()); + Assert.AreEqual(shift, result.Shift, result.Shift.GetAccuracy()); + Assert.AreEqual(deviation, result.StandardDeviation, result.StandardDeviation.GetAccuracy()); + } + + [Test] + public void DarcyPermeability_NoSoilProfile_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile.SoilProfile = null; + + // Call + var result = derivedInput.DarcyPermeability; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DarcyPermeability_NoStochasticSoilProfile_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile = null; + + // Call + var result = derivedInput.DarcyPermeability; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DarcyPermeability_NoSurfaceLine_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.SurfaceLine = null; + + // Call + var result = derivedInput.DarcyPermeability; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DarcyPermeability_NoExitPointL_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.ExitPointL = (RoundedDouble) double.NaN; + + // Call + var result = derivedInput.DarcyPermeability; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DarcyPermeability_NoAquiferLayers_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[] + { + new PipingSoilLayer(1.0) + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.DarcyPermeability; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DarcyPermeability_SingleAquiferLayers_ReturnsWithParametersFromLayer() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + var random = new Random(21); + var permeabilityMean = random.NextDouble(); + var permeabilityDeviation = random.NextDouble(); + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[] + { + new PipingSoilLayer(1.0) + { + IsAquifer = true, + PermeabilityMean = permeabilityMean, + PermeabilityDeviation = permeabilityDeviation + } + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.DarcyPermeability; + + // Assert + Assert.AreEqual(permeabilityMean, result.Mean, result.Mean.GetAccuracy()); + Assert.AreEqual(permeabilityDeviation, result.StandardDeviation, result.StandardDeviation.GetAccuracy()); + } + + [Test] + public void DarcyPermeability_MultipleAquiferLayers_ReturnsWithParametersFromTopmostLayer() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + var permeabilityMean = 0.5; + var permeabilityDeviation = 0.2; + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[] + { + new PipingSoilLayer(1.0) + { + IsAquifer = true, + PermeabilityMean = permeabilityMean, + PermeabilityDeviation = permeabilityDeviation + }, + new PipingSoilLayer(0.0) + { + IsAquifer = true, + PermeabilityMean = 12.5, + PermeabilityDeviation = 2.3 + } + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.DarcyPermeability; + + // Assert + Assert.AreEqual(permeabilityMean, result.Mean, result.Mean.GetAccuracy()); + Assert.AreEqual(permeabilityDeviation, result.StandardDeviation, result.StandardDeviation.GetAccuracy()); + } + + [Test] + public void DiameterD70_NoSoilProfile_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile.SoilProfile = null; + + // Call + var result = derivedInput.DiameterD70; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DiameterD70_NoStochasticSoilProfile_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile = null; + + // Call + var result = derivedInput.DiameterD70; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DiameterD70_NoSurfaceLine_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.SurfaceLine = null; + + // Call + var result = derivedInput.DiameterD70; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DiameterD70_NoExitPointL_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.ExitPointL = (RoundedDouble) double.NaN; + + // Call + var result = derivedInput.DiameterD70; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DiameterD70_NoAquiferLayers_ReturnsNaNForParameters() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[] + { + new PipingSoilLayer(1.0) + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.DiameterD70; + + // Assert + Assert.IsNaN(result.Mean); + Assert.IsNaN(result.StandardDeviation); + } + + [Test] + public void DiameterD70_SingleAquiferLayers_ReturnsWithParametersFromLayer() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + var random = new Random(21); + var diameterD70Mean = random.NextDouble(); + var diameterD70Deviation = random.NextDouble(); + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[] + { + new PipingSoilLayer(1.0) + { + IsAquifer = true, + DiameterD70Mean = diameterD70Mean, + DiameterD70Deviation = diameterD70Deviation + } + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.DiameterD70; + + // Assert + Assert.AreEqual(diameterD70Mean, result.Mean, result.Mean.GetAccuracy()); + Assert.AreEqual(diameterD70Deviation, result.StandardDeviation, result.StandardDeviation.GetAccuracy()); + } + + [Test] + public void DiameterD70_MultipleAquiferLayers_ReturnsWithParametersFromTopmostLayer() + { + // Setup + var input = PipingCalculationFactory.CreateInputWithAquiferAndCoverageLayer(); + var derivedInput = new DerivedPipingInput(input); + var diameterD70Mean = 0.5; + var diameterD70Deviation = 0.2; + input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[] + { + new PipingSoilLayer(1.0) + { + IsAquifer = true, + DiameterD70Mean = diameterD70Mean, + DiameterD70Deviation = diameterD70Deviation + }, + new PipingSoilLayer(0.0) + { + IsAquifer = true, + DiameterD70Mean = 12.5, + DiameterD70Deviation = 2.3 + } + }, SoilProfileType.SoilProfile1D, 0); + + // Call + var result = derivedInput.DiameterD70; + + // Assert + Assert.AreEqual(diameterD70Mean, result.Mean, result.Mean.GetAccuracy()); + Assert.AreEqual(diameterD70Deviation, result.StandardDeviation, result.StandardDeviation.GetAccuracy()); + } } } \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs =================================================================== diff -u -r2fa47cd04602f934423a03259178a8de32cae17d -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 2fa47cd04602f934423a03259178a8de32cae17d) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingInputTest.cs (.../PipingInputTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -67,23 +67,16 @@ GetErrorTolerance(inputParameters.DampingFactorExit.StandardDeviation)); Assert.AreEqual(3, inputParameters.DampingFactorExit.StandardDeviation.NumberOfDecimalPlaces); - double defaultLogNormalMean = Math.Exp(-0.5); - double defaultLogNormalStandardDev = Math.Sqrt((Math.Exp(1) - 1)*Math.Exp(1)); - Assert.IsInstanceOf(inputParameters.Diameter70); - Assert.AreEqual(defaultLogNormalMean, inputParameters.Diameter70.Mean, - GetErrorTolerance(inputParameters.Diameter70.Mean)); + Assert.IsNaN(inputParameters.Diameter70.Mean); + Assert.IsNaN(inputParameters.Diameter70.StandardDeviation); Assert.AreEqual(6, inputParameters.Diameter70.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(defaultLogNormalStandardDev, inputParameters.Diameter70.StandardDeviation, - GetErrorTolerance(inputParameters.Diameter70.StandardDeviation)); Assert.AreEqual(6, inputParameters.Diameter70.StandardDeviation.NumberOfDecimalPlaces); Assert.IsInstanceOf(inputParameters.DarcyPermeability); - Assert.AreEqual(defaultLogNormalMean, inputParameters.DarcyPermeability.Mean, - GetErrorTolerance(inputParameters.DarcyPermeability.Mean)); + Assert.IsNaN(inputParameters.DarcyPermeability.Mean); + Assert.IsNaN(inputParameters.DarcyPermeability.StandardDeviation); Assert.AreEqual(6, inputParameters.DarcyPermeability.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(defaultLogNormalStandardDev, inputParameters.DarcyPermeability.StandardDeviation, - GetErrorTolerance(inputParameters.DarcyPermeability.StandardDeviation)); Assert.AreEqual(6, inputParameters.DarcyPermeability.StandardDeviation.NumberOfDecimalPlaces); Assert.IsNull(inputParameters.SurfaceLine); @@ -110,10 +103,12 @@ Assert.AreEqual(2, inputParameters.ThicknessCoverageLayer.StandardDeviation.NumberOfDecimalPlaces); Assert.IsInstanceOf(inputParameters.SaturatedVolumicWeightOfCoverageLayer); - Assert.AreEqual(17.5, inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean.Value); Assert.AreEqual(2, inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(0, inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation.Value); Assert.AreEqual(2, inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation.NumberOfDecimalPlaces); + Assert.AreEqual(2, inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift.NumberOfDecimalPlaces); + Assert.IsNaN(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean.Value); + Assert.IsNaN(inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation.Value); + Assert.IsNaN(inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift.Value); Assert.IsInstanceOf(inputParameters.ThicknessAquiferLayer); Assert.IsNaN(inputParameters.ThicknessAquiferLayer.Mean); @@ -374,84 +369,6 @@ } [Test] - public void SaturatedVolumicWeightOfCoverageLayer_SetNewValue_UpdateMeanAndStandardDeviation() - { - // Setup - PipingInput inputs = new PipingInput(new GeneralPipingInput()); - ShiftedLogNormalDistribution originalSaturatedVolumicWeightOfCoverageLayer = inputs.SaturatedVolumicWeightOfCoverageLayer; - - ShiftedLogNormalDistribution newValue = new ShiftedLogNormalDistribution(5) - { - Mean = (RoundedDouble) 1.11111, - StandardDeviation = (RoundedDouble) 2.22222, - Shift = (RoundedDouble) (-3.33333) - }; - - // Call - inputs.SaturatedVolumicWeightOfCoverageLayer = newValue; - - // Assert - Assert.AreSame(originalSaturatedVolumicWeightOfCoverageLayer, inputs.SaturatedVolumicWeightOfCoverageLayer, - "Stochast instance hasn't changed to 'newValue'."); - Assert.AreEqual(2, originalSaturatedVolumicWeightOfCoverageLayer.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(1.11, originalSaturatedVolumicWeightOfCoverageLayer.Mean.Value); - Assert.AreEqual(2, originalSaturatedVolumicWeightOfCoverageLayer.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(2.22, originalSaturatedVolumicWeightOfCoverageLayer.StandardDeviation.Value); - Assert.AreEqual(2, originalSaturatedVolumicWeightOfCoverageLayer.Shift.NumberOfDecimalPlaces); - Assert.AreEqual(-3.33, originalSaturatedVolumicWeightOfCoverageLayer.Shift.Value); - } - - [Test] - public void Diameter70_SetNewValue_UpdateMeanAndStandardDeviation() - { - // Setup - PipingInput inputs = new PipingInput(new GeneralPipingInput()); - LogNormalDistribution originalDiameter70 = inputs.Diameter70; - - LogNormalDistribution newValue = new LogNormalDistribution(5) - { - Mean = (RoundedDouble) 8.8888, - StandardDeviation = (RoundedDouble) 9.14363 - }; - - // Call - inputs.Diameter70 = newValue; - - // Assert - Assert.AreSame(originalDiameter70, inputs.Diameter70, - "Stochast instance hasn't changed to 'newValue'."); - Assert.AreEqual(6, originalDiameter70.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(8.8887999, originalDiameter70.Mean.Value, originalDiameter70.Mean.GetAccuracy()); - Assert.AreEqual(6, originalDiameter70.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(9.1436299, originalDiameter70.StandardDeviation.Value, originalDiameter70.StandardDeviation.GetAccuracy()); - } - - [Test] - public void DarcyPermeability_SetNewValue_UpdateMeanAndStandardDeviation() - { - // Setup - PipingInput inputs = new PipingInput(new GeneralPipingInput()); - LogNormalDistribution originalDarcyPermeability = inputs.DarcyPermeability; - - LogNormalDistribution newValue = new LogNormalDistribution(5) - { - Mean = (RoundedDouble) 1.93753, - StandardDeviation = (RoundedDouble) 859.49028 - }; - - // Call - inputs.DarcyPermeability = newValue; - - // Assert - Assert.AreSame(originalDarcyPermeability, inputs.DarcyPermeability, - "Stochast instance hasn't changed to 'newValue'."); - Assert.AreEqual(6, originalDarcyPermeability.Mean.NumberOfDecimalPlaces); - Assert.AreEqual(1.9375300, originalDarcyPermeability.Mean.Value, originalDarcyPermeability.Mean.GetAccuracy()); - Assert.AreEqual(6, originalDarcyPermeability.StandardDeviation.NumberOfDecimalPlaces); - Assert.AreEqual(859.4902799, originalDarcyPermeability.StandardDeviation.Value, originalDarcyPermeability.StandardDeviation.GetAccuracy()); - } - - [Test] public void AssessmentLevel_InputHasNewHydraulicBoundaryLocationSet_AssessmentLevelUpdated() { // Setup Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilLayerTest.cs =================================================================== diff -u -r223528aec31c0f78f0f8ff67991e43f781075931 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilLayerTest.cs (.../PipingSoilLayerTest.cs) (revision 223528aec31c0f78f0f8ff67991e43f781075931) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilLayerTest.cs (.../PipingSoilLayerTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -47,6 +47,7 @@ Assert.IsNaN(layer.BelowPhreaticLevelMean); Assert.IsNaN(layer.BelowPhreaticLevelDeviation); + Assert.IsNaN(layer.BelowPhreaticLevelShift); Assert.IsNaN(layer.DiameterD70Mean); Assert.IsNaN(layer.DiameterD70Deviation); Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileExtensionsTest.cs =================================================================== diff -u --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileExtensionsTest.cs (revision 0) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileExtensionsTest.cs (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -0,0 +1,1041 @@ +// Copyright (C) Stichting Deltares 2016. All rights reserved. +// +// This file is part of Ringtoets. +// +// Ringtoets is free software: you can redistribute it and/or modify +// it under the terms of the GNU 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 General Public License for more details. +// +// You should have received a copy of the GNU 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.Collections.Generic; +using NUnit.Framework; +using Ringtoets.Piping.Primitives; + +namespace Ringtoets.Piping.Data.Test +{ + [TestFixture] + public class PipingSoilProfileExtensionsTest + { + #region GetTopmostConsecutiveAquiferLayerThicknessBelowLevel + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_NoAquiferLayer_NaN() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1), + new PipingSoilLayer(1.1) + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.0); + + // Assert + Assert.IsNaN(result); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AquiferLayerAboveLevel_NaN() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.0); + + // Assert + Assert.IsNaN(result); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AquiferLayerCompletelyBelowLevel_ReturnAquiferLayerThickness() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(2.2); + + // Assert + Assert.AreEqual(2.1, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AquiferLayerPartlyBelowLevel_ReturnAquiferLayerThicknessUpTillLevel() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.6); + + // Assert + Assert.AreEqual(1.6, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AquiferLayerTopEqualToLevel_ReturnAquiferLayerThickness() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(1.6) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.6); + + // Assert + Assert.AreEqual(1.6, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TwoAquiferLayersCompletelyBelowLevel_ReturnConsecutiveAquiferLayerThickness() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + }, + new PipingSoilLayer(0.5) + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(2.2); + + // Assert + Assert.AreEqual(1.6, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TopmostAquiferLayerTopEqualToLevel_ReturnConsecutiveAquiferLayerThickness() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + }, + new PipingSoilLayer(0.5) + { + IsAquifer = false + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(2.1); + + // Assert + Assert.AreEqual(1.6, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TopmostAquiferLayerTopPartlyBelowLevel_ReturnConsecutiveAquiferLayerThickness() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + }, + new PipingSoilLayer(0.5) + { + IsAquifer = false + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(2.0); + + // Assert + Assert.AreEqual(1.5, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TopmostAquiferLayerCompletelyAboveLevel_ReturnBottomAquiferLayerThickness() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.5) + { + IsAquifer = false + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.3); + + // Assert + Assert.AreEqual(1.1, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TopmostAquiferLayerPartlyAboveLevel_ReturnConsecutiveAquiferLayerThicknessUpTillLevel() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.5); + + // Assert + Assert.AreEqual(1.5, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TwoConsecutiveAquiferLayersAndOneNonConsecutiveAquiferLayer_ReturnConsecutiveAquiferLayerThicknessUpTillLevel() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.0), + new PipingSoilLayer(0.5) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.5); + + // Assert + Assert.AreEqual(0.5, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AllAquiferLayersAboveLevel_NaN() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + }, + new PipingSoilLayer(0.6) + { + IsAquifer = false + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(0.5); + + // Assert + Assert.IsNaN(result); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_BottomAquiferLayerTopEqualToLevel_BottomAquiferLayerThickness() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.1); + + // Assert + Assert.AreEqual(1.1, result, 1e-6); + } + + [Test] + public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_LevelBelowProfile_NaN() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.5, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + double result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(0.0); + + // Assert + Assert.IsNaN(result); + } + + #endregion + + #region GetConsecutiveAquiferLayersBelowLevel + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_NoAquiferLayer_ReturnsEmptyCollection() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1), + new PipingSoilLayer(1.1) + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(1.0); + + // Assert + Assert.IsEmpty(result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_AquiferLayerAboveLevel_ReturnsEmptyCollection() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(1.0); + + // Assert + Assert.IsEmpty(result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_AquiferLayerCompletelyBelowLevel_ReturnAquiferLayer() + { + // Setup + var aquiferLayer = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayer + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(2.2); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayer }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_AquiferLayerPartlyBelowLevel_ReturnCollectionWithAquiferLayer() + { + // Setup + var aquiferLayer = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayer + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(1.6); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayer }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_AquiferLayerTopEqualToLevel_ReturnCollectionWithAquiferLayer() + { + // Setup + var aquiferLayer = new PipingSoilLayer(1.6) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayer + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(1.6); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayer }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_TwoAquiferLayersCompletelyBelowLevel_ReturnConsecutiveAquiferLayers() + { + // Setup + var aquiferLayerA = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var aquiferLayerB = new PipingSoilLayer(1.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayerA, + aquiferLayerB, + new PipingSoilLayer(0.5) + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(2.2); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayerA, aquiferLayerB }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_TopmostAquiferLayerTopEqualToLevel_ReturnConsecutiveAquiferLayers() + { + // Setup + var aquiferLayerA = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var aquiferLayerB = new PipingSoilLayer(1.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayerA, + aquiferLayerB, + new PipingSoilLayer(0.5) + { + IsAquifer = false + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(2.1); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayerA, aquiferLayerB }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_TopmostAquiferLayerTopPartlyBelowLevel_ReturnCollectionWithAquiferLayer() + { + // Setup + var aquiferLayerA = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var aquiferLayerB = new PipingSoilLayer(1.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayerA, + aquiferLayerB, + new PipingSoilLayer(0.5) + { + IsAquifer = false + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(2.0); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayerA, aquiferLayerB }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_TopmostAquiferLayerCompletelyAboveLevel_ReturnCollectionWithoutTopmostAquiferLayer() + { + // Setup + var aquiferLayerA = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var aquiferLayerB = new PipingSoilLayer(1.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayerA, + new PipingSoilLayer(1.5) + { + IsAquifer = false + }, + aquiferLayerB + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(1.3); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayerB }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_TopmostAquiferLayerPartlyAboveLevel_ReturnCollectionWithTopmostAquiferLayer() + { + // Setup + var aquiferLayerA = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var aquiferLayerB = new PipingSoilLayer(1.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayerA, + aquiferLayerB + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(1.5); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayerA, aquiferLayerB }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_TwoConsecutiveAquiferLayersAndOneNonConsecutiveAquiferLayer_ReturnConsecutiveAquiferLayers() + { + // Setup + var aquiferLayerA = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var aquiferLayerB = new PipingSoilLayer(1.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayerA, + aquiferLayerB, + new PipingSoilLayer(1.0), + new PipingSoilLayer(0.5) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(1.5); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayerA, aquiferLayerB }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_AllAquiferLayersAboveLevel_ReturnsEmptyCollection() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + }, + new PipingSoilLayer(0.6) + { + IsAquifer = false + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(0.5); + + // Assert + Assert.IsEmpty(result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_BottomAquiferLayerTopEqualToLevel_ReturnsCollectionWithBottomAquiferLayer() + { + // Setup + var aquiferLayerA = new PipingSoilLayer(2.1) + { + IsAquifer = true + }; + var aquiferLayerB = new PipingSoilLayer(1.1) + { + IsAquifer = true + }; + var pipingSoilLayers = new[] + { + aquiferLayerA, + aquiferLayerB + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(1.1); + + // Assert + CollectionAssert.AreEqual(new[] { aquiferLayerB }, result); + } + + [Test] + public void GetConsecutiveAquiferLayersBelowLevel_LevelBelowProfile_ReturnsEmptyCollection() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.5, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquiferLayersBelowLevel(0.0); + + // Assert + Assert.IsEmpty(result); + } + + #endregion + + #region GetConsecutiveAquitardLayersBelowLevel + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_NoAquitardLayer_ReturnsEmptyCollection() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = true + }, + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(1.0); + + // Assert + Assert.IsEmpty(result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_AquitardLayerAboveLevel_ReturnsEmptyCollection() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1), + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(1.0); + + // Assert + Assert.IsEmpty(result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_AquitardLayerCompletelyBelowLevel_ReturnAquitardLayer() + { + // Setup + var aquitardLayer = new PipingSoilLayer(2.1); + var pipingSoilLayers = new[] + { + aquitardLayer + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(2.2); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayer }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_AquitardLayerPartlyBelowLevel_ReturnCollectionWithAquitardLayer() + { + // Setup + var aquitardLayer = new PipingSoilLayer(2.1); + var pipingSoilLayers = new[] + { + aquitardLayer + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(1.6); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayer }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_AquitardLayerTopEqualToLevel_ReturnCollectionWithAquitardLayer() + { + // Setup + var aquitardLayer = new PipingSoilLayer(1.6); + var pipingSoilLayers = new[] + { + aquitardLayer + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(1.6); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayer }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_TwoAquitardLayersCompletelyBelowLevel_ReturnConsecutiveAquitardLayers() + { + // Setup + var aquitardLayerA = new PipingSoilLayer(2.1); + var aquitardLayerB = new PipingSoilLayer(1.1); + var pipingSoilLayers = new[] + { + aquitardLayerA, + aquitardLayerB, + new PipingSoilLayer(0.5) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(2.2); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayerA, aquitardLayerB }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_TopmostAquitardLayerTopEqualToLevel_ReturnConsecutiveAquitardLayers() + { + // Setup + var aquitardLayerA = new PipingSoilLayer(2.1); + var aquitardLayerB = new PipingSoilLayer(1.1); + var pipingSoilLayers = new[] + { + aquitardLayerA, + aquitardLayerB, + new PipingSoilLayer(0.5) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(2.1); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayerA, aquitardLayerB }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_TopmostAquitardLayerTopPartlyBelowLevel_ReturnCollectionWithAquitardLayer() + { + // Setup + var aquitardLayerA = new PipingSoilLayer(2.1); + var aquitardLayerB = new PipingSoilLayer(1.1); + var pipingSoilLayers = new[] + { + aquitardLayerA, + aquitardLayerB, + new PipingSoilLayer(0.5) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(2.0); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayerA, aquitardLayerB }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_TopmostAquitardLayerCompletelyAboveLevel_ReturnCollectionWithoutTopmostAquitardLayer() + { + // Setup + var aquitardLayerA = new PipingSoilLayer(2.1); + var aquitardLayerB = new PipingSoilLayer(1.1); + var pipingSoilLayers = new[] + { + aquitardLayerA, + new PipingSoilLayer(1.5) + { + IsAquifer = true + }, + aquitardLayerB + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(1.3); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayerB }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_TopmostAquitardLayerPartlyAboveLevel_ReturnCollectionWithTopmostAquitardLayer() + { + // Setup + var aquitardLayerA = new PipingSoilLayer(2.1); + var aquitardLayerB = new PipingSoilLayer(1.1); + var pipingSoilLayers = new[] + { + aquitardLayerA, + aquitardLayerB + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(1.5); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayerA, aquitardLayerB }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_TwoConsecutiveAquitardLayersAndOneNonConsecutiveAquitardLayer_ReturnConsecutiveAquitardLayers() + { + // Setup + var aquitardLayerA = new PipingSoilLayer(2.1); + var aquitardLayerB = new PipingSoilLayer(1.1); + var pipingSoilLayers = new[] + { + aquitardLayerA, + aquitardLayerB, + new PipingSoilLayer(1.0) + { + IsAquifer = true + }, + new PipingSoilLayer(0.5) + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(1.5); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayerA, aquitardLayerB }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_AllAquitardLayersAboveLevel_ReturnsEmptyCollection() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(2.1) + { + IsAquifer = false + }, + new PipingSoilLayer(1.1) + { + IsAquifer = false + }, + new PipingSoilLayer(0.6) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(0.5); + + // Assert + Assert.IsEmpty(result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_BottomAquitardLayerTopEqualToLevel_ReturnsCollectionWithBottomAquitardLayer() + { + // Setup + var aquitardLayerA = new PipingSoilLayer(2.1) + { + IsAquifer = false + }; + var aquitardLayerB = new PipingSoilLayer(1.1) + { + IsAquifer = false + }; + var pipingSoilLayers = new[] + { + aquitardLayerA, + aquitardLayerB + }; + var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(1.1); + + // Assert + CollectionAssert.AreEqual(new[] { aquitardLayerB }, result); + } + + [Test] + public void GetConsecutiveAquitardLayersBelowLevel_LevelBelowProfile_ReturnsEmptyCollection() + { + // Setup + var pipingSoilLayers = new[] + { + new PipingSoilLayer(1.1) + { + IsAquifer = true + } + }; + var profile = new PipingSoilProfile(string.Empty, 0.5, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); + + // Call + IEnumerable result = profile.GetConsecutiveAquitardLayersBelowLevel(0.0); + + // Assert + Assert.IsEmpty(result); + } + + #endregion + + } +} \ No newline at end of file Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs =================================================================== diff -u -r8293556a04e3650c9978df7a50f8f8ad0d792ed8 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision 8293556a04e3650c9978df7a50f8f8ad0d792ed8) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/PipingSoilProfileTest.cs (.../PipingSoilProfileTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -166,340 +166,6 @@ } [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_NoAquiferLayer_NaN() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1), - new PipingSoilLayer(1.1) - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.0); - - // Assert - Assert.IsNaN(result); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AquiferLayerAboveLevel_NaN() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.1) - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.0); - - // Assert - Assert.IsNaN(result); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AquiferLayerCompletelyBelowLevel_ReturnAquiferLayerThickness() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(2.2); - - // Assert - Assert.AreEqual(2.1, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AquiferLayerPartlyBelowLevel_ReturnAquiferLayerThicknessUpTillLevel() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.6); - - // Assert - Assert.AreEqual(1.6, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AquiferLayerTopEqualToLevel_ReturnAquiferLayerThickness() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(1.6) - { - IsAquifer = true - }, - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.6); - - // Assert - Assert.AreEqual(1.6, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TwoAquiferLayersCompletelyBelowLevel_ReturnConsecutiveAquiferLayerThickness() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.1) - { - IsAquifer = true - }, - new PipingSoilLayer(0.5) - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(2.2); - - // Assert - Assert.AreEqual(1.6, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TopmostAquiferLayerTopEqualToLevel_ReturnConsecutiveAquiferLayerThickness() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.1) - { - IsAquifer = true - }, - new PipingSoilLayer(0.5) - { - IsAquifer = false - } - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(2.1); - - // Assert - Assert.AreEqual(1.6, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TopmostAquiferLayerTopPartlyBelowLevel_ReturnConsecutiveAquiferLayerThickness() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.1) - { - IsAquifer = true - }, - new PipingSoilLayer(0.5) - { - IsAquifer = false - } - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(2.0); - - // Assert - Assert.AreEqual(1.5, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TopmostAquiferLayerCompletelyAboveLevel_ReturnBottomAquiferLayerThickness() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.5) - { - IsAquifer = false - }, - new PipingSoilLayer(1.1) - { - IsAquifer = true - } - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.3); - - // Assert - Assert.AreEqual(1.1, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TopmostAquiferLayerPartlyAboveLevel_ReturnConsecutiveAquiferLayerThicknessUpTillLevel() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.1) - { - IsAquifer = true - } - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.5); - - // Assert - Assert.AreEqual(1.5, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_TwoConsecutiveAquiferLayersAndOneNonConsecutiveAquiferLayer_ReturnConsecutiveAquiferLayerThicknessUpTillLevel() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.0), - new PipingSoilLayer(0.5) - { - IsAquifer = true - } - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.5); - - // Assert - Assert.AreEqual(0.5, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_AllAquiferLayersAboveLevel_NaN() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.1) - { - IsAquifer = true - }, - new PipingSoilLayer(0.6) - { - IsAquifer = false - } - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(0.5); - - // Assert - Assert.IsNaN(result); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_BottomAquiferLayerTopEqualToLevel_BottomAquiferLayerThickness() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(2.1) - { - IsAquifer = true - }, - new PipingSoilLayer(1.1) - { - IsAquifer = true - }, - }; - var profile = new PipingSoilProfile(string.Empty, 0.0, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - var result = profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(1.1); - - // Assert - Assert.AreEqual(1.1, result, 1e-6); - } - - [Test] - public void GetTopmostConsecutiveAquiferLayerThicknessBelowLevel_LevelBelowProfile_ArgumentException() - { - // Setup - var pipingSoilLayers = new[] - { - new PipingSoilLayer(1.1) - { - IsAquifer = true - } - }; - var profile = new PipingSoilProfile(string.Empty, 0.5, pipingSoilLayers, SoilProfileType.SoilProfile1D, 0); - - // Call - TestDelegate call = () => profile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(0.0); - - // Assert - var message = string.Format("Level {0} is below the bottom of the soil profile {1}.", 0.0, 0.5); - TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, message); - } - - [Test] [TestCase(null)] [TestCase("")] [TestCase("some name")] Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj =================================================================== diff -u -rce94b8228bc7e51779b3754217580f13cb35e475 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision ce94b8228bc7e51779b3754217580f13cb35e475) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.Test/Ringtoets.Piping.Data.Test.csproj (.../Ringtoets.Piping.Data.Test.csproj) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -68,6 +68,7 @@ + Index: Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs =================================================================== diff -u -rbb0aeecc47206f5089ab04ca6c3575a1de8c206f -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs (.../PipingCalculationFactory.cs) (revision bb0aeecc47206f5089ab04ca6c3575a1de8c206f) +++ Ringtoets/Piping/test/Ringtoets.Piping.Data.TestUtil/PipingCalculationFactory.cs (.../PipingCalculationFactory.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -44,11 +44,18 @@ { new PipingSoilLayer(top) { - IsAquifer = false + IsAquifer = false, + BelowPhreaticLevelDeviation = 0, + BelowPhreaticLevelShift = 10, + BelowPhreaticLevelMean = 17.5 }, new PipingSoilLayer(top/2) { - IsAquifer = true + IsAquifer = true, + DiameterD70Deviation = 0, + DiameterD70Mean = 1.0, + PermeabilityDeviation = 0, + PermeabilityMean = 1.0 } }, SoilProfileType.SoilProfile1D, 0) }; @@ -86,14 +93,6 @@ { Mean = (RoundedDouble) 1.0 }, - DarcyPermeability = - { - Mean = (RoundedDouble) 1.0 - }, - Diameter70 = - { - Mean = (RoundedDouble) 1.0 - }, PhreaticLevelExit = { Mean = (RoundedDouble) 2.0 Index: Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs =================================================================== diff -u -r775077965de8db55e76ff3ef1f050d7007a8b4e7 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 775077965de8db55e76ff3ef1f050d7007a8b4e7) +++ Ringtoets/Piping/test/Ringtoets.Piping.Forms.Test/PropertyClasses/PipingInputContextPropertiesTest.cs (.../PipingInputContextPropertiesTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -110,11 +110,21 @@ Assert.AreSame(inputParameters.DampingFactorExit, properties.DampingFactorExit.Distribution); Assert.AreEqual(inputParameters.ThicknessCoverageLayer.Mean, properties.ThicknessCoverageLayer.Distribution.Mean); Assert.AreEqual(inputParameters.ThicknessCoverageLayer.StandardDeviation, properties.ThicknessCoverageLayer.Distribution.StandardDeviation); - Assert.AreSame(inputParameters.Diameter70, properties.Diameter70.Distribution); - Assert.AreSame(inputParameters.DarcyPermeability, properties.DarcyPermeability.Distribution); + Assert.AreEqual(inputParameters.Diameter70.Mean, properties.Diameter70.Distribution.Mean); + Assert.AreEqual(inputParameters.Diameter70.StandardDeviation, properties.Diameter70.Distribution.StandardDeviation); + Assert.AreEqual(inputParameters.DarcyPermeability.Mean, properties.DarcyPermeability.Distribution.Mean); + Assert.AreEqual(inputParameters.DarcyPermeability.StandardDeviation, properties.DarcyPermeability.Distribution.StandardDeviation); Assert.AreEqual(inputParameters.ThicknessAquiferLayer.Mean, properties.ThicknessAquiferLayer.Distribution.Mean); Assert.AreEqual(inputParameters.ThicknessAquiferLayer.StandardDeviation, properties.ThicknessAquiferLayer.Distribution.StandardDeviation); - Assert.AreSame(inputParameters.SaturatedVolumicWeightOfCoverageLayer, properties.SaturatedVolumicWeightOfCoverageLayer.Distribution); + Assert.AreEqual( + inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean, + properties.SaturatedVolumicWeightOfCoverageLayer.Distribution.Mean); + Assert.AreEqual( + inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation, + properties.SaturatedVolumicWeightOfCoverageLayer.Distribution.StandardDeviation); + Assert.AreEqual( + inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift, + properties.SaturatedVolumicWeightOfCoverageLayer.Distribution.Shift); Assert.AreEqual(inputParameters.AssessmentLevel, properties.AssessmentLevel); Assert.AreEqual(inputParameters.PiezometricHeadExit, properties.PiezometricHeadExit); @@ -175,7 +185,7 @@ var mocks = new MockRepository(); var assessmentSectionMock = mocks.StrictMock(); var projectObserver = mocks.StrictMock(); - int numberProperties = 9; + int numberProperties = 6; projectObserver.Expect(o => o.UpdateObserver()).Repeat.Times(numberProperties); mocks.ReplayAll(); @@ -197,9 +207,6 @@ LogNormalDistribution dampingFactorExit = new LogNormalDistribution(3); NormalDistribution phreaticLevelExit = new NormalDistribution(2); - LogNormalDistribution diameter70 = new LogNormalDistribution(2); - LogNormalDistribution darcyPermeability = new LogNormalDistribution(3); - ShiftedLogNormalDistribution saturatedVolumicWeightOfCoverageLoayer = new ShiftedLogNormalDistribution(2); RingtoetsPipingSurfaceLine surfaceLine = ValidSurfaceLine(0.0, 4.0); StochasticSoilModel stochasticSoilModel1 = ValidStochasticSoilModel(0.0, 4.0); @@ -223,9 +230,6 @@ assessmentSectionMock), DampingFactorExit = new LogNormalDistributionDesignVariable(dampingFactorExit), PhreaticLevelExit = new NormalDistributionDesignVariable(phreaticLevelExit), - Diameter70 = new LogNormalDistributionDesignVariable(diameter70), - DarcyPermeability = new LogNormalDistributionDesignVariable(darcyPermeability), - SaturatedVolumicWeightOfCoverageLayer = new ShiftedLogNormalDistributionDesignVariable(saturatedVolumicWeightOfCoverageLoayer), SurfaceLine = surfaceLine, StochasticSoilModel = stochasticSoilModel2, StochasticSoilProfile = stochasticSoilProfile2, @@ -245,23 +249,6 @@ Assert.AreEqual(phreaticLevelExit.StandardDeviation, inputParameters.PhreaticLevelExit.StandardDeviation, inputParameters.PhreaticLevelExit.GetAccuracy()); - Assert.AreEqual(diameter70.Mean, inputParameters.Diameter70.Mean, - inputParameters.Diameter70.GetAccuracy()); - Assert.AreEqual(diameter70.StandardDeviation, inputParameters.Diameter70.StandardDeviation, - inputParameters.Diameter70.GetAccuracy()); - - Assert.AreEqual(darcyPermeability.Mean, inputParameters.DarcyPermeability.Mean, - inputParameters.DarcyPermeability.GetAccuracy()); - Assert.AreEqual(darcyPermeability.StandardDeviation, inputParameters.DarcyPermeability.StandardDeviation, - inputParameters.DarcyPermeability.GetAccuracy()); - - Assert.AreEqual(saturatedVolumicWeightOfCoverageLoayer.Mean, inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean, - inputParameters.SaturatedVolumicWeightOfCoverageLayer.GetAccuracy()); - Assert.AreEqual(saturatedVolumicWeightOfCoverageLoayer.StandardDeviation, inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation, - inputParameters.SaturatedVolumicWeightOfCoverageLayer.GetAccuracy()); - Assert.AreEqual(saturatedVolumicWeightOfCoverageLoayer.Shift, inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift, - inputParameters.SaturatedVolumicWeightOfCoverageLayer.GetAccuracy()); - Assert.AreEqual(surfaceLine, inputParameters.SurfaceLine); Assert.AreEqual(stochasticSoilModel2, inputParameters.StochasticSoilModel); Assert.AreEqual(stochasticSoilProfile2, inputParameters.StochasticSoilModel.StochasticSoilProfiles.First()); Index: Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs =================================================================== diff -u -rba840423eb72501cbad89c1a6d88642531efa8d5 -r2363244674e6b7b97bead9a6855806420d368d80 --- Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs (.../PipingSemiProbabilisticDesignValueFactoryTest.cs) (revision ba840423eb72501cbad89c1a6d88642531efa8d5) +++ Ringtoets/Piping/test/Ringtoets.Piping.KernelWrapper.Test/PipingSemiProbabilisticDesignValueFactoryTest.cs (.../PipingSemiProbabilisticDesignValueFactoryTest.cs) (revision 2363244674e6b7b97bead9a6855806420d368d80) @@ -24,20 +24,6 @@ } [Test] - public void GetSaturatedVolumicWeightOfCoverageLayer_ValidPipingCalculation_CreateDesignVariableForSaturatedVolumicWeightOfCoverageLayer() - { - // Setup - var inputParameters = new PipingInput(new GeneralPipingInput()); - - // Call - var saturatedVolumicWeightOfCoverageLayer = PipingSemiProbabilisticDesignValueFactory.GetSaturatedVolumicWeightOfCoverageLayer(inputParameters); - - // Assert - Assert.AreSame(inputParameters.SaturatedVolumicWeightOfCoverageLayer, saturatedVolumicWeightOfCoverageLayer.Distribution); - Assert.AreEqual(0.05, saturatedVolumicWeightOfCoverageLayer.Percentile); - } - - [Test] public void GetPhreaticLevelExit_ValidPipingCalculation_CreateDesignVariableForPhreaticLevelExit() { // Setup @@ -94,7 +80,8 @@ var d70 = PipingSemiProbabilisticDesignValueFactory.GetDiameter70(inputParameters); // Assert - Assert.AreSame(inputParameters.Diameter70, d70.Distribution); + Assert.AreEqual(inputParameters.Diameter70.Mean, d70.Distribution.Mean); + Assert.AreEqual(inputParameters.Diameter70.StandardDeviation, d70.Distribution.StandardDeviation); Assert.AreEqual(0.05, d70.Percentile); } @@ -108,11 +95,34 @@ var darcyPermeability = PipingSemiProbabilisticDesignValueFactory.GetDarcyPermeability(inputParameters); // Assert - Assert.AreSame(inputParameters.DarcyPermeability, darcyPermeability.Distribution); + Assert.AreEqual(inputParameters.DarcyPermeability.Mean, darcyPermeability.Distribution.Mean); + Assert.AreEqual(inputParameters.DarcyPermeability.StandardDeviation, darcyPermeability.Distribution.StandardDeviation); Assert.AreEqual(0.95, darcyPermeability.Percentile); } [Test] + public void GetSaturatedVolumicWeightOfCoverageLayer_ValidPipingCalculation_CreateDesignVariableForSaturatedVolumicWeightOfCoverageLayer() + { + // Setup + var inputParameters = new PipingInput(new GeneralPipingInput()); + + // Call + var saturatedVolumicWeightOfCoverageLayer = PipingSemiProbabilisticDesignValueFactory.GetSaturatedVolumicWeightOfCoverageLayer(inputParameters); + + // Assert + Assert.AreEqual( + inputParameters.SaturatedVolumicWeightOfCoverageLayer.Mean, + saturatedVolumicWeightOfCoverageLayer.Distribution.Mean); + Assert.AreEqual( + inputParameters.SaturatedVolumicWeightOfCoverageLayer.StandardDeviation, + saturatedVolumicWeightOfCoverageLayer.Distribution.StandardDeviation); + Assert.AreEqual( + inputParameters.SaturatedVolumicWeightOfCoverageLayer.Shift, + saturatedVolumicWeightOfCoverageLayer.Distribution.Shift); + Assert.AreEqual(0.05, saturatedVolumicWeightOfCoverageLayer.Percentile); + } + + [Test] public void GetThicknessAquiferLayer_ValidPipingCalculation_CreateDesignVariableForThicknessAquiferLayer() { // Setup