ResSimpy


NameResSimpy JSON
Version 2.2.1 PyPI version JSON
download
home_pageNone
SummaryA Python library for working with Reservoir Simulator Models.
upload_time2024-05-23 10:56:08
maintainerNone
docs_urlNone
authorBP
requires_python<3.12,>=3.10
licenseApache-2.0
keywords ressimpy reservoir engineering
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ResSimpy: Python API for working with Reservoir Simulator models

[![License](https://img.shields.io/pypi/l/ressimpy)](https://github.com/bp/ResSimpy/blob/master/LICENSE.MD)
[![Documentation Status](https://readthedocs.org/projects/ressimpy/badge/?version=latest)](https://ResSimpy.readthedocs.io/en/latest/?badge=latest)
[![Python CI](https://github.com/bp/ResSimpy/actions/workflows/ci-tests.yml/badge.svg)](https://github.com/bp/ResSimpy/actions/workflows/ci-tests.yml)
![Python version](https://img.shields.io/pypi/pyversions/ResSimpy)
[![PyPI](https://img.shields.io/pypi/v/ResSimpy)](https://badge.fury.io/py/ResSimpy)
![Status](https://img.shields.io/pypi/status/ResSimpy)
[![codecov](https://codecov.io/gh/bp/ResSimpy/branch/master/graph/badge.svg)](https://codecov.io/gh/bp/ResSimpy)

## Introduction
**ResSimpy** is a Python API for automating reservoir simulation workflows, allowing the user to read, manipulate and 
write reservoir simulation input decks. Whilst it was created by staff at BP, we welcome contributions from anybody 
interested, whether it is by raising pull requests, or simply suggesting features / raising bugs in the [GitHub issues](https://github.com/bp/ResSimpy/issues).

### Documentation

See the complete package documentation on
[readthedocs](https://ResSimpy.readthedocs.io/).

## Installation

ResSimpy can be installed with pip:

```bash
pip install ressimpy
```

## Contributing

Please see [Contributing Guide](docs/CONTRIBUTING.rst) for instructions on how to set up a dev environment and contribute
code to the project.

## Getting Started
The following Python code examples demonstrate how to perform some simple operations on a model using ResSimpy:

### Step 1: Import the library
```python
from ResSimpy import NexusSimulator as Simulator
```

###  Step 2: Initialise the model
```python
nexus_fcs_file = '/path/to/fcsfile.fcs'
model = Simulator(origin=nexus_fcs_file) # Create the 'Simulator' model object
```

#### Once these steps are completed, you are able to perform any supported operations on the model. The following code snippets are examples of a few such operations:

### Writing Out Files
```python
# Update the files in the model that have been modified.
# IMPORTANT: no changes made to the model, such as adding completions or removing constraints will be applied to the model files until this function is called.
model.update_simulator_files()

# Create a copy of the entire model
model.write_out_new_simulator(new_file_path='/new/path/to/fcsfile.fcs', new_include_file_location='/new/path/to/includes_directory/')
```

### Wells - Get wells overview
```python
wells_info = model.wells.get_wells_overview() # Returns a list of wells with their information. Can be print()ed
print(wells_info)
```

### Wells - Get information about an individual Well 
```python
well = model.wells.get(well_name='well_1') # Retrieves the named well as a NexusWell object

# You can then access the various properties for that well (such as perforations, shutins, completion events etc) using (for example)
perforations = well.perforations

# You can pretty print the information about a well using
print(well.printable_well_info)

# Get the wells information in dataframe format
wells_df = model.wells.get_df()
print(wells_df)
```

### Completions 
```python
# Adding a completion
new_completion = {'date': '01/02/2025', 'i': 4, 'j': 5, 'k': 6, 'well_radius': 7.50} # Create a dictionary containing the properties of the completion you wish to add
model.wells.add_completion(well_name='well_1', completion_properties=new_completion) # Add the new completion

# Removing a completion
completion_to_modify = {'date': '01/02/2025', 'i': 4, 'j': 5, 'k': 6, 'well_radius': 7.5} # Create a dictionary containing the properties of the existing completion
model.wells.remove_completion(well_name='well_1', completion_properties=completion_to_modify) # Remove the completion

# Modifying a completion
modified_properties = {'date': '10/03/2025'} # Create a dict with the properties you want to change and their new values
model.wells.modify_completion(well_name='well_1', properties_to_modify=modified_properties, completion_to_change=completion_to_modify) # Modify the completion
```

### Structured Grid -  Get a list of the array functions applied to the grid 
```python
func_list = model.grid.get_array_functions_list()
func_summary_df = model.grid.get_array_functions_df() # get a dataframe instead

[print(x) for x in func_list[0:9]] # Example showing how to print out the first 10 functions
```

### Networks - Get constraints
```python
constraints = model.network.constraints.get_all()
constraints_for_well = constraints['well_1'] # Get the constraints for the well well_1

# You can then access various properties related to the constraints, such as oil, water and gas rates using
oil_rate = constraints_for_well[0].max_surface_oil_rate
print(f"\nmax surface oil rate: {oil_rate}")

# Get a dataframe with all constraints in it.
constraint_df = model.network.constraints.get_df()
print(constraint_df)
```

### Networks -  Get dataframes of well connections, wellbores, network connections and nodes
```python
df_well_cons = model.network.connections.get_df()
df_well_bores = model.network.wellbores.get_df()
df_connections = model.network.connections.get_df()
df_nodes = model.network.nodes.get_df()
```

## Support
For most bugs or feature requests, we recommend using [GitHub issues](https://github.com/bp/ResSimpy/issues).
If, however, you have a query related to something else, or if your query relates to something confidential, please feel
free to email the team at ResSimpy@bp.com.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "ResSimpy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.10",
    "maintainer_email": null,
    "keywords": "ResSimpy, Reservoir Engineering",
    "author": "BP",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/20/3e/e5e45a376cd5ebfdec973aa1b0d06abee2d31732b01bf59e2c5465584547/ressimpy-2.2.1.tar.gz",
    "platform": null,
    "description": "# ResSimpy: Python API for working with Reservoir Simulator models\n\n[![License](https://img.shields.io/pypi/l/ressimpy)](https://github.com/bp/ResSimpy/blob/master/LICENSE.MD)\n[![Documentation Status](https://readthedocs.org/projects/ressimpy/badge/?version=latest)](https://ResSimpy.readthedocs.io/en/latest/?badge=latest)\n[![Python CI](https://github.com/bp/ResSimpy/actions/workflows/ci-tests.yml/badge.svg)](https://github.com/bp/ResSimpy/actions/workflows/ci-tests.yml)\n![Python version](https://img.shields.io/pypi/pyversions/ResSimpy)\n[![PyPI](https://img.shields.io/pypi/v/ResSimpy)](https://badge.fury.io/py/ResSimpy)\n![Status](https://img.shields.io/pypi/status/ResSimpy)\n[![codecov](https://codecov.io/gh/bp/ResSimpy/branch/master/graph/badge.svg)](https://codecov.io/gh/bp/ResSimpy)\n\n## Introduction\n**ResSimpy** is a Python API for automating reservoir simulation workflows, allowing the user to read, manipulate and \nwrite reservoir simulation input decks. Whilst it was created by staff at BP, we welcome contributions from anybody \ninterested, whether it is by raising pull requests, or simply suggesting features / raising bugs in the [GitHub issues](https://github.com/bp/ResSimpy/issues).\n\n### Documentation\n\nSee the complete package documentation on\n[readthedocs](https://ResSimpy.readthedocs.io/).\n\n## Installation\n\nResSimpy can be installed with pip:\n\n```bash\npip install ressimpy\n```\n\n## Contributing\n\nPlease see [Contributing Guide](docs/CONTRIBUTING.rst) for instructions on how to set up a dev environment and contribute\ncode to the project.\n\n## Getting Started\nThe following Python code examples demonstrate how to perform some simple operations on a model using ResSimpy:\n\n### Step 1: Import the library\n```python\nfrom ResSimpy import NexusSimulator as Simulator\n```\n\n###  Step 2: Initialise the model\n```python\nnexus_fcs_file = '/path/to/fcsfile.fcs'\nmodel = Simulator(origin=nexus_fcs_file) # Create the 'Simulator' model object\n```\n\n#### Once these steps are completed, you are able to perform any supported operations on the model. The following code snippets are examples of a few such operations:\n\n### Writing Out Files\n```python\n# Update the files in the model that have been modified.\n# IMPORTANT: no changes made to the model, such as adding completions or removing constraints will be applied to the model files until this function is called.\nmodel.update_simulator_files()\n\n# Create a copy of the entire model\nmodel.write_out_new_simulator(new_file_path='/new/path/to/fcsfile.fcs', new_include_file_location='/new/path/to/includes_directory/')\n```\n\n### Wells - Get wells overview\n```python\nwells_info = model.wells.get_wells_overview() # Returns a list of wells with their information. Can be print()ed\nprint(wells_info)\n```\n\n### Wells - Get information about an individual Well \n```python\nwell = model.wells.get(well_name='well_1') # Retrieves the named well as a NexusWell object\n\n# You can then access the various properties for that well (such as perforations, shutins, completion events etc) using (for example)\nperforations = well.perforations\n\n# You can pretty print the information about a well using\nprint(well.printable_well_info)\n\n# Get the wells information in dataframe format\nwells_df = model.wells.get_df()\nprint(wells_df)\n```\n\n### Completions \n```python\n# Adding a completion\nnew_completion = {'date': '01/02/2025', 'i': 4, 'j': 5, 'k': 6, 'well_radius': 7.50} # Create a dictionary containing the properties of the completion you wish to add\nmodel.wells.add_completion(well_name='well_1', completion_properties=new_completion) # Add the new completion\n\n# Removing a completion\ncompletion_to_modify = {'date': '01/02/2025', 'i': 4, 'j': 5, 'k': 6, 'well_radius': 7.5} # Create a dictionary containing the properties of the existing completion\nmodel.wells.remove_completion(well_name='well_1', completion_properties=completion_to_modify) # Remove the completion\n\n# Modifying a completion\nmodified_properties = {'date': '10/03/2025'} # Create a dict with the properties you want to change and their new values\nmodel.wells.modify_completion(well_name='well_1', properties_to_modify=modified_properties, completion_to_change=completion_to_modify) # Modify the completion\n```\n\n### Structured Grid -  Get a list of the array functions applied to the grid \n```python\nfunc_list = model.grid.get_array_functions_list()\nfunc_summary_df = model.grid.get_array_functions_df() # get a dataframe instead\n\n[print(x) for x in func_list[0:9]] # Example showing how to print out the first 10 functions\n```\n\n### Networks - Get constraints\n```python\nconstraints = model.network.constraints.get_all()\nconstraints_for_well = constraints['well_1'] # Get the constraints for the well well_1\n\n# You can then access various properties related to the constraints, such as oil, water and gas rates using\noil_rate = constraints_for_well[0].max_surface_oil_rate\nprint(f\"\\nmax surface oil rate: {oil_rate}\")\n\n# Get a dataframe with all constraints in it.\nconstraint_df = model.network.constraints.get_df()\nprint(constraint_df)\n```\n\n### Networks -  Get dataframes of well connections, wellbores, network connections and nodes\n```python\ndf_well_cons = model.network.connections.get_df()\ndf_well_bores = model.network.wellbores.get_df()\ndf_connections = model.network.connections.get_df()\ndf_nodes = model.network.nodes.get_df()\n```\n\n## Support\nFor most bugs or feature requests, we recommend using [GitHub issues](https://github.com/bp/ResSimpy/issues).\nIf, however, you have a query related to something else, or if your query relates to something confidential, please feel\nfree to email the team at ResSimpy@bp.com.\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "A Python library for working with Reservoir Simulator Models.",
    "version": "2.2.1",
    "project_urls": null,
    "split_keywords": [
        "ressimpy",
        " reservoir engineering"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "780b655eeb90afe7d11108585b47b1d722595c923dd46674dfbda93493554d6e",
                "md5": "c84269fe150ecf9b1f80403e982509ce",
                "sha256": "ee92e3aed02167c8c14578e56766f2a05459821f614c037d9e20447d20694900"
            },
            "downloads": -1,
            "filename": "ressimpy-2.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c84269fe150ecf9b1f80403e982509ce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.10",
            "size": 284999,
            "upload_time": "2024-05-23T10:56:06",
            "upload_time_iso_8601": "2024-05-23T10:56:06.654461Z",
            "url": "https://files.pythonhosted.org/packages/78/0b/655eeb90afe7d11108585b47b1d722595c923dd46674dfbda93493554d6e/ressimpy-2.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "203ee5e45a376cd5ebfdec973aa1b0d06abee2d31732b01bf59e2c5465584547",
                "md5": "6bf1df3df3ebad884049b5af0d2c676a",
                "sha256": "755f22e69530ecd0a67170140d5608b23a252b2751998a1523178d8569a9d8fc"
            },
            "downloads": -1,
            "filename": "ressimpy-2.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "6bf1df3df3ebad884049b5af0d2c676a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.10",
            "size": 197465,
            "upload_time": "2024-05-23T10:56:08",
            "upload_time_iso_8601": "2024-05-23T10:56:08.663916Z",
            "url": "https://files.pythonhosted.org/packages/20/3e/e5e45a376cd5ebfdec973aa1b0d06abee2d31732b01bf59e2c5465584547/ressimpy-2.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-23 10:56:08",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "ressimpy"
}
        
BP
Elapsed time: 0.33730s