From f66f05ad0ebbe936da18d7bfe3081b245de1640c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olav=20M=C3=B8yner?= Date: Tue, 5 Nov 2024 09:39:12 +0100 Subject: [PATCH] Support for DXV/DYV/DZV --- src/CornerPointGrid/interface.jl | 55 ++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 20 deletions(-) diff --git a/src/CornerPointGrid/interface.jl b/src/CornerPointGrid/interface.jl index 26f3d54..b45cf6c 100644 --- a/src/CornerPointGrid/interface.jl +++ b/src/CornerPointGrid/interface.jl @@ -99,32 +99,47 @@ function mesh_from_dxdydz_and_tops(grid; actnum = get_effective_actnum(grid)) end return out end - DX = meshgrid_section("DX") - dx = vec(DX[:, 1, 1]) - for i in axes(DX, 1) - for j in axes(DX, 2) - for k in axes(DX, 3) - @assert DX[i, j, k] ≈ DX[i, 1, 1] + if haskey(grid, "DX") + DX = meshgrid_section("DX") + dx = vec(DX[:, 1, 1]) + for i in axes(DX, 1) + for j in axes(DX, 2) + for k in axes(DX, 3) + @assert DX[i, j, k] ≈ DX[i, 1, 1] + end end end - end - DY = meshgrid_section("DY") - dy = vec(DY[1, :, 1]) - for i in axes(DY, 1) - for j in axes(DY, 2) - for k in axes(DY, 3) - @assert DY[i, j, k] ≈ DY[1, j, 1] + else + @assert haskey(grid, "DXV") "Either DX or DXV must be provided in GRID." + dx = vec(grid["DXV"]) + end + if haskey(grid, "DY") + DY = meshgrid_section("DY") + dy = vec(DY[1, :, 1]) + for i in axes(DY, 1) + for j in axes(DY, 2) + for k in axes(DY, 3) + @assert DY[i, j, k] ≈ DY[1, j, 1] + end end end - end - DZ = meshgrid_section("DZ") - dz = vec(DZ[1, 1, :]) - for i in axes(DZ, 1) - for j in axes(DZ, 2) - for k in axes(DZ, 3) - @assert DZ[i, j, k] ≈ DZ[1, 1, k] + else + @assert haskey(grid, "DYV") "Either DY or DYV must be provided in GRID." + dy = vec(grid["DYV"]) + end + if haskey(grid, "DZ") + DZ = meshgrid_section("DZ") + dz = vec(DZ[1, 1, :]) + for i in axes(DZ, 1) + for j in axes(DZ, 2) + for k in axes(DZ, 3) + @assert DZ[i, j, k] ≈ DZ[1, 1, k] + end end end + else + @assert haskey(grid, "DZV") "Either DZ or DZV must be provided in GRID." + dz = vec(grid["DZV"]) end TOPS = meshgrid_section("TOPS") tops = TOPS[:, :, 1]