Index: DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs
===================================================================
diff -u -r3520 -r3621
--- DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 3520)
+++ DamEngine/trunk/src/Deltares.DamEngine.IntegrationTests/IntegrationTests/MacroStabilityInwardsTests.cs (.../MacroStabilityInwardsTests.cs) (revision 3621)
@@ -468,7 +468,7 @@
// with Dam Classic rev.1059
// Select first location (6-4-1-A-1-F)
// Analysis type "No adaption"
- // Calculation options: Stability Inside - Bishop
+ // Calculation options: Stability Inside - Uplift Van
// This tests both zone areas and use of 1D profiles
const string calcDir = "TestStabInwardsZoneUpliftVan";
if (Directory.Exists(calcDir))
@@ -844,7 +844,6 @@
[Test]
[SetUICulture("nl-NL")]
- [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")]
public void TestGiveFeedBackWhenNoProfilesAreAvailable()
{
// Based on "dam/IssueRelatedData/MWDAM-1341/HHNK Leggerstudie\DAM Leggerstudie.defx"
@@ -877,7 +876,6 @@
}
[Test]
- [Ignore("Test disabled due to removal of the old MacroStability kernel wrapper implementation")]
public void TestDesignWithRiverLevelAboveDikeTopButBelowDthCanCalculate()
{
var analysisType = "AdaptGeometry";
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj
===================================================================
diff -u -r3612 -r3621
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 3612)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/Deltares.DamEngine.Calculators.csproj (.../Deltares.DamEngine.Calculators.csproj) (revision 3621)
@@ -83,6 +83,7 @@
+
@@ -91,6 +92,7 @@
+
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs
===================================================================
diff -u -r3619 -r3621
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 3619)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/MacroStabilityIo/FillMacroStabilityWrapperInputFromEngine.cs (.../FillMacroStabilityWrapperInputFromEngine.cs) (revision 3621)
@@ -45,34 +45,41 @@
///
public class FillMacroStabilityWrapperInputFromEngine
{
-
private readonly Dictionary soilsDictionary =
new Dictionary();
+ /// Gets or sets the model type.
+ /// The model type.
+ public MStabModelType Model { get; set; }
/// Gets or sets the UpliftVan calculation grid.
/// The uplift van calculation grid.
public UpliftVanCalculationGrid UpliftVanCalculationGrid { get; set; }
+ /// Gets or sets the Bishop calculation grid.
+ /// The bishop calculation grid.
+ public BishopCalculationGrid BishopCalculationGrid { get; set; }
/// Gets or sets the traffic load.
/// The traffic load.
public TrafficLoad TrafficLoad { get; set; }
-
///
/// Creates the macro stability input.
///
/// The dam kernel input.
/// The failure mechanism parameters for MStab.
/// The WaterNet.
///
- public MacroStabilityInput CreateMacroStabilityInput(DamKernelInput damKernelInput, FailureMechanismParametersMStab failureMechanismParametersMStab, Data.Geometry.Waternet waterNet)
+ public MacroStabilityInput CreateMacroStabilityInput(DamKernelInput damKernelInput,
+ FailureMechanismParametersMStab failureMechanismParametersMStab, Waternet waterNet)
{
soilsDictionary.Clear();
- var macroStabilityInput = new KernelMacroStabilityInput();
- macroStabilityInput.StabilityModel = new StabilityInput();
- macroStabilityInput.PreprocessingInput = new PreprocessingInput();
+ var macroStabilityInput = new KernelMacroStabilityInput
+ {
+ StabilityModel = new StabilityInput(),
+ PreprocessingInput = new PreprocessingInput()
+ };
macroStabilityInput.StabilityModel.UpliftVanCalculationGrid = new KernelUpliftVanCalculationGrid();
- failureMechanismParametersMStab.MStabParameters.Model = MStabModelType.UpliftVan;
+ failureMechanismParametersMStab.MStabParameters.Model = failureMechanismParametersMStab.MStabParameters.Model;
TransferStabilityModelProperties(failureMechanismParametersMStab, macroStabilityInput.StabilityModel);
TransferSoils(damKernelInput.Location.SoilList, macroStabilityInput.StabilityModel.Soils);
@@ -94,47 +101,43 @@
var bottom = damKernelInput.SubSoilScenario.SoilProfile2D.Geometry.MinGeometryPointsZ;
var slipCircleDefinition = damKernelInput.DamFailureMechanismeCalculationSpecification
.FailureMechanismParametersMStab.MStabParameters.SlipCircleDefinition;
-
-
+
SearchAreaConditions preprocessingSearchAreaConditions = macroStabilityInput.PreprocessingInput.SearchAreaConditions;
- TransferUpliftVanCalculationGridSettings(slipCircleDefinition, top, bottom,
- preprocessingSearchAreaConditions);
- TransferUpliftVanCalculationGrid(UpliftVanCalculationGrid, macroStabilityInput.StabilityModel.UpliftVanCalculationGrid,
- preprocessingSearchAreaConditions.AutoTangentLines);
+ switch (Model)
+ {
+ case MStabModelType.Bishop:
+ TransferBishopCalculationGridSettings(slipCircleDefinition, top, bottom,
+ preprocessingSearchAreaConditions);
+ TransferBishopCalculationCircle(BishopCalculationGrid,
+ macroStabilityInput.StabilityModel.BishopCalculationCircle,
+ preprocessingSearchAreaConditions.AutoTangentLines);
+ break;
+ case MStabModelType.UpliftVan:
+ TransferUpliftVanCalculationGridSettings(slipCircleDefinition, top, bottom,
+ preprocessingSearchAreaConditions);
+ TransferUpliftVanCalculationGrid(UpliftVanCalculationGrid,
+ macroStabilityInput.StabilityModel.UpliftVanCalculationGrid,
+ preprocessingSearchAreaConditions.AutoTangentLines);
+ break;
+ default:
+ throw new ArgumentOutOfRangeException(nameof(Model));
+ }
+
lastStage.UniformLoads = new List();
TransferUniformLoads(TrafficLoad, lastStage.UniformLoads);
return macroStabilityInput;
}
- private void TransferStabilityModelProperties(FailureMechanismParametersMStab damFailureMechanismParametersMStab, StabilityInput kernelStabilityInput)
+ private static void TransferStabilityModelProperties(FailureMechanismParametersMStab damFailureMechanismParametersMStab,
+ StabilityInput kernelStabilityInput)
{
kernelStabilityInput.MoveGrid = true; // is not in DamEngine but MUST be true as we use the brute force approach.
kernelStabilityInput.MaximumSliceWidth = 1.0; // is not in DamEngine datamodel
kernelStabilityInput.SearchAlgorithm = ConversionHelper.ConvertToMacroStabilitySearchMethod(damFailureMechanismParametersMStab.MStabParameters.SearchMethod);
- if (kernelStabilityInput.SearchAlgorithm == SearchAlgorithm.Beeswarm)
- {
- CreateDefaultBeeSwarmOptions(kernelStabilityInput);
- }
kernelStabilityInput.ModelOption = ConversionHelper.ConvertToModelOptions(damFailureMechanismParametersMStab.MStabParameters.Model);
kernelStabilityInput.Orientation = ConversionHelper.ConvertToGridOrientation(damFailureMechanismParametersMStab.MStabParameters.GridPosition);
}
- private void CreateDefaultBeeSwarmOptions(StabilityInput kernelStabilityInput)
- {
- kernelStabilityInput.BeeswarmAlgorithmOptions = new BeeSwarmAlgorithmOptions
- {
- EliteCount = 2,
- Seed = 1,
- CrossOver = 0.3,
- Beta = 0.5,
- Delta = 0.7,
- DifferentialWeight = 0.3,
- MaximumNonImprovingGenerations = 100,
- PopulationCount = 125,
- GenerationCount = 24
- };
- }
-
private void TransferSoils(SoilList damSoilList, ICollection kernelSoils)
{
// Transfer all soils
@@ -288,6 +291,26 @@
return line;
}
+ private void TransferBishopCalculationGridSettings(SlipCircleDefinition slipCircleDefinition, double top, double bottom, SearchAreaConditions kernelSearchAreaConditions)
+ {
+ kernelSearchAreaConditions.AutoSearchArea =
+ slipCircleDefinition.GridSizeDetermination == GridSizeDetermination.Automatic;
+ kernelSearchAreaConditions.AutoTangentLines = slipCircleDefinition.UpliftVanTangentLinesDefinition ==
+ TangentLinesDefinition.OnBoundaryLines;
+ if (kernelSearchAreaConditions.AutoTangentLines)
+ {
+ kernelSearchAreaConditions.TangentLineNumber =
+ Convert.ToInt32(Math.Floor((top - bottom) / slipCircleDefinition.UpliftVanTangentLinesDistance) + 1);
+ kernelSearchAreaConditions.TangentLineZTop = top;
+ kernelSearchAreaConditions.TangentLineZBottom = bottom;
+ }
+ else
+ {
+ kernelSearchAreaConditions.TangentLineNumber = BishopCalculationGrid.TangentLineCount;
+ kernelSearchAreaConditions.TangentLineZTop = BishopCalculationGrid.TangentLineZTop;
+ kernelSearchAreaConditions.TangentLineZBottom = BishopCalculationGrid.TangentLineZBottom;
+ }
+ }
private void TransferUpliftVanCalculationGridSettings(SlipCircleDefinition slipCircleDefinition, double top, double bottom, SearchAreaConditions kernelSearchAreaConditions)
{
kernelSearchAreaConditions.AutoSearchArea =
@@ -297,8 +320,7 @@
if (kernelSearchAreaConditions.AutoTangentLines)
{
kernelSearchAreaConditions.TangentLineNumber =
- Convert.ToInt32(Math.Floor((top - bottom) / slipCircleDefinition.UpliftVanTangentLinesDistance) +
- 1);
+ Convert.ToInt32(Math.Floor((top - bottom) / slipCircleDefinition.UpliftVanTangentLinesDistance) + 1);
kernelSearchAreaConditions.TangentLineZTop = top;
kernelSearchAreaConditions.TangentLineZBottom = bottom;
}
@@ -310,7 +332,28 @@
}
}
- private void TransferUpliftVanCalculationGrid(UpliftVanCalculationGrid damUpliftVanCalculationGrid,
+ private static void TransferBishopCalculationCircle(BishopCalculationGrid damBishopCalculationGrid,
+ BishopCalculationCircle kernelBishopCalculationCircle, bool isAutoTangentLines)
+ {
+ if (damBishopCalculationGrid == null) throw new ArgumentNullException(nameof(damBishopCalculationGrid));
+ if (kernelBishopCalculationCircle == null) throw new ArgumentNullException(nameof(kernelBishopCalculationCircle));
+
+ kernelBishopCalculationCircle.Grid = new CalculationGrid
+ {
+ GridXNumber = damBishopCalculationGrid.GridXCount,
+ GridXLeft = damBishopCalculationGrid.GridXLeft,
+ GridXRight = damBishopCalculationGrid.GridXRight,
+ GridZNumber = damBishopCalculationGrid.GridZCount,
+ GridZTop = damBishopCalculationGrid.GridZTop,
+ GridZBottom = damBishopCalculationGrid.GridZBottom
+ };
+
+ if(!isAutoTangentLines)
+ {
+ kernelBishopCalculationCircle.TangentLines = damBishopCalculationGrid.TangentLineLevels.ToArray();
+ }
+ }
+ private static void TransferUpliftVanCalculationGrid(UpliftVanCalculationGrid damUpliftVanCalculationGrid,
KernelUpliftVanCalculationGrid kernelUpliftVanCalculationGrid,
bool isAutoTangentLines)
{
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs
===================================================================
diff -u -r3520 -r3621
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 3520)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators.Tests/KernelWrappers/MacroStabilityCommon/MacroStabilityIoTests.cs (.../MacroStabilityIoTests.cs) (revision 3621)
@@ -113,6 +113,8 @@
fillEngineFromMacroStabilityWrapperInput.FillDamProjectDataFromKernelModel(expectedMacrostabilityInput);
// Then the data models are equal
+ Assert.AreEqual(expectedMacrostabilityInput.StabilityModel,
+ fillEngineFromMacroStabilityWrapperInput.FailureMechanismParametersMStab.MStabParameters.Model);
CompareStabilityModel(expectedParametersMStab, fillEngineFromMacroStabilityWrapperInput.FailureMechanismParametersMStab);
CompareSoilModel(expectedSoilList, fillEngineFromMacroStabilityWrapperInput.SoilList);
CompareSoilProfile2D(expectedSoilProfile2D, fillEngineFromMacroStabilityWrapperInput.SoilProfile2D);
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/BishopGridCreator.cs (revision 3621)
@@ -0,0 +1,124 @@
+// Copyright (C) Stichting Deltares 2022. All rights reserved.
+//
+// This file is part of the Dam Engine.
+//
+// The Dam Engine is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero 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.Linq;
+using Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon;
+using Deltares.DamEngine.Data.General;
+using Deltares.DamEngine.Data.Geotechnics;
+
+namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityInwards
+{
+ public class BishopGridCreator
+ {
+ /// Determines the UpliftVan grid from settings.
+ /// the slip circle definition
+ /// The surface line.
+ ///
+ public static BishopCalculationGrid DetermineGridsFromSettings(
+ SlipCircleDefinition slipCircleDefinition, SurfaceLine2 surfaceLine)
+ {
+ var bishopCalculationGrid = new BishopCalculationGrid()
+ {
+ IsGridsAutomatic = false,
+ IsTangentLinesAutomatic = false
+ };
+
+ if (slipCircleDefinition.GridSizeDetermination == GridSizeDetermination.Specified)
+ {
+ // Define specified active (left) grid
+ if (surfaceLine != null)
+ {
+ // Use middle of the dike for X-coordinate
+ var dikeTopAtRiverPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtRiver);
+ var dikeTopAtPolderPoint = surfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder);
+ double gridXCoordinate = (dikeTopAtRiverPoint.X + dikeTopAtPolderPoint.X) * 0.5;
+ double gridYCoordinate = surfaceLine.Geometry.GetZatX(gridXCoordinate);
+ double gridWidth = slipCircleDefinition.BishopGridHorizontalPointDistance *
+ (slipCircleDefinition.BishopGridHorizontalPointCount - 1);
+ double gridHeight = slipCircleDefinition.BishopGridVerticalPointDistance *
+ (slipCircleDefinition.BishopGridVerticalPointCount - 1);
+ bishopCalculationGrid.GridXLeft = gridXCoordinate;
+ bishopCalculationGrid.GridXRight = gridXCoordinate + gridWidth;
+ bishopCalculationGrid.GridXCount = slipCircleDefinition.BishopGridHorizontalPointCount;
+ bishopCalculationGrid.GridZBottom = gridYCoordinate;
+ bishopCalculationGrid.GridZTop = gridYCoordinate + gridHeight;
+ bishopCalculationGrid.GridZCount = slipCircleDefinition.BishopGridVerticalPointCount;
+ }
+
+ // Tangent lines are defined in another method
+ }
+ else
+ {
+ // code for slipCircleDefinition.GridSizeDetermination == GridSizeDetermination.Automatic
+ bishopCalculationGrid.IsGridsAutomatic = true;
+ }
+
+ return bishopCalculationGrid;
+ }
+
+ /// Determines the tangent lines.
+ /// The bishop calculation grid.
+ /// The slip circle definition.
+ /// The soil profile1 d.
+ /// The minimum circle depth.
+ public static void DetermineTangentLines(BishopCalculationGrid bishopCalculationGrid, SlipCircleDefinition slipCircleDefinition,
+ SoilProfile1D soilProfile1D, double minimumCircleDepth)
+ {
+ switch (slipCircleDefinition.BishopTangentLinesDefinition)
+ {
+ case TangentLinesDefinition.OnBoundaryLines:
+ // In the kernel, the tangent lines are set to the boundaries, no need to do anything here.
+ bishopCalculationGrid.IsTangentLinesAutomatic = false;
+ break;
+ case TangentLinesDefinition.Specified:
+ DetermineTangentLinesSpecified(bishopCalculationGrid, soilProfile1D,
+ slipCircleDefinition.BishopTangentLinesDistance, minimumCircleDepth);
+ break;
+ }
+
+ }
+
+ private static void DetermineTangentLinesSpecified(BishopCalculationGrid bishopCalculationGrid,
+ SoilProfile1D soilProfile1D, double distance, double minimumCircleDepth)
+ {
+ if (!(distance > 0))
+ {
+ throw new ArgumentException(string.Format("Vertical distance should be > 0 but is {0}", distance));
+ }
+ double topOfBottomLayer = soilProfile1D.Layers.Last().TopLevel;
+ double surfaceLevel = soilProfile1D.Layers.First().TopLevel;
+ double bottomTangentLines = topOfBottomLayer - distance;
+ bottomTangentLines = Math.Min(bottomTangentLines, surfaceLevel - minimumCircleDepth);
+ double topTangentLines = bottomTangentLines;
+ int tangentLinesCount = 1;
+ while (topTangentLines < surfaceLevel)
+ {
+ topTangentLines += distance;
+ tangentLinesCount++;
+ }
+
+ bishopCalculationGrid.TangentLineCount = tangentLinesCount;
+ bishopCalculationGrid.TangentLineZTop = topTangentLines;
+ bishopCalculationGrid.TangentLineZBottom = bottomTangentLines;
+ }
+ }
+}
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs
===================================================================
diff -u -r3615 -r3621
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs (.../MacroStabilityInwardsKernelWrapper.cs) (revision 3615)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityInwards/MacroStabilityInwardsKernelWrapper.cs (.../MacroStabilityInwardsKernelWrapper.cs) (revision 3621)
@@ -43,7 +43,6 @@
using LogMessage = Deltares.DamEngine.Data.Standard.Logging.LogMessage;
using LogMessageType = Deltares.DamEngine.Data.Standard.Logging.LogMessageType;
using Soil = Deltares.DamEngine.Data.Geotechnics.Soil;
-using UpliftVanCalculationGrid = Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon.UpliftVanCalculationGrid;
namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityInwards
{
@@ -59,7 +58,7 @@
///
/// The failure mechanism parameters MStab.
///
- public FailureMechanismParametersMStab FailureMechanismParametersMStab { get; set; }
+ public FailureMechanismParametersMStab FailureMechanismParametersMStab { get; set; }
///
/// Prepares the specified dam kernel input.
@@ -87,62 +86,97 @@
try
{
EnsureSoilProfile2DIsFilled(damKernelInput.SubSoilScenario, damKernelInput.Location.SurfaceLine, damKernelInput.Location.GetDikeEmbankmentSoil());
-
- // Determine whether there is uplift
- UpliftSituation upliftSituation;
+
const bool useRivelLevelLow = false;
- var plLines = UpliftHelper.DeterminePlLinesForStability(damKernelInput, useRivelLevelLow, out upliftSituation);
- upliftSituation.IsUplift = UpliftHelper.DetermineIsUplift(plLines, damKernelInput.Location, damKernelInput.SubSoilScenario);
- macroStabilityOutput.UpliftSituation = upliftSituation;
- if (upliftSituation.IsUplift)
+ var plLines = UpliftHelper.DeterminePlLinesForStability(damKernelInput, useRivelLevelLow, out var upliftSituation);
+
+ var left = damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X;
+ var right = damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X;
+ var penetrationLength = damKernelInput.Location.ModelParametersForPlLines.PenetrationLength;
+ var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile2D.GetSoilProfile1D(
+ damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X);
+ var waterNet = PlLinesToWaternetConverter.ConvertPlLineToWaternet(plLines, soilProfile1D, penetrationLength, left, right);
+
+ FillMacroStabilityWrapperInputFromEngine fillMacroStabilityWrapperFromEngine = new FillMacroStabilityWrapperInputFromEngine
{
- var left = damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelOutside).X;
- var right = damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.SurfaceLevelInside).X;
- var penetrationLength = damKernelInput.Location.ModelParametersForPlLines.PenetrationLength;
- var soilProfile1D = damKernelInput.SubSoilScenario.SoilProfile2D.GetSoilProfile1D(
- damKernelInput.Location.SurfaceLine.CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.DikeTopAtPolder).X);
- var waterNet = PlLinesToWaternetConverter.ConvertPlLineToWaternet(plLines, soilProfile1D, penetrationLength, left, right);
+ Model = FailureMechanismParametersMStab.MStabParameters.Model,
+ };
- // Define traffic load
- TrafficLoad trafficLoad = null;
- if (damKernelInput.Location.StabilityOptions != null && damKernelInput.Location.StabilityOptions.TrafficLoad.HasValue &&
- !(Math.Abs(damKernelInput.Location.StabilityOptions.TrafficLoad.Value) < 1e-6))
+ switch (FailureMechanismParametersMStab.MStabParameters.Model)
+ {
+ case MStabModelType.Bishop:
{
- trafficLoad = new TrafficLoad();
- trafficLoad.Pressure = damKernelInput.Location.StabilityOptions.TrafficLoad.Value;
- trafficLoad.XStart = damKernelInput.Location.SurfaceLine
- .CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside).X;
- trafficLoad.XEnd = damKernelInput.Location.SurfaceLine
- .CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside).X;
+ // Define slip circle Bishop
+ var slipCircleDefinition = damKernelInput.DamFailureMechanismeCalculationSpecification
+ .FailureMechanismParametersMStab.MStabParameters.SlipCircleDefinition;
+ var minimumCircleDepth = damKernelInput.DamFailureMechanismeCalculationSpecification
+ .FailureMechanismParametersMStab.MStabParameters.CalculationOptions.MinimalCircleDepth;
+ var bishopCalculationGrid = BishopGridCreator.DetermineGridsFromSettings(
+ slipCircleDefinition, damKernelInput.Location.SurfaceLine);
+ var centerOfLeftGridXCoordinate = (bishopCalculationGrid.GridXLeft + bishopCalculationGrid.GridXRight) * 0.5;
+ var soilProfile1DAtCenterOfLeftGridXCoordinate =
+ damKernelInput.SubSoilScenario.DetermineSoilProfile1DAtX(centerOfLeftGridXCoordinate, damKernelInput.Location.SurfaceLine,
+ damKernelInput.Location.GetDikeEmbankmentSoil());
+ BishopGridCreator.DetermineTangentLines(bishopCalculationGrid, slipCircleDefinition,
+ soilProfile1DAtCenterOfLeftGridXCoordinate, minimumCircleDepth);
+
+ fillMacroStabilityWrapperFromEngine.BishopCalculationGrid = bishopCalculationGrid;
+ break;
}
+ case MStabModelType.UpliftVan:
+ {
+ // Determine whether there is uplift
+ upliftSituation.IsUplift = UpliftHelper.DetermineIsUplift(plLines, damKernelInput.Location, damKernelInput.SubSoilScenario);
+ macroStabilityOutput.UpliftSituation = upliftSituation;
+ if (!upliftSituation.IsUplift)
+ {
+ return PrepareResult.NotRelevant;
+ }
- // Define slip circle UpliftVan
- var slipCircleDefinition = damKernelInput.DamFailureMechanismeCalculationSpecification
- .FailureMechanismParametersMStab.MStabParameters.SlipCircleDefinition;
- double minimumCircleDepth = damKernelInput.DamFailureMechanismeCalculationSpecification
- .FailureMechanismParametersMStab.MStabParameters.CalculationOptions.MinimalCircleDepth;
- UpliftVanCalculationGrid upliftVanCalculationGrid = UpliftVanGridCreator.DetermineGridsFromSettings(
- slipCircleDefinition, damKernelInput.Location.SurfaceLine);
- double centerOfLeftGridXCoordinate =
- (upliftVanCalculationGrid.LeftGridXLeft + upliftVanCalculationGrid.LeftGridXRight) * 0.5;
- SoilProfile1D soilProfile1DAtCenterOfLeftGridXCoordinate =
- damKernelInput.SubSoilScenario.DetermineSoilProfile1DAtX(centerOfLeftGridXCoordinate, damKernelInput.Location.SurfaceLine,
- damKernelInput.Location.GetDikeEmbankmentSoil());
- UpliftVanGridCreator.DetermineTangentLines(upliftVanCalculationGrid, slipCircleDefinition,
- soilProfile1DAtCenterOfLeftGridXCoordinate, minimumCircleDepth);
+ // Define traffic load
+ TrafficLoad trafficLoad = null;
+ if (damKernelInput.Location.StabilityOptions != null && damKernelInput.Location.StabilityOptions.TrafficLoad.HasValue &&
+ !(Math.Abs(damKernelInput.Location.StabilityOptions.TrafficLoad.Value) < 1e-6))
+ {
+ trafficLoad = new TrafficLoad
+ {
+ Pressure = damKernelInput.Location.StabilityOptions.TrafficLoad.Value,
+ XStart = damKernelInput.Location.SurfaceLine
+ .CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadInside).X,
+ XEnd = damKernelInput.Location.SurfaceLine
+ .CharacteristicPoints.GetGeometryPoint(CharacteristicPointType.TrafficLoadOutside).X
+ };
+ }
- FillMacroStabilityWrapperInputFromEngine fillMacroStabilityWrapperFromEngine = new FillMacroStabilityWrapperInputFromEngine()
- {
- TrafficLoad = trafficLoad,
- UpliftVanCalculationGrid = upliftVanCalculationGrid
- };
-
- macroStabilityInput.Input = fillMacroStabilityWrapperFromEngine.CreateMacroStabilityInput(damKernelInput, FailureMechanismParametersMStab, waterNet);
- fileNameForCalculation = GetStabilityInputFileName(damKernelInput, iterationIndex, FailureMechanismParametersMStab.MStabParameters.Model);
- return PrepareKernel(macroStabilityInput.Input);
+ // Define slip circle UpliftVan
+ var slipCircleDefinition = damKernelInput.DamFailureMechanismeCalculationSpecification
+ .FailureMechanismParametersMStab.MStabParameters.SlipCircleDefinition;
+ var minimumCircleDepth = damKernelInput.DamFailureMechanismeCalculationSpecification
+ .FailureMechanismParametersMStab.MStabParameters.CalculationOptions.MinimalCircleDepth;
+ var upliftVanCalculationGrid = UpliftVanGridCreator.DetermineGridsFromSettings(
+ slipCircleDefinition, damKernelInput.Location.SurfaceLine);
+ var centerOfLeftGridXCoordinate =
+ (upliftVanCalculationGrid.LeftGridXLeft + upliftVanCalculationGrid.LeftGridXRight) * 0.5;
+ var soilProfile1DAtCenterOfLeftGridXCoordinate =
+ damKernelInput.SubSoilScenario.DetermineSoilProfile1DAtX(centerOfLeftGridXCoordinate, damKernelInput.Location.SurfaceLine,
+ damKernelInput.Location.GetDikeEmbankmentSoil());
+ UpliftVanGridCreator.DetermineTangentLines(upliftVanCalculationGrid, slipCircleDefinition,
+ soilProfile1DAtCenterOfLeftGridXCoordinate, minimumCircleDepth);
+
+ fillMacroStabilityWrapperFromEngine = new FillMacroStabilityWrapperInputFromEngine
+ {
+ TrafficLoad = trafficLoad,
+ UpliftVanCalculationGrid = upliftVanCalculationGrid
+ };
+ break;
+ }
+ default:
+ throw new ArgumentOutOfRangeException(nameof(FailureMechanismParametersMStab.MStabParameters.Model));
}
- return PrepareResult.NotRelevant;
+ macroStabilityInput.Input = fillMacroStabilityWrapperFromEngine.CreateMacroStabilityInput(damKernelInput, FailureMechanismParametersMStab, waterNet);
+ fileNameForCalculation = GetStabilityInputFileName(damKernelInput, iterationIndex, FailureMechanismParametersMStab.MStabParameters.Model);
+ return PrepareKernel(macroStabilityInput.Input);
}
catch
{
@@ -182,7 +216,7 @@
stabilityCalculator = new Calculator(input);
// For now a simple check to see if any data has been past at all.
var inputAsXml = stabilityCalculator.KernelInputXml;
-
+
File.WriteAllText(fileNameForCalculation, inputAsXml);
//Todo #Bka : this would be the place to write the stix file based on the input. Separate method as some additional as yet unavailable data needs to be set first.
// var stixWriter = new StixWriter(); #Bka Leave this code here for now as this is the real deal as soon as the tool is finished. Do not remark this in review.
@@ -196,7 +230,6 @@
{
return PrepareResult.Failed;
}
-
}
catch
{
@@ -227,7 +260,7 @@
if (kernelDataOutput != null)
{
- ((MacroStabilityOutput) kernelDataOutput).CalculationResult = CalculationResult.InvalidInputData;
+ ((MacroStabilityOutput)kernelDataOutput).CalculationResult = CalculationResult.InvalidInputData;
}
foreach (var resultMessage in result.Messages)
@@ -252,17 +285,19 @@
break;
}
}
+
messages.Add(message);
}
+
return 1;
}
catch (Exception e)
{
- var message = new LogMessage {MessageType = LogMessageType.FatalError, Message = e.Message};
+ var message = new LogMessage { MessageType = LogMessageType.FatalError, Message = e.Message };
messages.Add(message);
if (kernelDataOutput != null)
{
- ((MacroStabilityOutput) kernelDataOutput).CalculationResult = CalculationResult.InvalidInputData;
+ ((MacroStabilityOutput)kernelDataOutput).CalculationResult = CalculationResult.InvalidInputData;
}
return 1;
@@ -301,7 +336,6 @@
FillEngineFromMacroStabilityWrapperOutput.FillEngineDataWithResults(macroStabilityOutputKernel, macroStabilityOutput,
out messages);
WriteStixFileBasedOnInputAndResultsSlipPlane(input, macroStabilityOutput);
-
}
catch (Exception e)
{
@@ -322,17 +356,18 @@
macroStabilityOutputItem.CalculationPath = Path.GetDirectoryName(fileNameForCalculation);
macroStabilityOutputItem.ProjectName = Path.GetFileName(fileNameForCalculation);
var fileNameForCalculationAsStix = Path.ChangeExtension(fileNameForCalculation, ".stix");
- StixWriter.FillInfo("DAM Engine", macroStabilityOutputItem.CalculationPath,
+ StixWriter.FillInfo("DAM Engine", macroStabilityOutputItem.CalculationPath,
macroStabilityOutputItem.ProjectName, true);
StixWriter.FillCalculatedDualCircle(macroStabilityOutputItem.ActiveCenterPoint.X,
macroStabilityOutputItem.ActiveCenterPoint.Z,
- macroStabilityOutputItem.ActiveCenterPointRadius,
+ macroStabilityOutputItem.ActiveCenterPointRadius,
macroStabilityOutputItem.PassiveCenterPoint.X,
macroStabilityOutputItem.PassiveCenterPoint.Z);
if (File.Exists(fileNameForCalculationAsStix))
{
File.Delete(fileNameForCalculationAsStix);
}
+
StixWriter.WriteStixFile(fileNameForCalculationAsStix, input.Input);
}
}
@@ -372,13 +407,15 @@
macroStabilityOutputItem.ActiveCenterPointRadius;
designResult.StabilityDesignResults.ResultSlices = macroStabilityOutputItem.ResultSlices;
}
+
if (macroStabilityOutputItem.StabilityModelType == MStabModelType.UpliftVan)
{
designResult.StabilityDesignResults.PassiveCenterPoint =
macroStabilityOutputItem.PassiveCenterPoint;
designResult.StabilityDesignResults.PassiveCenterPointRadius =
macroStabilityOutputItem.PassiveCenterPointRadius;
}
+
designResults.Add(designResult);
}
}
@@ -506,13 +543,16 @@
{
designAdvise = DesignAdvise.SlopeInwards;
}
+
bool isDesignReady = fosAchieved >= fosRequired;
if (isDesignReady)
{
designAdvise = DesignAdvise.None;
}
+
return isDesignReady;
}
+
designAdvise = DesignAdvise.None;
evaluationMessage = "No Output";
return false;
@@ -625,4 +665,4 @@
return dir;
}
}
-}
+}
\ No newline at end of file
Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/BishopCalculationGrid.cs
===================================================================
diff -u
--- DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/BishopCalculationGrid.cs (revision 0)
+++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/KernelWrappers/MacroStabilityCommon/BishopCalculationGrid.cs (revision 3621)
@@ -0,0 +1,68 @@
+// Copyright (C) Stichting Deltares 2021. All rights reserved.
+//
+// This file is part of the Dam Engine.
+//
+// The Dam Engine is free software: you can redistribute it and/or modify
+// it under the terms of the GNU Affero 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 Affero General Public License for more details.
+//
+// You should have received a copy of the GNU Affero 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.Collections.Generic;
+
+namespace Deltares.DamEngine.Calculators.KernelWrappers.MacroStabilityCommon
+{
+ /// Parameters for the UpliftVan MacroStability kernel; used for IO
+ public class BishopCalculationGrid
+ {
+ /// Gets or sets the IsGridsAutomatic option.
+ /// IsGridsAutomatic.
+ public bool IsGridsAutomatic { get; set; }
+ /// Gets or sets the grid x left.
+ /// The grid x left.
+ public double GridXLeft { get; set; }
+ /// Gets or sets the left grid x right.
+ /// The grid x right.
+ public double GridXRight { get; set; }
+ /// Gets or sets the left grid z top.
+ /// The grid z top.
+ public double GridZTop { get; set; }
+ /// Gets or sets the left grid z bottom.
+ /// The grid z bottom.
+ public double GridZBottom { get; set; }
+ /// Gets or sets the left grid x count.
+ /// The grid x count.
+ public int GridXCount { get; set; }
+ /// Gets or sets the left grid z count.
+ /// The grid z count.
+ public int GridZCount { get; set; }
+
+ /// Gets or sets the tangent line z top.
+ /// The tangent line z top.
+ /// Gets or sets the tangent line creation automatic or specified.
+ /// The tangent line creation setting .
+ public bool IsTangentLinesAutomatic { get; set; }
+ public double TangentLineZTop { get; set; }
+ /// Gets or sets the tangent line z bottom.
+ /// The tangent line z bottom.
+ public double TangentLineZBottom { get; set; }
+ /// Gets or sets the tangent line count.
+ /// The tangent line count.
+ public int TangentLineCount { get; set; }
+
+ /// Gets or sets the tangent line levels.
+ /// The tangent line levels.
+ public ListTangentLineLevels { get; set; } = new List();
+ }
+}