Skip to main content

A Library for Thermodynamics using Cubic & Associative contributions written in Rust.

Reason this release was yanked:

_

Project description

REOS

import numpy as np
from reos.reos import EquationOfState,State,CPAParameters,CubicRecord,AssociationRecord

#1) Cubic pure parameters
c_water = CubicRecord(a0 = 0.12277, b = 0.0145e-3, c1 = 0.6736, tc = 647.14)
c_co2 = CubicRecord(a0 = 0.35079, b = 0.0272e-3, c1 = 0.7602, tc = 304.12)


#2) Associative pure parameters (Water 4C and CO2 1ea, data from  Tsivintzelis,2011)  
a_water  = AssociationRecord.associative(b = 0.0145e-3, eps = 166.55e2, beta = 0.0692, na = 2, nb = 2, nc = 0)
a_co2  = AssociationRecord.solvate(b = 0.0272e-3, na = 0, nb = 1, nc = 0)

#3) Build a CPAParameters object 
parameters = CPAParameters.from_records(
    cubic = [c_water,c_co2],
    assoc = [a_water,a_co2])

# Set the combination's rule 
parameters.set_cubic_binary(j = 0, i = 1, kij_a =  0.000877, kij_b = -0.15508 ) #kij = aT + b
parameters.set_assoc_binary(j = 0, i = 1, rule = "mcr1", beta = 0.1836) # modified CR1

#4) Create a EoS object w\ CPA contribution
eos = EquationOfState.cpa(parameters)

#5) Instantiate a State object from the EoS
T=298.15
P=500e5
x=np.array([0.5,0.5])
state= State.tpx(eos,T,P,x,density_initialization="vapor")

# Compute thermodynamic properties
phi=np.exp(state.ln_phi())
print(f"phi = {phi}")

# Get association variables
assoc = eos.get_association()
sites_map =assoc.get_sites_map()

X=state.non_bonded_sites()

print(f"Sites = {sites_map}") 

print(f"Non-Bonded Sites fraction = {X}")
phi = [2.14385748e-04 5.65853284e-01]
Sites = ((0, 0), (1, 0), (1, 1)) #(type, owner)
Non-Bonded Sites fraction = [0.07333045 0.22590468 0.69485154]

#The Project's Sctructre

├── crates
│   ├── reos
│   └── reos_py
├── python-examples
└── README.md

reos

The rust core-base of project.

reos_py

Python Interface for the features inside reos-crate, made with pyo3 and maturin.

To install reos package in your python enviromnent, if you have cargo and maturin installed, just do the following command inside /reos_py:

maturin develop --release

This command will install reos in your machine, and you can simply import it like any other python module:

from reos.reos import EquationOfState,State,CPAParameters,CubicRecord,AssociationRecord

Otherwise, if you want to use reos inside a google colab notebook, you can use the reos_colab.ipynb ( located in /python_examples), where will be installed cargo and maturin, to compile the reos in a .wheel file, and finnaly import it .

python_examples

This folder contains the usage of principal functionalities of the reos crate in Python through some examples:

  • Phase Diagram of VLE for mixtures with binary mixtures with associative + inert mixtures and cross-associating mixtures
  • Water solubility in CO2 vapor phase

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

reos-0.0.1.tar.gz (38.4 kB view details)

Uploaded Source

Built Distribution

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

reos-0.0.1-cp312-cp312-manylinux_2_34_x86_64.whl (454.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

File details

Details for the file reos-0.0.1.tar.gz.

File metadata

  • Download URL: reos-0.0.1.tar.gz
  • Upload date:
  • Size: 38.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for reos-0.0.1.tar.gz
Algorithm Hash digest
SHA256 cbd7f1275c65568104b5b94afc5059a81a9888e8dc8325acc69808427db9fef4
MD5 0e1dbfee0283a759845ad8fd00afbc4a
BLAKE2b-256 9a86b014ead976142d1aa178e2d5830c5e76f236fc33b2d13d8b609df5ce8df8

See more details on using hashes here.

File details

Details for the file reos-0.0.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for reos-0.0.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e30345b9e28ed9ba272d00d827283bba1cc27fc733bd5e4c188f43df689d6249
MD5 9402812f8d31120f4f8a43f71b6eb693
BLAKE2b-256 8ccac8da8d521efac4bae5eb2be589294f4a1876a347a0ebab530370e5dd21c4

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