using System; using Deltares.DamEngine.Data.Properties; namespace Deltares.DamEngine.Data.Geotechnics { public static class SoilProfile1DAquiferLayerCombiner { public struct AquiferLayerProperties { public double D70; public double Height; public double PermeabilityKx; } /// /// Combines the aquifer layers. /// /// The 1D soil profile. /// Name of the top layer. /// Properties of the combined aquifer layers /// InconsistentWaterpressureInterpolationModel public static AquiferLayerProperties CombineLayers(SoilProfile1D soilProfile1D, string topLayerName) { SoilLayer1D layerWithName = soilProfile1D.GetLayerWithName(topLayerName); double num1 = 0.0; double diameterD70 = layerWithName.Soil.DiameterD70; double num2 = 0.0; int startLayerIndex = soilProfile1D.GetLayerIndexAt(layerWithName); WaterpressureInterpolationModel interpolationModel = layerWithName.WaterpressureInterpolationModel; for (int layerIndexAt = startLayerIndex; layerIndexAt < soilProfile1D.LayerCount && soilProfile1D.Layers[layerIndexAt].IsAquifer; ++layerIndexAt) { if (interpolationModel != soilProfile1D.Layers[layerIndexAt].WaterpressureInterpolationModel) { throw new SoilProfile1DAquiferLayerCombinerException( string.Format(Resources.SoilProfile1DAquiferLayerCombiner_CombineLayers_InconsistentWaterpressureInterpolationModel, soilProfile1D.Name)); } double layerHeight = soilProfile1D.GetLayerHeight(soilProfile1D.Layers[layerIndexAt]); num1 += layerHeight; num2 += layerHeight * soilProfile1D.Layers[layerIndexAt].Soil.PermeabKx; } AquiferLayerProperties aquiferLayer = new AquiferLayerProperties(); aquiferLayer.D70 = diameterD70; aquiferLayer.Height = num1; aquiferLayer.PermeabilityKx = num2 / num1; return aquiferLayer; } } }