Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions .github/workflows/ci_pycopm_ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ jobs:

- name: Check code style and linting
run: |
black --target-version py312 --check src/ tests/
black --target-version py312 src/ tests/ --check
pylint src/ tests/
mypy --ignore-missing-imports src/ tests/

- name: Run tests
run: |
pytest --cov=pycopm --exitfirst --cov-report term-missing --basetemp=test_outputs tests/
pytest --cov=pycopm --cov-report term-missing --basetemp=test_outputs tests/ --exitfirst

- name: Run hello world example
run: |
Expand Down
111 changes: 111 additions & 0 deletions examples/decks/MODEL7.DATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
-- Copyright (C) 2026 NORCE Research AS
-- flow MODEL7.DATA
-- pycopm -i MODEL7.DATA -w STANDARD -t 2 -a max -z 1:2 -l S
-- pycopm -i MODEL7.DATA -w DUAL -t 2 -a max -z 1:2 -l D -dual 'poro == 0.1'
----------------------------------------------------------------------------
RUNSPEC
----------------------------------------------------------------------------
DIMENS
3 3 2 /

EQLDIMS
/

TABDIMS
/

CO2STORE
GAS
WATER

METRIC

START
1 JAN 2025 /

WELLDIMS
/

UNIFOUT
----------------------------------------------------------------------------
GRID
----------------------------------------------------------------------------
INIT

DX
18*1E2 /

DY
18*1E2 /

DZ
18*1E2 /

TOPS
9*0 /

FLUXNUM
1 1 2 1 2 2 1 1 2
2 1 1 2 2 1 2 1 1
/

EQUALREG
PORO 0 0 F /
PORO 0.25 1 F /
PORO 1e-1 2 F /
PERMX 0 0 F /
PERMX 1.172745396974317 1 F /
PERMX 1.172745396974317e-2 2 F /
PERMY 0 0 F /
PERMY 1.172745396974317 1 F /
PERMY 1.172745396974317e-2 2 F /
PERMZ 0 0 F /
PERMZ 1.172745396974317 1 F /
PERMZ 1.172745396974317e-2 2 F /
/

NNC
1 1 1 2 1 2 3 /
1 1 1 1 2 2 7 /
2 2 2 3 2 1 11 /
/
----------------------------------------------------------------------------
PROPS
----------------------------------------------------------------------------
SGWFN
0 0 1 0
1 1 0 0 /

ROCK
276 4.934e-05 /
----------------------------------------------------------------------------
SOLUTION
----------------------------------------------------------------------------
EQUIL
0 200 0 0 0 0 1 1 0 /

RPTRST
BASIC=2 RPORV /
----------------------------------------------------------------------------
SUMMARY
----------------------------------------------------------------------------
BPR
3 3 2 /
/
----------------------------------------------------------------------------
SCHEDULE
----------------------------------------------------------------------------
RPTRST
BASIC=2 RPORV /

SOURCE
1 1 1 WATER 1E+04 /
/
TSTEP
9131.25 /

SOURCE
1 1 1 WATER 0 /
/
TSTEP
3652.5 /
120 changes: 120 additions & 0 deletions examples/decks/MODEL8.DATA
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
-- Copyright (C) 2026 NORCE Research AS
-- flow MODEL8.DATA
-- pycopm -i MODEL8.DATA -w STANDARD -t 2 -a max -z 1:2 -l S
-- pycopm -i MODEL8.DATA -w DUAL -t 2 -a max -z 1:2 -l D -dual 'poro == 0.1'
----------------------------------------------------------------------------
RUNSPEC
----------------------------------------------------------------------------
DIMENS
3 2 2 /

EQLDIMS
/

TABDIMS
/

CO2STORE
GAS
WATER

METRIC

START
1 JAN 2025 /

WELLDIMS
/

UNIFOUT
----------------------------------------------------------------------------
GRID
----------------------------------------------------------------------------
INIT

COORD
0 0 0 0 0 2E3
2.5E3 0 0 2.5E3 0 2E3
5E3 0 0 5E3 0 2E3
7.5E3 0 0 7.5E3 0 2E3
0 1E3 0 0 1E3 2E3
2.5E3 1E3 0 2.5E3 1E3 2E3
5E3 1E3 0 5E3 1E3 2E3
7.5E3 1E3 0 7.5E3 1E3 2E3
0 2E3 0 0 2E3 2E3
2.5E3 2E3 0 2.5E3 2E3 2E3
5E3 2E3 0 5E3 2E3 2E3
7.5E3 2E3 0 7.5E3 2E3 2E3 /

ZCORN
5E2 5E2 0 0 -5E2 -5E2 5E2 5E2 0 0 -5E2 -5E2
5E2 5E2 -2.5E2 -2.5E2 -5E2 -5E2 5E2 5E2 -2.5E2 -2.5E2 -5E2 -5E2

15E2 15E2 7.5E2 7.5E2 2.5E2 2.5E2 15E2 15E2 7.5E2 7.5E2 2.5E2 2.5E2
15E2 15E2 5E2 5E2 2.5E2 2.5E2 15E2 15E2 5E2 5E2 2.5E2 2.5E2

15E2 15E2 7.5E2 7.5E2 2.5E2 2.5E2 15E2 15E2 7.5E2 7.5E2 2.5E2 2.5E2
15E2 15E2 5E2 5E2 2.5E2 2.5E2 15E2 15E2 5E2 5E2 2.5E2 2.5E2
15E2 15E2 10E2 10E2 10E2 10E2 15E2 15E2 10E2 10E2 10E2 10E2
15E2 15E2 10E2 10E2 10E2 10E2 15E2 15E2 10E2 10E2 10E2 10E2 /

FLUXNUM
1 2 2 0 2 0
1 1 1 0 2 0
/

EQUALREG
PORO 0 0 F /
PORO 0.25 1 F /
PORO 1e-1 2 F /
PERMX 0 0 F /
PERMX 1.172745396974317 1 F /
PERMX 1.172745396974317e-2 2 F /
PERMY 0 0 F /
PERMY 1.172745396974317 1 F /
PERMY 1.172745396974317e-2 2 F /
PERMZ 0 0 F /
PERMZ 1.172745396974317 1 F /
PERMZ 1.172745396974317e-2 2 F /
/

----------------------------------------------------------------------------
PROPS
----------------------------------------------------------------------------
SGWFN
0 0 1 0
1 1 0 0 /

ROCK
276 4.934e-05 /
----------------------------------------------------------------------------
SOLUTION
----------------------------------------------------------------------------
EQUIL
-5E2 200 0 0 0 0 1 1 0 /

RPTRST
BASIC=2 RPORV /
----------------------------------------------------------------------------
SUMMARY
----------------------------------------------------------------------------
BPR
3 1 2 /
/
----------------------------------------------------------------------------
SCHEDULE
----------------------------------------------------------------------------
RPTRST
BASIC=2 RPORV /

SOURCE
1 1 1 WATER 1E+04 /
/
TSTEP
9131.25 /

SOURCE
1 1 1 WATER 0 /
/
TSTEP
3652.5 /
4 changes: 3 additions & 1 deletion src/pycopm/core/pycopm.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,9 @@ def load_parser():
"--dual",
default="",
help="Set the criterium to differentiate net and non-net in coarsening using a static "
"variable, e.g., 'poro <= 0.1' ('' by default).",
"variable. To remove the vertical transfer function (FT) between net and not-net cells, "
"add to the command ', vertical TF = 0', e.g., 'poro <= 0.1' (which includes vertical TF) "
"or 'poro <= 0.1, vertical TF = 0' ('' by default)",
)
return vars(parser.parse_known_args()[0])

Expand Down
17 changes: 10 additions & 7 deletions src/pycopm/utils/generate_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -670,22 +670,25 @@ def initialize_variables(dic):
dic["facpermz"] = dic["ini"]["PERMZ"][i] / float(val)
break
dic["msk"] = np.ones(len(dic["porv"]))
dic["dual_vertical_tf"] = True
if dic["dual"]:
dual = dic["dual"].split(" ")
val = dual[2].replace(",", "")
dic["dual_vertical_tf"] = "vertical TF = 0" not in dic["dual"]
quan = np.array(dic["ini"][dual[0].upper()])
dic["dual"] = 1
if dual[1] == "==":
dic["msk"][dic["porv"] > 0] = quan != float(dual[2])
dic["msk"][dic["porv"] > 0] = quan != float(val)
elif dual[1] == ">=":
dic["msk"][dic["porv"] > 0] = quan < float(dual[2])
dic["msk"][dic["porv"] > 0] = quan < float(val)
elif dual[1] == "<=":
dic["msk"][dic["porv"] > 0] = quan > float(dual[2])
dic["msk"][dic["porv"] > 0] = quan > float(val)
elif dual[1] == "<":
dic["msk"][dic["porv"] > 0] = quan >= float(dual[2])
dic["msk"][dic["porv"] > 0] = quan >= float(val)
elif dual[1] == ">":
dic["msk"][dic["porv"] > 0] = quan <= float(dual[2])
dic["msk"][dic["porv"] > 0] = quan <= float(val)
elif dual[1] == "!=":
dic["msk"][dic["porv"] > 0] = quan == float(dual[2])
dic["msk"][dic["porv"] > 0] = quan == float(val)
else:
print(f"Unknow criterium for non-net cells ({dic['dual']}).")
sys.exit()
Expand Down Expand Up @@ -915,7 +918,7 @@ def write_props(dic, n):
tmp = compact_format(dic[f"{name}_c"])
if (
"*" in tmp[0]
and not (dic["trans"] > 0 and name in ["tranx", "trany"])
and not (dic["trans"] > 0 and name in ["tranx", "trany", "tranz"])
and (not dic["dual"] or n > dic["ntot"])
):
if int(tmp[0].split("*")[0]) == n:
Expand Down
Loading
Loading