//-----------------------------------------------------------------------
//
// Copyright (c) 2009 Deltares. All rights reserved.
//
// B. Faassen
// barry.faassen@deltares.nl
// 18-06-2009
// n.a.
//-----------------------------------------------------------------------
using Deltares.Geotechnics;
using Deltares.Geotechnics.GeotechnicalGeometry;
using Deltares.Dam.Data;
using Deltares.Geotechnics.SurfaceLines;
using Deltares.Geotechnics.TestUtils;
using NUnit.Framework;
namespace Deltares.Dam.Tests
{
[TestFixture]
public class PipingCalculatorBlighTest
{
[Test]
[ExpectedException(typeof(ParameterMissingException))]
public void ThrowsExceptionWhenSurfaceLineParameterIsMissing()
{
var soilProfile = FactoryForSoilProfileTests.CreateClaySandClaySandProfile();
var calculator = new PipingCalculatorBligh(new ModelParametersForPLLines(), 0, null, null, 1.0);
using (var location = new Location())
{
calculator.CalculatePipingFactor(location, null, soilProfile, 0.0);
}
}
[Test]
[ExpectedException(typeof(DamFailureMechanismeCalculatorException))]
public void ThrowsExceptionWhenSoilProfileParameterIsMissing()
{
var calculator = new PipingCalculatorBligh(new ModelParametersForPLLines(), 0, null, null, 1.0);
using(var surfaceLine = new SurfaceLine2
{
Geometry = new LocalizedGeometryPointString(),
CharacteristicPoints = { GeometryMustContainPoint = true }
})
using (var location = new Location())
{
calculator.CalculatePipingFactor(location, surfaceLine, null, 0.0);
}
}
[Test]
[ExpectedException(typeof(ParameterMissingException))]
public void ThrowsExceptionWhenCharacteristicPointDikeToeAtRiverDoesNotExist()
{
using (var surfaceLine = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
{
int index = -1;
for (int i = 0; i < surfaceLine.CharacteristicPoints.Count; i++)
{
if (surfaceLine.CharacteristicPoints[i].CharacteristicPointType == CharacteristicPointType.DikeToeAtRiver)
{
index = i;
break;
}
}
surfaceLine.CharacteristicPoints.Annotate(index, CharacteristicPointType.None);
Assert.IsNull(surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtRiver),
"Test prerequisite failed.");
using (var dike = new Dike())
{
var soilProfile = FactoryForSoilProfileTests.CreateClaySandClaySandProfile();
var calculator = new PipingCalculatorBligh(new ModelParametersForPLLines(),
1.0, dike.GaugePLLines, dike.Gauges, 1.0);
using (var location = new Location())
{
calculator.CalculatePipingFactor(location, surfaceLine, soilProfile, 0.0);
}
}
}
}
[Test]
public void CanCalculateThePipingFactorUsingBlighNoUplift()
{
using (var surfaceLine = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
using (var dike = new Dike())
{
var soilProfile = FactoryForSoilProfileTests.CreateClaySandClaySandProfile();
var calculator = new PipingCalculatorBligh(new ModelParametersForPLLines(),
1.0, dike.GaugePLLines, dike.Gauges, 1.0);
using (var location = new Location())
{
var actual = calculator.CalculatePipingFactor(location, surfaceLine, soilProfile, 0.0);
// Phreatic level in profile
// Mass of soil volume above
// dry 6 m x 12 kN/m3 = 72
// wet 9 m x 16 kN/m3 = 144
// Total: 72 + 144 = 216
// Phreatic pressure
// 20 m x 10 kN/m3 = 200
// UpliftFactor = 216/200 = 1.08
// UpliftFactor > 1.0, so no piping, so returns cDefaultMaxReturnValue
var expected = PipingCalculatorBligh.cDefaultMaxReturnValue;
Assert.AreEqual(expected, actual);
}
}
}
[Test]
public void CanCalculateThePipingFactorUsingBligh()
{
using (var surfaceLine = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
using (var dike = new Dike())
{
var soilProfile = FactoryForSoilProfileTests.CreateClaySandProfileForPipingBligh();
var modelParametersForPLLines = new ModelParametersForPLLines();
modelParametersForPLLines.DampingFactorPL4 = 0.0;
var calculator = new PipingCalculatorBligh(modelParametersForPLLines,
1.0, dike.GaugePLLines, dike.Gauges, 1.0);
using (var location = new Location())
{
var actual = calculator.CalculatePipingFactor(location, surfaceLine, soilProfile, 2.0);
// Phreatic level in profile
// Mass of soil volume above
// material above bottom sandlayer: 0 to -5 m
// dry/wet 5 m x 1 kN/m3 = 5
// Phreatic pressure (Head PLLine 4 is ca. 1.0
// 6.0 m x 10 kN/m3 = 60,0
// UpliftFactor = 5/60.0 = 0.0833
// UpliftFactor < 1.0, so piping will occur in toe of dike
//
// L = ToeOfDike.x - entrypoint.x = 50.5 - 10.0 = 40.5
// d = height coverlayer = 5.0
// Fluidisationgradient = 0.3
// Hc = L / 18 = 40.5 / 18 = 2.25
// Ha = 2.0 - 0.0 - (Fluidisationgradient * d) = 2.0 - 0.3 * 5.0 = 0.5
// Piping factor = Hc / Ha = 2.25 / 0.5
const double expected = 4.5;
Assert.AreEqual(expected, actual);
}
}
}
[Test]
public void CanCalculateHCritical()
{
const double cTolerance = 0.00001;
double hCritical = PipingCalculatorBligh.CalculateHCritical(15.0, 180.0);
Assert.AreEqual(0.833333, hCritical, cTolerance);
hCritical = PipingCalculatorBligh.CalculateHCritical(15.0, 260.0);
Assert.AreEqual(1.000000, hCritical, cTolerance);
hCritical = PipingCalculatorBligh.CalculateHCritical(20.0, 180.0);
Assert.AreEqual(1.111111111, hCritical, cTolerance);
hCritical = PipingCalculatorBligh.CalculateHCritical(20.0, 260.0);
Assert.AreEqual(1.333333333, hCritical, cTolerance);
hCritical = PipingCalculatorBligh.CalculateHCritical(60.0, 180.0);
Assert.AreEqual(3.333333333, hCritical, cTolerance);
}
}
}