Summary
When cpgrid_from_horizons generates a grid with zero-thickness cells (from horizons that are equal at some pillar columns), the pinched cells survive into the final mesh as active cells with zero volume and NaN centroids. mesh_from_grid_section does not deactivate them because programmatically generated grids lack PINCH keyword data — the pinch processing path relies on Eclipse deck metadata that doesn't exist here.
Minimal reproducer
using GeoEnergyIO: cpgrid_from_horizons, mesh_from_grid_section
using JutulDarcy: reservoir_domain
# 3×3 grid, 2 layers. Layer 2 is pinched to zero thickness at column (2,2).
X = range(0.0, 300.0; length=4)
Y = range(0.0, 300.0; length=4)
h1 = fill(100.0, 4, 4) # top
h2 = fill(200.0, 4, 4) # middle
h3 = fill(300.0, 4, 4) # bottom
# Pinch: make h2 == h3 at pillars surrounding column (2,2)
for j in 2:3, i in 2:3
h2[i, j] = h3[i, j]
end
data = cpgrid_from_horizons(X, Y, [h1, h2, h3])
mesh = mesh_from_grid_section(data)
domain = reservoir_domain(mesh)
cc = domain[:cell_centroids]
vols = domain[:volumes]
nc = size(cc, 2)
println("Total cells: $nc (expected 17, got 18)") # pinched cell not deactivated
nan_count = count(i -> any(isnan, @view cc[:, i]), 1:nc)
zero_vol = count(==(0.0), vols)
println("NaN centroids: $nan_count, zero-volume: $zero_vol")
# Output:
# Total cells: 18 (expected 17, got 18)
# NaN centroids: 1, zero-volume: 1
Expected behavior
The pinched cell should be excluded from the mesh (deactivated via ACTNUM or equivalent), producing 17 active cells with no NaN centroids and no zero-volume cells.
Environment
- GeoEnergyIO v1.1.31
- Julia 1.11.8
Summary
When
cpgrid_from_horizonsgenerates a grid with zero-thickness cells (from horizons that are equal at some pillar columns), the pinched cells survive into the final mesh as active cells with zero volume and NaN centroids.mesh_from_grid_sectiondoes not deactivate them because programmatically generated grids lack PINCH keyword data — the pinch processing path relies on Eclipse deck metadata that doesn't exist here.Minimal reproducer
Expected behavior
The pinched cell should be excluded from the mesh (deactivated via ACTNUM or equivalent), producing 17 active cells with no NaN centroids and no zero-volume cells.
Environment