Skip to main content

Well Temperature Distribution

Project description



This project aims to create a module able to calculate the temperature distribution for an entire well.

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.


Libraries used in the project:

Numpy, Matplotlib, Math and Tkinter.


1. Inlet Fluid Temperature
2. Surface Temperature
3. Well Depth
4. Water Depth
5. Drill Pipe Inner Diameter
6. Drill Pipe Outer Diameter
7. Casing Inner Diameter
8. Surrounding Space Diameter
9. Riser Inner Diameter
10. Riser Outer Diameter
11. Nearby Formation Diameter
12. Circulation Rate
13. Fluid Thermal Conductivity (Default Value Provided)
14. Casing Thermal Conductivity (Default Value Provided)
15. Drill Pipe Thermal Conductivity (Default Value Provided)
16. Comprehensive Csg-Fm Thermal Conductivity (Default Value Provided)
17. Riser Thermal Conductivity (Default Value Provided)
18. Comprehensive Riser-Water Thermal Conductivity (Default Value Provided)
19. Seawater Thermal Conductivity (Default Value Provided)
20. Fluid Heat Capacity (Default Value Provided)
21. Casing Heat Capacity (Default Value Provided)
22. Drill Pipe Heat Capacity (Default Value Provided)
23. Riser Heat Capacity (Default Value Provided)
24. Seawater Heat Capacity (Default Value Provided)
25. Surrounding Space Heat Capacity (Default Value Provided)
26. Convective Heat Transfer Coefficient at the Inner Face of Drill Pipe (Default Value Provided)
27. Convective Heat Transfer Coefficient at the Outer Face of Drill Pipe (Default Value Provided)
28. Convective Heat Transfer Coefficient at the Inner Face of Casing (Default Value Provided)
29. Convective Heat Transfer Coefficient at the Inner Face of Riser (Default Value Provided)
30. Geothermal Gradient (Default Value Provided)
31. Seawater Thermal Gradient (Default Value Provided)
32. Fluid Density (Default Value Provided)
33. Drill Pipe Density (Default Value Provided)
34. Casing Density (Default Value Provided)
35. Riser Density (Default Value Provided)
36. Formation Density (Default Value Provided)
37. Seawater Density (Default Value Provided)
38. Surrouding Average Density (Default Value Provided)
39. Weight on bit (WOB)
40. Rate of Penetration (ROP)
41. Area of Nuzzles
42. Reynolds
43. Measured Depth at Target


Temperature of the fluid inside the Drill String (Tdsi)
Temperature of the Drill String Wall (Tds)
Temperature of the fluid inside the Annular (Ta)
Temperature of the Casing (Tcsg)
Temperature of the Riser (Tr)
Temperature of the Surrounding Space (Tsr)
Temperature of the Formation (Tfm)


Note 1: Above seabed, casing section is replaced with the riser and surrounding space would be sea water.

Note 2: Beyond the 'undisturbed formation zone' the temperature keeps constant (Tfm).

Distribution Scheme

Code Distribution

The code is compound by 8 files: â–· contains a function to define the MD, and TVD values from the wellpath.

temp_dict.json â–· contains the parameters required for the temperature calculation. â–· creates a class (WellTemperature) to have access to the parameters of the case. â–· defines the initial and boundary conditions. â–· contains a function to calculate the coefficients for the heat tranfer equations that will be used. â–· contains a function to generate the entire temperature profile. â–· contains a function to plot Tfm, Ta(bottom), Ta(outlet) vs time and also Temperature profile at stabilization time. â–· contains a function to determine the temperature profile when it is already stabilized.


1. If you have already the values of TVD and MD from your own wellpath, then you can skip the calculation in the wellpath function:

md=range(mdt)  # Measured Depth from RKB, m
    tvd=[]   # True Vertical Depth from RKB, m

    for z in md:

And then you only need to define these two lists (tvd and md) instead, and the shoes depths of the casings of course.

2. You can check and modify all the parameters from the file temp_dict.json or call the value from a variable/object directly to the file

3. Run the file and you will get the entire temperature profile at stabilization time (Tdsi,Ta,Tr,Tcsg,Tsr,Tfm), the temperature at the bottom through the time (Tbot),the temperature at the outlet (Annular) through the time (Tout) and the stabilization temperature (finaltime).

Running the tests

How to run the automated tests for this system...

- unittest
- nose or nose2
- pytest


Please read CONTRIBUTING for details on our code of conduct, and the process for submitting pull requests to us.


We use SemVer for versioning. For the versions available, see the tags on this repository.


See also the list of contributors who participated in this project.


This project is licensed under the GNU Lesser General Public License v3.0 - see the LICENSE file for details

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pwptemp, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size pwptemp-0.0.2-py3-none-any.whl (14.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pwptemp-0.0.2.tar.gz (12.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page