//-----------------------------------------------------------------------
//
// Copyright (c) 2009 Deltares. All rights reserved.
//
// B.S.T.I.M. The
// tom.the@deltares.nl
// 16-06-2009
// Contains class to test calculation of SoilVolumeMass
//-----------------------------------------------------------------------
using Deltares.Geotechnics.TestUtils;
using NUnit.Framework;
namespace Deltares.Uplift.Tests
{
[TestFixture]
public class SoilVolumeMassCalculatorTest
{
[Test]
public void CalculateForComplexProfileWithPhreaticLineInProfile1()
{
const double cTolerance = 0.001;
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateComplexProfile();
calculator.SurfaceLevel = 0.21;
calculator.PhreaticLevel = -0.98;
calculator.TopOfLayerToBeEvaluated = -5.0;
// See spreadsheet "DAM Volumic weight test"
Assert.AreEqual(76.358, calculator.CalculateTotalMass(), cTolerance);
}
[Test]
public void CalculateForComplexProfileWithPhreaticLineInProfile2()
{
const double cTolerance = 0.001;
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateComplexProfile();
calculator.SurfaceLevel = 10.0;
calculator.PhreaticLevel = -1.8;
calculator.TopOfLayerToBeEvaluated = -5.0;
// See spreadsheet "DAM Volumic weight test"
Assert.AreEqual(230.22, calculator.CalculateTotalMass(), cTolerance);
}
[Test]
public void CalculateForSimpleProfileWithPhreaticLineAboveProfile()
{
const double cTolerance = 0.0001;
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile();
calculator.SurfaceLevel = 5.0;
calculator.PhreaticLevel = 10.0;
calculator.TopOfLayerToBeEvaluated = -10;
calculator.VolumicWeightOfWater = 10.0;
// All wet soil
// wet 15 m x 16 kN/m3 = 240
// water above surface 5 m x 10.0 kN/m3 = 50
// Total: 240 + 50 = 290
Assert.AreEqual(290.0, calculator.CalculateTotalMass(), cTolerance);
}
[Test]
public void CalculateForSimpleProfileWithPhreaticLineBelowProfile()
{
const double cTolerance = 0.0001;
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile();
calculator.SurfaceLevel = 5.0;
calculator.PhreaticLevel = -20.0;
calculator.TopOfLayerToBeEvaluated = -10;
// All dry soil
// dry 15 m x 12 kN/m3 = 180
Assert.AreEqual(180.0, calculator.CalculateTotalMass(), cTolerance);
}
[Test]
public void CalculateForSimpleProfileWithPhreaticLineInProfile()
{
const double cTolerance = 0.0001;
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile();
calculator.SurfaceLevel = 5.0;
calculator.PhreaticLevel = -1.0;
calculator.TopOfLayerToBeEvaluated = -10;
// Phreatic level in profile
// dry 6 m x 12 kN/m3 = 72
// wet 9 m x 16 kN/m3 = 144
// Total: 72 + 144 = 216
Assert.AreEqual(216.0, calculator.CalculateTotalMass(), cTolerance);
}
///
/// Same as above test, but now the oven dry unit weight has to be used
///
[Test]
public void CalculateForSimpleProfileWithPhreaticLineInProfileAndDryOption()
{
const double cTolerance = 0.0001;
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile();
foreach (var layer in calculator.SoilProfile.Layers)
{
layer.Soil.DryUnitWeight = layer.Soil.AbovePhreaticLevel;
layer.Soil.AbovePhreaticLevel = layer.Soil.AbovePhreaticLevel + 1.0;
}
calculator.SurfaceLevel = 5.0;
calculator.PhreaticLevel = -1.0;
calculator.TopOfLayerToBeEvaluated = -10;
calculator.IsUseOvenDryUnitWeight = true;
// Phreatic level in profile
// dry 6 m x 12 kN/m3 = 72
// wet 9 m x 16 kN/m3 = 144
// Total: 72 + 144 = 216
Assert.AreEqual(216.0, calculator.CalculateTotalMass(), cTolerance);
}
[Test]
public void CalculateForTwoLayerProfileWithPhreaticLineOnBoundary()
{
const double cTolerance = 0.0001;
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateTwoLayerProfile();
calculator.SurfaceLevel = 10.0;
calculator.PhreaticLevel = 2.0;
calculator.TopOfLayerToBeEvaluated = -10;
calculator.VolumicWeightOfWater = 10.0;
// All wet soil
// dry 8 m x 10 kN/m3 = 80
// wet 12 m x 22 kN/m3 = 264
// Total: 80 + 264 = 344
Assert.AreEqual(344.0, calculator.CalculateTotalMass(), cTolerance);
}
[Test]
[ExpectedException(typeof(SoilVolumicMassCalculatorException))]
public void ThrowsExceptionWhenSoilProfileParameterIsMissing()
{
var calculator = new SoilVolumicMassCalculator();
calculator.CalculateTotalMass();
}
[Test]
[ExpectedException(typeof(SoilVolumicMassCalculatorException))]
public void ThrowsExceptionWhenSurfaceLevelIsAboveProfile()
{
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile();
calculator.SurfaceLevel = 15.0;
calculator.CalculateTotalMass();
}
[Test]
[ExpectedException(typeof(SoilVolumicMassCalculatorException))]
public void ThrowsExceptionWhenSurfaceLevelIsBelowProfile()
{
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile();
calculator.SurfaceLevel = -100.0;
calculator.CalculateTotalMass();
}
[Test]
[ExpectedException(typeof(SoilVolumicMassCalculatorException))]
public void ThrowsExceptionWhenTopLevelToBeValuatedIsBelowProfile()
{
var calculator = new SoilVolumicMassCalculator();
calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile();
calculator.TopOfLayerToBeEvaluated = -100.0;
calculator.CalculateTotalMass();
}
}
}