Category: Programming

  • Frac Design in Python

    Need to design a frac quickly, with performance and pumping schedules for screening and budgeting? Got you covered!

    The proppant number follows unified fracture design theory that for a given fracture volume, there is an ideal fracture width and half-length that maximizes stimulation. This is around Fcd=1.6 for many fracs, especially frac packs. 

    However it’s not always realistic – some fractures would be thousands of feet long but only 0.1” wide – good luck with proppant entry, and embedment or slumping is going to kill the APC – or 10’ long but 5” wide – reality for such a soft rock is there’s of embedment and mixing of disaggregated formation and proppant at the rock face, with maybe a clean 1” frac.

    The next step is then to look at predicted fracture geometry with one of the common 1D models, Penny, PKN, or KGD, and see if that volume of proppant and geometry is sensible. If the Fcd is backmodeled based on the geometry, what is realistically possible in terms of rate and proppant placed? This can be iterated a few times until the fracture geometry starts to agree on itself. It may be that more or less proppant and rate is needed to achieve targets, or we stick with the original volume and acknowledge that Fcd may not be optimal. In the video example the 32bpm is overkill and should be reduced considerably as the Fcd is lower than 1.7, suggesting that length should be longer and with more net pressure gain.

    Finally the schedule is based entirely on volume and efficiency that builds a fracture – geometry is formed, fluid leaks off, proppant is placed successively in an ideal model. I frequently use this as a first estimate in Stimplan, make some standard modifications that I prefer, and I usually end up with a pretty decent first pass at a frac. Obviously multi-layered rocks make this approach not as effective, but for first pass this method has saved me quite a bit of time and energy in frac design, and lets me respond to production teams on estimated costs and performance within an hour of getting barebones data, sometimes during the same meeting!

    Currently this app is unavailable publicly due to tight integration with the rest of the software, but I wanted to share an example of a custom app can be built and deployed to work within your workflow. I hope to have a framework of the package available soon once I have the background data model developed, but in the meantime I’m happy to have a chat on how this and other applications work and can help!

  • Von Mises Derivation and Application

    Von Mises stress envelope is a valuable tool to performing tubular stress analysis. However that pretty ellipse that you put your load calculations in has some math behind it, and understanding how it is derived helps understand why it is used.

    The Von Mises envelope equation provides the interaction between the different stresses that will equal to the yield stress of the tubular. When other stresses are 0, then clearly the remaining stress will be the same as yield. However what happens if you start pulling tension on the pipe? Does that additional stress strengthen or weaken the pipe? It actually strengthens it, and can be valuable in eking out maximum performance in your tubing and casing through design. Trying to draw a single envelope can be difficult with up to 4 variables, however this workflow illustrates how some terms can be eliminated or made in terms of one other, and identify the extremes to plot with.

    Von Mises works well for extending the ability of the pipe under tension and burst conditions, however collapse is a different story; it is an inherently unstable condition that is fine, until it isn’t. While burst will often cause some cracking and leaks as the pressure increases until total failure happens, collapse can happen extremely quickly, causing catastrophic damage before it can be reacted to. The term pancaking isn’t an exaggeration, pipe can be nice and round in one moment and flattened in the next. I remember an incident with sand screens, the field had been producing great until water influx carried particles that plugged the screen, and wells started going down one after another. The API calculations in 5C3 are the standard for determining collapse, and have a well-proven track history.

    I did a separate write up in Word to accompany code on my Github, and have copied it below (email me if you’d like a PDF of it). Head over to https://github.com/jack-charles/PipeEnvelope to check out the code itself. It’s setup out of the box to create and plot multiple VME and API curves with safety factors and derating. It can be modified easily to integrate into your own workflows for quick stress checks, without breaking out the big software packages and needing to re-input all your data.

    Next in the series – how do we calculate the tubing and casing loads, especially with buckling or torsion? And how do we know which envelope the load should be plotted against?

  • Sand Sieve Analysis Python script

    I uploaded to GitHub a Python version of the sand sieve analysis spreadsheet that I used for years. The script will generate a number of plots that help graphically determine sand control options, in a method better than the traditional Excel spreadsheets do.

    https://github.com/jack-charles/SandSieveAnalysis

    It has a straightforward terminal prompt that allows for:

    • Opening a new sieve data file with multiple samples
    • Combining multiple sieve data results (plotting old core data with newer offset wells is easy!)
    • Selection of screens and proppants as options
    • Calculation of the cumulative weight percentages, uniformity coefficients, sorting coefficients, etc.
    • Plots of distributions, parameters against depth and other parameters, and screen/proppant data to determine suitability of sand control
    • Basic input error detection, but don’t stress the program if you can help it!
    • Displays to terminal or outputs to a JSON file

    On my to-do list is to incorporate logging data, such as gamma ray, sonic, and density logs to help establish other views of the formation. I would like to also add in sand retention test data from a flow cell (typically retained perm vs pressure and flow) to help make selections. I will make periodic updates to add in other calculations, including converting this to a Flask or other web framework application, and integrating to an SQL database for complete data collection.

    If you find this useful or have suggestions for improvements, please let me know. These graphs work for me, but may not be the best for users globally.

    This is a first baby step I have in mind for delivering bespoke production and well engineering calculations through an online (internet or intranet) platform. We’re all familiar with enterprise software like Landmark and trust their reliability for well integrity, but I believe there are many other critical calculations that we rely too heavily on Excel for. Even worse is when we must rely on Excel for calculations that are then put into EDM and other software. I will discuss more on my philosophy in later posts, but my own experiences and observations leads me to believe that operator and vendor data is not well managed. GIGO, unaudited calculation tools, and user laziness is a real thing that can make a database with hundreds of entries and gigs of data effectively useless.

    Interested in adding this and more to your company’s workflows? Contact me to see how we can make this happen.

  • Sharing Knowledge

    Over the years I’ve picked up quite a bit. One of the great joys of learning is to turn it around and share it. Besides sitting around a frac shack or doghouse and swapping stories, I’ve also published a number of reports, white papers, and industry papers.

    I’m also a big proponent of engineering programming, with some fairly complex VBA-backed Excel programs. Lately I have been converting much of my old code to Python, all 5000-ish lines of it, and exploring how to make the leap from the old spreadsheets to a proper web-based software platform, with assured calculations displayed in a clear and open manner.

    I will publish articles here on well engineering going forward, with a mix of theory, advice from experience, and how to practically apply it in an engineer’s procedures and calculations.

    Hopefully visitors will find it useful, and be part of the 10,000 for the day!