Index: dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/SoilVolumeMassCalculatorEffectiveStressTest.cs =================================================================== diff -u -r332 -r359 --- dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/SoilVolumeMassCalculatorEffectiveStressTest.cs (.../SoilVolumeMassCalculatorEffectiveStressTest.cs) (revision 332) +++ dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/SoilVolumeMassCalculatorEffectiveStressTest.cs (.../SoilVolumeMassCalculatorEffectiveStressTest.cs) (revision 359) @@ -8,7 +8,7 @@ internal class SoilVolumeMassCalculatorEffectiveStressTest { [Test] - public void CalculateWithExceedingMinimumThicknessCoverLayerAndLowSurfaceLevelFullySubmerged() + public void TestCalculateWithExceedingMinimumThicknessCoverLayerAndLowSurfaceLevelFullySubmerged() { const double expectedResult = 109.000; var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); @@ -23,7 +23,7 @@ } [Test] - public void CalculateWithExceedingMinimumThicknessCoverLayerAndLowSurfaceLevelPartlySubmerged() + public void TestCalculateWithExceedingMinimumThicknessCoverLayerAndLowSurfaceLevelPartlySubmerged() { const double expectedResult = 121.000; var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); @@ -38,7 +38,7 @@ } [Test] - public void CalculateWithExceedingMinimumThicknessCoverLayerFullySubmerged() + public void TestCalculateWithExceedingMinimumThicknessCoverLayerFullySubmerged() { const double expectedResult = 134.000; var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); @@ -53,7 +53,7 @@ } [Test] - public void CalculateWithExceedingMinimumThicknessCoverLayerPartlySubmerged() + public void TestCalculateWithExceedingMinimumThicknessCoverLayerPartlySubmerged() { const double expectedResult = 166.000; var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); @@ -68,7 +68,7 @@ } [Test] - public void CalculateWithoutExceedingMinimumThicknessCoverLayerAndLowSurfaceLevelFullySubmerged() + public void TestCalculateWithoutExceedingMinimumThicknessCoverLayerAndLowSurfaceLevelFullySubmerged() { const double expectedResult = 99.000; var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); @@ -83,7 +83,7 @@ } [Test] - public void CalculateWithoutExceedingMinimumThicknessCoverLayerAndLowSurfaceLevelPartlySubmerged() + public void TestCalculateWithoutExceedingMinimumThicknessCoverLayerAndLowSurfaceLevelPartlySubmerged() { const double expectedResult = 103.000; var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); @@ -98,7 +98,7 @@ } [Test] - public void CalculateWithoutExceedingMinimumThicknessCoverLayerFullySubmerged() + public void TestCalculateWithoutExceedingMinimumThicknessCoverLayerFullySubmerged() { const double expectedResult = 114.000; var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); @@ -112,7 +112,7 @@ } [Test] - public void CalculateWithoutExceedingMinimumThicknessCoverLayerPartlySubmerged() + public void TestCalculateWithoutExceedingMinimumThicknessCoverLayerPartlySubmerged() { const double expectedResult = 130.000; var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); @@ -128,7 +128,7 @@ [Test] [ExpectedException(typeof(SoilVolumicMassCalculatorException))] - public void ThrowsExceptionIfSoilProfileHasNoLayers() + public void TestThrowsExceptionIfSoilProfileHasNoLayers() { var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); soilVolumeMassCalculator.MinimumThicknessCoverLayer = 10; @@ -140,7 +140,7 @@ [Test] [ExpectedException(typeof(SoilVolumicMassCalculatorException))] - public void ThrowsExceptionIfSoilProfileNotAssignedInSoilVolumeMassCalculator() + public void TestThrowsExceptionIfSoilProfileNotAssignedInSoilVolumeMassCalculator() { var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); soilVolumeMassCalculator.MinimumThicknessCoverLayer = 10; @@ -151,7 +151,7 @@ [Test] [ExpectedException(typeof(SoilVolumicMassCalculatorException))] - public void ThrowsExceptionIfSurfaceLevelNotInsideProfile() + public void TestThrowsExceptionIfSurfaceLevelNotInsideProfile() { var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); soilVolumeMassCalculator.MinimumThicknessCoverLayer = 10; @@ -164,7 +164,7 @@ [Test] [ExpectedException(typeof(SoilVolumicMassCalculatorException))] - public void ThrowsExceptionIfTopLayerToBeEvaluatedNotInsideProfile() + public void TestThrowsExceptionIfTopLayerToBeEvaluatedNotInsideProfile() { var soilVolumeMassCalculator = new SoilVolumicMassCalculator(); soilVolumeMassCalculator.MinimumThicknessCoverLayer = 10; Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Geo/PipingConstants.cs =================================================================== diff -u -r335 -r359 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Geo/PipingConstants.cs (.../PipingConstants.cs) (revision 335) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Geo/PipingConstants.cs (.../PipingConstants.cs) (revision 359) @@ -1,10 +1,13 @@ namespace Deltares.DamUplift.Geo { /// - /// Class holding all constant default values specific to the WTI Piping kernel + /// Class holding constant default values /// public class PipingConstants { + /// + /// The minimum layer thickness + /// public const double MinimumLayerThickness = 0.001; } } \ No newline at end of file Index: dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/Geo/PipingProfileTests.cs =================================================================== diff -u -r332 -r359 --- dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/Geo/PipingProfileTests.cs (.../PipingProfileTests.cs) (revision 332) +++ dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/Geo/PipingProfileTests.cs (.../PipingProfileTests.cs) (revision 359) @@ -57,7 +57,7 @@ [Test] [SetUICulture("en-US")] - public void ValidateThrowsExceptionIfSoilProfileHasNoLayersEn() + public void TestValidateThrowsExceptionIfSoilProfileHasNoLayersEn() { var expectedMessage = "The profile has no layers, it must have at least 1 layer."; var profile = new PipingProfile @@ -71,7 +71,7 @@ [Test] [SetUICulture("nl-NL")] - public void ValidateThrowsExceptionIfSoilProfileHasNoLayersNl() + public void TestValidateThrowsExceptionIfSoilProfileHasNoLayersNl() { var expectedMessage = "Het ondergrondprofiel heeft geen lagen, er moet tenminste 1 laag zijn."; var profile = new PipingProfile @@ -85,7 +85,7 @@ [Test] [SetUICulture("en-US")] - public void ValidateThrowsExceptionIfSoilProfileHasNonOrderedLayers() + public void TestValidateThrowsExceptionIfSoilProfileHasNonOrderedLayers() { var expectedMessage = "The layers are not ordered from top to bottom."; var profile = new PipingProfile @@ -105,7 +105,7 @@ [Test] [SetUICulture("en-US")] - public void ValidateThrowsExceptionIfSoilProfileBottomIsNotDeepEnough() + public void TestValidateThrowsExceptionIfSoilProfileBottomIsNotDeepEnough() { var expectedMessage = "The bottomlevel ({0}) of the profile is not deep enough. It must be at least {1} m below the toplevel of the deepest layer ({2})."; var profile = new PipingProfile Index: dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/SoilVolumeMassCalculatorTest.cs =================================================================== diff -u -r328 -r359 --- dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/SoilVolumeMassCalculatorTest.cs (.../SoilVolumeMassCalculatorTest.cs) (revision 328) +++ dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/SoilVolumeMassCalculatorTest.cs (.../SoilVolumeMassCalculatorTest.cs) (revision 359) @@ -1,3 +1,4 @@ +using System; using Deltares.DamUplift; using NUnit.Framework; @@ -7,33 +8,31 @@ public class SoilVolumeMassCalculatorTest { [Test] - public void CalculateForComplexProfileWithPhreaticLineInProfile1() + public void TestCalculateForComplexProfileWithPhreaticLineInProfile1() { 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() + public void TestCalculateForComplexProfileWithPhreaticLineInProfile2() { 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() + public void TestCalculateForSimpleProfileWithPhreaticLineAboveProfile() { const double cTolerance = 0.0001; var calculator = new SoilVolumicMassCalculator(); @@ -50,7 +49,7 @@ } [Test] - public void CalculateForSimpleProfileWithPhreaticLineBelowProfile() + public void TestCalculateForSimpleProfileWithPhreaticLineBelowProfile() { const double cTolerance = 0.0001; var calculator = new SoilVolumicMassCalculator(); @@ -64,7 +63,7 @@ } [Test] - public void CalculateForSimpleProfileWithPhreaticLineInProfile() + public void TestCalculateForSimpleProfileWithPhreaticLineInProfile() { const double cTolerance = 0.0001; var calculator = new SoilVolumicMassCalculator(); @@ -83,7 +82,7 @@ /// Same as above test, but now the oven dry unit weight has to be used /// [Test] - public void CalculateForSimpleProfileWithPhreaticLineInProfileAndDryOption() + public void TestCalculateForSimpleProfileWithPhreaticLineInProfileAndDryOption() { const double cTolerance = 0.0001; var calculator = new SoilVolumicMassCalculator(); @@ -105,7 +104,7 @@ } [Test] - public void CalculateForTwoLayerProfileWithPhreaticLineOnBoundary() + public void TestCalculateForTwoLayerProfileWithPhreaticLineOnBoundary() { const double cTolerance = 0.0001; var calculator = new SoilVolumicMassCalculator(); @@ -123,15 +122,15 @@ [Test] [ExpectedException(typeof(SoilVolumicMassCalculatorException))] - public void ThrowsExceptionWhenSoilProfileParameterIsMissing() + public void TestThrowsExceptionWhenSoilProfileParameterIsMissing() { var calculator = new SoilVolumicMassCalculator(); calculator.CalculateTotalMass(); } [Test] [ExpectedException(typeof(SoilVolumicMassCalculatorException))] - public void ThrowsExceptionWhenSurfaceLevelIsAboveProfile() + public void TestThrowsExceptionWhenSurfaceLevelIsAboveProfile() { var calculator = new SoilVolumicMassCalculator(); calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); @@ -140,8 +139,30 @@ } [Test] + [ExpectedException(typeof(SoilVolumicMassCalculatorException), ExpectedMessage = "Het maaiveld ligt buiten het ondergrondprofiel")] + [SetUICulture("nl-NL")] + public void TestLanguageNlThrowsExceptionWhenSurfaceLevelIsAboveProfile() + { + var calculator = new SoilVolumicMassCalculator(); + calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); + calculator.SurfaceLevel = 15.0; + calculator.CalculateTotalMass(); + } + + [Test] + [ExpectedException(typeof(SoilVolumicMassCalculatorException), ExpectedMessage = "Surfacelevel is not inside soil profile")] + [SetUICulture("en-US")] + public void TestLanguageEnThrowsExceptionWhenSurfaceLevelIsAboveProfile() + { + var calculator = new SoilVolumicMassCalculator(); + calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); + calculator.SurfaceLevel = 15.0; + calculator.CalculateTotalMass(); + } + + [Test] [ExpectedException(typeof(SoilVolumicMassCalculatorException))] - public void ThrowsExceptionWhenSurfaceLevelIsBelowProfile() + public void TestThrowsExceptionWhenSurfaceLevelIsBelowProfile() { var calculator = new SoilVolumicMassCalculator(); calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); @@ -151,7 +172,7 @@ [Test] [ExpectedException(typeof(SoilVolumicMassCalculatorException))] - public void ThrowsExceptionWhenTopLevelToBeValuatedIsBelowProfile() + public void TestThrowsExceptionWhenTopLevelToBeValuatedIsBelowProfile() { var calculator = new SoilVolumicMassCalculator(); calculator.SoilProfile = FactoryForSoilProfileTests.CreateSimpleProfile(); Index: dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/UpliftCalculatorTest.cs =================================================================== diff -u -r328 -r359 --- dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/UpliftCalculatorTest.cs (.../UpliftCalculatorTest.cs) (revision 328) +++ dam failuremechanisms/damPiping/trunk/src/Tests/Deltares.DamUpliftTests/UpliftCalculatorTest.cs (.../UpliftCalculatorTest.cs) (revision 359) @@ -7,7 +7,7 @@ public class UpliftCalculatorTest { [Test] - public void CalculateExtraHeightForSimpleProfileWithPhreaticLineInProfile() + public void TestCalculateExtraHeightForSimpleProfileWithPhreaticLineInProfile() { const double cTolerance = 0.0001; var calculator = new UpliftCalculator(); @@ -38,7 +38,7 @@ } [Test] - public void CalculateHeadOfPlLineForSimpleProfileWithPhreaticLineInProfile() + public void TestCalculateHeadOfPlLineForSimpleProfileWithPhreaticLineInProfile() { const double cTolerance = 0.0001; var calculator = new UpliftCalculator(); @@ -68,7 +68,7 @@ } [Test] - public void CalculateUpliftFactorForSimpleProfileWithPhreaticLineInProfile() + public void TestCalculateUpliftFactorForSimpleProfileWithPhreaticLineInProfile() { const double cTolerance = 0.0001; var calculator = new UpliftCalculator(); @@ -93,7 +93,7 @@ /// Same as above test, but now the oven dry unit weight has to be used /// [Test] - public void CalculateUpliftFactorForSimpleProfileWithPhreaticLineInProfileAndDryOption() + public void TestCalculateUpliftFactorForSimpleProfileWithPhreaticLineInProfileAndDryOption() { const double cTolerance = 0.0001; var calculator = new UpliftCalculator(); @@ -122,24 +122,42 @@ [Test] [ExpectedException(typeof(UpliftCalculatorException))] - public void ThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateHeadOfPlLine() + public void TestThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateExtraHeight() { var calculator = new UpliftCalculator(); - calculator.CalculateHeadOfPLLine(0.0); + calculator.CalculateUpliftFactor(0.0); } [Test] [ExpectedException(typeof(UpliftCalculatorException))] - public void ThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateUpliftFactor() + public void TestThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateHeadOfPlLine() { var calculator = new UpliftCalculator(); + calculator.CalculateHeadOfPLLine(0.0); + } + + [Test] + [ExpectedException(typeof(UpliftCalculatorException), ExpectedMessage = "Het ondergrondprofiel is niet gedefinieerd")] + [SetUICulture("nl-NL")] + public void TestLanguageNlThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateUpliftFactor() + { + var calculator = new UpliftCalculator(); calculator.CalculateUpliftFactor(0.0); } + [Test] + [ExpectedException(typeof(UpliftCalculatorException), ExpectedMessage = "The soilprofile is not defined")] + [SetUICulture("en-US")] + public void TestLanguageEnThrowsExceptionWhenSoilProfileParameterIsMissingInCalculateUpliftFactor() + { + var calculator = new UpliftCalculator(); + calculator.CalculateUpliftFactor(0.0); + } + [TestFixtureSetUp] - public void FixtureSetup() {} + public void FixtureSetup() { } [TestFixtureTearDown] - public void FixtureTearDown() {} + public void FixtureTearDown() { } } } \ No newline at end of file Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/SoilVolumicMassCalculator.cs =================================================================== diff -u -r329 -r359 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/SoilVolumicMassCalculator.cs (.../SoilVolumicMassCalculator.cs) (revision 329) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/SoilVolumicMassCalculator.cs (.../SoilVolumicMassCalculator.cs) (revision 359) @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using Deltares.DamUplift.Geo; +using Deltares.DamUplift.Properties; namespace Deltares.DamUplift { @@ -10,7 +11,7 @@ /// public class SoilVolumicMassCalculatorException : Exception { - public SoilVolumicMassCalculatorException(string message) : base(message) {} + public SoilVolumicMassCalculatorException(string message) : base(message) { } } /// @@ -29,12 +30,60 @@ IsUseOvenDryUnitWeight = false; } + /// + /// Gets or sets a value indicating whether to use use oven dry unit weight. + /// + /// + /// true if oven dry unit weight is to be used; otherwise, false. + /// public bool IsUseOvenDryUnitWeight { get; set; } + + /// + /// Gets or sets the volumic weight of water. + /// + /// + /// The volumic weight of water. + /// public double VolumicWeightOfWater { get; set; } + + /// + /// Gets or sets the phreatic level. + /// + /// + /// The phreatic level. + /// public double PhreaticLevel { get; set; } + + /// + /// Gets or sets the surface level. + /// + /// + /// The surface level. + /// public double SurfaceLevel { get; set; } + + /// + /// Gets or sets the top of the layer to be evaluated. + /// + /// + /// Top of the layer to be evaluated. + /// public double TopOfLayerToBeEvaluated { get; set; } + + /// + /// Gets or sets the soil profile. + /// + /// + /// The soil profile. + /// public PipingProfile SoilProfile { get; set; } + + /// + /// Gets or sets the minimum thickness cover layer. + /// + /// + /// The minimum thickness cover layer. + /// public double MinimumThicknessCoverLayer { get; set; } /// @@ -57,7 +106,7 @@ if (PhreaticLevel > SurfaceLevel) { var height = PhreaticLevel - SurfaceLevel; - weight += height*VolumicWeightOfWater; + weight += height * VolumicWeightOfWater; } return weight; @@ -89,36 +138,12 @@ double factorWet; double factorDry; DetermineHeightAndDryAndWetFraction(topLevel, bottomLevel, out factorWet, out factorDry); - weight += GetSoilUnitWeightDry(layer).Value*factorDry*height + (layer.BelowPhreaticLevel - VolumicWeightOfWater)*factorWet*height; + weight += GetSoilUnitWeightDry(layer).Value * factorDry * height + (layer.BelowPhreaticLevel - VolumicWeightOfWater) * factorWet * height; } return weight; } /// - /// Validates the input - /// - /// a filled list when errors are found else an empty list - public List Validate() - { - var errors = new List(); - if (SoilProfile == null) - { - errors.Add("The soilprofile is not defined"); - return errors; - } - if ((SurfaceLevel - SoilProfile.TopLevel) > CTolerance || (SurfaceLevel - SoilProfile.BottomLevel) < -CTolerance) - { - errors.Add("Surfacelevel is not inside soil profile"); - } - if ((TopOfLayerToBeEvaluated - SoilProfile.TopLevel) > CTolerance || - (TopOfLayerToBeEvaluated - SoilProfile.BottomLevel) < -CTolerance) - { - errors.Add("The top layer to be evaluated is not inside the soil profile"); - } - return errors; - } - - /// /// Gets the contribution of the weight of a layer, taking in account the phreatic level /// /// The layer. @@ -131,7 +156,7 @@ double factorDry; DetermineHeightAndDryAndWetFraction(topLevel, bottomLevel, out factorWet, out factorDry); - return GetSoilUnitWeightDry(layer).Value*factorDry*height + layer.BelowPhreaticLevel*factorWet*height; + return GetSoilUnitWeightDry(layer).Value * factorDry * height + layer.BelowPhreaticLevel * factorWet * height; } /// @@ -149,7 +174,7 @@ // If above phreatic line use the dry weight of the soil // if below phreatic line use the effective submerged weight (gamma_sat - gamma_water) - return GetSoilUnitWeightDry(layer).Value*factorDry*height + (layer.BelowPhreaticLevel - VolumicWeightOfWater)*factorWet*height; + return GetSoilUnitWeightDry(layer).Value * factorDry * height + (layer.BelowPhreaticLevel - VolumicWeightOfWater) * factorWet * height; } /// @@ -176,7 +201,7 @@ else { var pLevel = (topLevel - PhreaticLevel); - factorDry = pLevel.AlmostEquals(0.0) ? 0.0 : pLevel/height; + factorDry = pLevel.AlmostEquals(0.0) ? 0.0 : pLevel / height; factorWet = 1.0 - factorDry; } } @@ -255,7 +280,7 @@ { if (SoilProfile == null) { - throw new SoilVolumicMassCalculatorException("The soilprofile is not defined"); + throw new SoilVolumicMassCalculatorException(Resources.SoilVolumicMassCalculator_ThrowWhenSoilProfileIsNull_The_soilprofile_is_not_defined); } } @@ -267,7 +292,7 @@ { if (SoilProfile.Layers.Count == 0) { - throw new SoilVolumicMassCalculatorException("The soilprofile has no layers"); + throw new SoilVolumicMassCalculatorException(Resources.SoilVolumicMassCalculator_ThrowWhenSoilProfileHasNoLayers_The_soilprofile_has_no_layers); } } @@ -280,7 +305,7 @@ if ((SurfaceLevel - SoilProfile.TopLevel) > CTolerance || (SurfaceLevel - SoilProfile.BottomLevel) < -CTolerance) { - throw new SoilVolumicMassCalculatorException("Surfacelevel is not inside soil profile"); + throw new SoilVolumicMassCalculatorException(Resources.SoilVolumicMassCalculator_ThrowWhenSurfaceLevelNotInsideProfile_Surfacelevel_is_not_inside_soil_profile); } } @@ -292,7 +317,7 @@ { if ((TopOfLayerToBeEvaluated - SoilProfile.TopLevel) > CTolerance || (TopOfLayerToBeEvaluated - SoilProfile.BottomLevel) < -CTolerance) { - throw new SoilVolumicMassCalculatorException("The top layer to be evaluated is not inside the soil profile"); + throw new SoilVolumicMassCalculatorException(Resources.SoilVolumicMassCalculator_ThrowWhenTopLayerToBeEvaluatedNotInsideProfile_The_top_layer_to_be_evaluated_is_not_inside_the_soil_profile); } } } Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/UpliftCalculator.cs =================================================================== diff -u -r332 -r359 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/UpliftCalculator.cs (.../UpliftCalculator.cs) (revision 332) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/UpliftCalculator.cs (.../UpliftCalculator.cs) (revision 359) @@ -1,51 +1,99 @@ using System; using System.Runtime.Serialization; using Deltares.DamUplift.Geo; +using Deltares.DamUplift.Properties; namespace Deltares.DamUplift { + /// + /// Exception class for UpliftCalculatorException + /// + /// [Serializable] public class UpliftCalculatorException : ApplicationException { - // - // For guidelines regarding the creation of new exception types, see - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp - // and - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp - // - - public UpliftCalculatorException() {} - public UpliftCalculatorException(string message) : base(message) {} - public UpliftCalculatorException(string message, ApplicationException inner) : base(message, inner) {} - - protected UpliftCalculatorException( - SerializationInfo info, - StreamingContext context) - : base(info, context) {} + /// + /// Initializes a new instance of the class. + /// + /// A message that describes the error. + public UpliftCalculatorException(string message) : base(message) { } } + /// + /// Class that calculates Uplift + /// public class UpliftCalculator { + /// + /// Initializes a new instance of the class. + /// public UpliftCalculator() { VolumicWeightOfWater = Physics.UnitWeightOfwater; UnitWeightSoilEmbankment = null; IsUseOvenDryUnitWeight = false; } + /// + /// Gets or sets a value indicating whether to use use oven dry unit weight. + /// + /// + /// true if oven dry unit weight is to be used; otherwise, false. + /// public bool IsUseOvenDryUnitWeight { get; set; } + + /// + /// Gets or sets the volumic weight of water. + /// + /// + /// The volumic weight of water. + /// public double VolumicWeightOfWater { get; set; } + + /// + /// Gets or sets the soil profile. + /// + /// + /// The soil profile. + /// public PipingProfile SoilProfile { get; set; } + + /// + /// Gets or sets the top of the layer to be evaluated. + /// + /// + /// Top of the layer to be evaluated. + /// public double TopOfLayerToBeEvaluated { get; set; } + + /// + /// Gets or sets the surface level. + /// + /// + /// The surface level. + /// public double SurfaceLevel { get; set; } + + /// + /// Gets or sets the phreatic level. + /// + /// + /// The phreatic level. + /// public double PhreaticLevel { get; set; } -// public double UpLiftTopLevel { get; set; } + + /// + /// Gets or sets the unit weight of the soil in the embankment. + /// + /// + /// The unit weight of the soil in the embankment. + /// public double? UnitWeightSoilEmbankment { get; set; } /// - /// + /// Calculates the uplift factor. /// - /// + /// The head of pl line. /// public double CalculateUpliftFactor(double headOfPLLine) { @@ -56,11 +104,11 @@ massCalculator.IsUseOvenDryUnitWeight = IsUseOvenDryUnitWeight; var mass = massCalculator.CalculateTotalMass(); var height = headOfPLLine - TopOfLayerToBeEvaluated; - var phreaticPressure = VolumicWeightOfWater*height; + var phreaticPressure = VolumicWeightOfWater * height; if (phreaticPressure > 0) { - return mass/phreaticPressure; + return mass / phreaticPressure; } else { @@ -83,9 +131,9 @@ var mass = massCalculator.CalculateTotalMass(); var toplevel = Math.Min(SurfaceLevel, TopOfLayerToBeEvaluated); var height = headOfPLLine - toplevel; - var phreaticPressure = VolumicWeightOfWater*height; + var phreaticPressure = VolumicWeightOfWater * height; - double requiredExtraMass = upliftFactor*phreaticPressure - mass; + double requiredExtraMass = upliftFactor * phreaticPressure - mass; double unitWeightSoil = SoilProfile.Layers[0].AbovePhreaticLevel; if (UnitWeightSoilEmbankment != null) @@ -95,7 +143,7 @@ if (requiredExtraMass > 0) { - return requiredExtraMass/unitWeightSoil; + return requiredExtraMass / unitWeightSoil; } else { @@ -104,9 +152,9 @@ } /// - /// + /// Calculates the head of the pl line. /// - /// + /// The uplift factor. /// public double CalculateHeadOfPLLine(double upliftFactor) { @@ -116,44 +164,41 @@ massCalculator.IsUseOvenDryUnitWeight = IsUseOvenDryUnitWeight; var massSoils = massCalculator.CalculateTotalMass(); - var massWater = massSoils/(upliftFactor*VolumicWeightOfWater); + var massWater = massSoils / (upliftFactor * VolumicWeightOfWater); return massWater + TopOfLayerToBeEvaluated; } - /// - /// - /// - /// private SoilVolumicMassCalculator CreateSoilVolumeMassCalculator() { PipingProfile updatedSoilProfile = AddTopLayerIfSurfaceLevelHigherThenToplevelSoilProfile(SoilProfile); return new SoilVolumicMassCalculator - { - PhreaticLevel = PhreaticLevel, - SoilProfile = updatedSoilProfile, - TopOfLayerToBeEvaluated = TopOfLayerToBeEvaluated, - SurfaceLevel = SurfaceLevel, - VolumicWeightOfWater = VolumicWeightOfWater - }; + { + PhreaticLevel = PhreaticLevel, + SoilProfile = updatedSoilProfile, + TopOfLayerToBeEvaluated = TopOfLayerToBeEvaluated, + SurfaceLevel = SurfaceLevel, + VolumicWeightOfWater = VolumicWeightOfWater + }; } /// /// Adds an extra top layer if surface level is higher then toplevel soil profile. /// /// The updated soil profile. /// + private PipingProfile AddTopLayerIfSurfaceLevelHigherThenToplevelSoilProfile(PipingProfile updatedSoilProfile) { if ((SurfaceLevel > SoilProfile.TopLevel) && (UnitWeightSoilEmbankment != null)) { updatedSoilProfile = new PipingProfile(); updatedSoilProfile.Assign(SoilProfile); updatedSoilProfile.Layers.Insert(0, new PipingLayer() - { - AbovePhreaticLevel = UnitWeightSoilEmbankment.Value, - BelowPhreaticLevel = UnitWeightSoilEmbankment.Value, - TopLevel = SurfaceLevel - }); + { + AbovePhreaticLevel = UnitWeightSoilEmbankment.Value, + BelowPhreaticLevel = UnitWeightSoilEmbankment.Value, + TopLevel = SurfaceLevel + }); } return updatedSoilProfile; } @@ -165,7 +210,7 @@ { if (SoilProfile == null) { - throw new UpliftCalculatorException("The soilprofile is not defined"); + throw new UpliftCalculatorException(Resources.UpliftCalculator_ThrowWhenSoilProfileIsNull_The_soilprofile_is_not_defined); } } } Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.Designer.cs =================================================================== diff -u -r328 -r359 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 328) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.Designer.cs (.../Resources.Designer.cs) (revision 359) @@ -86,5 +86,54 @@ return ResourceManager.GetString("PipingProfile_Validate_ProfileHasNoLayers", resourceCulture); } } + + /// + /// Looks up a localized string similar to The soilprofile has no layers. + /// + internal static string SoilVolumicMassCalculator_ThrowWhenSoilProfileHasNoLayers_The_soilprofile_has_no_layers { + get { + return ResourceManager.GetString("SoilVolumicMassCalculator_ThrowWhenSoilProfileHasNoLayers_The_soilprofile_has_no_" + + "layers", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The soilprofile is not defined. + /// + internal static string SoilVolumicMassCalculator_ThrowWhenSoilProfileIsNull_The_soilprofile_is_not_defined { + get { + return ResourceManager.GetString("SoilVolumicMassCalculator_ThrowWhenSoilProfileIsNull_The_soilprofile_is_not_defin" + + "ed", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Surfacelevel is not inside soil profile. + /// + internal static string SoilVolumicMassCalculator_ThrowWhenSurfaceLevelNotInsideProfile_Surfacelevel_is_not_inside_soil_profile { + get { + return ResourceManager.GetString("SoilVolumicMassCalculator_ThrowWhenSurfaceLevelNotInsideProfile_Surfacelevel_is_n" + + "ot_inside_soil_profile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The top layer to be evaluated is not inside the soil profile. + /// + internal static string SoilVolumicMassCalculator_ThrowWhenTopLayerToBeEvaluatedNotInsideProfile_The_top_layer_to_be_evaluated_is_not_inside_the_soil_profile { + get { + return ResourceManager.GetString("SoilVolumicMassCalculator_ThrowWhenTopLayerToBeEvaluatedNotInsideProfile_The_top_" + + "layer_to_be_evaluated_is_not_inside_the_soil_profile", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The soilprofile is not defined. + /// + internal static string UpliftCalculator_ThrowWhenSoilProfileIsNull_The_soilprofile_is_not_defined { + get { + return ResourceManager.GetString("UpliftCalculator_ThrowWhenSoilProfileIsNull_The_soilprofile_is_not_defined", resourceCulture); + } + } } } Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.resx =================================================================== diff -u -r328 -r359 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.resx (.../Resources.resx) (revision 328) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.resx (.../Resources.resx) (revision 359) @@ -126,4 +126,19 @@ The bottomlevel ({0}) of the profile is not deep enough. It must be at least {1} m below the toplevel of the deepest layer ({2}). + + The soilprofile is not defined + + + The soilprofile has no layers + + + Surfacelevel is not inside soil profile + + + The top layer to be evaluated is not inside the soil profile + + + The soilprofile is not defined + \ No newline at end of file Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.nl-NL.resx =================================================================== diff -u -r328 -r359 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 328) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Properties/Resources.nl-NL.resx (.../Resources.nl-NL.resx) (revision 359) @@ -126,4 +126,19 @@ Het ondergrondprofiel heeft geen lagen, er moet tenminste 1 laag zijn. + + Het ondergrondprofiel heeft geen lagen + + + Het ondergrondprofiel is niet gedefinieerd + + + Het maaiveld ligt buiten het ondergrondprofiel + + + De bovenste laag, die wordt beschouwd, ligt buiten het ondergrondprofiel + + + Het ondergrondprofiel is niet gedefinieerd + \ No newline at end of file Index: dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Geo/Helper.cs =================================================================== diff -u -r335 -r359 --- dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Geo/Helper.cs (.../Helper.cs) (revision 335) +++ dam failuremechanisms/damPiping/trunk/src/Deltares.DamUplift/Geo/Helper.cs (.../Helper.cs) (revision 359) @@ -4,6 +4,13 @@ { public static class Helper { + /// + /// Checks if two doubles are equal with a defined precision. + /// + /// The double1. + /// The double2. + /// The precision. + /// public static bool AlmostEquals(double double1, double double2, double precision) { if (double.IsNaN(double1) && double.IsNaN(double2)) @@ -12,6 +19,12 @@ return false; return Math.Abs(double1 - double2) <= precision; } + /// + /// Checks if two doubles are equal. + /// + /// The double1. + /// The double2. + /// public static bool AlmostEquals(this double double1, double double2) { return AlmostEquals(double1, double2, 1E-07);