{"id":46467386,"url":"https://github.com/cssr-tools/ml_near_well","last_synced_at":"2026-03-06T05:01:34.106Z","repository":{"id":242691815,"uuid":"803874928","full_name":"cssr-tools/ML_near_well","owner":"cssr-tools","description":"Runfiles for an ML near-well model and to reproduce results from the article \"A machine-learned near-well model in OPM Flow\". Uses pyopmnearwell.","archived":false,"fork":false,"pushed_at":"2025-10-06T11:07:48.000Z","size":523,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"paper","last_synced_at":"2025-10-06T13:11:31.716Z","etag":null,"topics":["co2-storage","machine-learning","near-well-model","reservoir-simulation"],"latest_commit_sha":null,"homepage":"","language":"Mako","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cssr-tools.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-05-21T14:29:36.000Z","updated_at":"2024-10-15T14:33:56.000Z","dependencies_parsed_at":"2026-03-06T05:00:43.640Z","dependency_job_id":null,"html_url":"https://github.com/cssr-tools/ML_near_well","commit_stats":null,"previous_names":["cssr-tools/ml_near_well"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cssr-tools/ML_near_well","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssr-tools%2FML_near_well","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssr-tools%2FML_near_well/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssr-tools%2FML_near_well/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssr-tools%2FML_near_well/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cssr-tools","download_url":"https://codeload.github.com/cssr-tools/ML_near_well/tar.gz/refs/heads/paper","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cssr-tools%2FML_near_well/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30162716,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T04:43:31.446Z","status":"ssl_error","status_checked_at":"2026-03-06T04:40:30.133Z","response_time":250,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["co2-storage","machine-learning","near-well-model","reservoir-simulation"],"created_at":"2026-03-06T05:00:33.806Z","updated_at":"2026-03-06T05:01:34.094Z","avatar_url":"https://github.com/cssr-tools.png","language":"Mako","readme":"# ML_near_well\n**ML_near_well** is a collection of runfiles for a machine-learned near-well model. The\nkey idea is to replace the analytical expression for well transmissibility from\nPeaceman-type well models with a neural network. The network is trained on data from\nfine-scale ensemble simulations of the near-well region under differing flow regimes.\nThis novel approach allows for flexible and accurate modeling of transient and\nmultiphase effects.\n\nThe accompanying paper is [*A machine-learned near-well model in OPM Flow*](), to be\npublished later in 2024.\n\nThe ensemble simulations as well as tests of the final model are run in the open-source\nreservoir simulator OPM Flow. In addition, our code uses the\n[pyopmnearwell](https://github.com/cssr-tools/pyopmnearwell) package for near-well\nensemble simulations and model training and the [OPM Flow - neural network framework]()\nfor integration of neural networks into OPM Flow. \n\n**Note:** The latter is not publicly available yet (as of 06.06.2024); without it the\ncode in this repository will only run partly. As soon as everything is available, this note will be removed.\n\n**06th August 2024:** ``pyopmnearwell`` was just updated to require ``OPM Flow 2024.04`` and ``python 3.10``.\nThis might cause some smaller issues with, e.g., renamed keywords, as this repo was tested with\n``OPM Flow 2023.04`` and ``python 3.8``. We will test and update everything as soon as possible.\n\n# Installation\n**Note:** Everything was tested on ``WSL2`` with an ``ubuntu 20.02`` installation,\n``python 3.8.10``, and ``OPM Flow 2023.04``.\n1. Create a virtual environment (e.g., with ``conda``) and install the dependencies with\n   ``pip install -r requirements.txt``.\n2. Clone https://github.com/cssr-tools/pyopmnearwell/tree/development, go to the local\n   repo, and install with ``pip install .``-.\n3. Install OPM or build from source https://opm-project.org/?page_id=36 (needed to run\n   the ensemble scripts).\n4. Build OPM with ML integration from source\n   https://github.com/fractalmanifold/ml_integration2opm/tree/main (needed to run the\n   integration scripts).\n5. Clone this repo ``git clone ...``.\n6. Update the paths to OPM and OPM with ML integration in the runscripts.\n```\nh2o/runspecs.py\nco2_2d/runspecs.py\nco2_3d/runspecs.py\n```\n\n# Usage\nYou can reproduce the paper results as described below. To create and integrate your own\nnear-well model, follow the structure of the examples. The workflow consists of four\nsteps:\n1. Run an ensemble of radial fine-scale near-well simulations.\n   ``pyopmnearwell.ml.ensemble`` provides useful functions.\n2. Extract and upscale features and targets to create a dataset.\n   ``pyopmnearwell.ml.ensemble`` and ``pyopmnearwell.ml.upscale`` provide useful\n   functions.\n3. Train a neural network in Tensorflow. ``pyopmnearwell.ml.nn`` and\n   ``ML_near_well.utils`` provide useful functions.\n4. Integrate the network into OPM Flow and run a full simulation.\n   ``pyopmnearwell.ml.integration`` provides useful functions.\n\nNOTE: At the moment, some hardcoded hacks are needed to make everything work. Make sure\nthat you use the right values to get correct results.\n- The total injected volume inside OPM Flow is calculated by multiplying elapsed time\n  with injection rate. The injection rate is hardcoded for each model and needs to be\n  adjusted in ``standardwell_impl.mako`` inside the ``wellIndexEval`` function. (This is\n  relevant for the CO2 examples.)\n- The scaling of outputs and inputs for the NN is done inside OPM Flow. However, the\n  scaling values are hardcoded and OPM Flow needs to be recompiled each time the model\n  changes. ``pyopmnearwell`` provides some helper functions (in ``ml.nn`` and\n  ``ml.integration``) that automatically store these values, fill them into the\n  ``standardwell_impl.mako`` templates and recompile Flow.\n  In the release version of OPM Flow - NN version, scaling values will be stored\n  directly inside the neural network, such that this procedure is no longer needed.\n- OPM Flow does not support radial simulations. Instead the near-well ensemble\n  simulations are run on a triangle shaped domain. The results correspond then to radii\n  adjusted with ``pyopmnearwell.utils.formulas.pyopmnearwell_correction`` on a radial\n  grid of the same angle as the triangle. Afterwards, some results/values, such as\n  injection rate, still need to be adjusted to a full 360° well.\n\n# Reproduce results\nTo reproduce the paper results and figures, run these commands:\n```\ncd examples\nbash run.bash\n```\nAlternatively, you can run each of the examples individually, e.g.,:\n```\ncd examples/h2o_extended\npython main.py\n```\nResults 1, 2, and 3 in the paper correspond to ``h2o``, ``co2_2d``,\nand ``co2_3d``.\n\n# Citing\nIf you use either all or part of of the code in this repository, we kindly ask you to\ncite the following reference:\n\nP. von Schultzendorff, T. H. Sandve, B. Kane, D. Landa-Marbán, J. W. Both, and J. M. Nordbotten, “A Machine-Learned Near-Well Model in OPM Flow”, presented at ECMOR 2024, European Association of Geoscientists \u0026 Engineers, Sep. 2024, pp. 1–23. doi: 10.3997/2214-4609.202437033.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssr-tools%2Fml_near_well","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcssr-tools%2Fml_near_well","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcssr-tools%2Fml_near_well/lists"}