// 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.HydraRing.Data;
using Ringtoets.Piping.Data.Probabilistics;
using Ringtoets.Piping.Data.Properties;
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
{
private readonly GeneralPipingInput generalInputParameters;
private RoundedDouble assessmentLevel;
private RoundedDouble exitPointL;
private RoundedDouble entryPointL;
private RoundedDouble piezometricHeadExit;
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);
assessmentLevel = new RoundedDouble(2, double.NaN);
piezometricHeadExit = new RoundedDouble(2, double.NaN);
PhreaticLevelExit = new NormalDistribution(3);
DampingFactorExit = new LognormalDistribution(3)
{
Mean = (RoundedDouble)1.0
};
ThicknessCoverageLayer = new LognormalDistribution(2)
{
Mean = (RoundedDouble)double.NaN,
StandardDeviation = (RoundedDouble)0.5
};
SaturatedVolumicWeightOfCoverageLayer = new ShiftedLognormalDistribution(2)
{
Shift = (RoundedDouble) 10,
Mean = (RoundedDouble) 17.5,
StandardDeviation = (RoundedDouble)0
};
SeepageLength = new LognormalDistribution(2)
{
Mean = (RoundedDouble)double.NaN,
StandardDeviation = (RoundedDouble)double.NaN
};
Diameter70 = new LognormalDistribution(2);
DarcyPermeability = new LognormalDistribution(3);
ThicknessAquiferLayer = new LognormalDistribution(2)
{
Mean = (RoundedDouble)double.NaN,
StandardDeviation = (RoundedDouble)0.5
};
}
///
/// Gets or sets the outside high water level.
/// [m]
///
public RoundedDouble AssessmentLevel
{
get
{
return assessmentLevel;
}
set
{
assessmentLevel = value.ToPrecision(assessmentLevel.NumberOfDecimalPlaces);
}
}
///
/// Gets or sets the piezometric head at the exit point.
/// [m]
///
public RoundedDouble PiezometricHeadExit
{
get
{
return piezometricHeadExit;
}
set
{
piezometricHeadExit = value.ToPrecision(piezometricHeadExit.NumberOfDecimalPlaces);
}
}
///
/// 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]
///
/// is less than 0.
public RoundedDouble EntryPointL
{
get
{
return entryPointL;
}
set
{
if (value < 0.0)
{
throw new ArgumentOutOfRangeException("value", Resources.PipingInput_EntryPointL_Value_must_be_greater_than_or_equal_to_zero);
}
entryPointL = value.ToPrecision(entryPointL.NumberOfDecimalPlaces);
}
}
///
/// 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]
///
/// is less than or equal to 0.
public RoundedDouble ExitPointL
{
get
{
return exitPointL;
}
set
{
if (value <= 0.0)
{
throw new ArgumentOutOfRangeException("value", Resources.PipingInput_ExitPointL_Value_must_be_greater_than_zero);
}
exitPointL = value.ToPrecision(exitPointL.NumberOfDecimalPlaces);
}
}
///
/// Gets or sets the surface line.
///
public RingtoetsPipingSurfaceLine SurfaceLine
{
get
{
return surfaceLine;
}
set
{
surfaceLine = value;
UpdateEntryAndExitPoint();
}
}
///
/// Gets or sets the profile which contains a 1 dimensional definition of soil layers with properties.
///
public PipingSoilProfile SoilProfile { get; set; }
///
/// Gets or set the hydraulic boundary location from which to use the assessment level.
///
public HydraulicBoundaryLocation HydraulicBoundaryLocation { get; set; }
#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 degrees Celsius.
/// [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; set; }
///
/// Gets or sets the horizontal distance between entry and exit point.
/// [m]
///
public LognormalDistribution SeepageLength { get; set; }
///
/// 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; set; }
///
/// Gets or sets the Darcy-speed with which water flows through the aquifer layer.
/// [m/s]
///
public LognormalDistribution DarcyPermeability { get; set; }
///
/// Gets or sets the thickness of the aquifer layer.
/// [m]
///
public LognormalDistribution ThicknessAquiferLayer { get; set; }
///
/// Gets or sets the total thickness of the coverage layer at the exit point.
/// [m]
///
public LognormalDistribution ThicknessCoverageLayer { get; set; }
///
/// Gets or sets the damping factor at the exit point.
///
public LognormalDistribution DampingFactorExit { get; set; }
///
/// Gets or sets the volumic weight of the saturated coverage layer.
///
public ShiftedLognormalDistribution SaturatedVolumicWeightOfCoverageLayer { get; set; }
#endregion
private void UpdateEntryAndExitPoint()
{
if (SurfaceLine == null)
{
ExitPointL = (RoundedDouble)double.NaN;
SeepageLength.Mean = (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;
}
}
}
}