// Copyright (C) Stichting Deltares 2017. All rights reserved. // // This file is part of the DAM Engine. // // The DAM Engine 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. using System; using System.Collections.Generic; using Deltares.DamEngine.Data.Geotechnics; namespace Deltares.DamEngine.Data.RWScenarios { public class AquitardEvaluatorException : Exception { public AquitardEvaluatorException(string message) : base(message) { } } public class AquitardEvaluator { private SoilProfile1D soilProfile; const double CMinimimalUnitWeightAquitard = 12.0; // kN/m2 public AquitardEvaluator(SoilProfile1D soilProfile) { this.soilProfile = soilProfile; } /// /// Sum all aquitards between boezembottom and aquifer with a minimum weight of CMinimimalUnitWeightAquitard /// /// /// public double DetermineAquitardThicknessWithMinimalWeight(double surfaceLevel, Soil embankmentMaterial) { return DetermineAquitardThickness(surfaceLevel, true, embankmentMaterial); } /// /// Sum all aquitards between boezembottom and aquifer without check on minimum weight /// /// /// public double DetermineAquitardThicknessWithoutMinimalWeight(double surfaceLevel, Soil embankmentMaterial) { return DetermineAquitardThickness(surfaceLevel, false, embankmentMaterial); } /// /// Sum all aquitards between boezembottom and aquifer /// /// /// /// private double DetermineAquitardThickness(double surfaceLevel, bool checkOnMinimalWeight, Soil embankmentMaterial) { ThrowExceptionWhenSurfaceLevelOutsideProfile(surfaceLevel, embankmentMaterial); double aquitardBottomLevel = this.soilProfile.GetTopLevelOfHighestAquifer(); double thickness = 0.0; List layers = new List(this.soilProfile.Layers); if (surfaceLevel > soilProfile.TopLevel) { SoilLayer1D embankmentLayer = new SoilLayer1D(embankmentMaterial, surfaceLevel); layers.Insert(0, embankmentLayer); } foreach (SoilLayer1D layer in layers) { bool includeLayer = true; // Only include layer if soil has minimal weight if (checkOnMinimalWeight) { includeLayer = layer.Soil.BelowPhreaticLevel >= CMinimimalUnitWeightAquitard; } // Only include layer if soil is waterremmend (clay or peat) includeLayer = includeLayer && (layer.Soil.SoilType == SoilType.Clay || layer.Soil.SoilType == SoilType.Peat); if (includeLayer) { double levelTop = Math.Min(surfaceLevel, layer.TopLevel); double levelBottom = soilProfile.TopLevel; if (soilProfile.Layers.Contains(layer)) { levelBottom = Math.Max(aquitardBottomLevel, layer.TopLevel - soilProfile.GetLayerHeight(layer)); } if (levelTop > levelBottom) { thickness += (levelTop - levelBottom); } } } return thickness; } public double DetermineAquitardClayThickness(double surfaceLevel) { ThrowExceptionWhenSurfaceLevelOutsideProfile(surfaceLevel, null); //ThrowExceptionWhenMoreThan2Aquifers(); double aquitardBottomLevel = this.soilProfile.GetTopLevelOfHighestAquifer(); double thickness = 0.0; foreach (SoilLayer1D layer in soilProfile.Layers) { if (layer.Soil.SoilType == SoilType.Clay) { double levelTop = Math.Min(surfaceLevel, layer.TopLevel); double levelBottom = Math.Max(aquitardBottomLevel, layer.TopLevel - soilProfile.GetLayerHeight(layer)); if (levelTop > levelBottom) { thickness += (levelTop - levelBottom); } } } return thickness; } private void ThrowExceptionWhenSurfaceLevelOutsideProfile(double surfaceLevel, Soil embankmentMaterial) { if (surfaceLevel < soilProfile.BottomLevel || (surfaceLevel > soilProfile.TopLevel && embankmentMaterial == null)) { throw new AquitardEvaluatorException(String.Format( "Specified z-level {0} in AquitardEvaluator outside soilprofile '{1}' (should be between {2} and {3}", surfaceLevel, soilProfile.Name, soilProfile.BottomLevel, soilProfile.TopLevel)); } } private void ThrowExceptionWhenMoreThan2Aquifers() { if (soilProfile.GetAquiferLayers().Count > 2) { throw new AquitardEvaluatorException("Soilprofile has more than 2 aquifers"); } } } }