// Copyright (C) Stichting Deltares 2016. All rights reserved. // // This file is part of Ringtoets. // // Ringtoets is free software: you can redistribute it and/or modify // it under the terms of the GNU 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 General Public License for more details. // // You should have received a copy of the GNU 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 Core.Common.Base; using Core.Common.Base.Data; using Core.Common.Base.Geometry; using Ringtoets.Common.Data.Calculation; using Ringtoets.Common.Data.Probabilistics; using Ringtoets.HydraRing.Data; using Ringtoets.Piping.Data.Properties; using Ringtoets.Piping.Primitives; namespace Ringtoets.Piping.Data { /// /// Class that holds all piping calculation specific input parameters, e.g. the values /// that can differ across various calculations. /// public class PipingInput : Observable, ICalculationInput { private readonly GeneralPipingInput generalInputParameters; private readonly NormalDistribution phreaticLevelExit; private readonly LogNormalDistribution dampingFactorExit; private readonly ShiftedLogNormalDistribution saturatedVolumicWeightOfCoverageLayer; private readonly LogNormalDistribution darcyPermeability; private readonly LogNormalDistribution diameter70; private RoundedDouble exitPointL; private RoundedDouble entryPointL; private RingtoetsPipingSurfaceLine surfaceLine; /// /// Initializes a new instance of the class. /// /// General piping calculation parameters that /// are the same across all piping calculations. /// When /// is null. public PipingInput(GeneralPipingInput generalInputParameters) { if (generalInputParameters == null) { throw new ArgumentNullException("generalInputParameters"); } this.generalInputParameters = generalInputParameters; exitPointL = new RoundedDouble(2, double.NaN); entryPointL = new RoundedDouble(2, double.NaN); phreaticLevelExit = new NormalDistribution(3); dampingFactorExit = new LogNormalDistribution(3) { Mean = (RoundedDouble) 0.7, StandardDeviation = (RoundedDouble) 0.0 }; saturatedVolumicWeightOfCoverageLayer = new ShiftedLogNormalDistribution(2) { Shift = (RoundedDouble) 10, Mean = (RoundedDouble) 17.5, StandardDeviation = (RoundedDouble) 0 }; diameter70 = new LogNormalDistribution(2); darcyPermeability = new LogNormalDistribution(3); } /// /// Gets or sets the l-coordinate of the entry point, which, together with /// the l-coordinate of the exit point, is used to determine the seepage /// length of . /// [m] /// /// Thrown when either: /// /// is smaller or equal to . /// is not on the . /// /// public RoundedDouble EntryPointL { get { return entryPointL; } set { var newEntryPoint = value.ToPrecision(entryPointL.NumberOfDecimalPlaces); ValidateEntryExitPoint(newEntryPoint, exitPointL); ValidatePointOnSurfaceLine(newEntryPoint); entryPointL = newEntryPoint; } } /// /// Gets or sets the l-coordinate of the exit point, which, together with /// the l-coordinate of the entry point, is used to determine the seepage /// length of . /// [m] /// /// Thrown when either: /// /// is smaller or equal to . /// is not on the . /// /// public RoundedDouble ExitPointL { get { return exitPointL; } set { var newExitPoint = value.ToPrecision(exitPointL.NumberOfDecimalPlaces); ValidateEntryExitPoint(entryPointL, newExitPoint); ValidatePointOnSurfaceLine(newExitPoint); exitPointL = newExitPoint; } } private void ValidateEntryExitPoint(RoundedDouble entryPoint, RoundedDouble exitPoint) { if (!double.IsNaN(entryPoint) && !double.IsNaN(exitPoint) && entryPoint >= exitPoint) { throw new ArgumentOutOfRangeException(null, Resources.PipingInput_EntryPointL_greater_or_equal_to_ExitPointL); } } private void ValidatePointOnSurfaceLine(RoundedDouble newPoint) { if (surfaceLine != null) { surfaceLine.ValidateInRange(newPoint, surfaceLine.ProjectGeometryToLZ().ToArray()); } } /// /// Gets or sets the surface line. /// public RingtoetsPipingSurfaceLine SurfaceLine { get { return surfaceLine; } set { surfaceLine = value; UpdateEntryAndExitPoint(); } } /// /// Gets or sets the stochastic soil model which is linked to the . /// public StochasticSoilModel StochasticSoilModel { get; set; } /// /// Gets or sets the profile which contains a 1 dimensional definition of soil layers with properties. /// public StochasticSoilProfile StochasticSoilProfile { get; set; } /// /// Gets or set the hydraulic boundary location from which to use the assessment level. /// public HydraulicBoundaryLocation HydraulicBoundaryLocation { get; set; } private void UpdateEntryAndExitPoint() { if (SurfaceLine == null) { ExitPointL = (RoundedDouble) double.NaN; } else { int entryPointIndex = Array.IndexOf(SurfaceLine.Points, SurfaceLine.DikeToeAtRiver); int exitPointIndex = Array.IndexOf(SurfaceLine.Points, SurfaceLine.DikeToeAtPolder); Point2D[] localGeometry = SurfaceLine.ProjectGeometryToLZ().ToArray(); double tempEntryPointL = localGeometry[0].X; double tempExitPointL = localGeometry[localGeometry.Length - 1].X; bool isDifferentPoints = entryPointIndex < 0 || exitPointIndex < 0 || entryPointIndex < exitPointIndex; if (isDifferentPoints && exitPointIndex > 0) { tempExitPointL = localGeometry.ElementAt(exitPointIndex).X; } if (isDifferentPoints && entryPointIndex > -1) { tempEntryPointL = localGeometry.ElementAt(entryPointIndex).X; } ExitPointL = (RoundedDouble) tempExitPointL; EntryPointL = (RoundedDouble) tempEntryPointL; } } #region Derived input /// /// Gets the outside high water level. /// [m] /// public RoundedDouble AssessmentLevel { get { return new DerivedPipingInput(this).AssessmentLevel; } } /// /// Gets the piezometric head at the exit point. /// [m] /// public RoundedDouble PiezometricHeadExit { get { return new DerivedPipingInput(this).PiezometricHeadExit; } } #endregion #region General input parameters /// /// Gets the reduction factor Sellmeijer. /// public double SellmeijerReductionFactor { get { return generalInputParameters.SellmeijerReductionFactor; } } /// /// Gets the volumetric weight of water. /// [kN/m³] /// public double WaterVolumetricWeight { get { return generalInputParameters.WaterVolumetricWeight; } } /// /// Gets the (lowerbound) volumic weight of sand grain material of a sand layer under water. /// [kN/m³] /// public double SandParticlesVolumicWeight { get { return generalInputParameters.SandParticlesVolumicWeight; } } /// /// Gets the White's drag coefficient. /// public double WhitesDragCoefficient { get { return generalInputParameters.WhitesDragCoefficient; } } /// /// Gets the kinematic viscosity of water at 10 °C. /// [m²/s] /// public double WaterKinematicViscosity { get { return generalInputParameters.WaterKinematicViscosity; } } /// /// Gets the gravitational acceleration. /// [m/s²] /// public double Gravity { get { return generalInputParameters.Gravity; } } /// /// Gets the mean diameter of small scale tests applied to different kinds of sand, on which the formula of Sellmeijer has been fit. /// [m] /// public double MeanDiameter70 { get { return generalInputParameters.MeanDiameter70; } } /// /// Gets the angle of the force balance representing the amount in which sand grains resist rolling. /// [°] /// public double BeddingAngle { get { return generalInputParameters.BeddingAngle; } } /// /// Gets the calculation value used to account for uncertainty in the model for uplift. /// public double UpliftModelFactor { get { return generalInputParameters.UpliftModelFactor; } } /// /// Gets the calculation value used to account for uncertainty in the model for Sellmeijer. /// public double SellmeijerModelFactor { get { return generalInputParameters.SellmeijerModelFactor; } } /// /// Gets the critical exit gradient for heave. /// public double CriticalHeaveGradient { get { return generalInputParameters.CriticalHeaveGradient; } } #endregion #region Probabilistic parameters /// /// Gets or sets the phreatic level at the exit point. /// [m] /// public NormalDistribution PhreaticLevelExit { get { return phreaticLevelExit; } set { phreaticLevelExit.Mean = value.Mean; phreaticLevelExit.StandardDeviation = value.StandardDeviation; } } /// /// Gets or sets the horizontal distance between entry and exit point. /// [m] /// public LogNormalDistribution SeepageLength { get { return new DerivedPipingInput(this).SeepageLength; } } /// /// Gets or sets the sieve size through which 70% fraction of the grains of the top part of the aquifer passes. /// [m] /// public LogNormalDistribution Diameter70 { get { return diameter70; } set { diameter70.Mean = value.Mean; diameter70.StandardDeviation = value.StandardDeviation; } } /// /// Gets or sets the Darcy-speed with which water flows through the aquifer layer. /// [m/s] /// public LogNormalDistribution DarcyPermeability { get { return darcyPermeability; } set { darcyPermeability.Mean = value.Mean; darcyPermeability.StandardDeviation = value.StandardDeviation; } } /// /// Gets or sets the thickness of the aquifer layer. /// [m] /// public LogNormalDistribution ThicknessAquiferLayer { get { return new DerivedPipingInput(this).ThicknessAquiferLayer; } } /// /// Gets or sets the total thickness of the coverage layer at the exit point. /// [m] /// public LogNormalDistribution ThicknessCoverageLayer { get { return new DerivedPipingInput(this).ThicknessCoverageLayer; } } /// /// Gets or sets the damping factor at the exit point. /// public LogNormalDistribution DampingFactorExit { get { return dampingFactorExit; } set { dampingFactorExit.Mean = value.Mean; dampingFactorExit.StandardDeviation = value.StandardDeviation; } } /// /// Gets or sets the volumic weight of the saturated coverage layer. /// public ShiftedLogNormalDistribution SaturatedVolumicWeightOfCoverageLayer { get { return saturatedVolumicWeightOfCoverageLayer; } set { saturatedVolumicWeightOfCoverageLayer.Mean = value.Mean; saturatedVolumicWeightOfCoverageLayer.StandardDeviation = value.StandardDeviation; saturatedVolumicWeightOfCoverageLayer.Shift = value.Shift; } } #endregion } }