Skip to main content

pyiapws: IAPWS for python.

Project description

Introduction

Python wrapper around the Fortran iapws library. The Fortran library does not need to be installed, the python wrapper embeds all needed dependencies for Windows and MacOS. On linux, you might have to install libgfortran if it is not distributed with your linux distribution.

All functions that operate on arrays, more precisely on objects with the buffer protocol, return memory views in order to avoid compilation dependencies on 3rd party packages.

Installation

In a terminal, enter:

pip install pyiapws

Usage

import array
import numpy as np
import matplotlib.pyplot as plt
import pyiapws

print("########################## IAPWS VERSION ##########################")
print(pyiapws.__version__)

print("########################## IAPWS R2-83 ##########################")
print("Tc in H2O", pyiapws.r283.tc_H2O, "K")
print("pc in H2O", pyiapws.r283.pc_H2O, "MPa")
print("rhoc in H2O", pyiapws.r283.rhoc_H2O, "kg/m3")

print("Tc in D2O", pyiapws.r283.tc_D2O, "K")
print("pc in D2O", pyiapws.r283.pc_D2O, "MPa")
print("rhoc in D2O", pyiapws.r283.rhoc_D2O, "kg/m3")

print("")

print("########################## IAPWS G7-04 ##########################")
gas  = "O2"
T = array.array("d", (25.0,))

# Compute kh and kd in H2O
heavywater = False
m = pyiapws.g704.kh(T, "O2", heavywater)
k = array.array("d", m)
print(f"Gas={gas}\tT={T[0]}C\tkh={k[0]:+10.4f}\n")

m = pyiapws.g704.kd(T, "O2", heavywater)
k = array.array("d", m)
print(f"Gas={gas}\tT={T[0]}C\tkh={k[0]:+10.4f}\n")

# Get and print the available gases
heavywater = False
gases_list = pyiapws.g704.gases(heavywater)
gases_str = pyiapws.g704.gases2(heavywater)
ngas = pyiapws.g704.ngases(heavywater)
print(f"Gases in H2O: {ngas:}")
print(gases_str)
for gas in gases_list:
    print(gas)

heavywater = True
gases_list = pyiapws.g704.gases(heavywater)
gases_str = pyiapws.g704.gases2(heavywater)
ngas = pyiapws.g704.ngases(heavywater)
print(f"Gases in D2O: {ngas:}")
print(gases_str)
for gas in gases_list:
    print(gas)

style = {"marker":".", "ls":"", "ms":2}
T_KELVIN = 273.15
T = np.linspace(0.0, 360.0, 1000)

solvent = {True: "D2O", False: "H2O"}

print("Generating plot for kh")
kname = "kh"
for HEAVYWATER in (False, True):
    print(solvent[HEAVYWATER])
    fig = plt.figure()
    ax = fig.add_subplot()
    ax.grid(visible=True, ls=':')
    ax.set_xlabel("T /°C")
    ax.set_ylabel("ln (kh/1GPa)")
    gases = pyiapws.g704.gases(HEAVYWATER)
    for gas in gases:
        k_m = pyiapws.g704.kh(T, gas, HEAVYWATER)
        k = np.asarray(k_m) / 1000.0
        ln_k = np.log(k)
        ax.plot(T, ln_k, label=gas, **style)
    ax.legend(ncol=3)

print("Generating plot for kd")
kname = "kd"
for HEAVYWATER in (False, True):
    print(solvent[HEAVYWATER])
    fig = plt.figure()
    ax = fig.add_subplot()
    ax.grid(visible=True, ls=':')
    ax.set_xlabel("T /°C")
    ax.set_ylabel("ln kd")
    gases = pyiapws.g704.gases(HEAVYWATER)
    for gas in gases:
        k_m = pyiapws.g704.kd(T, gas, HEAVYWATER)
        k = np.asarray(k_m)
        ln_k = np.log(k)
        ax.plot(T, ln_k, label=gas, **style)
    ax.legend(ncol=3)

License

MIT

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

pyiapws-0.4.0.tar.gz (49.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pyiapws-0.4.0-cp313-cp313-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.13Windows x86-64

pyiapws-0.4.0-cp313-cp313-manylinux_2_31_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ x86-64

pyiapws-0.4.0-cp312-cp312-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12Windows x86-64

pyiapws-0.4.0-cp312-cp312-manylinux_2_31_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ x86-64

pyiapws-0.4.0-cp312-cp312-macosx_12_0_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12macOS 12.0+ x86-64

pyiapws-0.4.0-cp311-cp311-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.11Windows x86-64

pyiapws-0.4.0-cp311-cp311-manylinux_2_31_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ x86-64

pyiapws-0.4.0-cp311-cp311-macosx_12_0_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 12.0+ x86-64

pyiapws-0.4.0-cp310-cp310-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.10Windows x86-64

pyiapws-0.4.0-cp310-cp310-manylinux_2_31_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ x86-64

pyiapws-0.4.0-cp310-cp310-macosx_12_0_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 12.0+ x86-64

pyiapws-0.4.0-cp39-cp39-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.9Windows x86-64

pyiapws-0.4.0-cp39-cp39-manylinux_2_31_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.31+ x86-64

pyiapws-0.4.0-cp39-cp39-macosx_12_0_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9macOS 12.0+ x86-64

pyiapws-0.4.0-cp38-cp38-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.8Windows x86-64

pyiapws-0.4.0-cp38-cp38-manylinux_2_31_x86_64.whl (1.3 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.31+ x86-64

pyiapws-0.4.0-cp38-cp38-macosx_12_0_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8macOS 12.0+ x86-64

File details

Details for the file pyiapws-0.4.0.tar.gz.

File metadata

  • Download URL: pyiapws-0.4.0.tar.gz
  • Upload date:
  • Size: 49.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for pyiapws-0.4.0.tar.gz
Algorithm Hash digest
SHA256 ef613ced2d379e180330149a61b20274a11018042a8b5a1af9f2a70950245acf
MD5 209b2f37181ef81a3a5ea51919917b41
BLAKE2b-256 f3645109616d3a17fd75f56ab94db55feb7b50c23ef15227936a6e68d5ef7ba3

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: pyiapws-0.4.0-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for pyiapws-0.4.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 9fa3cf63923b35f83047fdbd7ceb7016cecb00dec89baab9a4828b34bd56b3bf
MD5 543e1cbbc43ac2055a52dbb4914fb14a
BLAKE2b-256 dff919e44f89e6ab3e3abccf50f5bd7f4772dbfb999002746dad22210465cd0e

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp313-cp313-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp313-cp313-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 1cd2436054e794d91b9a379b8d571e3144fb927503da39da928c0d0b83717428
MD5 e046a3e97f68b2876ebae51ed780d295
BLAKE2b-256 b92d1b2541d1ea90f688388bcf6d5632d505c89bcd64e9c02f136c857b0250fa

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: pyiapws-0.4.0-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pyiapws-0.4.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 80dedfeb01236c1970523b025ca584c4323fac3c210e066975fabb3ee9e5d175
MD5 ab766d99657863b22b7a6b8b03abac1d
BLAKE2b-256 7e194c44b09a51b550ad0c12be207d5adbe76eac9acd1e8370c7de4ae2e20329

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp312-cp312-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp312-cp312-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 655393480b68f1c512ab6bdabd89773146f1a3f6169b559cd60f7433129ffdb1
MD5 df59ec71751055f63a5da29e5c61726c
BLAKE2b-256 20082aafc23342a85877cf53099ad3499c0c3bc85f0c80db8a7b82a51d404084

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp312-cp312-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp312-cp312-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 fb1b19515f520821c71631e5499ee03e25771babb7332b2bff122ae1ef1bbc66
MD5 852c0a33f47901d93e2a33b90267d0fe
BLAKE2b-256 5841248923b8368a7367f27abf22f96a2726e820a1552da14771de15f5a09e16

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: pyiapws-0.4.0-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pyiapws-0.4.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2cb144b21096c49528293b28c41d3653aa97402fadffa9b14e14a2d817400ba2
MD5 a451604ac6489b2b9c5148ad71be23dc
BLAKE2b-256 75a60f941c95f948b8147bad47fe5fb66b161e7367a4c6af8858589dd20e6970

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp311-cp311-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp311-cp311-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 5b1e0f61028cef5d2074505f5a46305ef27e77e32c2828ff3e26e2889e3d99d7
MD5 04301cc8043706af23fd42ea95812001
BLAKE2b-256 0109113b3d038872f096523e7d6ec3ad24e3692ae6a837b9817d32dde8afdf8b

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp311-cp311-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp311-cp311-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 897921790166f34b9edb12cda5bd02324cfd124eed2a29a1c476dbd7981d0b0f
MD5 3df99d93c017505642f5bf57e080b61b
BLAKE2b-256 18535fae44f28376309ec66967011a006f6be048e4e847b2a0da30ba45afd291

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: pyiapws-0.4.0-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pyiapws-0.4.0-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 a2bfb70ef20216a7e342ebf4c1d3663094adc71ac9d8b3156a6ee6bc40864874
MD5 23efa889e5d1e90a633b628d2ec50108
BLAKE2b-256 544b3dc32b2a24c50faef473aec39c07d31f7d3a55684625f2eac07d3383155b

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp310-cp310-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp310-cp310-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 921d57de210efae56c707c4af3c9bd4f78c5c4b5f8886cb121708f21def11437
MD5 e9af64bd44fdea5a9bcdeeb69345f004
BLAKE2b-256 57a7b7710a39b36c8dc251889657ce3635bcbfabff32ab55a75d4176a4d37ca4

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 b76211c79db8c18225f5d259f22f12de51fcf56c33bf2220d144c3f58cb851c0
MD5 67d1bba97e30d6a0837e66acf2848a78
BLAKE2b-256 5bde82b0d682186f40c8d15d870eef98b4c135f6ca15b86ee4ba774a3e98d0d0

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: pyiapws-0.4.0-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pyiapws-0.4.0-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 febc0451ece027f4cc1c2013d8087919c5148f401535b4245a0606f0fd988bb4
MD5 ce941002cc4316e95e6cc31715eb1f2b
BLAKE2b-256 fcd4a270eb25e8d9557804bad7f65bd30a81a9d9f8afe4fde0b0be0f3597343f

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp39-cp39-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp39-cp39-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 daaa014d7c4c9596ac96e74e0e76ea7d94f4f2d02fd8c07540a7ef709a3fc765
MD5 8050fc49d5593c6dfa5be526db481428
BLAKE2b-256 97de9808415f58e15f40d0041d9d989ee64d773b6d2de23a7c9a90f2891c6aa5

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp39-cp39-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp39-cp39-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 8e64b8b7ebe86bc6825bf518a577c038d656782a87b93bfbb937623470d94181
MD5 c627e34fc81fcd90dfc6e4d8d21bec85
BLAKE2b-256 9001a79a8d35802a98bbb154ba82beef5c8fa0b8732e6071da593b04e3abcd97

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: pyiapws-0.4.0-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.9

File hashes

Hashes for pyiapws-0.4.0-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 65cda5de28be3b6022cadd13ff37008f275f11a5acbf9a371103f9b740cb05aa
MD5 82d24e0bf57bef67b3d9ffd8c10bc0eb
BLAKE2b-256 cc5e988dab75104e8d4b99ea83f72e07ae7d6f99457c5aa1e9c98528d6512c56

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp38-cp38-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp38-cp38-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 3d99a1c3aa04d8177cf591ab11ee0d945c5ef9b4803a862d4ea1a21b8226047d
MD5 c7e3437912aacd5c9e151cfaceb289a6
BLAKE2b-256 69f11ece649e2fdfb7502b86e71e2df9068639ab74b1e9e90b384c52300ea8cd

See more details on using hashes here.

File details

Details for the file pyiapws-0.4.0-cp38-cp38-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for pyiapws-0.4.0-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 c21fffe5483f5baa08c27b345940f53e54c1fd0c46593ed823d69a0f0bc1ed6e
MD5 ca09c871038b15b0a9663aa3a797ea3c
BLAKE2b-256 07687777f6799f2a8653b908352612a955ba78bf70109e6ba98c672542548cec

See more details on using hashes here.

Supported by

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