Index: DamClients/DamPythonInterface/trunk/src/tests/test_surface_line.py
===================================================================
diff -u -r3479 -r3508
--- DamClients/DamPythonInterface/trunk/src/tests/test_surface_line.py (.../test_surface_line.py) (revision 3479)
+++ DamClients/DamPythonInterface/trunk/src/tests/test_surface_line.py (.../test_surface_line.py) (revision 3508)
@@ -138,17 +138,36 @@
@pytest.mark.integrationtest
def test_serialize_surface_line(self):
# Initialize class to be tested
- points_available = [
- PointTypeEnum.SurfaceLevelOutside,
- PointTypeEnum.DikeToeAtRiver,
- PointTypeEnum.DikeTopAtRiver,
- PointTypeEnum.DikeTopAtPolder,
- PointTypeEnum.DikeToeAtPolder,
- PointTypeEnum.SurfaceLevelInside,
+ # Create surface lines
+ X = [0, 10, 19, 20.5, 23, 23, 35, 100]
+ Z = [
+ 1,
+ 1,
+ 4,
+ 4,
+ 4,
+ 4,
+ 0,
+ 0,
]
+ PointTypeList = [
+ 1,
+ 5,
+ 8,
+ 10,
+ 11,
+ 12,
+ 15,
+ 25,
+ ]
+
list_of_points = [
- Point(X=1 * counter, Z=2 * counter, PointType=point_type)
- for counter, point_type in enumerate(points_available)
+ Point(
+ X=X[counter],
+ Z=Z[counter],
+ PointType=PointTypeEnum(PointTypeList[counter]),
+ )
+ for counter, point_type in enumerate(X)
]
surfaceline = SurfaceLine(Points=list_of_points, Name="Test surface line")
# check initial expectations
Index: DamClients/DamPythonInterface/trunk/src/tests/test_data/test_serialize_surface_line.xml
===================================================================
diff -u -r3474 -r3508
--- DamClients/DamPythonInterface/trunk/src/tests/test_data/test_serialize_surface_line.xml (.../test_serialize_surface_line.xml) (revision 3474)
+++ DamClients/DamPythonInterface/trunk/src/tests/test_data/test_serialize_surface_line.xml (.../test_serialize_surface_line.xml) (revision 3508)
@@ -1,10 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
Index: DamClients/DamPythonInterface/trunk/src/tests/test_output/test_serialize_surface_line.xml
===================================================================
diff -u -r3474 -r3508
--- DamClients/DamPythonInterface/trunk/src/tests/test_output/test_serialize_surface_line.xml (.../test_serialize_surface_line.xml) (revision 3474)
+++ DamClients/DamPythonInterface/trunk/src/tests/test_output/test_serialize_surface_line.xml (.../test_serialize_surface_line.xml) (revision 3508)
@@ -1,10 +1,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
Index: DamClients/DamPythonInterface/trunk/src/dampythoninterface/input.py
===================================================================
diff -u -r3501 -r3508
--- DamClients/DamPythonInterface/trunk/src/dampythoninterface/input.py (.../input.py) (revision 3501)
+++ DamClients/DamPythonInterface/trunk/src/dampythoninterface/input.py (.../input.py) (revision 3508)
@@ -21,6 +21,7 @@
from typing import List, Optional
+from enum import Enum, IntEnum
from pathlib import Path
import lxml.etree as et
from pydantic import validator
@@ -34,6 +35,20 @@
from .location import Location
+class FailureMechanismSystem(IntEnum):
+ StabilityInside = 0
+ StabilityOutside = 1
+ Piping = 2
+ HorizontalBalance = 3
+
+
+class StabilityType(Enum):
+ Bishop = "Bishop"
+ UpliftVan = "UpliftVan"
+ BishopUpliftVan = "BishopUpliftVan"
+ UpliftVanWti = "UpliftVanWti"
+
+
class DamInput(BaseDataClass):
"""
Class that contains all inputs for the DAM engine xml.
@@ -48,6 +63,16 @@
SoilProfiles1D: List[SoilProfile1D] = []
Segments: List[Segment] = []
Locations: List[Location] = []
+ FailureMechanismSystemType: Optional[
+ FailureMechanismSystem
+ ] = FailureMechanismSystem.StabilityInside
+ StabilityModelType: StabilityType
+ __AnalysisType__ = "NoAdaption"
+ ProjectPath: Path
+ MaxCalculationCores: Optional[int] = 1
+ __xmlns_xsi__: str = "http://www.w3.org/2001/XMLSchema-instance"
+ __xmlns_xsd__: str = "http://www.w3.org/2001/XMLSchema"
+ __DamProjectType__: str = "Design"
@validator("SoilProfiles1D")
def soil_profiles_contain_soils(cls, v, values, **kwargs):
@@ -82,7 +107,18 @@
Function that export the DamInput dataclass to an xml that can be used as input of the DAMengine.
"""
- input_root = et.Element("Input")
+ nsmap = {"xsd": self.__xmlns_xsd__, "xsi": self.__xmlns_xsi__}
+ input_root = et.Element("Input", nsmap=nsmap)
+
+ # write all elements of the input
+ input_root.set("DamProjectType", self.__DamProjectType__)
+ input_root.set(
+ "FailureMechanismSystemType", str(self.FailureMechanismSystemType.value)
+ )
+ input_root.set("StabilityModelType", self.StabilityModelType.value)
+ input_root.set("AnalysisType", self.__AnalysisType__)
+ input_root.set("ProjectPath", str(self.ProjectPath.resolve()))
+ input_root.set("MaxCalculationCores", str(self.MaxCalculationCores))
# create location line element
locations_root = et.Element("Locations")
for location in self.Locations:
@@ -104,7 +140,7 @@
soilprofiles_root.append(soil_profile.serialize())
input_root.append(soilprofiles_root)
# add segments
- segments_root = et.Element("Elements")
+ segments_root = et.Element("Segments")
for segment in self.Segments:
segments_root.append(segment.serialize())
input_root.append(segments_root)
Index: DamClients/DamPythonInterface/trunk/src/tests/test_input.py
===================================================================
diff -u -r3504 -r3508
--- DamClients/DamPythonInterface/trunk/src/tests/test_input.py (.../test_input.py) (revision 3504)
+++ DamClients/DamPythonInterface/trunk/src/tests/test_input.py (.../test_input.py) (revision 3508)
@@ -24,9 +24,9 @@
from pathlib import Path
from lxml import etree
-from dampythoninterface.input import DamInput
+from dampythoninterface.input import DamInput, FailureMechanismSystem, StabilityType
from dampythoninterface.surface_line import SurfaceLine, PointTypeEnum, Point
-from dampythoninterface.soil import Soil
+from dampythoninterface.soil import Soil, ShearStrengthModelType, DilatancyTypeModel
from dampythoninterface.stability_parameters import (
SearchMethodType,
StabilityParameters,
@@ -140,46 +140,211 @@
Probability=1,
SegmentFailureMechanismType=SegmentFailureMechanismTypeClass.Piping,
)
- return [
- Segment(Name="Test segment", SoilGeometryProbability=[profile_1, profile_2])
- ]
+ return [Segment(Name="1", SoilGeometryProbability=[profile_1, profile_2])]
def create_surface_lines(self) -> List[SurfaceLine]:
# Create surface lines
- points_available = [
- PointTypeEnum.SurfaceLevelOutside,
- PointTypeEnum.DikeToeAtRiver,
- PointTypeEnum.DikeTopAtRiver,
- PointTypeEnum.DikeTopAtPolder,
- PointTypeEnum.DikeToeAtPolder,
- PointTypeEnum.SurfaceLevelInside,
+ X = [0, 10, 19, 20.5, 23, 23, 35, 100]
+ Z = [
+ 1,
+ 1,
+ 4,
+ 4,
+ 4,
+ 4,
+ 0,
+ 0,
]
+ PointTypeList = [
+ 1,
+ 5,
+ 8,
+ 10,
+ 11,
+ 12,
+ 15,
+ 25,
+ ]
+
list_of_points = [
- Point(X=1 * counter, Z=2 * counter, PointType=point_type)
- for counter, point_type in enumerate(points_available)
+ Point(
+ X=X[counter],
+ Z=Z[counter],
+ PointType=PointTypeEnum(PointTypeList[counter]),
+ )
+ for counter, point_type in enumerate(X)
]
- surfaceline_1 = SurfaceLine(Points=list_of_points, Name="Surface line 1")
- surfaceline_2 = SurfaceLine(Points=list_of_points, Name="Surface line 2")
+ surfaceline_1 = SurfaceLine(Points=list_of_points, Name="Profiel 1")
# check initial expectations
- assert surfaceline_1.Name == "Surface line 1"
- assert surfaceline_2.Name == "Surface line 2"
- return [surfaceline_1, surfaceline_2]
+ assert surfaceline_1.Name == "Profiel 1"
+ return [surfaceline_1]
def create_soils(self) -> List[Soil]:
soil_1 = Soil(
- Name="soil 1",
+ Name="Dijkmateriaal",
+ BeddingAngle=37,
+ DiameterD70=0.00019999999999999998,
+ PermeabKx=0.0004,
+ WhitesConstant=0.25,
AbovePhreaticLevel=17,
BelowPhreaticLevel=17,
- IsAquifer=True,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0.5,
+ FrictionAngle=22,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
)
soil_2 = Soil(
- Name="soil 2",
- AbovePhreaticLevel=20,
- BelowPhreaticLevel=20,
- IsAquifer=False,
+ Name="Deklaag_klei",
+ BeddingAngle=38,
+ DiameterD70=0.00019999999999999998,
+ PermeabKx=0.001,
+ WhitesConstant=0.25,
+ AbovePhreaticLevel=16,
+ BelowPhreaticLevel=16,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0.5,
+ FrictionAngle=22,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
)
- return [soil_1, soil_2]
+ soil_3 = Soil(
+ Name="wl_zand1",
+ BeddingAngle=39,
+ DiameterD70=0.00020999999999999998,
+ PermeabKx=0.0009,
+ WhitesConstant=0.25,
+ AbovePhreaticLevel=18,
+ BelowPhreaticLevel=19,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0,
+ FrictionAngle=32,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
+ )
+ soil_4 = Soil(
+ Name="Ophoogmateriaal_dijk",
+ BeddingAngle=40,
+ DiameterD70=0.00019999999999999998,
+ PermeabKx=0.0004,
+ WhitesConstant=0.25,
+ AbovePhreaticLevel=17,
+ BelowPhreaticLevel=17,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0.5,
+ FrictionAngle=22,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
+ )
+ soil_5 = Soil(
+ Name="Ophoogmateriaal_berm",
+ BeddingAngle=41,
+ DiameterD70=0.00019999999999999998,
+ PermeabKx=0.0004,
+ WhitesConstant=0.25,
+ AbovePhreaticLevel=18,
+ BelowPhreaticLevel=19,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0.5,
+ FrictionAngle=22,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
+ )
+ soil_6 = Soil(
+ Name="wl_zand2",
+ BeddingAngle=42,
+ DiameterD70=0.000215,
+ PermeabKx=0.0008,
+ WhitesConstant=0.25,
+ AbovePhreaticLevel=18,
+ BelowPhreaticLevel=19,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0,
+ FrictionAngle=32,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
+ )
+ soil_7 = Soil(
+ Name="wl_zand3",
+ BeddingAngle=43,
+ DiameterD70=0.00021999999999999998,
+ PermeabKx=0.0007,
+ WhitesConstant=0.25,
+ AbovePhreaticLevel=18,
+ BelowPhreaticLevel=19,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0,
+ FrictionAngle=32,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
+ )
+ soil_8 = Soil(
+ Name="wl_zand4",
+ BeddingAngle=44,
+ DiameterD70=0.000225,
+ PermeabKx=0.0006,
+ WhitesConstant=0.25,
+ AbovePhreaticLevel=18,
+ BelowPhreaticLevel=19,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0,
+ FrictionAngle=32,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
+ )
+ soil_9 = Soil(
+ Name="wl_zand5",
+ BeddingAngle=45,
+ DiameterD70=0.00022999999999999998,
+ PermeabKx=0.0005,
+ WhitesConstant=0.25,
+ AbovePhreaticLevel=18,
+ BelowPhreaticLevel=19,
+ DryUnitWeight=0.01,
+ ShearStrengthModel=ShearStrengthModelType.CPhi,
+ UseDefaultShearStrengthModel=False,
+ Cohesion=0,
+ FrictionAngle=32,
+ DilatancyType=DilatancyTypeModel.Phi,
+ RRatio=1,
+ StrengthIncreaseExponent=0.7,
+ RatioCuPc=0.22,
+ )
+ return [soil_1, soil_2, soil_3, soil_4, soil_5, soil_6, soil_7, soil_8, soil_9]
+
def create_stability_parameters(self) -> StabilityParameters:
return StabilityParameters(
SearchMethod=SearchMethodType.Calculationgrid,
@@ -196,22 +361,29 @@
soil_layer_1 = Layer1D(
Name="L0",
SoilName=soil_names[0],
- TopLevel=0,
+ TopLevel=10,
IsAquifer=False,
WaterpressureInterpolationModel=WaterpressureInterpolationModelType.Automatic,
)
soil_layer_2 = Layer1D(
Name="L1",
SoilName=soil_names[1],
- TopLevel=-2,
+ TopLevel=0,
IsAquifer=False,
WaterpressureInterpolationModel=WaterpressureInterpolationModelType.Automatic,
)
+ soil_layer_3 = Layer1D(
+ Name="L2",
+ SoilName=soil_names[2],
+ TopLevel=-2,
+ IsAquifer=True,
+ WaterpressureInterpolationModel=WaterpressureInterpolationModelType.Automatic,
+ )
return [
SoilProfile1D(
- Name="Soil profile",
+ Name="soilprofile_01",
BottomLevel=-10,
- Layers1D=[soil_layer_1, soil_layer_2],
+ Layers1D=[soil_layer_1, soil_layer_2, soil_layer_3],
)
]
@@ -221,7 +393,9 @@
# create soil class
soils = self.create_soils()
test_stabilty_parameters = self.create_stability_parameters()
- soil_profiles = self.create_profiles([soils[0].Name, "wrong soil name"])
+ soil_profiles = self.create_profiles(
+ [soils[0].Name, "wrong soil name", "wrong soil name"]
+ )
segments = self.define_segment([soil_profiles[0].Name, soil_profiles[0].Name])
# run test
error_message = "Soil with name wrong soil name"
@@ -244,7 +418,9 @@
soils = self.create_soils()
# Create stability parameters
test_stabilty_parameters = self.create_stability_parameters()
- soil_profiles = self.create_profiles([soils[0].Name, soils[1].Name])
+ soil_profiles = self.create_profiles(
+ [soils[0].Name, soils[1].Name, soils[1].Name]
+ )
segments = self.define_segment([soil_profiles[0].Name, "Wrong profile"])
# run test
error_message = "Wrong profile"
@@ -267,7 +443,9 @@
soils = self.create_soils()
# Create stability parameters
test_stabilty_parameters = self.create_stability_parameters()
- soil_profiles = self.create_profiles([soils[0].Name, soils[1].Name])
+ soil_profiles = self.create_profiles(
+ ["Dijkmateriaal", "Deklaag_klei", "wl_zand1"]
+ )
segments = self.define_segment([soil_profiles[0].Name, soil_profiles[0].Name])
locations = self.define_locations()
# Make input class
@@ -278,6 +456,9 @@
SoilProfiles1D=soil_profiles,
Segments=segments,
Locations=locations,
+ StabilityModelType=StabilityType.UpliftVan,
+ FailureMechanismSystemType=FailureMechanismSystem.StabilityInside,
+ ProjectPath=Path(""),
)
assert model
# run test
Index: DamClients/DamPythonInterface/trunk/src/tests/test_output/test_full_output.xml
===================================================================
diff -u -r3501 -r3508
--- DamClients/DamPythonInterface/trunk/src/tests/test_output/test_full_output.xml (.../test_full_output.xml) (revision 3501)
+++ DamClients/DamPythonInterface/trunk/src/tests/test_output/test_full_output.xml (.../test_full_output.xml) (revision 3508)
@@ -1,52 +1,53 @@
-
+
+
-
+
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
-
-
-
-
+
+
+
+
-
+
Index: DamClients/DamPythonInterface/trunk/src/dampythoninterface/location.py
===================================================================
diff -u -r3501 -r3508
--- DamClients/DamPythonInterface/trunk/src/dampythoninterface/location.py (.../location.py) (revision 3501)
+++ DamClients/DamPythonInterface/trunk/src/dampythoninterface/location.py (.../location.py) (revision 3508)
@@ -249,6 +249,7 @@
General: general options
DesignScenarios: list of design scenarios
StabilityOptions: stability options
+ WaternetOptions: waternet options
"""
@@ -264,6 +265,7 @@
General: Optional[General]
DesignScenarios: List[DesignScenario]
StabilityOptions: Optional[StabilityOptions]
+ WaternetOptions: Optional[WaternetOptions]
def serialize(self) -> et.Element:
"""Function that serializes the Location class."""
Index: DamClients/DamPythonInterface/trunk/src/dampythoninterface/surface_line.py
===================================================================
diff -u -r3479 -r3508
--- DamClients/DamPythonInterface/trunk/src/dampythoninterface/surface_line.py (.../surface_line.py) (revision 3479)
+++ DamClients/DamPythonInterface/trunk/src/dampythoninterface/surface_line.py (.../surface_line.py) (revision 3508)
@@ -33,24 +33,24 @@
Enumeration class for the characteristic point type.
"""
- NONE = 1
- SurfaceLevelOutside = 2
- DikeToeAtRiver = 3
- ShoulderTopOutside = 4
- ShoulderBaseOutside = 5
- DikeTopAtRiver = 6
- DikeLine = 7
- TrafficLoadOutside = 8
- TrafficLoadInside = 9
- DikeTopAtPolder = 10
- ShoulderBaseInside = 11
- ShoulderTopInside = 12
- DikeToeAtPolder = 13
- DitchDikeSide = 14
- BottomDitchDikeSide = 15
- BottomDitchPolderSide = 16
- DitchPolderSide = 17
- SurfaceLevelInside = 18
+ NONE = 0
+ SurfaceLevelOutside = 1
+ DikeToeAtRiver = 5
+ ShoulderTopOutside = 6
+ ShoulderBaseOutside = 7
+ DikeTopAtRiver = 8
+ DikeLine = 9
+ TrafficLoadOutside = 10
+ TrafficLoadInside = 11
+ DikeTopAtPolder = 12
+ ShoulderBaseInside = 13
+ ShoulderTopInside = 14
+ DikeToeAtPolder = 15
+ DitchDikeSide = 16
+ BottomDitchDikeSide = 17
+ BottomDitchPolderSide = 18
+ DitchPolderSide = 19
+ SurfaceLevelInside = 25
class Point(BaseDataClass):