Skip to content

Commit

Permalink
ENH: Add upscaler.py, analysis.py, many smaller features, maintenance…
Browse files Browse the repository at this point in the history
… & bug fixes
  • Loading branch information
pschultzendorff committed Aug 2, 2024
1 parent 6176975 commit d78c724
Show file tree
Hide file tree
Showing 71 changed files with 2,468 additions and 12,324 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ['3.8']
python-version: ['3.10']
os: [ubuntu-latest]

runs-on: ${{ matrix.os }}
Expand Down
5 changes: 3 additions & 2 deletions examples/cemracs2023/ml/recovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
"""

import os

import matplotlib.pyplot as plt
import numpy as np
from ecl.summary import EclSum
from mako.template import Template
import matplotlib.pyplot as plt

npoints, npruns = 20, 5
tmin, tmax = 0, 30
Expand All @@ -18,7 +19,7 @@
FLOW = "/Users/dmar/Github/opm/build/opm-simulators/bin/flow"
FLAGS = (
" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0"
+ " --ecl-enable-drift-compensation=0 --newton-max-iterations=50"
+ " --enable-drift-compensation=0 --newton-max-iterations=50"
+ " --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5"
+ " --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true"
+ " --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false"
Expand Down
2 changes: 1 addition & 1 deletion examples/cemracs2023/ml_cyclic_h2/h2.mako
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
h2store okoroafor2023 #Model (co2store/h2store)
Expand Down
2 changes: 1 addition & 1 deletion examples/cemracs2023/ml_example_co2/co2.mako
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
2 changes: 1 addition & 1 deletion examples/cemracs2023/ml_example_h2/h2.mako
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
h2store okoroafor2023 #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --ml-wi-filename="${pwd}/model_pressure_radius_WI/WI.model" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --ml-wi-filename="${pwd}/model_pressure_radius_WI/WI.model" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --ml-wi-filename="${pwd}/model_pressure_radius_WI/WI.model" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --ml-wi-filename="${pwd}/model_pressure_radius_WI/WI.model" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
1. WI [m*s]
"""

from __future__ import annotations

import logging
Expand Down Expand Up @@ -54,13 +55,15 @@
X: float = 2.500000e-01 # Outer coordinates of first cell.
Y: float = -1.443376e-01
WELL_RADIUS: float = math.sqrt(X**2 + Y**2) # unit: [m]; Fixed during training.
DENSITY: float = 12.9788 # unit: kg/m^3; for 72 bar, 30.9780 °C. Is this at surface conditions or not?
DENSITY: float = (
12.9788 # unit: kg/m^3; for 72 bar, 30.9780 °C. Is this at surface conditions or not?
)
VISCOSITY: float = 1.52786e-05 # unit: Pa*s; for 72 bar, 30.9780 °C

FLOW = "flow"
FLAGS = (
" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0"
+ " --ecl-enable-drift-compensation=0 --newton-max-iterations=50"
+ " --enable-drift-compensation=0 --newton-max-iterations=50"
+ " --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5"
+ " --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true"
+ " --enable-opm-rst-file=true --linear-solver=cprw"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --ml-wi-filename="" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --ml-wi-filename="${pwd}/water_re.modelPeaceman" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --ml-wi-filename="${pwd}/water_re.modelPeaceman" --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --tolerance-mb=1e-7 --tolerance-wells=1e-5 --relaxed-well-flow-tol=1e-5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Set the full path to the flow executable and flags"""
${flow} --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --ecl-enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99
${flow} --linear-solver-reduction=1e-5 --relaxed-max-pv-fraction=0 --enable-drift-compensation=0 --newton-max-iterations=50 --newton-min-iterations=5 --use-multisegment-well=false --enable-tuning=true --enable-opm-rst-file=true --linear-solver=cprw --enable-well-operability-check=false --min-time-step-before-shutting-problematic-wells-in-days=1e-99

"""Set the model parameters"""
co2store base #Model (co2store/h2store)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ def compute_peaceman(k_h: float, r_e: float, r_w: float) -> float:
from the Peaceman well model.
.. math::
WI\cdot\frac{\mu}{\rho} = \frac{2\pi hk}{\ln (r_e/r_w)}
Parameters:
k_h: Permeability times the cell thickness (thickness fix to 1 m).
r_e: Equivalent well-block radius.
r_w: Wellbore radius.
Args:
k_h (float): Permeability times the cell thickness (thickness fix to 1 m).
r_e (float): Equivalent well-block radius.
r_w (float): Wellbore radius.
Returns:
:math:`WI\cdot\frac{\mu}{\rho}`
float: :math:`WI\cdot\frac{\mu}{\rho}`
"""
w_i = (2 * math.pi * k_h) / (math.log(r_e / r_w))
return w_i
Expand Down
Loading

0 comments on commit d78c724

Please sign in to comment.