using System; using System.Collections.Generic; using System.IO; using Deltares.Mathematics; // ======================================================================================================================= // Class name: TUpliftCalculation // // Description: // // Copyright (c) 1999-2010 Deltares // // Date ID Modification // 2008-06-19 Best Created // 2010-04-20 Sel Implementation general StabilityCalculation class // 2010-05-12 Sel Implemented Genetic algorithm // 2010-05-20 Sel Finetuned use of GA in general // ======================================================================================================================= namespace Deltares.Stability.Calculation.Inner { public class TUpliftCalculation : TStabilityCalculation, IExtremeCalculation { // Private fields private TUpliftActiveCentrePoints FActiveCentrePoints = null; private bool FDumpMinimumPlane = false; // FMinimumResultUpliftPlanes: array of TUpliftResult; // private TZones FZone = null; private TSlipCircleData FLocalSlipData; private int FNumber = 0; // ======================================================================================================================= // Date ID Modification // 2008-06-19 Best Created // ======================================================================================================================= //Constructor Create() public TUpliftCalculation() : base() { // TODO: Add any constructor code here FNumber = 0; } public void CreateNewZone1Stramien(TMinimumResultData AMinZoneResult) { double dxL; double dyL; double dxR; double dyR; TSlipCircleData LSlipCircleData = FInterfaceData.SlipCircleData; dxL = (LSlipCircleData.XRightCenterPoint - LSlipCircleData.XLeftCenterPoint); dyL = (LSlipCircleData.ZTopCenterPoint - LSlipCircleData.ZBottomCenterPoint); dxR = (LSlipCircleData.XRightCenterPointPassive - LSlipCircleData.XLeftCenterPointPassive); dyR = (LSlipCircleData.ZTopCenterPointPassive - LSlipCircleData.ZBottomCenterPointPassive); double Lxcoor = AMinZoneResult.XActive; double LZCoor = AMinZoneResult.ZActive; double LXCoorPassive = AMinZoneResult.XPassive; double LZCoorpassive = AMinZoneResult.ZPassive; // plaats linker grid om middelpunt FLocalSlipData.XRightCenterPoint = Lxcoor + 0.5*dxL; FLocalSlipData.XLeftCenterPoint = Lxcoor - 0.5*dxL; FLocalSlipData.ZTopCenterPoint = LZCoor + 0.5*dyL; FLocalSlipData.ZBottomCenterPoint = LZCoor - 0.5*dyL; FLocalSlipData.XIntervalCount = LSlipCircleData.XIntervalCount; FLocalSlipData.ZIntervalCount = LSlipCircleData.ZIntervalCount; // plaats rechter grid om middelpunt FLocalSlipData.XRightCenterPointPassive = LXCoorPassive + 0.5*dxR; FLocalSlipData.XLeftCenterPointPassive = LXCoorPassive - 0.5*dxR; FLocalSlipData.ZTopCenterPointPassive = LZCoorpassive + 0.5*dyR; FLocalSlipData.ZBottomCenterPointPassive = LZCoorpassive - 0.5*dyR; FLocalSlipData.XIntervalCountPassive = LSlipCircleData.XIntervalCountPassive; FLocalSlipData.ZIntervalCountPassive = LSlipCircleData.ZIntervalCountPassive; FLocalSlipData.TangentIntervalCount = LSlipCircleData.TangentIntervalCount; } // ======================================================================================================================= // Date ID Modification // 2008-06-19 Best Created // ======================================================================================================================= public override void CalculationGrid() { int i; TMinimumResultData[] LMinResult; int LAutoGridMoves; int LMaxAutoGridMoves; int LZoneIndex; int LZoneEnd; var Ldeltas = new TDeltaRecord(); string Lstr; LZoneEnd = 1; if ((FInterfaceData.ModelData.HasZonePlot)) { LZoneEnd = Constants.CMaxDumps; } // Set dimension for minimum (zone) slip planes LMinResult = new TMinimumResultData[Constants.CMaxDumps]; // ad zone nr for these for (i = LMinResult.GetLowerBound(0); i <= LMinResult.GetUpperBound(0); i ++) { LMinResult[i].ZoneNr = i; } // Setlength(FMinimumResultUpliftPlanes, CMaxdumps); // Calculate rest profile if apropriate /* if ((this.FInterfaceData.ModelData.HasZonePlot)) { FZone = new TZones(); FZone.InterfaceData = this.FInterfaceData; FZone.CreateRestProfile(); // FRestProfile = FZone.RestProfile; } */ for (LZoneIndex = 0; LZoneIndex < Constants.CMaxDumps; LZoneIndex ++) { LMinResult[LZoneIndex].FStability = Constants.CFMinStart; } // Create all the circles FDumpMinimumPlane = false; LMaxAutoGridMoves = FInterfaceData.CalculationOptions.NumberOfAutogridMoves; LAutoGridMoves = 0; FLocalSlipData = FInterfaceData.SlipCircleData; CreateUpliftSlidePlanes(); CalculateAllSlidePlanes(LMinResult, ref LAutoGridMoves, LMaxAutoGridMoves, Ldeltas, LZoneEnd); if ((FInterfaceData.ModelData.HasZonePlot) && (FInterfaceData.CalculationOptions.IsGridMoved)) { if (LMinResult[0].ZoneNr > 2) { TMinimumResultData locMin = LMinResult[0]; zonePenalty = 10; CreateNewZone1Stramien(LMinResult[1]); CreateUpliftSlidePlanes(); CalculateAllSlidePlanes(LMinResult, ref LAutoGridMoves, LMaxAutoGridMoves, Ldeltas, LZoneEnd); if (LMinResult[0].FStability > locMin.FStability) { LMinResult[0] = locMin; zonePenalty = 0; } } } // Calculate and dump minimum slide planes FDumpMinimumPlane = true; for (LZoneIndex = 0; LZoneIndex < LZoneEnd; LZoneIndex ++) { if ((LMinResult[LZoneIndex].FStability < Constants.CFMinStart - 1)) { RecalculateMinimalSlipPlane(LZoneIndex, LMinResult[LZoneIndex]); } } FDumpMinimumPlane = false; if ((FIsProbabilisticCalculation)) { for (LZoneIndex = 0; LZoneIndex < LZoneEnd; LZoneIndex ++) { if ((LMinResult[LZoneIndex].FStability < Constants.CFMinStart - 1)) { try { CalculateProbabilisticPlane(LMinResult[LZoneIndex]); } catch (Exception E) { Lstr = E.Message; throw E; } } } } } public override void CalculationGA(GeneticAlgorithm AGeneticAlgorithm) { TBounds LBounds; TUpliftPlane LUpliftPlane; // Set options AGeneticAlgorithm.GenomeCount = 5; // Set the bounds for the genetic algorithm; the radius is composed of middle point and tangent line LBounds.Min = FInterfaceData.SlipCircleData.XLeftCenterPoint; LBounds.Inc = FInterfaceData.SlipCircleData.XRightCenterPoint - FInterfaceData.SlipCircleData.XLeftCenterPoint; AGeneticAlgorithm.SetBounds(0, LBounds); LBounds.Min = FInterfaceData.SlipCircleData.ZBottomCenterPoint; LBounds.Inc = FInterfaceData.SlipCircleData.ZTopCenterPoint - FInterfaceData.SlipCircleData.ZBottomCenterPoint; AGeneticAlgorithm.SetBounds(1, LBounds); LBounds.Min = FInterfaceData.SlipCircleData.XLeftCenterPointPassive; LBounds.Inc = FInterfaceData.SlipCircleData.XRightCenterPointPassive - FInterfaceData.SlipCircleData.XLeftCenterPointPassive; AGeneticAlgorithm.SetBounds(2, LBounds); LBounds.Min = FInterfaceData.SlipCircleData.ZBottomCenterPointPassive; LBounds.Inc = FInterfaceData.SlipCircleData.ZTopCenterPointPassive - FInterfaceData.SlipCircleData.ZBottomCenterPointPassive; AGeneticAlgorithm.SetBounds(3, LBounds); LBounds.Min = FInterfaceData.SlipCircleData.BottomTangentZ; LBounds.Inc = FInterfaceData.SlipCircleData.TopTangentZ - FInterfaceData.SlipCircleData.BottomTangentZ; AGeneticAlgorithm.SetBounds(4, LBounds); // Communicate the address of the calculation AGeneticAlgorithm.GeneticCalculation = this; // Determine safety factor AGeneticAlgorithm.Calculation(); // Pass minimum planee to dumpdata FDumpMinimumPlane = true; LUpliftPlane = new TUpliftPlane(); LUpliftPlane.XActiveCentre = AGeneticAlgorithm.Fittest[0]; LUpliftPlane.ZActiveCentre = AGeneticAlgorithm.Fittest[1]; LUpliftPlane.XPassiveCentre = AGeneticAlgorithm.Fittest[2]; LUpliftPlane.ZPassiveCentre = AGeneticAlgorithm.Fittest[3]; LUpliftPlane.ZTangent = AGeneticAlgorithm.Fittest[4]; LUpliftPlane.InterfaceData = FInterfaceData; // fill with calculated data object dummy = LUpliftPlane.SafetyFactor; if (FIsProbabilisticCalculation) { dummy = LUpliftPlane.ReliabilityIndex; } // add to dump AddMinimumSlipPlane(LUpliftPlane, 0, AGeneticAlgorithm.Fittest[AGeneticAlgorithm.GenomeCount]); FDumpMinimumPlane = false; } public override void CalculationLM(LevenbergMarquardtExtreme ALevenbergMarquardt) {} public double ComputeExtremeResult(double[] AGenome) { double result; TUpliftPlane LUpliftPlane; double[] LMinStabilityResults; LMinStabilityResults = new double[1]; FNumber ++; // Create LiftVan plane and pass data LUpliftPlane = new TUpliftPlane(); LUpliftPlane.XActiveCentre = AGenome[0]; LUpliftPlane.ZActiveCentre = AGenome[1]; LUpliftPlane.XPassiveCentre = AGenome[2]; LUpliftPlane.ZPassiveCentre = AGenome[3]; LUpliftPlane.ZTangent = AGenome[4]; LUpliftPlane.InterfaceData = FInterfaceData; // Calculation result = LUpliftPlane.SafetyFactor; FMinStabilityFactor = Math.Min(FMinStabilityFactor, result); LMinStabilityResults[0] = FMinStabilityFactor; // (* // AssignFile(lft, LastSlipPlaneFileName); // try // append(lft); // writeln(lft, 'Safety is ', Result: 12: 3); // finally // closefile(lft); // end; // *) if ((DoSetValues != null)) { DoSetValues("Uplift", LMinStabilityResults); } return result; } // ======================================================================================================================= // Date ID Modification // 2008-07-03 Best Created // ======================================================================================================================= private void DetermineGridPoints(ref double XRight, ref double XLeft, ref double ZTop, ref double ZBottom, bool AIsActive, ref int nx, ref int nz) { bool LIsLeftSideRequested; // If Active is requested and the left side is active LIsLeftSideRequested = (AIsActive && (FInterfaceData.ModelData.LeftSideIsActive)); if (!LIsLeftSideRequested) { // If Passive is requested and the left side is passsive LIsLeftSideRequested = (!AIsActive && (!FInterfaceData.ModelData.LeftSideIsActive)); } // vul met de goede variabelen if (LIsLeftSideRequested) { XLeft = FLocalSlipData.XLeftCenterPoint; XRight = FLocalSlipData.XRightCenterPoint; ZTop = FLocalSlipData.ZTopCenterPoint; ZBottom = FLocalSlipData.ZBottomCenterPoint; nx = FLocalSlipData.XIntervalCount; nz = FLocalSlipData.ZIntervalCount; } else { XLeft = FLocalSlipData.XLeftCenterPointPassive; XRight = FLocalSlipData.XRightCenterPointPassive; ZTop = FLocalSlipData.ZTopCenterPointPassive; ZBottom = FLocalSlipData.ZBottomCenterPointPassive; nx = FLocalSlipData.XIntervalCountPassive; nz = FLocalSlipData.ZIntervalCountPassive; } } // ======================================================================================================================= // Date ID Modification // 2008-08-05 Best Created // ======================================================================================================================= private void ResetGridPoints(double XRight, double XLeft, double ZTop, double ZBottom, bool AIsActive) { // vul met de goede variabelen if (AIsActive) { FLocalSlipData.XLeftCenterPoint = XLeft; FLocalSlipData.XRightCenterPoint = XRight; FLocalSlipData.ZTopCenterPoint = ZTop; FLocalSlipData.ZBottomCenterPoint = ZBottom; } else { FLocalSlipData.XLeftCenterPointPassive = XLeft; FLocalSlipData.XRightCenterPointPassive = XRight; FLocalSlipData.ZTopCenterPointPassive = ZTop; FLocalSlipData.ZBottomCenterPointPassive = ZBottom; } } // ======================================================================================================================= // Date ID Modification // 2008-06-19 Best Created // ======================================================================================================================= private void CreateSlidePlanes(int AXActiveCount, double AXLeftActive, double ADeltaXActive, int AZActiveCount, double AZBottomActive, double ADeltaZActive, int AXPassiveCount, double AXLeftPassive, double ADeltaXPassive, int AZPassiveCount, double AZBottomPassive, double ADeltaZPassive, int ATangentIntervalCount, double ABottomTangent, double ADeltaTangent, bool IsPassiveRight) { int i; int j; int k; int l; int m; double LXMidActive; double LZMidActive; double LXMidPassive; double LZMidPassive; double LZTangent; bool LContinue; TUpliftActiveCentrePoint LActiveCentrePoint; TCentrePoint LCentrePoint; int LXActive = 0; int LXPassive = 0; int LZActive = 0; int LZPassive = 0; int LTangent = 0; if ((ADeltaXActive < Constants.CEpsMin)) { LXActive = 0; } if ((ADeltaXPassive < Constants.CEpsMin)) { LXPassive = 0; } if ((ADeltaZActive < Constants.CEpsMin)) { LZActive = 0; } if ((ADeltaZPassive < Constants.CEpsMin)) { LZPassive = 0; } if ((ADeltaTangent < Constants.CEpsMin)) { LTangent = 0; } FActiveCentrePoints = new TUpliftActiveCentrePoints(); for (i = 0; i <= AXActiveCount - LXActive; i ++) { LXMidActive = AXLeftActive + i*ADeltaXActive; for (j = 0; j <= AZActiveCount - LZActive; j ++) { LZMidActive = AZBottomActive + j*ADeltaZActive; // Create active grid LActiveCentrePoint = new TUpliftActiveCentrePoint(); LActiveCentrePoint.XMidActive = LXMidActive; LActiveCentrePoint.ZMidActive = LZMidActive; for (k = 0; k <= AXPassiveCount - LXPassive; k ++) { LXMidPassive = AXLeftPassive + k*ADeltaXPassive; for (l = 0; l <= AZPassiveCount - LZPassive; l ++) { LZMidPassive = AZBottomPassive + l*ADeltaZPassive; // Create passive center points tangent lines included LCentrePoint = new TCentrePoint(); LCentrePoint.XMid = LXMidPassive; LCentrePoint.ZMid = LZMidPassive; // Test if x passive side keeps on the passive side if (IsPassiveRight) { LContinue = ((LXMidActive) <= LXMidPassive); } else { LContinue = ((LXMidPassive) <= LXMidActive); } if (LContinue) { //LCentrePoint.SetCircels(ATangentIntervalCount + 1 - LTangent); for (m = 0; m <= ATangentIntervalCount - LTangent; m ++) { LCentrePoint.circles.Add(new TSingleResultData()); LZTangent = ABottomTangent + m*ADeltaTangent; LCentrePoint.circles[m].ZTangent = LZTangent; // cirkels moeten hor op raaklijn aankomen // (* TestSlidePlane(LXMidActive, LZMidActive, LXMidPassive, LZMidPassive, // LZTangent, LXEntry, LXExit, LErrorString); // LCentrePoint.Circles[m].XLeft := LXEntry; // LCentrePoint.Circles[m].XRight := LXExit; // LCentrePoint.Circles[m].CircleMessage := LErrorString; // *) } } LActiveCentrePoint.PassiveGid.AddCentrePoint(LCentrePoint); } } FActiveCentrePoints.AddActiveCenterpoint(LActiveCentrePoint); } } } // ======================================================================================================================= // Description: Maakt per glijvlak een resultaat waar voorlopig alleen de middelpunten en // stralen in staan. De veiligheidsfactor staat op de default van 999. // Later wordt vanuit de resultaat array de berekening per glijvlak gestart. // // Date ID Modification // 1999-03-28 Best Created // ======================================================================================================================= private void CreateUpliftSlidePlanes() { double dxl; double dyl; double dxr; // de afstanden tussen de middelpunten en raaklijnen double dyr; double dzt; TStabilitySideSet LStabilitySide; if ((FInterfaceData.ModelData.LeftSideIsActive)) { LStabilitySide = TStabilitySideSet.RightSide; } else { LStabilitySide = TStabilitySideSet.LeftSide; } // bepaal de intervallen tussen de punten if ((FLocalSlipData.XIntervalCount > 0)) { dxl = (FLocalSlipData.XRightCenterPoint - FLocalSlipData.XLeftCenterPoint)/(FLocalSlipData.XIntervalCount); } else { dxl = 0.0; } if ((FLocalSlipData.ZIntervalCount > 0)) { dyl = (FLocalSlipData.ZTopCenterPoint - FLocalSlipData.ZBottomCenterPoint)/(FLocalSlipData.ZIntervalCount); } else { dyl = 0.0; } if ((FLocalSlipData.XIntervalCountPassive > 0)) { dxr = (FLocalSlipData.XRightCenterPointPassive - FLocalSlipData.XLeftCenterPointPassive)/(FLocalSlipData.XIntervalCountPassive); } else { dxr = 0.0; } if ((FLocalSlipData.ZIntervalCountPassive > 0)) { dyr = (FLocalSlipData.ZTopCenterPointPassive - FLocalSlipData.ZBottomCenterPointPassive)/(FLocalSlipData.ZIntervalCountPassive); } else { dyr = 0.0; } if ((FLocalSlipData.TangentIntervalCount > 0)) { dzt = (FLocalSlipData.TopTangentZ - FLocalSlipData.BottomTangentZ)/(FLocalSlipData.TangentIntervalCount); } else { dzt = 0.0; } if ((LStabilitySide == TStabilitySideSet.LeftSide)) { CreateSlidePlanes(FLocalSlipData.XIntervalCountPassive, FLocalSlipData.XLeftCenterPointPassive, dxr, FLocalSlipData.ZIntervalCountPassive, FLocalSlipData.ZBottomCenterPointPassive, dyr, FLocalSlipData.XIntervalCount, FLocalSlipData.XLeftCenterPoint, dxl, FLocalSlipData.ZIntervalCount, FLocalSlipData.ZBottomCenterPoint, dyl, FLocalSlipData.TangentIntervalCount, FLocalSlipData.BottomTangentZ, dzt, false); } else { CreateSlidePlanes(FLocalSlipData.XIntervalCount, FLocalSlipData.XLeftCenterPoint, dxl, FLocalSlipData.ZIntervalCount, FLocalSlipData.ZBottomCenterPoint, dyl, FLocalSlipData.XIntervalCountPassive, FLocalSlipData.XLeftCenterPointPassive, dxr, FLocalSlipData.ZIntervalCountPassive, FLocalSlipData.ZBottomCenterPointPassive, dyr, FLocalSlipData.TangentIntervalCount, FLocalSlipData.BottomTangentZ, dzt, true); } } // Private methods // ======================================================================================================================= // Description: adjust center points if necessary // // Outline of hlp variable // // 8 4 9 // + + + + + // + + + + + // 1 + + + + + 2 // + + + + + // + + + + + // 6 3 7 // // Date ID Modification // 1999-04-08 Best Created // ======================================================================================================================= private bool AdjustCentre(double AXCentre, double AZCentre, bool AIsActive) { bool result; double XLeft = 0; double XRight = 0; double ZTop = 0; double ZBottom = 0; int nx = 0; int nz = 0; int hlp = 0; double dx = 0; double dz = 0; double LError = 0; LError = 0.0001; hlp = 0; result = true; // Find the points from the grid (active or passsive) DetermineGridPoints(ref XRight, ref XLeft, ref ZTop, ref ZBottom, AIsActive, ref nx, ref nz); if ((Math.Abs(AXCentre - XLeft) < LError)) { hlp = 1; } if ((Math.Abs(AXCentre - XRight) < LError)) { hlp = 2; } if ((Math.Abs(AZCentre - ZBottom) < LError)) { // If a minimum value is at a corner of the grid, move the grid in two directions if ((hlp == 0)) { hlp = 3; } else { if ((hlp == 1)) { hlp = 6; } else { hlp = 7; } } } if ((Math.Abs(AZCentre - ZTop) < LError)) { if ((hlp == 0)) { hlp = 4; } else { if ((hlp == 1)) { hlp = 8; } else { hlp = 9; } } } if ((hlp == 0)) { result = false; } if (result) { // Create intervalls dx = Math.Abs(XRight - XLeft)/nx; dz = Math.Abs(ZTop - ZBottom)/nz; if ((hlp == 1) || (hlp == 6) || (hlp == 8)) { XLeft = XLeft - (nx - 1)*dx; XRight = XRight - (nx - 1)*dx; } if ((hlp == 2) || (hlp == 7) || (hlp == 9)) { XLeft = XLeft + (nx - 1)*dx; XRight = XRight + (nx - 1)*dx; } if ((hlp == 3) || (hlp == 6) || (hlp == 7)) { ZBottom = ZBottom - (nz - 1)*dz; ZTop = ZTop - (nz - 1)*dz; } if ((hlp == 4) || (hlp == 8) || (hlp == 9)) { ZBottom = ZBottom + (nz - 1)*dz; ZTop = ZTop + (nz - 1)*dz; } // reset the points to the grid (active or passsive) ResetGridPoints(XRight, XLeft, ZTop, ZBottom, AIsActive); } return result; } // ======================================================================================================================= // Description: Find minimum procedure // // Date ID Modification // 1999-04-08 Best Created // ======================================================================================================================= private bool SearchForMinimum(ref int AAutoGridMoves, ref TMinimumResultData[] AMinResult) { bool result; var LHulpCentrePoint = new List(); bool LActiveResult; bool LPassiveResult; bool LIsActive; bool LHasPassiveGridMoved; bool LHasActiveGridMoved; bool LHasTangentMoved; AAutoGridMoves ++; result = true; LActiveResult = true; LPassiveResult = true; LHasPassiveGridMoved = false; LHasTangentMoved = false; // See if it is possible to move the active grid if ((FLocalSlipData.XIntervalCount < 2) || (FLocalSlipData.ZIntervalCount < 2)) { LActiveResult = false; } // See if it is possible to move the passive grid if ((FLocalSlipData.XIntervalCountPassive < 2) || (FLocalSlipData.ZIntervalCountPassive < 2)) { LPassiveResult = false; } // If no correct slide plane is found then don't move the slide planes if (LActiveResult || LPassiveResult) { // See if there is any calculation result if ((Math.Abs(AMinResult[0].FStability - Constants.CFMinStart) < Constants.CAlmostZero)) { result = false; } // if any result is found if (result) { if (LActiveResult) { // See if active minimum is at a boundary LIsActive = true; LHasActiveGridMoved = AdjustCentre(AMinResult[0].XActive, AMinResult[0].ZActive, LIsActive); result = LHasActiveGridMoved; } if (LPassiveResult) { // See if passive circle lies on a boundary LIsActive = false; LHasPassiveGridMoved = (AdjustCentre(AMinResult[0].XPassive, AMinResult[0].ZPassive, LIsActive)); result = result || LHasPassiveGridMoved; } if (result) { // Maak een kopie van de result array // Make a copy of the result array LHulpCentrePoint.Clear(); LHulpCentrePoint.AddRange(FActiveCentrePoints.ActiveCenterpoints); // Create the data from OldCenter points CreateUpliftSlidePlanes(); FActiveCentrePoints.FilldataFromOldCenterpoints(LHulpCentrePoint, LHasTangentMoved, LHasPassiveGridMoved); } } } else { result = false; } return result; } // ======================================================================================================================= // Date ID Modification // 2008-08-13 Best Created // ======================================================================================================================= private void CalculateUpliftSpencerPlanes(ref TMinimumResultData[] AMinResult) { int LActiveCenterpointCount = 0; int LPassiveCenterpointCount = 0; int LTangentLineCount = 0; int LNActiveDim = 0; int LNPassiveDim = 0; int LNCircelDim = 0; TSpencerPlane LSpencerplane; TCentrePoint LPassiveCenterpoint; bool LDoesPlaneIntesectsRestProfile = false; double LXMid = 0; double LZMid = 0; double LRadius = 0; double LXSurface = 0; double LZExit = 0; double LAngle = 0; double LStability = 0; int LZoneNr = 0; int LExtraZonenr = 0; bool LIsBishopCalculation = false; double[] MinStabilityResults = null; LIsBishopCalculation = false; LNActiveDim = FActiveCentrePoints.ActiveCenterpoints.Count; for (LActiveCenterpointCount = 0; LActiveCenterpointCount < LNActiveDim; LActiveCenterpointCount ++) { LNPassiveDim = FActiveCentrePoints.ActiveCenterpoints[LActiveCenterpointCount].PassiveGid.ArrayOfCentrePoints.Count; for (LPassiveCenterpointCount = 0; LPassiveCenterpointCount < LNPassiveDim; LPassiveCenterpointCount ++) { // Short cut LPassiveCenterpoint = FActiveCentrePoints.ActiveCenterpoints[LActiveCenterpointCount].PassiveGid.ArrayOfCentrePoints[ LPassiveCenterpointCount]; LNCircelDim = LPassiveCenterpoint.circles.Count; for (LTangentLineCount = 0; LTangentLineCount < LNCircelDim; LTangentLineCount ++) { if ((LPassiveCenterpoint.circles[LTangentLineCount].CircleMessage == "")) { LSpencerplane = new TSpencerPlane(); // fill data LSpencerplane.InterfaceData = FInterfaceData; LSpencerplane.XActiveCentre = FActiveCentrePoints.ActiveCenterpoints[LActiveCenterpointCount].XMidActive; LSpencerplane.ZActiveCentre = FActiveCentrePoints.ActiveCenterpoints[LActiveCenterpointCount].ZMidActive; LSpencerplane.XPassiveCentre = LPassiveCenterpoint.XMid; LSpencerplane.ZPassiveCentre = LPassiveCenterpoint.ZMid; LSpencerplane.ZTangent = LPassiveCenterpoint.circles[LTangentLineCount].ZTangent; // Do the calculation LStability = LSpencerplane.SafetyFactor; LPassiveCenterpoint.circles[LTangentLineCount].FStability = LStability; var sliceArray = LSpencerplane.GetSliceArray(); MinStabilityResults = new double[sliceArray.Length + 1]; sliceArray.CopyTo(MinStabilityResults, 0); MinStabilityResults[MinStabilityResults.Length - 1] = LStability; if (DoSetValues != null) { DoSetValues("UpliftSpencer", MinStabilityResults); } if ((LStability > 0)) { LPassiveCenterpoint.circles[LTangentLineCount].CircleMessage = Constants.CCalculated + LPassiveCenterpoint.circles[LTangentLineCount].CircleMessage; } // If zone calculation keep lower zone // If zone plot calculation Find zone nr if ((FInterfaceData.ModelData.HasZonePlot)) { LXMid = LSpencerplane.XActiveCentre; LZMid = LSpencerplane.ZActiveCentre; LRadius = LZMid - LSpencerplane.ZTangent; if ((FInterfaceData.ZoneData.StabilitySide == TStabilitySideSet.LeftSide)) { LXSurface = LSpencerplane.XRightSurface; LZExit = LSpencerplane.ZLeftSurface; } else { LXSurface = LSpencerplane.XLeftSurface; LZExit = LSpencerplane.ZRightSurface; } FZone.GetZoneNr(LIsBishopCalculation, LXMid, LZMid, LRadius, LStability, LXSurface, ref LAngle, ref LZoneNr, ref LExtraZonenr, LZExit, ref LDoesPlaneIntesectsRestProfile); // nr is zone nr if ((LStability < AMinResult[LZoneNr].FStability)) { AMinResult[LZoneNr].XActive = LSpencerplane.XActiveCentre; AMinResult[LZoneNr].ZActive = LSpencerplane.ZActiveCentre; AMinResult[LZoneNr].ZTangent = LSpencerplane.ZTangent; AMinResult[LZoneNr].XPassive = LSpencerplane.XPassiveCentre; AMinResult[LZoneNr].ZPassive = LSpencerplane.ZPassiveCentre; AMinResult[LZoneNr].XLeft = LSpencerplane.XLeftSurface; AMinResult[LZoneNr].XRight = LSpencerplane.XRightSurface; AMinResult[LZoneNr].FStability = LStability; MinStabilityResults = new double[AMinResult.Length + 1]; MinStabilityResults[AMinResult.Length - 1] = LStability; if (DoSetValues != null) { DoSetValues("UpliftSpencer", MinStabilityResults); } } if ((LExtraZonenr > 4)) { if ((LStability < AMinResult[LExtraZonenr].FStability)) { AMinResult[LExtraZonenr].XActive = LSpencerplane.XActiveCentre; AMinResult[LExtraZonenr].ZActive = LSpencerplane.ZActiveCentre; AMinResult[LExtraZonenr].ZTangent = LSpencerplane.ZTangent; AMinResult[LExtraZonenr].XPassive = LSpencerplane.XPassiveCentre; AMinResult[LExtraZonenr].ZPassive = LSpencerplane.ZPassiveCentre; AMinResult[LExtraZonenr].XLeft = LSpencerplane.XLeftSurface; AMinResult[LExtraZonenr].XRight = LSpencerplane.XRightSurface; AMinResult[LExtraZonenr].FStability = LStability; MinStabilityResults = new double[AMinResult.Length + 1]; MinStabilityResults[AMinResult.Length - 1] = LStability; if (DoSetValues != null) { DoSetValues("UpliftSpencer", MinStabilityResults); } } } } // keep the minimum Slip plane 0 is overall if ((LStability < AMinResult[0].FStability)) { AMinResult[0].XActive = LSpencerplane.XActiveCentre; AMinResult[0].ZActive = LSpencerplane.ZActiveCentre; AMinResult[0].ZTangent = LSpencerplane.ZTangent; AMinResult[0].XPassive = LSpencerplane.XPassiveCentre; AMinResult[0].ZPassive = LSpencerplane.ZPassiveCentre; AMinResult[0].XLeft = LSpencerplane.XLeftSurface; AMinResult[0].XRight = LSpencerplane.XRightSurface; AMinResult[0].FStability = LStability; AMinResult[0].ZoneNr = LZoneNr; } } } } if (DoProgress != null) { DoProgress(Convert.ToDouble(LActiveCenterpointCount + 1)/Convert.ToDouble(LNActiveDim)); } } } // ======================================================================================================================= // Date ID Modification // 2008-07-03 Best Created // ======================================================================================================================= private void CalculateUpliftplanes(ref TMinimumResultData[] AMinResult) { int LActiveCenterpointIndex = 0; int LPassiveCenterpointCount = 0; int LTangentLineCount = 0; int LNActiveDim = 0; int LNPassiveDim = 0; int LNCircelDim = 0; TUpliftPlane LUpliftPlane; double LRotatedStabilityFactor; TCentrePoint LPassiveCenterpoint; int LZoneNr = 0; int LExtraZonenr = 0; double LXMid = 0; double LZMid = 0; double LRadius = 0; double LXSurface = 0; double LZExit = 0; double LAngle = 0; double LStability = 0; bool LIsBishopCalculation = false; bool LDoesPlaneIntesectsRestProfile = false; double[] LMinstability; double[] LMinStabilityResults; bool LReady = false; string lstr; LIsBishopCalculation = false; LZoneNr = 0; LMinstability = new double[1]; LNActiveDim = FActiveCentrePoints.ActiveCenterpoints.Count; for (LActiveCenterpointIndex = 0; LActiveCenterpointIndex < LNActiveDim; LActiveCenterpointIndex ++) { LNPassiveDim = FActiveCentrePoints.ActiveCenterpoints[LActiveCenterpointIndex].PassiveGid.ArrayOfCentrePoints.Count; for (LPassiveCenterpointCount = 0; LPassiveCenterpointCount < LNPassiveDim; LPassiveCenterpointCount ++) { // Short cut LPassiveCenterpoint = FActiveCentrePoints.ActiveCenterpoints[LActiveCenterpointIndex].PassiveGid.ArrayOfCentrePoints[ LPassiveCenterpointCount]; LNCircelDim = LPassiveCenterpoint.circles.Count; for (LTangentLineCount = 0; LTangentLineCount < LNCircelDim; LTangentLineCount ++) { if ((LPassiveCenterpoint.circles[LTangentLineCount].CircleMessage == "")) { LUpliftPlane = new TUpliftPlane(); // fill data try { LUpliftPlane.InterfaceData = FInterfaceData; LUpliftPlane.XActiveCentre = FActiveCentrePoints.ActiveCenterpoints[LActiveCenterpointIndex].XMidActive; LUpliftPlane.ZActiveCentre = FActiveCentrePoints.ActiveCenterpoints[LActiveCenterpointIndex].ZMidActive; LUpliftPlane.XPassiveCentre = LPassiveCenterpoint.XMid; LUpliftPlane.ZPassiveCentre = LPassiveCenterpoint.ZMid; LUpliftPlane.ZTangent = LPassiveCenterpoint.circles[LTangentLineCount].ZTangent; LUpliftPlane.XLeftSurface = LPassiveCenterpoint.circles[LTangentLineCount].XLeft; LUpliftPlane.XRightSurface = LPassiveCenterpoint.circles[LTangentLineCount].XRight; // Do the calculation LStability = LUpliftPlane.SafetyFactor; LPassiveCenterpoint.circles[LTangentLineCount].FStability = LStability; LPassiveCenterpoint.circles[LTangentLineCount].CircleMessage = LUpliftPlane.ErrorNote; } catch (Exception E) { lstr = E.Message; throw E; } if ((LStability > 0) && (LStability < Constants.CFMinStart - 1)) { LPassiveCenterpoint.circles[LTangentLineCount].CircleMessage = Constants.CCalculated + LPassiveCenterpoint.circles[LTangentLineCount].CircleMessage; if ((FInterfaceData.ModelData.HasZonePlot)) { LXMid = LUpliftPlane.XActiveCentre; LZMid = LUpliftPlane.ZActiveCentre; LRadius = LUpliftPlane.ZActiveCentre - LUpliftPlane.ZTangent; if ((FInterfaceData.ZoneData.StabilitySide == TStabilitySideSet.LeftSide)) { LXSurface = LUpliftPlane.XRightSurface; LZExit = LUpliftPlane.ZLeftSurface; } else { LXSurface = LUpliftPlane.XLeftSurface; LZExit = LUpliftPlane.ZRightSurface; } FZone.GetZoneNr(LIsBishopCalculation, LXMid, LZMid, LRadius, LStability, LXSurface, ref LAngle, ref LZoneNr, ref LExtraZonenr, LZExit, ref LDoesPlaneIntesectsRestProfile); if ((LZoneNr > 2)) { if (LDoesPlaneIntesectsRestProfile) { // only slip planes that intersect with the rest profile are considered if ((LZoneNr == 3) || (LZoneNr == 4)) { LReady = false; if ((LZoneNr == 3)) { LReady = (LStability >= InterfaceData.ZoneData.SafetyZone1a); } if ((LZoneNr == 4)) { LReady = (LStability >= InterfaceData.ZoneData.SafetyZone1b); } if (!LReady) { if ((Math.Abs(LAngle) > Constants.CAlmostZero)) { LUpliftPlane.Angle = LAngle; LUpliftPlane.RemoldFactor = FInterfaceData.ZoneData.RemoldingReductionFactor; LUpliftPlane.SchemaFactor = FInterfaceData.ZoneData.SchematizationReductionFactor; LRotatedStabilityFactor = LUpliftPlane.RotateSafetyFactor; // if intersects restprofile and not safe after rotation it is a zone 1a or 1b circel if (((LZoneNr == 3) && (LRotatedStabilityFactor < InterfaceData.ZoneData.SafetyZone1a))) { LZoneNr = 1; } if (((LZoneNr == 4) && (LRotatedStabilityFactor < InterfaceData.ZoneData.SafetyZone1b))) { LZoneNr = 2; } } } } } } // nr is zone nr if ((LStability < AMinResult[LZoneNr].FStability)) { AMinResult[LZoneNr].XActive = LUpliftPlane.XActiveCentre; AMinResult[LZoneNr].ZActive = LUpliftPlane.ZActiveCentre; AMinResult[LZoneNr].ZTangent = LUpliftPlane.ZTangent; AMinResult[LZoneNr].XPassive = LUpliftPlane.XPassiveCentre; AMinResult[LZoneNr].ZPassive = LUpliftPlane.ZPassiveCentre; AMinResult[LZoneNr].XLeft = LUpliftPlane.XLeftSurface; AMinResult[LZoneNr].XRight = LUpliftPlane.XRightSurface; AMinResult[LZoneNr].FStability = LStability; } if ((LExtraZonenr > 4)) { if ((LStability < AMinResult[LExtraZonenr].FStability)) { AMinResult[LExtraZonenr].XActive = LUpliftPlane.XActiveCentre; AMinResult[LExtraZonenr].ZActive = LUpliftPlane.ZActiveCentre; AMinResult[LExtraZonenr].ZTangent = LUpliftPlane.ZTangent; AMinResult[LExtraZonenr].XPassive = LUpliftPlane.XPassiveCentre; AMinResult[LExtraZonenr].ZPassive = LUpliftPlane.ZPassiveCentre; AMinResult[LExtraZonenr].XLeft = LUpliftPlane.XLeftSurface; AMinResult[LExtraZonenr].XRight = LUpliftPlane.XRightSurface; AMinResult[LExtraZonenr].FStability = LStability; } } } // keep the minimum Slide plane if ((LStability < AMinResult[0].FStability)) { AMinResult[0].XActive = LUpliftPlane.XActiveCentre; AMinResult[0].ZActive = LUpliftPlane.ZActiveCentre; AMinResult[0].ZTangent = LUpliftPlane.ZTangent; AMinResult[0].XPassive = LUpliftPlane.XPassiveCentre; AMinResult[0].ZPassive = LUpliftPlane.ZPassiveCentre; AMinResult[0].XLeft = LUpliftPlane.XLeftSurface; AMinResult[0].XRight = LUpliftPlane.XRightSurface; AMinResult[0].FStability = LStability; AMinResult[0].ZoneNr = LZoneNr; LMinStabilityResults = LUpliftPlane.GetSliceArray(); var resultsWithStability = new double[LMinStabilityResults.Length + 1]; LMinStabilityResults.CopyTo(resultsWithStability, 0); resultsWithStability[resultsWithStability.Length - 1] = LStability; if ((DoSetValues != null)) { DoSetValues("Uplift", resultsWithStability); } } } } } } if ((DoProgress != null)) { DoProgress(Convert.ToDouble(LActiveCenterpointIndex + 1)/Convert.ToDouble(LNActiveDim)); } } } // ======================================================================================================================= // Date ID Modification // 2009-05-27 Created // ======================================================================================================================= private void AddMinimumSlipPlane(TUpliftPlane AUpliftPlane, int AZonenr, double AStability) { TUpliftResult LResultPlane; int i; int LNSlices; LNSlices = AUpliftPlane.NSlices; LResultPlane = new TUpliftResult(); LResultPlane.SetSliceDimension(LNSlices); for (i = 0; i < LNSlices; i ++) { LResultPlane.Slices[i] = new Tslice(AUpliftPlane.GetSlice(i)); } LResultPlane.ZoneNr = AZonenr; LResultPlane.CalcMethod = FInterfaceData.ModelData.CalcType; LResultPlane.StabilityFactor = AStability; LResultPlane.XCenterPoint = AUpliftPlane.XActiveCentre; LResultPlane.ZCenterPoint = AUpliftPlane.ZActiveCentre; LResultPlane.Radius = AUpliftPlane.ActiveRadius; LResultPlane.XPassiveCentre = AUpliftPlane.XPassiveCentre; LResultPlane.ZPassiveCentre = AUpliftPlane.ZPassiveCentre; LResultPlane.PassiveRadius = AUpliftPlane.PassiveRadius; LResultPlane.ResistingMomUniterated = AUpliftPlane.ResistingMom0; LResultPlane.ResistingMom = AUpliftPlane.ResistingMom; LResultPlane.TextileMoment = AUpliftPlane.TextileMoment; LResultPlane.DrivingMoment = AUpliftPlane.DrivingMoment; LResultPlane.ActiveDMoment = AUpliftPlane.ActiveDMoment; LResultPlane.PassiveDMoment = AUpliftPlane.PassiveDMoment; LResultPlane.ActiveRMoment = AUpliftPlane.ActiveRMoment; LResultPlane.PassiveRMoment = AUpliftPlane.PassiveRMoment; LResultPlane.ActiveForce0 = AUpliftPlane.ActiveForce0; LResultPlane.PassiveForce0 = AUpliftPlane.PassiveForce0; LResultPlane.HorizontalForce0 = AUpliftPlane.HorForce0; LResultPlane.ActiveForce = AUpliftPlane.ActiveForce; LResultPlane.PassiveForce = AUpliftPlane.PassiveForce; LResultPlane.HorizontalForce = AUpliftPlane.HorForce; FDumpData.AddMinimumUpliftCircle(LResultPlane); #if DUMP DoDumpMinimumCircel(LResultPlane); #endif } // ======================================================================================================================= // Date ID Modification // 2008-12-03 Best Created // ======================================================================================================================= private void DoDumpMinimumCircel(TUpliftResult AResultPlane) { int i = 0; int LNSlices = 0; StreamWriter writer; Tslice LSlice; LNSlices = AResultPlane.Slices.Length; writer = new StreamWriter("testVan.txt"); writer.WriteLine("Slice| X-coor | Y-bot | Y-top | Width | Angle | Angle |Arc.len.|Cohesion|"); writer.WriteLine(" | [m] | [m] | [m] | [m] | bottom | top | [m] | [kN/m2]|"); writer.WriteLine("-----|--------|--------|--------|--------|--------|--------|--------|--------|"); for (i = 0; i < LNSlices; i++) { LSlice = AResultPlane.Slices[i]; writer.WriteLine("{0,4:0} |{1,7:0.00} |{2,7:0.00} |{3,7:0.00} |{4,7:0.00} |{5,7:0.00} |{6,7:0.00} |{7,7:0.00} |{8,7:0.00} |", i + 1, LSlice.XMid, LSlice.ZBottomMid, LSlice.ZTopMid, LSlice.Width, LSlice.BottomAngle, LSlice.TopAngle, LSlice.ArcLength, LSlice.CohBottom); } writer.WriteLine(" "); writer.WriteLine(" "); writer.WriteLine(" "); writer.WriteLine("Slice| Phi | Sw surf| Fw hor.| Fw ver.| Weight | S-tot. | S-eff. |Sw-hydro|"); writer.WriteLine(" | degree | [kN/m2]| [kN] | [kN] | [kN] | [kN/m2]| [kN/m2]| [kN/m2]|"); writer.WriteLine("-----|--------|--------|--------|--------|--------|--------|--------|--------|"); for (i = 0; i < LNSlices; i++) { LSlice = AResultPlane.Slices[i]; writer.WriteLine("{0,4:0} |{1,7:0.00} |{2,7:0.00} |{3,7:0.00} |{4,7:0.00} |{5,7:0.00} |{6,7:0.00} |{7,7:0.00} |{8,7:0.00} |", i + 1, LSlice.PhiBottom, LSlice.PoreOnSurface, LSlice.HPoreOnSurface, LSlice.VPoreOnSurface, LSlice.Weight, LSlice.TotalStress, LSlice.EffectiveStress, LSlice.HydrostaticPore); } writer.WriteLine(" "); writer.WriteLine(" "); writer.WriteLine(" "); writer.WriteLine("Slice| Sw-extr| Sw tot.|S shear | Cu | Ko | Sig-Vo'|Alf*SigB|Sig-Alfa|"); writer.WriteLine(" | [kN/m2]| [kN/m2]| [kN/m2]| [kN/m2]| | [kN/m2]| [kN/m2]| |"); writer.WriteLine("-----|--------|--------|--------|--------|--------|--------|--------|--------|"); for (i = 0; i < LNSlices; i++) { LSlice = AResultPlane.Slices[i]; writer.WriteLine("{0,4:0} |{1,7:0.00} |{2,7:0.00} |{3,7:0.00} |{4,7:0.00} |{5,7:0.00} |{6,7:0.00} |{7,7:0.00} |{8,7:0.00} |", i + 1, LSlice.ExcessPore, LSlice.TotalPore, LSlice.ShearStress, LSlice.Cu, LSlice.K0, LSlice.PreLoadStress, LSlice.LoadStress, LSlice.SigmaAlfa); } writer.Close(); } // ======================================================================================================================= // Date ID Modification // 2009-05-27 Created // ======================================================================================================================= private void AddMinimumSlipPlane(TSpencerPlane AUpliftPlane, int AZonenr, double AStability) { TUpliftResult LResultPlane; int i; int LNSlices; LNSlices = AUpliftPlane.NSlices; LResultPlane = new TUpliftResult(); LResultPlane.SetSliceDimension(LNSlices); for (i = 0; i < LNSlices; i ++) { LResultPlane.Slices[i] = new Tslice(AUpliftPlane.GetSlice(i)); } LResultPlane.ZoneNr = AZonenr; LResultPlane.CalcMethod = FInterfaceData.ModelData.CalcType; LResultPlane.StabilityFactor = AStability; LResultPlane.XCenterPoint = AUpliftPlane.XActiveCentre; LResultPlane.ZCenterPoint = AUpliftPlane.ZActiveCentre; LResultPlane.Radius = AUpliftPlane.ZActiveCentre - AUpliftPlane.ZTangent; LResultPlane.XPassiveCentre = AUpliftPlane.XPassiveCentre; LResultPlane.ZPassiveCentre = AUpliftPlane.ZPassiveCentre; LResultPlane.PassiveRadius = AUpliftPlane.ZPassiveCentre - AUpliftPlane.ZTangent; FDumpData.AddMinimumUpliftCircle(LResultPlane); } // ======================================================================================================================= // Date ID Modification // 2009-06-09 Created // ======================================================================================================================= private void RecalculateMinimalUpliftPlanes(int AZoneIndex, TMinimumResultData AMinResult) { TUpliftPlane LUpliftPlane; double LStabilityFactor; LUpliftPlane = new TUpliftPlane(); // fill data LUpliftPlane.InterfaceData = FInterfaceData; LUpliftPlane.XActiveCentre = AMinResult.XActive; LUpliftPlane.ZActiveCentre = AMinResult.ZActive; LUpliftPlane.XPassiveCentre = AMinResult.XPassive; LUpliftPlane.ZPassiveCentre = AMinResult.ZPassive; LUpliftPlane.ZTangent = AMinResult.ZTangent; LUpliftPlane.XLeftSurface = AMinResult.XLeft; LUpliftPlane.XRightSurface = AMinResult.XRight; // Do the calculation LStabilityFactor = LUpliftPlane.SafetyFactor; if (FDumpMinimumPlane) { AddMinimumSlipPlane(LUpliftPlane, AZoneIndex, LStabilityFactor); } } // ======================================================================================================================= // Date ID Modification // 2010-06-22 Created // ======================================================================================================================= private void CalculateProbabilisticPlane(TMinimumResultData AMinResult) { TUpliftPlane LUpliftPlane; TprobabilisticData LProbabilisticData; LUpliftPlane = new TUpliftPlane(); // fill data LUpliftPlane.InterfaceData = FInterfaceData; LUpliftPlane.XActiveCentre = AMinResult.XActive; LUpliftPlane.ZActiveCentre = AMinResult.ZActive; LUpliftPlane.XPassiveCentre = AMinResult.XPassive; LUpliftPlane.ZPassiveCentre = AMinResult.ZPassive; LUpliftPlane.ZTangent = AMinResult.ZTangent; LUpliftPlane.XLeftSurface = AMinResult.XLeft; LUpliftPlane.XRightSurface = AMinResult.XRight; // LStabilityFactor := LUpliftplane.SafetyFactor; object dummy = LUpliftPlane.ReliabilityIndex; LProbabilisticData = LUpliftPlane.ProbabilisticResutData; FDumpData.AddProbabilisticData(LProbabilisticData); } // ======================================================================================================================= // Date ID Modification // 2010-04-14 Created // ======================================================================================================================= private void RecalculateMinimalUpliftSpencerPlanes(TMinimumResultData AMinResult) { TSpencerPlane LSpencerPlane; double LStabilityFactor; string Lstr; try { LSpencerPlane = new TSpencerPlane(); // fill data LSpencerPlane.InterfaceData = FInterfaceData; LSpencerPlane.XActiveCentre = AMinResult.XActive; LSpencerPlane.ZActiveCentre = AMinResult.ZActive; LSpencerPlane.XPassiveCentre = AMinResult.XPassive; LSpencerPlane.ZPassiveCentre = AMinResult.ZPassive; LSpencerPlane.ZTangent = AMinResult.ZTangent; LSpencerPlane.XLeftSurface = AMinResult.XLeft; LSpencerPlane.XRightSurface = AMinResult.XRight; // Do the calculation LStabilityFactor = LSpencerPlane.SafetyFactor; if (FDumpMinimumPlane) { AddMinimumSlipPlane(LSpencerPlane, AMinResult.ZoneNr, LStabilityFactor); } } catch (Exception E) { Lstr = E.Message; throw E; } } // ======================================================================================================================= // Date ID Modification // 2009-06-09 Created // ======================================================================================================================= private void RecalculateMinimalSlipPlane(int AZoneIndex, TMinimumResultData AMinResult) { if ((FInterfaceData.ModelData.CalcType == TCalculationTypeSet.csLiftSpencer)) { RecalculateMinimalUpliftSpencerPlanes(AMinResult); } else { RecalculateMinimalUpliftPlanes(AZoneIndex, AMinResult); } } // ======================================================================================================================= // Date ID Modification // 2010-04-14 Created // ======================================================================================================================= private void SwitchCenterPoints(ref TMinimumResultData AMinResult) { double LXActive; double LZActive; LXActive = AMinResult.XPassive; LZActive = AMinResult.ZPassive; AMinResult.XPassive = AMinResult.XActive; AMinResult.ZPassive = AMinResult.ZActive; AMinResult.XActive = LXActive; AMinResult.ZActive = LZActive; } // ======================================================================================================================= // Date ID Modification // 2010-04-14 Created // ======================================================================================================================= private void AdjustCentrePoints(ref TMinimumResultData[] AMinResult) { int i; for (i = AMinResult.GetLowerBound(0); i <= AMinResult.GetUpperBound(0); i ++) { // If left side (lowest coordinate) should be active if ((FInterfaceData.ModelData.LeftSideIsActive)) { if ((AMinResult[i].XActive > AMinResult[i].XPassive)) { SwitchCenterPoints(ref AMinResult[i]); } } else { // If right side (Highest coordinate) should be active if ((AMinResult[i].XActive < AMinResult[i].XPassive)) { SwitchCenterPoints(ref AMinResult[i]); } } } } // ======================================================================================================================= // Date ID Modification // 2009-06-09 Created // ======================================================================================================================= private void CalculatePlanes(ref TMinimumResultData[] AMinResult) { if ((FInterfaceData.ModelData.CalcType == TCalculationTypeSet.csLiftSpencer)) { CalculateUpliftSpencerPlanes(ref AMinResult); } else { CalculateUpliftplanes(ref AMinResult); } AdjustCentrePoints(ref AMinResult); } // ======================================================================================================================= // Date ID Modification // 2004-01-21 Best Created // ======================================================================================================================= private bool IsRefinementAllowed() { return ((FInterfaceData.SlipCircleData.XIntervalCount > 0) && (FInterfaceData.SlipCircleData.ZIntervalCount > 0)) || ((FInterfaceData.SlipCircleData.XIntervalCountPassive > 0) && (FInterfaceData.SlipCircleData.ZIntervalCountPassive > 0)); } // ======================================================================================================================= // Date ID Modification // 2010-05-18 Created // ======================================================================================================================= private void DetermineDeltas(ref TDeltaRecord deltas) { const double reductionFactor = 0.5; deltas.DeltaX = reductionFactor*Math.Abs(FLocalSlipData.XLeftCenterPoint - FLocalSlipData.XRightCenterPoint)/FLocalSlipData.XIntervalCount; deltas.DeltaZ = reductionFactor*Math.Abs(FLocalSlipData.ZTopCenterPoint - FLocalSlipData.ZBottomCenterPoint)/FLocalSlipData.ZIntervalCount; deltas.DeltaXpassive = reductionFactor*Math.Abs(FLocalSlipData.XLeftCenterPointPassive - FLocalSlipData.XRightCenterPointPassive)/FLocalSlipData.XIntervalCountPassive; deltas.DeltaZpassive = reductionFactor*Math.Abs(FLocalSlipData.ZTopCenterPointPassive - FLocalSlipData.ZBottomCenterPointPassive)/FLocalSlipData.ZIntervalCountPassive; } // ======================================================================================================================= // Date ID Modification // 2010-05-18 Best Created // ======================================================================================================================= private void CreateRefinementLocalSlipData(TMinimumResultData AMinZoneResult, TDeltaRecord Adeltas) { double Lxcoor; double LZCoor; double LXCoorPassive; double LZCoorpassive; Lxcoor = AMinZoneResult.XActive; LZCoor = AMinZoneResult.ZActive; LXCoorPassive = AMinZoneResult.XPassive; LZCoorpassive = AMinZoneResult.ZPassive; FLocalSlipData.XLeftCenterPoint = Lxcoor - Adeltas.DeltaX; FLocalSlipData.XRightCenterPoint = Lxcoor + Adeltas.DeltaX; FLocalSlipData.XIntervalCount = 2; FLocalSlipData.ZBottomCenterPoint = LZCoor - Adeltas.DeltaZ; FLocalSlipData.ZTopCenterPoint = LZCoor + Adeltas.DeltaZ; FLocalSlipData.ZIntervalCount = 2; // used in case of uplift and uplift spencer FLocalSlipData.XLeftCenterPointPassive = LXCoorPassive - Adeltas.DeltaXpassive; FLocalSlipData.XRightCenterPointPassive = LXCoorPassive + Adeltas.DeltaXpassive; FLocalSlipData.XIntervalCountPassive = 2; FLocalSlipData.ZBottomCenterPointPassive = LZCoorpassive - Adeltas.DeltaZpassive; FLocalSlipData.ZTopCenterPointPassive = LZCoorpassive + Adeltas.DeltaZpassive; FLocalSlipData.ZIntervalCountPassive = 2; } private void CalculateAllSlidePlanes(TMinimumResultData[] LMinResult, ref int LAutoGridMoves, int LMaxAutoGridMoves, TDeltaRecord Ldeltas, int LZoneEnd) { int LZoneIndex; try { CalculatePlanes(ref LMinResult); } catch (Exception E) { string Lstr = E.Message; throw E; } // If the minimum cirkel lies on the boundary of the grid // and the option move grid is on than move the grid if ((FInterfaceData.CalculationOptions.IsGridMoved)) { while ((SearchForMinimum(ref LAutoGridMoves, ref LMinResult)) && (LMaxAutoGridMoves > LAutoGridMoves)) { CalculatePlanes(ref LMinResult); } // While } // Een iets kleiner grid om de gevonden maatgevende punten if ((IsRefinementAllowed())) { DetermineDeltas(ref Ldeltas); for (LZoneIndex = 0; LZoneIndex < LZoneEnd; LZoneIndex ++) { if ((LMinResult[LZoneIndex].FStability < Constants.CFMinStart - 1)) { CreateRefinementLocalSlipData(LMinResult[LZoneIndex], Ldeltas); CreateUpliftSlidePlanes(); CalculatePlanes(ref LMinResult); } } } } // ======================================================================================================================= // Date ID Modification // 2010-04-22 Sel Created // ======================================================================================================================= } // end TUpliftCalculation } namespace Deltares.Stability.Calculation.Inner { public class UpliftCalculation {} // end UpliftCalculation }