using System; using System.IO; using Deltares.Geotechnics; using Deltares.Geotechnics.Soils; namespace Deltares.Stability.Calculation2 { public class InterpolationArea { private double InterBottomLeft; private double InterBottomRight; private double degreeOfConsolidationDueToLoad; private double aanpasPore; private double totalPorePressure; private InterpolationArea bottomLayerArea; private InterpolationPoint bottomLeftPoint; private InterpolationPoint bottomRightPoint; private double cohesion; private double dilatancy; private DilatancyType dilatancyType = DilatancyType.Phi; private double effectiveStress; private double helpZBottomLeft; private double helpZBottomRight; private double helpZTopLeft; private double helpZTopRight; private double horizontalInterpolationFactor; private double interTopLeft; private double interTopRight; private double multiplicationFactorCPhiLeft; private double multiplicationFactorCPhiRight; private double ocr; private double pGrens; private double phi; private double pnLinePore; private double porePressureDueToDegreeofConsolidationLoad; private double waterPressureOnSurface; private double pop; private TPreStressType preStressType; private double preloadStress; private double tempLoadMagnitudeColumn; private double permLoadMagnitudeColumn; private double zPhreaticLeftColumn; private double zPhreaticRightColumn; // Interpolatie parameters private Soil soil; private SoilLayer2D soilLayer; private double soilStress; private double su; private InterpolationArea topLayerArea; private InterpolationPoint topLeftPoint; private InterpolationPoint topRightPoint; private double totalStress; private double verticalInterpolationFactor; private double zCoordinate; public InterpolationArea() {} public InterpolationArea(InterpolationArea aArea) { topLeftPoint = new InterpolationPoint(aArea.TopLeftPoint); topRightPoint = new InterpolationPoint(aArea.TopRightPoint); bottomLeftPoint = new InterpolationPoint(aArea.BottomLeftPoint); bottomRightPoint = new InterpolationPoint(aArea.BottomRightPoint); POP = aArea.POP; Soil = aArea.Soil; SoilLayer = aArea.SoilLayer; } public double ZCoordinate { get { return zCoordinate; } set { zCoordinate = value; } } // help variables needed for parameter calculation public double HelpZTopLeft { get { return helpZTopLeft; } set { helpZTopLeft = value; } } public double HelpZBottomLeft { get { return helpZBottomLeft; } set { helpZBottomLeft = value; } } public double HelpZTopRight { get { return helpZTopRight; } set { helpZTopRight = value; } } public double HelpZBottomRight { get { return helpZBottomRight; } set { helpZBottomRight = value; } } public InterpolationPoint TopLeftPoint { get { return topLeftPoint; } set { topLeftPoint = value; } } public InterpolationPoint TopRightPoint { get { return topRightPoint; } set { topRightPoint = value; } } public InterpolationPoint BottomLeftPoint { get { return bottomLeftPoint; } set { bottomLeftPoint = value; } } public InterpolationPoint BottomRightPoint { get { return bottomRightPoint; } set { bottomRightPoint = value; } } public double HorizontalInterpolationFactor { get { return horizontalInterpolationFactor; } set { horizontalInterpolationFactor = value; } } public double VerticalInterpolationFactor { get { return verticalInterpolationFactor; } set { verticalInterpolationFactor = value; } } public Soil Soil { get { return soil; } set { soil = value; } } public SoilLayer2D SoilLayer { get { return soilLayer; } set { soilLayer = value; } } // de op te vragen parameters public double Phi { get { return phi; } set { phi = value; } } public double Cohesion { get { return cohesion; } set { cohesion = value; } } public double Dilatancy { get { return dilatancy; } set { dilatancy = value; } } public double Su { get { return su; } set { su = value; } } public double PnLinePore { get { return pnLinePore; } set { pnLinePore = value; } } public double PorePressureDueToDegreeofConsolidationLoad { get { return porePressureDueToDegreeofConsolidationLoad; } set { porePressureDueToDegreeofConsolidationLoad = value; } } public double WaterPressureOnSurface { get { return waterPressureOnSurface; } set { waterPressureOnSurface = value; } } public double AanpasPore { get { return aanpasPore; } set { aanpasPore = value; } } public double DegreeOfConsolidationDueToLoad { get { return degreeOfConsolidationDueToLoad; } set { degreeOfConsolidationDueToLoad = value; } } public double TotalPorePressure { get { return totalPorePressure; } set { totalPorePressure = value; } } public double TotalStress { get { return totalStress; } set { totalStress = value; } } // is stress from soil body with free water if any public double SoilStress { get { return soilStress; } set { soilStress = value; } } // is stress from soil body without free water public double EffectiveStress { get { return effectiveStress; } set { effectiveStress = value; } } // is total stress (free water included) //minus total pore (aanpas pore included) public double PreloadStress { get { return preloadStress; } set { preloadStress = value; } } public double TempLoadMagnitudeColumn { get { return tempLoadMagnitudeColumn; } set { tempLoadMagnitudeColumn = value; } } private double PermLoadMagnitudeColumn { get { return permLoadMagnitudeColumn; } set { permLoadMagnitudeColumn = value; } } private double ZPhreaticLeftColumn { get { return zPhreaticLeftColumn; } set { zPhreaticLeftColumn = value; } } private double ZPhreaticRightColumn { get { return zPhreaticRightColumn; } set { zPhreaticRightColumn = value; } } public double MultiplicationFactorCPhiLeft { get { return multiplicationFactorCPhiLeft; } set { multiplicationFactorCPhiLeft = value; } } public double MultiplicationFactorCPhiRight { get { return multiplicationFactorCPhiRight; } set { multiplicationFactorCPhiRight = value; } } public double PGrens { get { return pGrens; } set { pGrens = value; } } public DilatancyType DilatancyType { get { return dilatancyType; } set { dilatancyType = value; } } public double POP { get { return pop; } set { pop = value; } } public double OCR { get { return ocr; } set { ocr = value; } } public TPreStressType PreStressType { get { return preStressType; } set { preStressType = value; } } //TODO: Han check public ShearStrengthModel ShearStrenghModel { get; set; } public InterpolationArea TopLayerArea { get { return topLayerArea; } set { topLayerArea = value; } } public InterpolationArea BottomLayerArea { get { return bottomLayerArea; } set { bottomLayerArea = value; } } public double DetermineZCoorMid() { return 0.5*(0.5*(topLeftPoint.ZCoordinate + topRightPoint.ZCoordinate) + 0.5*(bottomLeftPoint.ZCoordinate + bottomRightPoint.ZCoordinate)); } /// /// The interpolation factors are calculated /// for the effect from each /// public void DetermineParameters() //=============================== { interTopLeft = (1.0 - horizontalInterpolationFactor - verticalInterpolationFactor + horizontalInterpolationFactor*verticalInterpolationFactor); interTopRight = (horizontalInterpolationFactor - horizontalInterpolationFactor*verticalInterpolationFactor); InterBottomLeft = (verticalInterpolationFactor - horizontalInterpolationFactor*verticalInterpolationFactor); InterBottomRight = horizontalInterpolationFactor*verticalInterpolationFactor; // Calculate the needed parameters // ... first the pore pressures (NOTE: AanpasPore is the extra pore pressure due to the Degree of Consolidation of a Load on an other load, this is zero in Macrostability) // because the input of a DoC of a load on an other load is not possible. PnLinePore = interTopLeft*topLeftPoint.PnLinePore + interTopRight*topRightPoint.PnLinePore + InterBottomLeft*bottomLeftPoint.PnLinePore + InterBottomRight*bottomRightPoint.PnLinePore; AanpasPore = interTopLeft*topLeftPoint.AanpasPore + interTopRight*topRightPoint.AanpasPore + InterBottomLeft*bottomLeftPoint.AanpasPore + InterBottomRight*bottomRightPoint.AanpasPore; PorePressureDueToDegreeofConsolidationLoad = interTopLeft * topLeftPoint.PorePressureDueToDegreeofConsolidationLoad + interTopRight * topRightPoint.PorePressureDueToDegreeofConsolidationLoad + InterBottomLeft * bottomLeftPoint.PorePressureDueToDegreeofConsolidationLoad + InterBottomRight * bottomRightPoint.PorePressureDueToDegreeofConsolidationLoad; ; // AanpasLoadForce = InterTopLeft * topLeftPoint.WaterLoadStress + InterTopRight * topRightPoint.WaterLoadStress + // InterBottomLeft * bottomLeftPoint.WaterLoadStress + // InterBottomRight * bottomRightPoint.WaterLoadStress; TotalPorePressure = PnLinePore + AanpasPore + PorePressureDueToDegreeofConsolidationLoad; // ... The soil stress SoilStress = interTopLeft * topLeftPoint.SoilStress + interTopRight * topRightPoint.SoilStress + InterBottomLeft * bottomLeftPoint.SoilStress + InterBottomRight * bottomRightPoint.SoilStress; // ... The total stress, including eventually loads and water above surface level TotalStress = interTopLeft * topLeftPoint.TotalStress + interTopRight * topRightPoint.TotalStress + InterBottomLeft * bottomLeftPoint.TotalStress + InterBottomRight * bottomRightPoint.TotalStress; EffectiveStress = TotalStress - TotalPorePressure; PreloadStress = interTopLeft*topLeftPoint.PreLoadStress + interTopRight * topRightPoint.PreLoadStress + InterBottomLeft*bottomLeftPoint.PreLoadStress + InterBottomRight*bottomRightPoint.PreLoadStress; // ... The undrained shear strength Su if (ShearStrenghModel == ShearStrengthModel.CuCalculated) { Su = DetermineUndrainedShearStrengthValueFromPop(); } if (ShearStrenghModel == ShearStrengthModel.CuMeasured) { double suBottom = BottomLayerArea.BottomRightPoint.SuMeasured*horizontalInterpolationFactor + BottomLayerArea.BottomLeftPoint.SuMeasured*(1 - horizontalInterpolationFactor); double zBottom = BottomLayerArea.BottomRightPoint.ZCoordinate*horizontalInterpolationFactor + BottomLayerArea.BottomLeftPoint.ZCoordinate*(1 - horizontalInterpolationFactor); double suTop = TopLayerArea.TopRightPoint.SuMeasured*horizontalInterpolationFactor + TopLayerArea.TopLeftPoint.SuMeasured*(1 - horizontalInterpolationFactor); double zTop = TopLayerArea.TopRightPoint.ZCoordinate*horizontalInterpolationFactor + TopLayerArea.TopLeftPoint.ZCoordinate*(1 - horizontalInterpolationFactor); double verticalFraction = (zCoordinate - zBottom)/(zTop - zBottom); Su = verticalFraction*suTop + (1 - verticalFraction)*suBottom; } } /// /// Calculates the POP based on the preconsolidation stress /// /// Preconsolidation stress /// POP public double DeterminePopFromPreconsolidationStress(double preconsolidationStress) { double localEffStress = EffectiveStress; return Math.Max(0, preconsolidationStress - localEffStress); } public double PorePressureTop() { double aanpasPore = TopLeftPoint.AanpasPore + horizontalInterpolationFactor* (TopRightPoint.AanpasPore - TopLeftPoint.AanpasPore); double pnlinePore = TopLeftPoint.PnLinePore + horizontalInterpolationFactor* (TopRightPoint.PnLinePore - TopLeftPoint.PnLinePore); double porePressureFromDegreeOfConsolidationDueToLoad = TopLeftPoint.PorePressureDueToDegreeofConsolidationLoad + horizontalInterpolationFactor * (TopRightPoint.PorePressureDueToDegreeofConsolidationLoad - TopLeftPoint.PorePressureDueToDegreeofConsolidationLoad); return aanpasPore + pnlinePore + porePressureFromDegreeOfConsolidationDueToLoad; } public double PorePressureBottom() { double aanpasPore = BottomLeftPoint.AanpasPore + horizontalInterpolationFactor * (BottomRightPoint.AanpasPore - BottomLeftPoint.AanpasPore); double pnlinePore = BottomLeftPoint.PnLinePore + horizontalInterpolationFactor * (BottomRightPoint.PnLinePore - BottomLeftPoint.PnLinePore); double porePressureFromDegreeOfConsolidationDueToLoad = BottomLeftPoint.PorePressureDueToDegreeofConsolidationLoad + horizontalInterpolationFactor * (BottomRightPoint.PorePressureDueToDegreeofConsolidationLoad - BottomLeftPoint.PorePressureDueToDegreeofConsolidationLoad); return aanpasPore + pnlinePore + porePressureFromDegreeOfConsolidationDueToLoad; } public double PorePressureAtZ(double aZ) { double PoreTop = PorePressureTop(); double Porebot = PorePressureBottom(); double ZTop = ZCoordinateTop(); double Zbottom = ZCoordinateBottom(); if (ZTop == Zbottom) { return PoreTop; } return PoreTop + (aZ - ZTop)/(Zbottom - ZTop)*(Porebot - PoreTop); } public double ZCoordinateTop() { return TopLeftPoint.ZCoordinate + horizontalInterpolationFactor* (TopRightPoint.ZCoordinate - TopLeftPoint.ZCoordinate); } public double ZCoordinateBottom() { return BottomLeftPoint.ZCoordinate + horizontalInterpolationFactor* (BottomRightPoint.ZCoordinate - BottomLeftPoint.ZCoordinate); } public void WriteData(StreamWriter writer) { writer.WriteLine(" "); writer.WriteLine(" A r e a "); writer.WriteLine(" "); writer.WriteLine(" POP : " + "{0,7:0.000} ", pop); writer.WriteLine(" SoilName : " + soil.Name); writer.WriteLine(" "); writer.WriteLine(" top Left top right "); writer.WriteLine(" z Coordinate : " + "{0,7:0.000} {1,7:0.000}", topLeftPoint.ZCoordinate, topRightPoint.ZCoordinate); writer.WriteLine(" x Coordinate : " + "{0,7:0.000} {1,7:0.000}", topLeftPoint.XCoordinate, topRightPoint.XCoordinate); writer.WriteLine(" total Stress : " + "{0,7:0.000} {1,7:0.000}", topLeftPoint.SoilStress, topRightPoint.SoilStress); writer.WriteLine(" PN line pore : " + "{0,7:0.000} {1,7:0.000}", topLeftPoint.PnLinePore, topRightPoint.PnLinePore); writer.WriteLine(" "); writer.WriteLine(" "); writer.WriteLine(" Bottom Left Bottom right "); writer.WriteLine(" z Coordinate : " + "{0,7:0.000} {1,7:0.000}", bottomLeftPoint.ZCoordinate, bottomRightPoint.ZCoordinate); writer.WriteLine(" x Coordinate : " + "{0,7:0.000} {1,7:0.000}", bottomLeftPoint.XCoordinate, bottomRightPoint.XCoordinate); writer.WriteLine(" total Stress : " + "{0,7:0.000} {1,7:0.000}", bottomLeftPoint.SoilStress, bottomRightPoint.SoilStress); writer.WriteLine(" PN line pore : " + "{0,7:0.000} {1,7:0.000}", bottomLeftPoint.PnLinePore, bottomRightPoint.PnLinePore); writer.WriteLine(" "); writer.WriteLine(" End of area "); } private double CalculatesSu(double AOCR) { ocr = AOCR; double localEffStress = EffectiveStress; // If the effective stress is maximized by 0 (to avoid negative effective stress), it leads to Su=0 which is not correct. // That's why a minimum effective stress of 1E-06 is used localEffStress = Math.Max(1E-06, localEffStress); pGrens = localEffStress * AOCR; double result = localEffStress * soil.RatioCuPc * Math.Pow(AOCR, soil.StrengthIncreaseExponent); return result; } /// /// Determine undrained shear strength value Su from POP /// /// Su calculated private double DetermineUndrainedShearStrengthValueFromPop() { // In case of negative effective stress, a minimum value of 1E-06 is used double localEffStress = Math.Max(1E-6, EffectiveStress); double lOCR = 1 + pop/localEffStress; return CalculatesSu(lOCR); } public override string ToString() { return this.Soil.ToString(); } } }