// Copyright (C) Stichting Deltares 2016. All rights reserved. // // This file is part of the Macro Stability kernel. // // The Macro Stability kernel is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser 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 Deltares.Geometry; using Deltares.Geotechnics; using Deltares.Geotechnics.Soils; using Deltares.Standard; namespace Deltares.Geotechnics.WaternetCreator { /// /// Calculation class to determine the uplift factor. /// public class UpliftCalculatorWTI { /// /// Initializes a new instance of the class. /// public UpliftCalculatorWTI() { VolumicWeightOfWater = Physics.UnitWeightOfwater; UnitWeightSoilEmbankment = null; IsUseOvenDryUnitWeight = false; } /// /// Gets or sets a value indicating whether this instance is use oven dry unit weight. /// /// /// true if this instance is use oven dry unit weight; 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 1D. /// /// /// The soil profile 1D. /// public SoilProfile1D SoilProfile { get; set; } /// /// Gets or sets the top of layer to be evaluated. /// /// /// The top of layer to be evaluated. /// public double TopOfLayerToBeEvaluated { get; set; } /// /// Gets or sets the PL-lines. /// /// /// The PL-lines. /// public List PLLines { 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; } /// /// Gets or sets uplift top level. /// /// /// Uplift top level. /// public double UpLiftTopLevel { get; set; } /// /// Gets or sets the unit weight soil embankment. /// /// /// The unit weight soil embankment. /// public double? UnitWeightSoilEmbankment { get; set; } /// /// Calculates the uplift factor associated to a given . /// /// The head of pl line. /// The uplift factor public double CalculateUpliftFactor(double headOfPLLine) { var massCalculator = CreateSoilVolumeMassCalculator(); massCalculator.IsUseOvenDryUnitWeight = IsUseOvenDryUnitWeight; var mass = massCalculator.Calculate(); var height = headOfPLLine - TopOfLayerToBeEvaluated; var phreaticPressure = VolumicWeightOfWater*height; if (phreaticPressure > 0) { return mass/phreaticPressure; } else { return double.MaxValue; } } /// /// Calculate soil extra height to be added to obtain the specified with a given . /// /// /// /// Required soil extra heigh to obtain the specified uplift factor. public double CalculateExtraHeight(double headOfPLLine, double upliftFactor) { var massCalculator = CreateSoilVolumeMassCalculator(); var mass = massCalculator.Calculate(); var toplevel = Math.Min(SurfaceLevel, TopOfLayerToBeEvaluated); var height = headOfPLLine - toplevel; var phreaticPressure = VolumicWeightOfWater*height; double requiredExtraMass = upliftFactor*phreaticPressure - mass; double unitWeightSoil = SoilProfile.Layers[0].Soil.AbovePhreaticLevel; if (UnitWeightSoilEmbankment != null) { unitWeightSoil = UnitWeightSoilEmbankment.Value; } if (requiredExtraMass > 0) { return requiredExtraMass/unitWeightSoil; } else { return 0.0; } } /// /// Calculates the head of PL-line associated to . /// /// The uplift factor. /// The head of PL-line associated to a given uplift factor. public double CalculateHeadOfPLLine(double upliftFactor) { var massCalculator = CreateSoilVolumeMassCalculator(); massCalculator.IsUseOvenDryUnitWeight = IsUseOvenDryUnitWeight; var massSoils = massCalculator.Calculate(); var massWater = massSoils/(upliftFactor*VolumicWeightOfWater); return massWater + TopOfLayerToBeEvaluated; } private SoilVolumeMassCalculator CreateSoilVolumeMassCalculator() { return new SoilVolumeMassCalculator { PhreaticLevel = PhreaticLevel, SoilProfile = SoilProfile, TopOfLayerToBeEvaluated = TopOfLayerToBeEvaluated, SurfaceLevel = SurfaceLevel, VolumicWeightOfWater = VolumicWeightOfWater }; } } }