Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dense data performance improvement #35

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions src/pyopmspe11/visualization/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,7 @@ def handle_inactive_mapping(dig, dil):
"""Set to inf the inactive grid centers in the reporting grid"""
var_array = np.empty(dig["noxz"]) * np.nan
var_array[dig["actind"]] = 0.0
for i in np.unique(dil["cell_ind"]):
for i in range(dig["nocellst"]):
inds = i == dil["cell_ind"]
if np.isnan(np.sum(var_array[inds])):
dil["refxgrid"][i] = np.inf
Expand Down Expand Up @@ -815,7 +815,7 @@ def static_map_to_report_grid_performance_spatial(dig, dil):
np.array(dig["init"].iget_kw("DZ")[0]),
np.array(dig["init"].iget_kw("DX")[0]),
)
for i in np.unique(dil["cell_ind"]):
for i in range(dig["nocellst"]):
inds = i == dil["cell_ind"]
p_v = np.sum(dig["porv"][inds])
if p_v > 0:
Expand Down Expand Up @@ -855,7 +855,7 @@ def map_to_report_grid_performance_spatial(dig, dil, names, d_t):
"""Map the simulation grid to the reporting grid"""
for name in names:
dil[f"{name}_refg"] = np.empty(dig["nocellsr"]) * np.nan
for i in np.unique(dil["cell_ind"]):
for i in range(dig["nocellst"]):
inds = i == dil["cell_ind"]
p_v = np.sum(dig["porv"][inds])
if p_v > 0:
Expand Down Expand Up @@ -920,6 +920,7 @@ def generate_arrays(dig, dil, names, t_n):
"""Numpy arrays for the dense data"""
for name in names:
dil[f"{name}_array"] = np.zeros(dig["nocellst"])
dil[f"{name}_refg"] = np.empty(dig["nocellsr"]) * np.nan
if dig["use"] == "opm":
sgas = np.array(dig["unrst"]["SGAS", t_n])
rhog = np.array(dig["unrst"]["GAS_DEN", t_n])
Expand Down Expand Up @@ -979,12 +980,11 @@ def compute_xh20(dig, dil, h2o_v, co2_g):

def map_to_report_grid(dig, dil, names):
"""Map the simulation grid to the reporting grid"""
for name in names:
dil[f"{name}_refg"] = np.empty(dig["nocellsr"]) * np.nan
for i in np.unique(dil["cell_ind"]):
inds = i == dil["cell_ind"]
p_v = np.sum(dig["porv"][inds])
if p_v > 0:
for i in range(dig["nocellst"]):
inds = i == dil["cell_ind"]
p_v = np.sum(dig["porv"][inds])
if p_v > 0:
for name in names:
if name == "tco2":
dil[f"{name}_refg"][i] = np.sum(dil[f"{name}_array"][inds])
else:
Expand Down
Loading