Skip to content

Commit ee1efba

Browse files
authored
Merge pull request #66 from daavid00/dev
Writing mapping from input to coarsened model
2 parents d6494ca + f571af8 commit ee1efba

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/pycopm/utils/generate_files.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ def create_deck(dic):
147147
dic["rptrst"] = []
148148
dic["mults"] = []
149149
dic["special"] = []
150+
dic["reftocoa"] = []
150151
dic["fip"] = ""
151152
dic["nrptsrt"] = 0
152153
dic["nrptsrtc"] = 0
@@ -248,6 +249,11 @@ def create_deck(dic):
248249
for j in range(dic["yn"]):
249250
for i in range(dic["xn"]):
250251
bar_animation()
252+
dic["reftocoa"].append(
253+
dic["ic"][i + 1]
254+
+ (dic["jc"][j + 1] - 1) * dic["nx"]
255+
+ (dic["kc"][k + 1] - 1) * dic["nx"] * dic["ny"]
256+
)
251257
ind = i + j * dic["xn"] + k * dic["xn"] * dic["yn"]
252258
cxyz = dic["grid"].xyz_from_ijk(i, j, k)
253259
x_0, y_0, z_0 = 0.0, 0.0, 0.0
@@ -741,6 +747,17 @@ def write_props(dic):
741747
file.write("FIPNUM\n")
742748
file.write("".join(fips))
743749
file.write("/")
750+
elif dic["coarsening"]:
751+
oprs = [f"{int(val)} " for val in dic["reftocoa"]]
752+
oprs = compact_format("".join(f"{int(val)} " for val in oprs).split())
753+
with open(
754+
f"{dic['fol']}/{dic['deckn']}_OPERNUM_PYCOPM_REFTOCOA.INC",
755+
"w",
756+
encoding="utf8",
757+
) as file:
758+
file.write("OPERNUM\n")
759+
file.write("".join(oprs))
760+
file.write("/")
744761
print("Writing the files")
745762
with alive_bar(len(names)) as bar_animation:
746763
for name in names:

0 commit comments

Comments
 (0)