Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/DerivedMacroStabilityInwardsInput.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/DerivedMacroStabilityInwardsInput.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/DerivedMacroStabilityInwardsInput.cs (revision fb3c8e242d17e52fadf6b84416e1819988cf2ce2)
@@ -0,0 +1,535 @@
+// Copyright (C) Stichting Deltares 2017. 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 Core.Common.Base.Data;
+using Ringtoets.Common.Data.Probabilistics;
+using Ringtoets.MacroStabilityInwards.InputParameterCalculation;
+using Ringtoets.MacroStabilityInwards.Primitives;
+using Ringtoets.MacroStabilityInwards.Primitives.Exceptions;
+
+namespace Ringtoets.MacroStabilityInwards.Data
+{
+ ///
+ /// Class responsible for calculating the derived macro stability inwards input.
+ ///
+ public class DerivedMacroStabilityInwardsInput
+ {
+ private const double seepageLengthCoefficientOfVariation = 0.1;
+
+ private readonly MacroStabilityInwardsInput input;
+
+ ///
+ /// Creates a new instance of .
+ ///
+ /// The input to calculate the derived macro stability inwards input.
+ /// Thrown when is null.
+ public DerivedMacroStabilityInwardsInput(MacroStabilityInwardsInput input)
+ {
+ if (input == null)
+ {
+ throw new ArgumentNullException(nameof(input), @"Cannot create DerivedMacroStabilityInwardsInput without MacroStabilityInwardsInput.");
+ }
+ this.input = input;
+ }
+
+ ///
+ /// Gets the piezometric head at the exit point.
+ /// [m]
+ ///
+ public RoundedDouble PiezometricHeadExit
+ {
+ get
+ {
+ RoundedDouble dampingFactorExit = PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(input).GetDesignValue();
+ RoundedDouble phreaticLevelExit = PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue();
+
+ return new RoundedDouble(2, InputParameterCalculationService.CalculatePiezometricHeadAtExit(input.AssessmentLevel,
+ dampingFactorExit,
+ phreaticLevelExit));
+ }
+ }
+
+ ///
+ /// Gets the horizontal distance between entry and exit point.
+ /// [m]
+ ///
+ public VariationCoefficientLogNormalDistribution SeepageLength
+ {
+ get
+ {
+ var seepageLength = new VariationCoefficientLogNormalDistribution(2);
+ double seepageLengthMean = input.ExitPointL - input.EntryPointL;
+
+ seepageLength.Mean = (RoundedDouble) seepageLengthMean;
+ seepageLength.CoefficientOfVariation = (RoundedDouble) seepageLengthCoefficientOfVariation;
+
+ return seepageLength;
+ }
+ }
+
+ ///
+ /// Gets the total thickness of the coverage layers at the exit point.
+ /// [m]
+ ///
+ public LogNormalDistribution ThicknessCoverageLayer
+ {
+ get
+ {
+ var thicknessCoverageLayer = new LogNormalDistribution(2)
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = (RoundedDouble) 0.5
+ };
+ UpdateThicknessCoverageLayerMean(thicknessCoverageLayer);
+
+ return thicknessCoverageLayer;
+ }
+ }
+
+ ///
+ /// Gets the effective thickness of the coverage layers at the exit point.
+ /// [m]
+ ///
+ public LogNormalDistribution EffectiveThicknessCoverageLayer
+ {
+ get
+ {
+ var thicknessCoverageLayer = new LogNormalDistribution(2)
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = (RoundedDouble) 0.5
+ };
+ UpdateEffectiveThicknessCoverageLayerMean(thicknessCoverageLayer);
+
+ return thicknessCoverageLayer;
+ }
+ }
+
+ ///
+ /// Gets the total thickness of the aquifer layers at the exit point.
+ /// [m]
+ ///
+ public LogNormalDistribution ThicknessAquiferLayer
+ {
+ get
+ {
+ var thicknessAquiferLayer = new LogNormalDistribution(2)
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = (RoundedDouble) 0.5
+ };
+ UpdateThicknessAquiferLayerMean(thicknessAquiferLayer);
+
+ return thicknessAquiferLayer;
+ }
+ }
+
+ ///
+ /// Gets the sieve size through which 70% of the grains of the top part of the aquifer pass.
+ /// [m]
+ ///
+ public VariationCoefficientLogNormalDistribution DiameterD70
+ {
+ get
+ {
+ var distribution = new VariationCoefficientLogNormalDistribution(6)
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ };
+ UpdateDiameterD70Parameters(distribution);
+
+ return distribution;
+ }
+ }
+
+ ///
+ /// Gets the Darcy-speed with which water flows through the aquifer layer.
+ /// [m/s]
+ ///
+ public VariationCoefficientLogNormalDistribution DarcyPermeability
+ {
+ get
+ {
+ var distribution = new VariationCoefficientLogNormalDistribution(6)
+ {
+ Mean = RoundedDouble.NaN,
+ CoefficientOfVariation = RoundedDouble.NaN
+ };
+ UpdateDarcyPermeabilityParameters(distribution);
+
+ return distribution;
+ }
+ }
+
+ ///
+ /// Gets the volumic weight of the saturated coverage layer.
+ ///
+ public LogNormalDistribution SaturatedVolumicWeightOfCoverageLayer
+ {
+ get
+ {
+ var distribution = new LogNormalDistribution(2)
+ {
+ Mean = RoundedDouble.NaN,
+ StandardDeviation = RoundedDouble.NaN,
+ Shift = RoundedDouble.NaN
+ };
+ UpdateSaturatedVolumicWeightOfCoverageLayerParameters(distribution);
+
+ return distribution;
+ }
+ }
+
+ private void UpdateThicknessAquiferLayerMean(LogNormalDistribution thicknessAquiferLayer)
+ {
+ StochasticSoilProfile stochasticSoilProfile = input.StochasticSoilProfile;
+ RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine;
+ RoundedDouble exitPointL = input.ExitPointL;
+
+ if (stochasticSoilProfile?.SoilProfile != null && surfaceLine != null && !double.IsNaN(exitPointL))
+ {
+ var thicknessTopAquiferLayer = new RoundedDouble(GetNumberOfDecimals(thicknessAquiferLayer),
+ GetThicknessTopAquiferLayer(stochasticSoilProfile.SoilProfile, surfaceLine, exitPointL));
+
+ if (thicknessTopAquiferLayer > 0)
+ {
+ thicknessAquiferLayer.Mean = thicknessTopAquiferLayer;
+ }
+ }
+ }
+
+ private void UpdateThicknessCoverageLayerMean(LogNormalDistribution thicknessCoverageLayerDistribution)
+ {
+ StochasticSoilProfile stochasticSoilProfile = input.StochasticSoilProfile;
+ RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine;
+ RoundedDouble exitPointL = input.ExitPointL;
+
+ if (stochasticSoilProfile?.SoilProfile != null && surfaceLine != null && !double.IsNaN(exitPointL))
+ {
+ var weightedMean = new RoundedDouble(GetNumberOfDecimals(thicknessCoverageLayerDistribution),
+ GetThicknessCoverageLayers(stochasticSoilProfile.SoilProfile, surfaceLine, exitPointL));
+
+ if (weightedMean > 0)
+ {
+ thicknessCoverageLayerDistribution.Mean = weightedMean;
+ }
+ }
+ }
+
+ private void UpdateEffectiveThicknessCoverageLayerMean(LogNormalDistribution effectiveThicknessCoverageLayerDistribution)
+ {
+ if (input.SurfaceLine != null && input.StochasticSoilProfile?.SoilProfile != null && !double.IsNaN(input.ExitPointL))
+ {
+ var weightedMean = new RoundedDouble(GetNumberOfDecimals(effectiveThicknessCoverageLayerDistribution),
+ InputParameterCalculationService.CalculateEffectiveThicknessCoverageLayer(
+ input.WaterVolumetricWeight,
+ PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(),
+ input.ExitPointL,
+ input.SurfaceLine,
+ input.StochasticSoilProfile.SoilProfile));
+
+ if (weightedMean > 0)
+ {
+ effectiveThicknessCoverageLayerDistribution.Mean = weightedMean;
+ }
+ }
+ }
+
+ private void UpdateDiameterD70Parameters(VariationCoefficientLogNormalDistribution diameterD70Distribution)
+ {
+ PipingSoilLayer topMostAquiferLayer = GetConsecutiveAquiferLayers().FirstOrDefault();
+ if (topMostAquiferLayer != null)
+ {
+ var diameterD70Mean = new RoundedDouble(GetNumberOfDecimals(diameterD70Distribution), topMostAquiferLayer.DiameterD70Mean);
+
+ if (diameterD70Mean > 0)
+ {
+ diameterD70Distribution.Mean = diameterD70Mean;
+ }
+ diameterD70Distribution.CoefficientOfVariation = (RoundedDouble) topMostAquiferLayer.DiameterD70CoefficientOfVariation;
+ }
+ }
+
+ private void UpdateDarcyPermeabilityParameters(VariationCoefficientLogNormalDistribution darcyPermeabilityDistribution)
+ {
+ PipingSoilLayer[] aquiferLayers = GetConsecutiveAquiferLayers();
+
+ int numberOfDecimals = GetNumberOfDecimals(darcyPermeabilityDistribution);
+
+ if (HasCorrectDarcyPermeabilityWeightDistributionParameterDefinition(
+ aquiferLayers,
+ numberOfDecimals))
+ {
+ PipingSoilLayer topMostAquiferLayer = aquiferLayers.First();
+
+ var permeabilityCoefficientOfVariation = new RoundedDouble(numberOfDecimals, topMostAquiferLayer.PermeabilityCoefficientOfVariation);
+
+ var weightedMean = new RoundedDouble(numberOfDecimals,
+ GetWeightedMeanForDarcyPermeabilityOfAquiferLayer(aquiferLayers,
+ input.StochasticSoilProfile.SoilProfile,
+ input.SurfaceLine.GetZAtL(input.ExitPointL)));
+
+ if (weightedMean > 0)
+ {
+ darcyPermeabilityDistribution.Mean = weightedMean;
+ }
+
+ darcyPermeabilityDistribution.CoefficientOfVariation = permeabilityCoefficientOfVariation;
+ }
+ }
+
+ private void UpdateSaturatedVolumicWeightOfCoverageLayerParameters(LogNormalDistribution volumicWeightDistribution)
+ {
+ PipingSoilLayer[] coverageLayers = GetConsecutiveCoverageLayers();
+
+ int numberOfDecimals = GetNumberOfDecimals(volumicWeightDistribution);
+
+ if (HasCorrectSaturatedWeightDistributionParameterDefinition(
+ coverageLayers,
+ numberOfDecimals))
+ {
+ PipingSoilLayer topMostAquitardLayer = coverageLayers.First();
+ volumicWeightDistribution.Shift = (RoundedDouble) topMostAquitardLayer.BelowPhreaticLevelShift;
+ volumicWeightDistribution.StandardDeviation = (RoundedDouble) topMostAquitardLayer.BelowPhreaticLevelDeviation;
+
+ var weightedMean = new RoundedDouble(numberOfDecimals,
+ GetWeightedMeanForVolumicWeightOfCoverageLayer(
+ coverageLayers,
+ input.StochasticSoilProfile.SoilProfile,
+ input.SurfaceLine.GetZAtL(input.ExitPointL)));
+
+ if (weightedMean > 0)
+ {
+ volumicWeightDistribution.Mean = weightedMean;
+ }
+ }
+ }
+
+ private static int GetNumberOfDecimals(IDistribution distribution)
+ {
+ return distribution.Mean.NumberOfDecimalPlaces;
+ }
+
+ private static int GetNumberOfDecimals(IVariationCoefficientDistribution distribution)
+ {
+ return distribution.Mean.NumberOfDecimalPlaces;
+ }
+
+ private static bool HasCorrectSaturatedWeightDistributionParameterDefinition(IList consecutiveAquitardLayers, int numberOfDecimals)
+ {
+ if (!consecutiveAquitardLayers.Any())
+ {
+ return false;
+ }
+
+ LogNormalDistribution[] distributions = GetLayerSaturatedVolumicWeightDistributionDefinitions(consecutiveAquitardLayers, numberOfDecimals);
+
+ if (distributions == null)
+ {
+ return false;
+ }
+
+ if (distributions.Length == 1)
+ {
+ return true;
+ }
+
+ return distributions.All(currentLayerDistribution => AreShiftAndDeviationEqual(
+ currentLayerDistribution,
+ distributions[0]));
+ }
+
+ private static bool HasCorrectDarcyPermeabilityWeightDistributionParameterDefinition(IList consecutiveAquitardLayers, int numberOfDecimals)
+ {
+ if (!consecutiveAquitardLayers.Any())
+ {
+ return false;
+ }
+
+ VariationCoefficientLogNormalDistribution[] distributions = GetLayerPermeabilityDistributionDefinitions(consecutiveAquitardLayers, numberOfDecimals);
+
+ if (distributions == null)
+ {
+ return false;
+ }
+
+ if (distributions.Length == 1)
+ {
+ return true;
+ }
+
+ return distributions.All(currentLayerDistribution => AreCoefficientEqual(
+ currentLayerDistribution,
+ distributions[0]));
+ }
+
+ private static LogNormalDistribution[] GetLayerSaturatedVolumicWeightDistributionDefinitions(IList consecutiveAquitardLayers, int numberOfDecimals)
+ {
+ try
+ {
+ return consecutiveAquitardLayers.Select(layer => new LogNormalDistribution(numberOfDecimals)
+ {
+ Mean = (RoundedDouble) layer.BelowPhreaticLevelMean,
+ StandardDeviation = (RoundedDouble) layer.BelowPhreaticLevelDeviation,
+ Shift = (RoundedDouble) layer.BelowPhreaticLevelShift
+ }).ToArray();
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ return null;
+ }
+ }
+
+ private static VariationCoefficientLogNormalDistribution[] GetLayerPermeabilityDistributionDefinitions(IList consecutiveAquitardLayers, int numberOfDecimals)
+ {
+ try
+ {
+ return consecutiveAquitardLayers.Select(layer => new VariationCoefficientLogNormalDistribution(numberOfDecimals)
+ {
+ Mean = (RoundedDouble) layer.PermeabilityMean,
+ CoefficientOfVariation = (RoundedDouble) layer.PermeabilityCoefficientOfVariation
+ }).ToArray();
+ }
+ catch (ArgumentOutOfRangeException)
+ {
+ return null;
+ }
+ }
+
+ private static bool AreShiftAndDeviationEqual(LogNormalDistribution currentLayerDistribution, LogNormalDistribution baseLayerDistribution)
+ {
+ return currentLayerDistribution.StandardDeviation == baseLayerDistribution.StandardDeviation &&
+ currentLayerDistribution.Shift == baseLayerDistribution.Shift;
+ }
+
+ private static bool AreCoefficientEqual(
+ VariationCoefficientLogNormalDistribution currentLayerDistribution,
+ VariationCoefficientLogNormalDistribution baseLayerDistribution)
+ {
+ return Math.Abs(baseLayerDistribution.CoefficientOfVariation - currentLayerDistribution.CoefficientOfVariation) < 1e-6;
+ }
+
+ private static double GetWeightedMeanForVolumicWeightOfCoverageLayer(PipingSoilLayer[] aquitardLayers, PipingSoilProfile profile, double surfaceLevel)
+ {
+ var totalThickness = 0.0;
+ var weighedTotal = 0.0;
+
+ foreach (PipingSoilLayer layer in aquitardLayers)
+ {
+ double layerThickness = profile.GetLayerThickness(layer);
+ double bottom = layer.Top - layerThickness;
+ double thicknessUnderSurface = Math.Min(layer.Top, surfaceLevel) - bottom;
+
+ totalThickness += thicknessUnderSurface;
+ weighedTotal += layer.BelowPhreaticLevelMean * thicknessUnderSurface;
+ }
+
+ return weighedTotal / totalThickness;
+ }
+
+ private static double GetWeightedMeanForDarcyPermeabilityOfAquiferLayer(PipingSoilLayer[] aquitardLayers, PipingSoilProfile profile, double surfaceLevel)
+ {
+ var totalThickness = 0.0;
+ var weighedTotal = 0.0;
+
+ foreach (PipingSoilLayer layer in aquitardLayers)
+ {
+ double layerThickness = profile.GetLayerThickness(layer);
+ double bottom = layer.Top - layerThickness;
+ double thicknessUnderSurface = Math.Min(layer.Top, surfaceLevel) - bottom;
+
+ totalThickness += thicknessUnderSurface;
+ weighedTotal += layer.PermeabilityMean * thicknessUnderSurface;
+ }
+
+ return weighedTotal / totalThickness;
+ }
+
+ private PipingSoilLayer[] GetConsecutiveAquiferLayers()
+ {
+ RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine;
+ PipingSoilProfile soilProfile = input.StochasticSoilProfile?.SoilProfile;
+ RoundedDouble exitPointL = input.ExitPointL;
+
+ if (surfaceLine != null && soilProfile != null && !double.IsNaN(exitPointL))
+ {
+ return soilProfile.GetConsecutiveAquiferLayersBelowLevel(surfaceLine.GetZAtL(exitPointL)).ToArray();
+ }
+
+ return new PipingSoilLayer[0];
+ }
+
+ private PipingSoilLayer[] GetConsecutiveCoverageLayers()
+ {
+ RingtoetsPipingSurfaceLine surfaceLine = input.SurfaceLine;
+ PipingSoilProfile soilProfile = input.StochasticSoilProfile?.SoilProfile;
+ RoundedDouble exitPointL = input.ExitPointL;
+
+ if (surfaceLine != null && soilProfile != null && !double.IsNaN(exitPointL))
+ {
+ PipingSoilLayer[] consecutiveAquitardLayersBelowLevel = soilProfile
+ .GetConsecutiveCoverageLayersBelowLevel(surfaceLine.GetZAtL(exitPointL))
+ .ToArray();
+
+ return consecutiveAquitardLayersBelowLevel;
+ }
+ return new PipingSoilLayer[0];
+ }
+
+ private static double GetThicknessTopAquiferLayer(PipingSoilProfile soilProfile, RingtoetsPipingSurfaceLine surfaceLine, RoundedDouble exitPointL)
+ {
+ try
+ {
+ double zAtL = surfaceLine.GetZAtL(exitPointL);
+ return soilProfile.GetTopmostConsecutiveAquiferLayerThicknessBelowLevel(zAtL);
+ }
+ catch (Exception e)
+ {
+ if (e is RingtoetsPipingSurfaceLineException || e is InvalidOperationException || e is ArgumentException)
+ {
+ return double.NaN;
+ }
+ throw;
+ }
+ }
+
+ private static double GetThicknessCoverageLayers(PipingSoilProfile soilProfile, RingtoetsPipingSurfaceLine surfaceLine, RoundedDouble exitPointL)
+ {
+ try
+ {
+ double zAtL = surfaceLine.GetZAtL(exitPointL);
+ return soilProfile.GetConsecutiveCoverageLayerThicknessBelowLevel(zAtL);
+ }
+ catch (Exception e)
+ {
+ if (e is RingtoetsPipingSurfaceLineException || e is InvalidOperationException || e is ArgumentException)
+ {
+ return double.NaN;
+ }
+ throw;
+ }
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag fb3c8e242d17e52fadf6b84416e1819988cf2ce2 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/DerivedPipingInput.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsInput.cs
===================================================================
diff -u -r4c16454e3b11df918816195e24fa56dc4e352eee -rfb3c8e242d17e52fadf6b84416e1819988cf2ce2
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsInput.cs (.../MacroStabilityInwardsInput.cs) (revision 4c16454e3b11df918816195e24fa56dc4e352eee)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/MacroStabilityInwardsInput.cs (.../MacroStabilityInwardsInput.cs) (revision fb3c8e242d17e52fadf6b84416e1819988cf2ce2)
@@ -343,7 +343,7 @@
{
get
{
- return new DerivedPipingInput(this).PiezometricHeadExit;
+ return new DerivedMacroStabilityInwardsInput(this).PiezometricHeadExit;
}
}
@@ -507,7 +507,7 @@
{
get
{
- return new DerivedPipingInput(this).SeepageLength;
+ return new DerivedMacroStabilityInwardsInput(this).SeepageLength;
}
}
@@ -519,7 +519,7 @@
{
get
{
- return new DerivedPipingInput(this).DiameterD70;
+ return new DerivedMacroStabilityInwardsInput(this).DiameterD70;
}
}
@@ -531,7 +531,7 @@
{
get
{
- return new DerivedPipingInput(this).DarcyPermeability;
+ return new DerivedMacroStabilityInwardsInput(this).DarcyPermeability;
}
}
@@ -543,7 +543,7 @@
{
get
{
- return new DerivedPipingInput(this).ThicknessAquiferLayer;
+ return new DerivedMacroStabilityInwardsInput(this).ThicknessAquiferLayer;
}
}
@@ -555,7 +555,7 @@
{
get
{
- return new DerivedPipingInput(this).ThicknessCoverageLayer;
+ return new DerivedMacroStabilityInwardsInput(this).ThicknessCoverageLayer;
}
}
@@ -567,7 +567,7 @@
{
get
{
- return new DerivedPipingInput(this).EffectiveThicknessCoverageLayer;
+ return new DerivedMacroStabilityInwardsInput(this).EffectiveThicknessCoverageLayer;
}
}
@@ -594,7 +594,7 @@
{
get
{
- return new DerivedPipingInput(this).SaturatedVolumicWeightOfCoverageLayer;
+ return new DerivedMacroStabilityInwardsInput(this).SaturatedVolumicWeightOfCoverageLayer;
}
}
Index: Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj
===================================================================
diff -u -rdad59298494f764a2d01bb90dfed14f29a8c00ae -rfb3c8e242d17e52fadf6b84416e1819988cf2ce2
--- Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj (.../Ringtoets.MacroStabilityInwards.Data.csproj) (revision dad59298494f764a2d01bb90dfed14f29a8c00ae)
+++ Ringtoets/MacroStabilityInwards/src/Ringtoets.MacroStabilityInwards.Data/Ringtoets.MacroStabilityInwards.Data.csproj (.../Ringtoets.MacroStabilityInwards.Data.csproj) (revision fb3c8e242d17e52fadf6b84416e1819988cf2ce2)
@@ -45,7 +45,7 @@
Properties\GlobalAssembly.cs
-
+
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/DerivedMacroStabilityInwardsInputTest.cs
===================================================================
diff -u
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/DerivedMacroStabilityInwardsInputTest.cs (revision 0)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/DerivedMacroStabilityInwardsInputTest.cs (revision fb3c8e242d17e52fadf6b84416e1819988cf2ce2)
@@ -0,0 +1,1358 @@
+// Copyright (C) Stichting Deltares 2017. 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 Core.Common.Base.Data;
+using Core.Common.TestUtil;
+using NUnit.Framework;
+using Ringtoets.Common.Data.Probabilistics;
+using Ringtoets.Common.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.Data.TestUtil;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.SubCalculator;
+using Ringtoets.MacroStabilityInwards.KernelWrapper.TestUtil.SubCalculator;
+using Ringtoets.MacroStabilityInwards.Primitives;
+
+namespace Ringtoets.MacroStabilityInwards.Data.Test
+{
+ [TestFixture]
+ public class DerivedMacroStabilityInwardsInputTest
+ {
+ [Test]
+ public void Constructor_WithoutInput_ThrowsArgumentNullException()
+ {
+ // Call
+ TestDelegate call = () => new DerivedMacroStabilityInwardsInput(null);
+
+ // Assert
+ const string expectedMessage = "Cannot create DerivedMacroStabilityInwardsInput without MacroStabilityInwardsInput.";
+ TestHelper.AssertThrowsArgumentExceptionAndTestMessage(call, expectedMessage);
+ }
+
+ [Test]
+ public void Constructor_WithInput_DoesNotThrow()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer(1.0, 1.1);
+
+ // Call
+ TestDelegate call = () => new DerivedMacroStabilityInwardsInput(input);
+
+ // Assert
+ Assert.DoesNotThrow(call);
+ }
+
+ [Test]
+ public void PiezometricHeadExit_ValidInput_SetsParametersForCalculatorAndReturnsPiezometricHead()
+ {
+ // Setup
+ var input = new MacroStabilityInwardsInput(new GeneralMacroStabilityInwardsInput());
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ using (new PipingSubCalculatorFactoryConfig())
+ {
+ // Call
+ RoundedDouble piezometricHead = derivedInput.PiezometricHeadExit;
+
+ // Assert
+ Assert.AreEqual(2, piezometricHead.NumberOfDecimalPlaces);
+ Assert.IsFalse(double.IsNaN(piezometricHead));
+
+ var factory = (TestPipingSubCalculatorFactory) PipingSubCalculatorFactory.Instance;
+ PiezoHeadCalculatorStub piezometricHeadAtExitCalculator = factory.LastCreatedPiezometricHeadAtExitCalculator;
+
+ Assert.AreEqual(piezometricHeadAtExitCalculator.HRiver, input.AssessmentLevel, input.AssessmentLevel.GetAccuracy());
+ Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetPhreaticLevelExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.PhiPolder,
+ input.PhreaticLevelExit.GetAccuracy());
+ Assert.AreEqual(PipingSemiProbabilisticDesignValueFactory.GetDampingFactorExit(input).GetDesignValue(), piezometricHeadAtExitCalculator.RExit,
+ input.DampingFactorExit.GetAccuracy());
+ }
+ }
+
+ [Test]
+ public void PiezometricHeadExit_InputWithAssessmentLevelMissing_PiezometricHeadSetToNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer(1.0, 1.0);
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ RoundedDouble piezometricHead = derivedInput.PiezometricHeadExit;
+
+ // Assert
+ Assert.IsNaN(piezometricHead);
+ }
+
+ [Test]
+ public void EffectiveThicknessCoverageLayer_SoilProfileSingleAquiferAndCoverageUnderSurfaceLine_ReturnsThicknessCoverageLayer()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution effectiveThicknessCoverageLayer = derivedInput.EffectiveThicknessCoverageLayer;
+
+ // Assert
+ Assert.AreEqual(2.0, effectiveThicknessCoverageLayer.Mean.Value);
+ }
+
+ [Test]
+ public void EffectiveThicknessCoverageLayer_InputWithoutSurfaceLine_MeansSetToNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.SurfaceLine = null;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution effectiveThicknessCoverageLayer = null;
+ Action call = () => effectiveThicknessCoverageLayer = derivedInput.EffectiveThicknessCoverageLayer;
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ Assert.IsNaN(effectiveThicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ [TestCase(1e-6)]
+ [TestCase(1)]
+ public void EffectiveThicknessCoverageLayer_SoilProfileSingleAquiferAboveSurfaceLine_ThicknessCoverageLayerNaN(double deltaAboveSurfaceLine)
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithSingleAquiferLayerAboveSurfaceLine(deltaAboveSurfaceLine);
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution effectiveThicknessCoverageLayer = derivedInput.EffectiveThicknessCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(effectiveThicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void EffectiveThicknessCoverageLayer_MeanSetSoilProfileSetToNull_ThicknessCoverageLayerNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.ThicknessCoverageLayer.Mean = new RoundedDouble(2, new Random(21).NextDouble() + 1);
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ input.StochasticSoilProfile = null;
+
+ // Call
+ LogNormalDistribution effectiveThicknessCoverageLayer = null;
+ Action call = () => effectiveThicknessCoverageLayer = derivedInput.EffectiveThicknessCoverageLayer;
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ Assert.IsNaN(effectiveThicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void EffectiveThicknessCoverageLayer_ProfileWithoutAquiferLayer_ThicknessCoverageLayerNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile(string.Empty, 0, new[]
+ {
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ }
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ // Call
+ LogNormalDistribution effectiveThicknessCoverageLayer = derivedInput.EffectiveThicknessCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(effectiveThicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void EffectiveThicknessCoverageLayer_InputResultsInZeroCoverageThickness_ThicknessCoverageLayerNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile(string.Empty, 0, new[]
+ {
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ },
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ // Call
+ LogNormalDistribution effectiveThicknessCoverageLayer = derivedInput.EffectiveThicknessCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(effectiveThicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void EffectiveThicknessCoverageLayer_InputWithoutSoilProfile_MeansSetToNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.StochasticSoilProfile = null;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution effectiveThicknessCoverageLayer = derivedInput.EffectiveThicknessCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(effectiveThicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessCoverageLayer_SoilProfileSingleAquiferAndCoverageUnderSurfaceLine_ReturnsThicknessCoverageLayer()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer;
+
+ // Assert
+ Assert.AreEqual(2.0, thicknessCoverageLayer.Mean.Value);
+ }
+
+ [Test]
+ public void ThicknessCoverageLayer_InputWithoutSurfaceLine_MeansSetToNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.SurfaceLine = null;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessCoverageLayer = null;
+ Action call = () => thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer;
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ Assert.IsNaN(thicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ [TestCase(1e-6)]
+ [TestCase(1)]
+ public void ThicknessCoverageLayer_SoilProfileSingleAquiferAboveSurfaceLine_ThicknessCoverageLayerNaN(double deltaAboveSurfaceLine)
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithSingleAquiferLayerAboveSurfaceLine(deltaAboveSurfaceLine);
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessCoverageLayer_MeanSetSoilProfileSetToNull_ThicknessCoverageLayerNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.ThicknessCoverageLayer.Mean = new RoundedDouble(2, new Random(21).NextDouble() + 1);
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ input.StochasticSoilProfile = null;
+
+ // Call
+ LogNormalDistribution thicknessCoverageLayer = null;
+ Action call = () => thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer;
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ Assert.IsNaN(thicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessCoverageLayer_ProfileWithoutAquiferLayer_ThicknessCoverageLayerNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile(string.Empty, 0, new[]
+ {
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ }
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ // Call
+ LogNormalDistribution thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessCoverageLayer_InputResultsInZeroCoverageThickness_ThicknessCoverageLayerNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile(string.Empty, 0, new[]
+ {
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ },
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ // Call
+ LogNormalDistribution thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessCoverageLayer_InputWithoutSoilProfile_MeansSetToNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.StochasticSoilProfile = null;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessCoverageLayer = derivedInput.ThicknessCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessCoverageLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_SoilProfileSingleAquiferAndCoverageUnderSurfaceLine_ReturnsMeanExpectedThicknessAquiferLayer()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.AreEqual(1.0, thicknessAquiferLayer.Mean.Value);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_InputWithoutSoilProfile_ReturnMeanNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.StochasticSoilProfile = null;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_InputWithoutSurfaceLine_ReturnMeanNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.SurfaceLine = null;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = null;
+ Action call = () => thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ Assert.IsNaN(thicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ [TestCase(1e-6)]
+ [TestCase(1)]
+ public void ThicknessAquiferLayer_SoilProfileSingleAquiferAboveSurfaceLine_ReturnMeanNaN(double deltaAboveSurfaceLine)
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithSingleAquiferLayerAboveSurfaceLine(deltaAboveSurfaceLine);
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_SoilProfileMultipleAquiferUnderSurfaceLine_MeanSetToTopmostConsecutiveAquiferLayerThickness()
+ {
+ // Setup
+ double expectedThickness;
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithMultipleAquiferLayersUnderSurfaceLine(out expectedThickness);
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.AreEqual(expectedThickness, thicknessAquiferLayer.Mean, 1e-6);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_MeanSetExitPointSetToNaN_ReturnMeanNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.ExitPointL = RoundedDouble.NaN;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = null;
+ Action call = () => thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ TestHelper.AssertLogMessagesCount(call, 0);
+ Assert.IsNaN(thicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_ProfileWithoutAquiferLayer_ReturnMeanNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile(string.Empty, 0, new[]
+ {
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ }
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_SoilProfileSingleAquiferUnderSurfaceLine_ReturnMeanExpectedThicknessAquiferLayer()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquifer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.AreEqual(1.0, thicknessAquiferLayer.Mean.Value);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_MeanSetSoilProfileSetToNull_ReturnMeanNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ input.StochasticSoilProfile = null;
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_InputResultsInZeroAquiferThickness_ReturnMeanNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile(string.Empty, 0, new[]
+ {
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ },
+ new PipingSoilLayer(0.0)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.IsNaN(thicknessAquiferLayer.Mean);
+ }
+
+ [Test]
+ public void ThicknessAquiferLayer_SurfaceLineHalfWayProfileLayer_ConsecutiveThicknessSetToLayerHeightUnderSurfaceLine()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = new StochasticSoilProfile(0.0, SoilProfileType.SoilProfile1D, 0)
+ {
+ SoilProfile = new PipingSoilProfile(string.Empty, 0, new[]
+ {
+ new PipingSoilLayer(2.5)
+ {
+ IsAquifer = true
+ },
+ new PipingSoilLayer(1.5)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0)
+ };
+
+ // Call
+ LogNormalDistribution thicknessAquiferLayer = derivedInput.ThicknessAquiferLayer;
+
+ // Assert
+ Assert.AreEqual(2.0, thicknessAquiferLayer.Mean.Value, 1e-6);
+ }
+
+ [Test]
+ public void SeepageLength_ValidData_ReturnsSeepageLength()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ VariationCoefficientLogNormalDistribution seepageLength = derivedInput.SeepageLength;
+
+ // Assert
+ Assert.AreEqual(0.5, seepageLength.Mean.Value);
+ Assert.AreEqual(0.1, seepageLength.CoefficientOfVariation.Value);
+ }
+
+ [Test]
+ public void SeepageLength_EntryPointNaN_SeepageLengthNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.EntryPointL = RoundedDouble.NaN;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ VariationCoefficientLogNormalDistribution seepageLength = derivedInput.SeepageLength;
+
+ // Assert
+ Assert.IsNaN(seepageLength.Mean);
+ Assert.AreEqual(0.1, seepageLength.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void SeepageLength_ExitPointNaN_SeepageLengthNaN()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ input.ExitPointL = RoundedDouble.NaN;
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ // Call
+ VariationCoefficientLogNormalDistribution seepageLength = derivedInput.SeepageLength;
+
+ // Assert
+ Assert.IsNaN(seepageLength.Mean);
+ Assert.AreEqual(0.1, seepageLength.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_NoSoilProfile_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = null;
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_NoStochasticSoilProfile_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = null;
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_NoSurfaceLine_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.SurfaceLine = null;
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_NoExitPointL_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.ExitPointL = RoundedDouble.NaN;
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_NoAquitardLayers_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_NoAquiferLayers_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = false
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_NoCoverageLayersAboveTopAquiferLayer_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(2.0)
+ {
+ IsAquifer = false
+ },
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_SingleLayer_ReturnsWithParametersFromLayer()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ var random = new Random(21);
+ double belowPhreaticLevelMean = 0.1 + 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
+ },
+ new PipingSoilLayer(0.5)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution 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_MultipleLayersEqualStandardDeviationAndShift_ReturnsWithWeightedMean()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ var random = new Random(21);
+ double belowPhreaticLevelMeanA = 0.1 + random.NextDouble();
+ double belowPhreaticLevelMeanB = 0.1 + 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
+ },
+ new PipingSoilLayer(-1.5)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.AreEqual((belowPhreaticLevelMeanA * 2.5 + belowPhreaticLevelMeanB * 1.0) / 3.5, result.Mean, result.Mean.GetAccuracy());
+ Assert.AreEqual(shift, result.Shift, result.Shift.GetAccuracy());
+ Assert.AreEqual(deviation, result.StandardDeviation, result.StandardDeviation.GetAccuracy());
+ }
+
+ [Test]
+ [TestCase(0.01, 0)]
+ [TestCase(0, 0.01)]
+ [TestCase(2, 1)]
+ [TestCase(3, -1)]
+ [TestCase(-0.01, 0)]
+ [TestCase(0, -0.01)]
+ [TestCase(-2, 1)]
+ [TestCase(-3, -1)]
+ public void SaturatedVolumicWeightOfCoverageLayer_MultipleLayersInequalStandardDeviationOrShift_ReturnsNaNValues(double deviationDelta, double shiftDelta)
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ var random = new Random(21);
+ double belowPhreaticLevelMeanA = 0.1 + random.NextDouble();
+ double belowPhreaticLevelMeanB = 0.1 + 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 + deviationDelta,
+ BelowPhreaticLevelShift = shift + shiftDelta,
+ BelowPhreaticLevelMean = belowPhreaticLevelMeanB
+ },
+ new PipingSoilLayer(-1.5)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_MultipleLayersInequalStandardDeviationOrShiftButEqualWhenRounded_ReturnsWithWeightedMean()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ const double belowPhreaticLevelMeanA = 2.5;
+ const double belowPhreaticLevelMeanB = 3.4;
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(2.5)
+ {
+ BelowPhreaticLevelDeviation = 1.014,
+ BelowPhreaticLevelShift = 1.014,
+ BelowPhreaticLevelMean = belowPhreaticLevelMeanA
+ },
+ new PipingSoilLayer(-0.5)
+ {
+ BelowPhreaticLevelDeviation = 1.006,
+ BelowPhreaticLevelShift = 1.006,
+ BelowPhreaticLevelMean = belowPhreaticLevelMeanB
+ },
+ new PipingSoilLayer(-1.5)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.AreEqual((belowPhreaticLevelMeanA * 2.5 + belowPhreaticLevelMeanB * 1.0) / 3.5, result.Mean, result.Mean.GetAccuracy());
+ Assert.AreEqual((RoundedDouble) 1.01, result.Shift);
+ Assert.AreEqual((RoundedDouble) 1.01, result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_OneLayerWithIncorrectShiftMeanCombination_ReturnsNaNValues()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(2.5)
+ {
+ BelowPhreaticLevelDeviation = 2.5,
+ BelowPhreaticLevelShift = 1.01,
+ BelowPhreaticLevelMean = 1.00
+ },
+ new PipingSoilLayer(-1.5)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void SaturatedVolumicWeightOfCoverageLayer_MultipleLayersOneLayerWithIncorrectShiftMeanCombination_ReturnsNaNValues()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(2.5)
+ {
+ BelowPhreaticLevelDeviation = 3.5,
+ BelowPhreaticLevelShift = 0.5,
+ BelowPhreaticLevelMean = 1.00
+ },
+ new PipingSoilLayer(-0.5)
+ {
+ BelowPhreaticLevelDeviation = 2.5,
+ BelowPhreaticLevelShift = 1.01,
+ BelowPhreaticLevelMean = 1.00
+ },
+ new PipingSoilLayer(-1.5)
+ {
+ IsAquifer = true
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ LogNormalDistribution result = derivedInput.SaturatedVolumicWeightOfCoverageLayer;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.Shift);
+ Assert.IsNaN(result.StandardDeviation);
+ }
+
+ [Test]
+ public void DarcyPermeability_NoSoilProfile_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = null;
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DarcyPermeability_NoStochasticSoilProfile_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = null;
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DarcyPermeability_NoSurfaceLine_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.SurfaceLine = null;
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DarcyPermeability_NoExitPointL_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.ExitPointL = RoundedDouble.NaN;
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DarcyPermeability_NoAquiferLayers_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DarcyPermeability_SingleLayerWithIncorrectMean_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", 0.0, new[]
+ {
+ new PipingSoilLayer(0.5)
+ {
+ IsAquifer = true,
+ PermeabilityCoefficientOfVariation = 0.3,
+ PermeabilityMean = 0
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DarcyPermeability_MultiplelayersWithOneIncorrectLayerMean_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", 0.0, new[]
+ {
+ new PipingSoilLayer(0.5)
+ {
+ IsAquifer = true,
+ PermeabilityCoefficientOfVariation = 0.3,
+ PermeabilityMean = 0
+ },
+ new PipingSoilLayer(1.5)
+ {
+ IsAquifer = true,
+ PermeabilityCoefficientOfVariation = 0.3,
+ PermeabilityMean = 2.4
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DarcyPermeability_MultipleAquiferLayersWithSameVariation_ReturnsWithWeightedMean()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+
+ var random = new Random(21);
+ double mean = 0.1 + random.NextDouble();
+ double mean2 = 0.1 + random.NextDouble();
+ const double coefficientOfVariation = 0.5;
+
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", 0.0, new[]
+ {
+ new PipingSoilLayer(0.5)
+ {
+ IsAquifer = true,
+ PermeabilityCoefficientOfVariation = coefficientOfVariation,
+ PermeabilityMean = mean
+ },
+ new PipingSoilLayer(1.5)
+ {
+ IsAquifer = true,
+ PermeabilityCoefficientOfVariation = coefficientOfVariation,
+ PermeabilityMean = mean2
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ double weightedMean = (mean * 0.5 + mean2) / 1.5;
+ Assert.AreEqual(weightedMean, result.Mean, result.Mean.GetAccuracy());
+ Assert.AreEqual(coefficientOfVariation, result.CoefficientOfVariation, result.CoefficientOfVariation.GetAccuracy());
+ }
+
+ [Test]
+ public void DarcyPermeability_SingleAquiferLayerWithRandomMeanAndDeviation_ReturnsWithWeightedMean()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ var random = new Random(21);
+ double permeabilityMean = 0.1 + random.NextDouble();
+ double permeabilityCoefficientOfVariation = random.NextDouble();
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true,
+ PermeabilityMean = permeabilityMean,
+ PermeabilityCoefficientOfVariation = permeabilityCoefficientOfVariation
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ var expectedMean = new RoundedDouble(6, permeabilityMean);
+ var expectedCoefficientOfVariation = new RoundedDouble(6, permeabilityCoefficientOfVariation);
+ Assert.AreEqual(expectedMean, result.Mean);
+ Assert.AreEqual(expectedCoefficientOfVariation, result.CoefficientOfVariation, result.CoefficientOfVariation.GetAccuracy());
+ }
+
+ [Test]
+ public void DarcyPermeability_MultipleAquiferLayersWithDifferentMeanAndDeviation_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true,
+ PermeabilityMean = 0.5,
+ PermeabilityCoefficientOfVariation = 0.2
+ },
+ new PipingSoilLayer(0.0)
+ {
+ IsAquifer = true,
+ PermeabilityMean = 12.5,
+ PermeabilityCoefficientOfVariation = 2.3
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DarcyPermeability;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DiameterD70_NoSoilProfile_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = null;
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DiameterD70;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DiameterD70_NoStochasticSoilProfile_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile = null;
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DiameterD70;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DiameterD70_NoSurfaceLine_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.SurfaceLine = null;
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DiameterD70;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DiameterD70_NoExitPointL_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.ExitPointL = RoundedDouble.NaN;
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DiameterD70;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DiameterD70_NoAquiferLayers_ReturnsNaNForParameters()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DiameterD70;
+
+ // Assert
+ Assert.IsNaN(result.Mean);
+ Assert.IsNaN(result.CoefficientOfVariation);
+ }
+
+ [Test]
+ public void DiameterD70_SingleAquiferLayers_ReturnsWithParametersFromLayer()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ var random = new Random(21);
+ double diameterD70Mean = 0.1 + random.NextDouble();
+ double diameterD70CoefficientOfVariation = random.NextDouble();
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true,
+ DiameterD70Mean = diameterD70Mean,
+ DiameterD70CoefficientOfVariation = diameterD70CoefficientOfVariation
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DiameterD70;
+
+ // Assert
+ Assert.AreEqual(diameterD70Mean, result.Mean, result.GetAccuracy());
+ Assert.AreEqual(diameterD70CoefficientOfVariation, result.CoefficientOfVariation, result.GetAccuracy());
+ }
+
+ [Test]
+ public void DiameterD70_MultipleAquiferLayers_ReturnsWithParametersFromTopmostLayer()
+ {
+ // Setup
+ MacroStabilityInwardsInput input = PipingInputFactory.CreateInputWithAquiferAndCoverageLayer();
+ var derivedInput = new DerivedMacroStabilityInwardsInput(input);
+ const double diameterD70Mean = 0.5;
+ const double diameterD70CoefficientOfVariation = 0.2;
+ input.StochasticSoilProfile.SoilProfile = new PipingSoilProfile("", -2.0, new[]
+ {
+ new PipingSoilLayer(1.0)
+ {
+ IsAquifer = true,
+ DiameterD70Mean = diameterD70Mean,
+ DiameterD70CoefficientOfVariation = diameterD70CoefficientOfVariation
+ },
+ new PipingSoilLayer(0.0)
+ {
+ IsAquifer = true,
+ DiameterD70Mean = 12.5,
+ DiameterD70CoefficientOfVariation = 2.3
+ }
+ }, SoilProfileType.SoilProfile1D, 0);
+
+ // Call
+ VariationCoefficientLogNormalDistribution result = derivedInput.DiameterD70;
+
+ // Assert
+ Assert.AreEqual(diameterD70Mean, result.Mean, result.GetAccuracy());
+ Assert.AreEqual(diameterD70CoefficientOfVariation, result.CoefficientOfVariation, result.GetAccuracy());
+ }
+ }
+}
\ No newline at end of file
Fisheye: Tag fb3c8e242d17e52fadf6b84416e1819988cf2ce2 refers to a dead (removed) revision in file `Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/DerivedPipingInputTest.cs'.
Fisheye: No comparison available. Pass `N' to diff?
Index: Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj
===================================================================
diff -u -rdad59298494f764a2d01bb90dfed14f29a8c00ae -rfb3c8e242d17e52fadf6b84416e1819988cf2ce2
--- Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision dad59298494f764a2d01bb90dfed14f29a8c00ae)
+++ Ringtoets/MacroStabilityInwards/test/Ringtoets.MacroStabilityInwards.Data.Test/Ringtoets.MacroStabilityInwards.Data.Test.csproj (.../Ringtoets.MacroStabilityInwards.Data.Test.csproj) (revision fb3c8e242d17e52fadf6b84416e1819988cf2ce2)
@@ -57,7 +57,7 @@
Properties\GlobalAssembly.cs
-
+