Skip to main content

A g-function calculator for Python

Project description

pygfunction: A g-function calculator for Python

Tests DOI

What is pygfunction?

pygfunction is a Python module for the calculation of thermal response factors, or g-functions, for fields of geothermal boreholes. g-functions form the basis of many simulation and sizing programs for geothermal heat pump systems. g-Functions are superimposed in time to predict fluid and ground temperatures in these systems.

At its core, pygfunction relies on the analytical finite line source solution to evaluate the thermal interference between boreholes in the same bore field. This allows for the very fast calculation of g-functions, even for very large bore fields with hundreds of boreholes.

Using pygfunction, g-functions can be calculated for any bore field configuration (i.e. arbitrarily positionned in space), including fields of boreholes with individually different lengths and radiuses. For regular fields of boreholes of equal size, setting-up the calculation of the g-function is as simple as a few lines of code. For example, the code for the calculation of the g-function of a 10 x 10 square array of boreholes (100 boreholes total):

import pygfunction as gt
import numpy as np
time = np.array([(i+1)*3600. for i in range(24)]) # Calculate hourly for one day
boreField = gt.boreholes.rectangle_field(N_1=10, N_2=10, B_1=7.5, B_2=7.5, H=150., D=4., r_b=0.075)
gFunc = gt.gfunction.gFunction(boreField, alpha=1.0e-6, time=time)
gFunc.visualize_g_function()

Once the g-function is evaluated, pygfunction provides tools to predict borehole temperature variations (using load aggregation methods) and to evaluate fluid temperatures in the boreholes for several U-tube pipe configurations.

Requirements

pygfunction was developed and tested using Python 3.7. In addition, the following packages are needed to run pygfunction and its examples:

  • Coolprop (>= 6.4.1)
  • matplotlib (>= 3.5.1),
  • numpy (>= 1.21.5)
  • scipy (>= 1.7.3)

The documentation is generated using Sphinx. The following packages are needed to build the documentation:

  • sphinx (>= 4.4.0)
  • numpydoc (>= 1.2.0)

Quick start

Users - Download pip and install the latest release:

pip install pygfunction

Alternatively, download the latest release and run the installation script:

pip install .

Developers - To get the latest version of the code, you can download the repository from github or clone the project in a local directory using git:

git clone https://github.com/MassimoCimmino/pygfunction.git

Install pygfunction in development mode (this requires pip >= 21.1):

pip install --editable .

Once pygfunction is copied to a local directory, you can verify that it is working properly by running the examples in pygfunction/examples/.

Documentation

pygfunction's documentation is hosted on ReadTheDocs.

License

pygfunction is licensed under the terms of the 3-clause BSD-license. See pygfunction license.

Contributing to pygfunction

You can report bugs and propose enhancements on the issue tracker.

To contribute code to pygfunction, follow the contribution workflow.

Contributors

All Contributors


Massimo Cimmino

💻 📖 💡 :rocket: 🤔 🚧 👀

Jack Cook

💻 💡 🤔 📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Copyright (c) 2017-2022, Massimo Cimmino All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

  • Neither the name of pygfunction nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Project details


Download files

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

Source Distribution

pygfunction-2.2.0.tar.gz (99.1 kB view details)

Uploaded Source

Built Distribution

pygfunction-2.2.0-py3-none-any.whl (90.0 kB view details)

Uploaded Python 3

File details

Details for the file pygfunction-2.2.0.tar.gz.

File metadata

  • Download URL: pygfunction-2.2.0.tar.gz
  • Upload date:
  • Size: 99.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.9.12

File hashes

Hashes for pygfunction-2.2.0.tar.gz
Algorithm Hash digest
SHA256 96c544c8e327635f45b95e65c37c7d282964d22b15d22281bb1871bda4115169
MD5 3e6f205aef0968786935c8e95d20ffb2
BLAKE2b-256 b825f9c98b081ac28ee08e16efbd05ff95e42b40a9a3e6c70a40145a47fdab7a

See more details on using hashes here.

Provenance

File details

Details for the file pygfunction-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: pygfunction-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 90.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.11.3 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.64.0 CPython/3.9.12

File hashes

Hashes for pygfunction-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e6146effd6ccb87592c3791fcf40f66330b9681d816308d1f8b8837e2a16c0ee
MD5 68d1fde9e3707be38f307cd49c72aa9d
BLAKE2b-256 b2319440a904d9de9cc8fef8213d75f5bea26d06fa7c7592538ac16119253e6b

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page