Index: DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs =================================================================== diff -u -r6866 -r6867 --- DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 6866) +++ DamEngine/trunk/src/Deltares.DamEngine.Calculators/PlLinesCreator/PlLinesCreator.cs (.../PlLinesCreator.cs) (revision 6867) @@ -438,13 +438,20 @@ private bool IsPenetrationZoneCompletelyWithinInfiltrationZoneFor1DGeometry(double penetrationLength) { SoilProfile1D relevantSoilProfile = GetRelevantSoilProfileForAquiferLayersSearch(); - double bottomLevelLowestInBetweenAquiferCluster = relevantSoilProfile.GetInBetweenAquiferClusters.Last().Item2.TopLevel; + // Determine the top level of the infiltration layers: + // - if no in-between aquifer is present, it is the surface line + // - if at least one in-between aquifer is present, it is the bottom level of the lowest in-between aquifer + double bottomLevelLowestInBetweenAquiferCluster = relevantSoilProfile.TopLevel; + if (relevantSoilProfile.GetInBetweenAquiferClusters.Count > 0) + { + bottomLevelLowestInBetweenAquiferCluster = relevantSoilProfile.GetInBetweenAquiferClusters.Last().Item2.BottomLevel; + } + double topLevelBottomAquifer = relevantSoilProfile.BottomAquiferLayer.TopLevel; - // The infiltration layers are the aquitards situated between the bottom aquifer (topLevelBottomAquifer) and: - // - the surface line if no in-between aquifer is present - // - the lowest in-between aquifer (bottomLevelLowestInBetweenAquiferCluster) if at least one in-between aquifer is present + // The infiltration layers are the layers situated between the bottom aquifer (topLevelBottomAquifer) and the top level + // of the infiltration layers (bottomLevelLowestInBetweenAquiferCluster) IList infiltrationLayers = (from SoilLayer1D layer in relevantSoilProfile.Layers - where (relevantSoilProfile.InBetweenAquiferLayer == null || layer.TopLevel < bottomLevelLowestInBetweenAquiferCluster) && + where layer.TopLevel <= bottomLevelLowestInBetweenAquiferCluster && layer.TopLevel > topLevelBottomAquifer select layer).ToList(); if (infiltrationLayers.Count > 0)