# Copyright (C) Stichting Deltares 2021. All rights reserved. # # This file is part of the Dam Python Interface. # # The Dam Python Interface 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. from .base_class import BaseDataClass from typing import Optional from enum import Enum import lxml.etree as et class ShearStrengthModelType(Enum): """Enum class that contains different shear strength models of D-Stability.""" NONE = "None" CPhi = "CPhi" StressTable = "StressTable" PseudoValues = "PseudoValues" SuMeasured = "SuMeasured" SuCalculated = "SuCalculated" SuGradient = "SuGradient" SuCalculatedWithYield = "SuCalculatedWithYield" CPhiOrSuCalculated = "CPhiOrSuCalculated" class DilatancyTypeModel(Enum): """ """ Phi = "Phi" Zero = "Zero" MinusPhi = "MinusPhi" class Soil(BaseDataClass): """ Dataclass that contains soil parameters. :param Name: Name of the soil :param BeddingAngle: bedding angle :param DiameterD70: 70%-fractile of the aquifer’s grain size distribution :param PermeabKx: Permeability of soil :param WhitesConstant: White’s constant :param DiameterD90: 90%-fractile of the aquifer’s grain size distribution :param AbovePhreaticLevel: unit weight above phreatic line :param BelowPhreaticLevel: unit weight below phreatic line :param DryUnitWeight: dry unit weight of soil :param ShearStrengthModel: shear strength model of the soil for D-Stability calculation :param UseDefaultShearStrengthModel: option that determines if the default shear strength model should be used :param Cohesion: cohesion of the soil :param FrictionAngle: friction angle :param Ocr: Overconsolidation ratio :param SlopeRestProfile: outdated value that determines the slope of the resting profile :param DilatancyType: dilatancy type model :param RRatio: outdated value of R ratio :param StrengthIncreaseExponent: strength increase exponent m :param RatioCuPc: ratio between Cu and Pc """ Name: str BeddingAngle: Optional[float] = 37 DiameterD70: Optional[float] = 208 PermeabKx: Optional[float] = None WhitesConstant: Optional[float] = 0.25 DiameterD90: Optional[float] = None AbovePhreaticLevel: Optional[float] = None BelowPhreaticLevel: Optional[float] = None DryUnitWeight: Optional[float] = None ShearStrengthModel: Optional[ShearStrengthModelType] = ShearStrengthModelType.NONE UseDefaultShearStrengthModel: Optional[bool] = False Cohesion: Optional[float] = None FrictionAngle: Optional[float] = None Ocr: Optional[float] = None SlopeRestProfile: Optional[float] = None DilatancyType: Optional[DilatancyTypeModel] = DilatancyTypeModel.Zero RRatio: Optional[float] = None StrengthIncreaseExponent: Optional[float] = None RatioCuPc: Optional[float] = None def serialize_soil(self) -> et.Element: """ Function that serializes the Soil class. """ soil_root = et.Element("Soil") dictionary_of_values = self.dict() for field, value in dictionary_of_values.items(): if value is None: soil_root.set(field, str(1)) elif isinstance(value, Enum): soil_root.set(field, value.value) elif isinstance(value, bool): soil_root.set(field, str(value).lower()) else: soil_root.set(field, str(value)) return soil_root