Skip to content

Commit

Permalink
Adding back and front pv buffer in spe11c
Browse files Browse the repository at this point in the history
  • Loading branch information
daavid00 committed Jul 19, 2024
1 parent 5e54a42 commit 6455dfa
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/hello_world/spe11a.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
flow --tolerance-mb=1e-7 --linear-solver=cprw --enable-tuning=true --newton-min-iterations=1 --enable-opm-rst-file=true --output-extra-convergence-info=steps,iterations --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
spe11a master #Name of the spe case (spe11a, spe11b, or spe11c) and OPM Flow version (master or release)
spe11a release #Name of the spe case (spe11a, spe11b, or spe11c) and OPM Flow version (master or release)
complete gaswater #Name of the co2 model (immiscible or complete) and co2store implementation (gaswater or gasoil [oil properties are set to water internally in OPM flow])
tensor #Type of grid (cartesian, tensor, or corner-point)
2.8 0.01 1.2 #Length, width, and depth [m]
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/spe11b.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
flow --tolerance-mb=1e-7 --linear-solver=cprw --enable-tuning=true --newton-min-iterations=1 --enable-opm-rst-file=true --output-extra-convergence-info=steps,iterations --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
spe11b master #Name of the spe case (spe11a, spe11b, or spe11c) and OPM Flow version (master or release)
spe11b release #Name of the spe case (spe11a, spe11b, or spe11c) and OPM Flow version (master or release)
complete gaswater #Name of the co2 model (immiscible or complete) and co2store implementation (gaswater or gasoil [oil properties are set to water internally in OPM flow])
corner-point #Type of grid (cartesian, tensor, or corner-point)
8400 1 1200 #Length, width, and depth [m]
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world/spe11c.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
flow --tolerance-mb=1e-7 --linear-solver=cprw --enable-tuning=true --newton-min-iterations=1 --enable-opm-rst-file=true --output-extra-convergence-info=steps,iterations --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
spe11c master #Name of the spe case (spe11a, spe11b, or spe11c) and OPM Flow version (master or release)
spe11c release #Name of the spe case (spe11a, spe11b, or spe11c) and OPM Flow version (master or release)
complete gaswater #Name of the co2 model (immiscible or complete) and co2store implementation (gaswater or gasoil [oil properties are set to water internally in OPM flow])
cartesian #Type of grid (cartesian, tensor, or corner-point)
8400 5000 1200 #Length, width, and depth [m]
Expand Down
61 changes: 60 additions & 1 deletion src/pyopmspe11/utils/mapproperties.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-FileCopyrightText: 2023 NORCE
# SPDX-License-Identifier: MIT
# pylint: disable=C0302, R0914
# pylint: disable=C0302, R0914, R0915

"""
Utiliy function for the grid and locations in the geological models.
Expand Down Expand Up @@ -61,6 +61,12 @@ def grid(dic):
dic["xmx"], len(dic["xmx"]) - 1, dic["xmx"][-1] - dic["widthBuffer"]
)
dic["noCells"][0] += 2
if dic["spe11"] == "spe11c" and 1.1 * dic["widthBuffer"] < dic["ymy"][1]:
dic["ymy"] = np.insert(dic["ymy"], 1, dic["widthBuffer"])
dic["ymy"] = np.insert(
dic["ymy"], len(dic["ymy"]) - 1, dic["ymy"][-1] - dic["widthBuffer"]
)
dic["noCells"][1] += 2
for name, size in zip(["xmx", "ymy", "zmz"], ["dx", "dy", "dz"]):
dic[f"{name}_center"] = (dic[f"{name}"][1:] + dic[f"{name}"][:-1]) / 2.0
dic[f"{size}"] = dic[f"{name}"][1:] - dic[f"{name}"][:-1]
Expand Down Expand Up @@ -244,6 +250,8 @@ def structured_handling_spe11bc(dic):
f"PORV {pv*dic['dy'][j+1]*dic['dz'][k]} {dic['noCells'][0]} "
+ f"{dic['noCells'][0]} {j+2} {j+2} {k+1} {k+1} /"
)
if dic["spe11"] == "spe11c":
add_pv_fipnum_front_back(dic)
dic["pop1"] = pd.Series(sensor1).argmin()
dic["pop2"] = pd.Series(sensor2).argmin()
dic["fipnum"][dic["pop1"]] = "8"
Expand All @@ -264,6 +272,49 @@ def structured_handling_spe11bc(dic):
file.write("\n".join(corners))


def add_pv_fipnum_front_back(dic):
"""
Add the buffer pore volume and bc labels also on the front and back boundaries
Args:
dic (dict): Global dictionary
Returns:
dic (dict): Modified global dictionary
"""
for k in range(dic["noCells"][2]):
for i in range(dic["noCells"][0] - 2):
ind = i + 1 + k * dic["noCells"][0] * dic["noCells"][1]
if int(dic["satnum"][ind]) != 1 and int(dic["satnum"][ind]) != 7:
pv = float(dic["poro"][ind]) * (dic["pvAdded"] + dic["widthBuffer"])
if dic["grid"] == "corner-point":
ind_xz = i + 1 + k * dic["noCells"][0]
dic["porv"].append(
f"PORV {pv*dic['d_x'][i+1]*dic['d_z'][ind_xz]} {i+2} {i+2} "
+ f"1 1 {k+1} {k+1} /"
)
dic["porv"].append(
f"PORV {pv*dic['d_x'][i+1]*dic['d_z'][ind_xz]} {i+2} {i+2} "
+ f"{dic['noCells'][1]} {dic['noCells'][1]} {k+1} {k+1} /"
)
else:
dic["porv"].append(
f"PORV {pv*dic['dx'][i+1]*dic['dz'][k]} {i+2} {i+2} "
+ f"1 1 {k+1} {k+1} /"
)
dic["porv"].append(
f"PORV {pv*dic['dx'][i+1]*dic['dz'][k]} {i+2} {i+2} "
+ f"{dic['noCells'][1]} {dic['noCells'][1]} {k+1} {k+1} /"
)
if int(dic["satnum"][ind]) == 1:
dic["fipnum"][ind] = "10"
dic["fipnum"][ind + dic["noCells"][0] * (dic["noCells"][1] - 1)] = "10"
else:
dic["fipnum"][ind] = "11"
dic["fipnum"][ind + dic["noCells"][0] * (dic["noCells"][1] - 1)] = "11"


def corner_point_handling_spe11a(dic):
"""
Locate the geological positions in the corner-point grid for the spe11a
Expand Down Expand Up @@ -488,6 +539,8 @@ def corner_point_handling_spe11bc(dic):
+ f"{dic['ijk'][2]+1} {dic['ijk'][2]+1} /"
)
xtemp, ztemp = [], []
if dic["spe11"] == "spe11c":
add_pv_fipnum_front_back(dic)
dic["pop1"] = pd.Series(sensor1).argmin()
dic["pop2"] = pd.Series(sensor2).argmin()
dic["well1"] = pd.Series(well1).argmin()
Expand Down Expand Up @@ -976,6 +1029,11 @@ def corner(dic):
dic["xmx"] = np.insert(
dic["xmx"], len(dic["xmx"]) - 1, dic["xmx"][-1] - dic["widthBuffer"]
)
if dic["spe11"] == "spe11c" and 1.1 * dic["widthBuffer"] < dic["ymy"][1]:
dic["ymy"] = np.insert(dic["ymy"], 1, dic["widthBuffer"])
dic["ymy"] = np.insert(
dic["ymy"], len(dic["ymy"]) - 1, dic["ymy"][-1] - dic["widthBuffer"]
)
for xcor in dic["xmx"]:
for _, lcor in enumerate(lines):
dic["xcor"].append(xcor)
Expand Down Expand Up @@ -1010,6 +1068,7 @@ def corner(dic):
dic["xmx"] = np.array(dic["xmx"])
dic["ymy_center"] = 0.5 * (np.array(dic["ymy"])[1:] + np.array(dic["ymy"])[:-1])
dic["d_y"] = np.array(dic["ymy"])[1:] - np.array(dic["ymy"])[:-1]
dic["d_x"] = np.array(dic["xmx"])[1:] - np.array(dic["xmx"])[:-1]


def refinement_z(xci, zci, ncx, ncz, znr):
Expand Down

0 comments on commit 6455dfa

Please sign in to comment.