Code Monkey home page Code Monkey logo

pywaterflood's Introduction

About me

I'm a research professor at The Pennsylvania State University. I write software and do scientific research for a living. In my spare time, I like to be outside hiking, jogging, or what have you, or inside, playing music with anyone who will have me.

I've been credibly accused of being eclectic. My degrees are in political science and physics. My research has covered everything from computational fluid dynamics to natural language processing to interpretable machine learning.

About my code

If you ever want a programmer to grimace, show them their old code. That said, there's hopefully something useful in here for you.

Petroleum engineering and geology

  1. Do you like capacitors? How about applying the equations for charging capacitors to oil fields? Have I got the Pywaterflood code for you!
  2. Ever maed a mistake? Me neither! Here are some mistakes that other people have or might make, specifically focusing on statistics and rocks.
  3. Do you want to know how much your unconventional wells are going to make? How about other people's wells? Here is the code to find that out. I'm particulary fond of this because I used solutions to these equations to get a PhD. Somehow.
  4. Want to make friends with a geomodeler? Help them with getting information in and out of Petrel.
  5. I don't have anything clever to say about this one. Predict permeability for sandstone cores with machine learning. Maybe you want to see how to write a paper in markdown with the code included?
  6. Do you like Thomas Bayes? How about his theories? Here you can see some Bayesian analysis applied to percolation theory.
  7. Not done with Bayes, are we? That's okay, I've also got Bayesian analysis applied to Lucia's rock typing.

Other software

  1. Do you like writing python projects? This is where I start with new projects. It's forked from the scientific python cookiecutter, which you should probably be using rather than mine. Some ideas are taken from cjolowicz. It's based on Cookiecutter.
  2. Do you like birds and the noises they make? How about mimicking those noises? With this, you can tweet all sorts of mimicry.
  3. Word documents tend to collect comments. Why? I'm not sure why. Sometimes, I'd like to take those comments and copy them to a text file.
  4. Want to know how Iowa is doing did on their drive to 325? You can see a Bayesian analysis of Iowa football.

Sometimes I post about my code on LinkedIn: Follow me on LinkedIn

Frank's GitHub stats

Top Langs

pywaterflood's People

Contributors

dependabot[bot] avatar frank1010111 avatar pre-commit-ci[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pywaterflood's Issues

JOSS review: edit docs to follow suggestions

  1. The "simple example" is also a bit underwhelming (although the notebook is much better). It produces no graphics or table to visualize the results, print anything to the screen, or provide any feedback to users.
  2. The writing is a bit terse, even for JOSS. Please see the general remarks below and the comments in the attached paper.
  3. Please add a note to the main readme explaining how to run the tests. I recall this is strongly suggested by JOSS at the submission stage, and seems it should be included for anyone who wishes to contribute to the software or develop on top of it.
  4. I suggest not describing a method as having been "perfected".

Shortened from review originally posted by @mgcooper in openjournals/joss-reviews#6191 (comment)

Add injection optimization tutorial

Is your feature request related to a problem? Please describe.
It would be nice to show how you can use CRM results to optimize water injection

Describe the solution you'd like

  1. Start out with production and injection histories
  2. Run CRM to get the gains from injector to producer
  3. Set a water injection budget, limits on how high or low each injector can go, etc
  4. Optimize oil production given these constraints

Describe alternatives you've considered
This could become a feature of the library if it gets enough interest.

Additional context
See https://www.sciencedirect.com/science/article/pii/S0920410509002046 and other examples from literature

Connectivity plots

Is your feature request related to a problem? Please describe.
I like to see the connectivity between injectors and producers at a map level.

Describe the solution you'd like
Given a fit CRM model and injector and producer locations, there should be a matplotlib quiver plot. with arrows given lengths and colors commensurate with the connectivity. This should be in a new submodule importable through pywaterflood.plotting.

Additional context
A demo plot looks like this
image

Python 3.12 support

Is your feature request related to a problem? Please describe.
I would like to use this package in python 3.12

Describe the solution you'd like
New wheels and testing for python 3.12

Describe alternatives you've considered
I could use python 3.11, but why not the newest?

Additional context
With python 3.12 released, we're one release closer to python-pi! 3.14 is only two years away.

Python 3.11 compatibility

Add python 3.11 compatibility to pyproject.toml and test it with github actions. Simplify any dangling dependencies.

Is the constraint on \sum_{j}^{Nprod} fij<=1$ implemented?

Is your feature request related to a problem? Please describe.
I have tested the library, and I noticed that $$\sum^{N_{prod}}_{j=1} fij\leq1$$ for a fixed injector $i$ is not fulfilled. This is the constrain given by Eq. 19 in Holanda et al. 2018. I have tried every option for constraints in CRM(constraints=..) and the issue remains. Not sure if I have missed/did something wrong and the constraint is already implemented.

Describe the solution you'd like
It would very helpful to have such constraint implemented. Make the solution more realistic, since in the real oil field, injection losses occur.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

Add forecasting tutorial

Is your feature request related to a problem? Please describe.
While the CRM can forecast production, there are no notebooks with examples of this

This would be added to the docs/user-guide/ as another notebook.

Unable to run buckley-leverett.ipynb :bug:

I have successfully installed pywaterflood and can run 7-minutes-to-pywaterflood.ipynb, choosing-crm.ipynb, and multiwell-productivity-index.ipynb. However, I can't run /buckley-leverett.ipynb

This is the error I get when trying to run the first cell in the notebook.

ModuleNotFoundError Traceback (most recent call last)
Cell In[3], line 6
3 import seaborn as sns
4 import pandas as pd
----> 6 from pywaterflood.buckleyleverett import Reservoir, water_front_velocity, breakthrough_sw

ModuleNotFoundError: No module named 'pywaterflood.buckleyleverett'

Koval fractional flow

Is your feature request related to a problem? Please describe.
There's information in how the water/oil ratio is changing. We ought to capture that with a Koval fractional flow model. We can compare it to the Buckley-Leverett solutions.

Describe the solution you'd like
The equation

$$f_w=\begin{cases} 0, & t_D < 1/K_v \\ \frac{K_v - \sqrt{K_v/t_D}}{K_v - 1}, & 1/K_v \le t_D \le K_v \\ 1, & t_D > K_v \end{cases}$$

image

where $K_v = H_k E$, $H_k$ is the heterogeneity, $E = \left(0.78 + 0.22 \left(\mu_o/\mu_w\right)^{1/4}\right)^4$ is the effective viscosity ratio.

Describe alternatives you've considered
Buckley Leverett with straight-line relative permeabilities might be able to do this.

Further reading: https://doi.org/10.2118/217973-PA

ML-style gain penalties

Is your feature request related to a problem? Please describe.
It would be kind of fun to have an option to penalize gains/connectivities between injectors and producers

Describe the solution you'd like
An option when creating a CRM to use a penalty function, either L1 or L2, on the gains when fitting.

Additional context
Elastic net regression

Buckley Leverett frontal advance equation

Add solution for $S_w$ frontal advance

$$\begin{equation} \left(\frac{dx}{dt}\right)_{S_w} = \frac{q_t}{\phi A} \left(\frac{\partial f_w}{\partial S_w}\right)_t \end{equation}$$

where

$$\begin{equation} f_w = \frac{1 + \frac{k_o A}{\mu_o q_t} \left(\rho_o - \rho_w\right) g \sin \alpha}{1 + \frac{k_o}{k_w}\frac{\mu_w}{\mu_o}} \end{equation}$$

and $k_o$ and $k_w$ are dependent upon water saturation following the Brooks and Corey model.

$$\begin{equation} k_{ro} = \left(\frac{S_o- S_{or}}{1 - S_{or} - S_{wc}- S_{gc}}\right)^{n_o} \end{equation}$$

Account for producer shutins

Is your feature request related to a problem? Please describe.
When producers are shut in and not producing, their production is still predicted. Those lengths of time should not factor into the residuals for finding connectivity between the shut in producers and the active injectors.

Describe the solution you'd like
There should be a flag that, when set, changes the behavior so that when production is zero, the residual for a fit should be set to zero.

class CRM:
    ...
    def __init__(
        self,
        primary: bool = True,
        tau_selection: str = "per-pair",
        constraints: str = "positive",
        producer_shutins: bool = False,
    ):

Describe alternatives you've considered
A mask could be applied. This effect can be ignored (but maybe shouldn't).

Additional context
The function of interest is at

def residual(x, production):
return sum(
(production - self._calculate_qhat(x, production, injection, time)) ** 2
)

capture bottomhole pressure variation

Bottomhole pressure variation at each producer can also affect its production rate. Yousef et al (2006) have a formulation of that contribution to production, which is

Kaviani et al (2012) suggest that a shift to production can be performed in segmented capacitance modeling with the equation

They then suggest it can be further simplified through assuming very large ฯ„ values between producers, which gets to the equation

The fitting parameters here are elements of v. This could either be solved simultaneously with the primary production rates and producer-injector connectivities, or as a pre-processing step.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.