//-----------------------------------------------------------------------
//
// Copyright (c) 2009 Deltares. All rights reserved.
//
// B.S.T.I.M. The
// tom.the@deltares.nl
// 10-07-2009
// Contains tests for class Deltares.Dam.Data.UpliftLocationDeterminator
//-----------------------------------------------------------------------
using Deltares.Dam.TestHelper;
using Deltares.Geotechnics;
using Deltares.Geotechnics.Soils;
using Deltares.Geotechnics.SurfaceLines;
using Deltares.Geotechnics.TestUtils;
namespace Deltares.Dam.Tests
{
using NUnit.Framework;
using Deltares.Dam.Data;
[TestFixture]
public class UpliftLocationDeterminatorTest
{
private static PLLines CreatePLLines(SurfaceLine2 surfaceLine, SoilProfile1D soilProfile, double riverLevel, bool isUseOvenDryUnitWeight)
{
PLLinesCreator plLineCreator = new PLLinesCreator();
plLineCreator.IsUseOvenDryUnitWeight = isUseOvenDryUnitWeight;
plLineCreator.SoilProfile = soilProfile;
plLineCreator.SurfaceLine = surfaceLine;
plLineCreator.WaterLevelRiverHigh = riverLevel;
plLineCreator.WaterLevelPolder = -0.5;
plLineCreator.ModelParametersForPLLines.DampingFactorPL3 = 0.3;
plLineCreator.ModelParametersForPLLines.DampingFactorPL4 = 0.4;
plLineCreator.ModelParametersForPLLines.PenetrationLength = 1.5;
plLineCreator.IsAdjustPL3AndPL4SoNoUpliftWillOccurEnabled = false; // for piping this must be set to false
using (var location = new Location { DamType = DamType.Regional })
{
return plLineCreator.CreateAllPLLines(location);
}
}
[TestFixtureSetUp]
public void FixtureSetup()
{
}
[TestFixtureTearDown]
public void FixtureTearDown()
{
}
[Test]
[ExpectedException(typeof(UpliftLocationDeterminatorException))]
public void ThrowsExceptionIfSoilProfileNotAssignedInUpliftLocationDeterminator()
{
using (var surfaceLineTutorial1 = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
{
var upliftLocationDeterminator = new UpliftLocationDeterminator();
upliftLocationDeterminator.SurfaceLine = surfaceLineTutorial1;
upliftLocationDeterminator.PLLines = PLLinesFactoryForTests.CreatePLLinesForUpliftLocationDeterminatorTests();
UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(1.0);
}
}
[Test]
[ExpectedException(typeof(UpliftLocationDeterminatorException))]
public void ThrowsExceptionIfPLLinesNotAssignedInUpliftLocationDeterminator()
{
using (var surfaceLineTutorial1 = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
{
var upliftLocationDeterminator = new UpliftLocationDeterminator();
upliftLocationDeterminator.SurfaceLine = surfaceLineTutorial1;
upliftLocationDeterminator.SoilProfile = FactoryForSoilProfileTests.CreateClaySandClaySandProfile();
UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(1.0);
}
}
[Test]
[ExpectedException(typeof(UpliftLocationDeterminatorException))]
public void ThrowsExceptionIfSurfaceLineNotAssignedInUpliftLocationDeterminator()
{
var upliftLocationDeterminator = new UpliftLocationDeterminator();
upliftLocationDeterminator.SoilProfile = FactoryForSoilProfileTests.CreateClaySandClaySandProfile();
upliftLocationDeterminator.PLLines = PLLinesFactoryForTests.CreatePLLinesForUpliftLocationDeterminatorTests();
UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(1.0);
}
[Test]
public void CheckIfUpliftIsDetectedForBothSandlayers()
{
using (var surfaceLineForPipingBligh = FactoryForSurfaceLineTests.CreateSurfaceLineForPipingBligh())
{
var upliftLocationDeterminator = new UpliftLocationDeterminator();
upliftLocationDeterminator.SoilProfile = FactoryForSoilProfileTests.CreateClaySandClaySandProfileForPipingBligh();
upliftLocationDeterminator.PLLines = PLLinesFactoryForTests.CreatePLLinesForUpliftLocationDeterminatorTests();
upliftLocationDeterminator.SurfaceLine = surfaceLineForPipingBligh;
UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAndResult(1.0);
Assert.IsTrue(upliftLocationAndResult.LocationEquals(upliftLocationDeterminator.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder)));
}
}
[Test]
public void GetLowestUpliftFactorCoordinateFromSimpleSurfaceLineAndOneSandLayerProfile()
{
const double cTolerance = 0.000001;
const double cExpectedXCoordinate = 59.5;
const double cExpectedZCoordinate = -2.0;
const double cExpectedUpliftFactor = 0.675781015; // Value taken from calculation itself
// Set required upliftcalculator variables
const double cRiverlevel = 4;
using (SurfaceLine2 surfaceLine = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
{
SoilProfile1D soilProfile = FactoryForSoilProfileTests.CreateClaySandProfile();
PLLines plLines = CreatePLLines(surfaceLine, soilProfile, cRiverlevel, false);
UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator()
{
SurfaceLine = surfaceLine,
SoilProfile = soilProfile,
PLLines = plLines
};
UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationAtWithLowestUpliftFactor();
Assert.AreEqual(cExpectedXCoordinate, upliftLocationAndResult.X, cTolerance);
Assert.AreEqual(cExpectedZCoordinate, upliftLocationAndResult.Z, cTolerance);
Assert.AreEqual(cExpectedUpliftFactor, upliftLocationAndResult.UpliftFactor.Value, cTolerance);
}
}
[Test]
public void GetLocationInPolderNearestDikeWithUpliftFactorLowerThanOneFromSimpleSurfaceLineAndOneSandLayerProfile()
{
const double cTolerance = 0.000001;
const double cExpectedUpliftFactor = 0.0666253589441213; // this value is copied from the debugger
// Set required upliftcalculator variables
const double cRiverlevel = 4;
using (SurfaceLine2 surfaceLine = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
{
SoilProfile1D soilProfile = FactoryForSoilProfileTests.CreateClaySandProfileForPipingBligh();
PLLines plLines = CreatePLLines(surfaceLine, soilProfile, cRiverlevel, false);
UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator()
{
SurfaceLine = surfaceLine,
SoilProfile = soilProfile,
PLLines = plLines
};
UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationInPolderNearestDikeWithUpliftFactorLowerThanRequired(1.0);
Assert.IsTrue(upliftLocationAndResult.LocationEquals(upliftLocationDeterminator.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder)));
Assert.AreEqual(cExpectedUpliftFactor, upliftLocationAndResult.UpliftFactor.Value, cTolerance);
}
}
///
/// Same as above test, but now the oven dry unit weight has to be used
///
[Test]
public void GetLocationInPolderNearestDikeWithUpliftFactorLowerThanOneFromSimpleSurfaceLineAndOneSandLayerProfileAndDryOption()
{
const double cTolerance = 0.000001;
const double cExpectedUpliftFactor = 0.0666253589441213; // this value is copied from the debugger
// Set required upliftcalculator variables
const double cRiverlevel = 4;
using (SurfaceLine2 surfaceLine = FactoryForSurfaceLineTests.CreateSurfaceLineTutorial1())
{
SoilProfile1D soilProfile = FactoryForSoilProfileTests.CreateClaySandProfileForPipingBligh();
foreach (SoilLayer1D layer in soilProfile.Layers)
{
layer.Soil.DryUnitWeight = layer.Soil.AbovePhreaticLevel;
layer.Soil.AbovePhreaticLevel = layer.Soil.AbovePhreaticLevel + 1.0;
}
PLLines plLines = CreatePLLines(surfaceLine, soilProfile, cRiverlevel, false);
UpliftLocationDeterminator upliftLocationDeterminator = new UpliftLocationDeterminator()
{
SurfaceLine = surfaceLine,
SoilProfile = soilProfile,
PLLines = plLines,
IsUseOvenDryUnitWeight = true
};
UpliftLocationAndResult upliftLocationAndResult = upliftLocationDeterminator.GetLocationInPolderNearestDikeWithUpliftFactorLowerThanRequired(1.0);
Assert.IsTrue(upliftLocationAndResult.LocationEquals(upliftLocationDeterminator.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeToeAtPolder)));
Assert.AreEqual(cExpectedUpliftFactor, upliftLocationAndResult.UpliftFactor.Value, cTolerance);
}
}
}
}