thermolib 0.7.7__tar.gz → 0.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. {thermolib-0.7.7 → thermolib-0.8.0}/Cargo.lock +1 -1
  2. {thermolib-0.7.7 → thermolib-0.8.0}/Cargo.toml +1 -1
  3. {thermolib-0.7.7 → thermolib-0.8.0}/PKG-INFO +1 -1
  4. thermolib-0.8.0/src/ideal_gas.rs +56 -0
  5. {thermolib-0.7.7 → thermolib-0.8.0}/src/lib.rs +3 -0
  6. {thermolib-0.7.7 → thermolib-0.8.0}/src/python.rs +2 -0
  7. {thermolib-0.7.7 → thermolib-0.8.0}/.gitignore +0 -0
  8. {thermolib-0.7.7 → thermolib-0.8.0}/LICENSE +0 -0
  9. {thermolib-0.7.7 → thermolib-0.8.0}/README.md +0 -0
  10. {thermolib-0.7.7 → thermolib-0.8.0}/pyproject.toml +0 -0
  11. {thermolib-0.7.7 → thermolib-0.8.0}/res/22DimethylButane.json +0 -0
  12. {thermolib-0.7.7 → thermolib-0.8.0}/res/23DimethylButane.json +0 -0
  13. {thermolib-0.7.7 → thermolib-0.8.0}/res/3MethylPentane.json +0 -0
  14. {thermolib-0.7.7 → thermolib-0.8.0}/res/C4F10.json +0 -0
  15. {thermolib-0.7.7 → thermolib-0.8.0}/res/C5F12.json +0 -0
  16. {thermolib-0.7.7 → thermolib-0.8.0}/res/C6F14.json +0 -0
  17. {thermolib-0.7.7 → thermolib-0.8.0}/res/NH3.json +0 -0
  18. {thermolib-0.7.7 → thermolib-0.8.0}/res/SO2.json +0 -0
  19. {thermolib-0.7.7 → thermolib-0.8.0}/src/algorithms.rs +0 -0
  20. {thermolib-0.7.7 → thermolib-0.8.0}/src/helmholtz/alpha.rs +0 -0
  21. {thermolib-0.7.7 → thermolib-0.8.0}/src/helmholtz/alpha_i.rs +0 -0
  22. {thermolib-0.7.7 → thermolib-0.8.0}/src/helmholtz/alpha_r.rs +0 -0
  23. {thermolib-0.7.7 → thermolib-0.8.0}/src/helmholtz/anc_eqn.rs +0 -0
  24. {thermolib-0.7.7 → thermolib-0.8.0}/src/helmholtz/assoc.rs +0 -0
  25. {thermolib-0.7.7 → thermolib-0.8.0}/src/helmholtz/rho_ini.rs +0 -0
  26. {thermolib-0.7.7 → thermolib-0.8.0}/src/helmholtz.rs +0 -0
  27. {thermolib-0.7.7 → thermolib-0.8.0}/src/liquid_metal/eta.rs +0 -0
  28. {thermolib-0.7.7 → thermolib-0.8.0}/src/liquid_metal/lambda.rs +0 -0
  29. {thermolib-0.7.7 → thermolib-0.8.0}/src/liquid_metal/metals.md +0 -0
  30. {thermolib-0.7.7 → thermolib-0.8.0}/src/liquid_metal/rho.rs +0 -0
  31. {thermolib-0.7.7 → thermolib-0.8.0}/src/liquid_metal.rs +0 -0
  32. {thermolib-0.7.7 → thermolib-0.8.0}/src/pc_saft.rs +0 -0
  33. {thermolib-0.7.7 → thermolib-0.8.0}/src/pr.rs +0 -0
  34. {thermolib-0.7.7 → thermolib-0.8.0}/src/rk.rs +0 -0
  35. {thermolib-0.7.7 → thermolib-0.8.0}/src/srk.rs +0 -0
  36. {thermolib-0.7.7 → thermolib-0.8.0}/src/vdw.rs +0 -0
  37. {thermolib-0.7.7 → thermolib-0.8.0}/tests/plot_ceos.py +0 -0
  38. {thermolib-0.7.7 → thermolib-0.8.0}/tests/test_fluids.rs +0 -0
@@ -210,7 +210,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
210
210
 
211
211
  [[package]]
212
212
  name = "thermolib"
213
- version = "0.7.7"
213
+ version = "0.8.0"
214
214
  dependencies = [
215
215
  "anyhow",
216
216
  "pyo3",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "thermolib"
3
- version = "0.7.7"
3
+ version = "0.8.0"
4
4
  edition = "2021"
5
5
  license = "MIT"
6
6
  description = "An open-source library for the calculation of fluid properties"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: thermolib
3
- Version: 0.7.7
3
+ Version: 0.8.0
4
4
  License-File: LICENSE
5
5
  Summary: An open-source library for the calculation of fluid properties
6
6
  License: MIT
@@ -0,0 +1,56 @@
1
+ #[cfg(feature = "with_pyo3")]
2
+ use pyo3::{pyclass, pymethods};
3
+ #[cfg_attr(feature = "with_pyo3", pyclass)]
4
+ pub struct IdealGas {
5
+ c: f64,
6
+ v: Vec<f64>,
7
+ }
8
+ impl IdealGas {
9
+ pub fn new_fluid() -> Self {
10
+ Self {
11
+ c: 1.5, // Translation contribution = 1.5
12
+ v: Vec::new(),
13
+ }
14
+ }
15
+ }
16
+ #[cfg_attr(feature = "with_pyo3", pymethods)]
17
+ #[allow(non_snake_case)]
18
+ impl IdealGas {
19
+ #[cfg(feature = "with_pyo3")]
20
+ #[new]
21
+ pub fn new_py() -> Self {
22
+ Self::new_fluid()
23
+ }
24
+ pub fn set_linear_molecule(&mut self) {
25
+ // Translation contribution = 1.5
26
+ // Rotation contribution = 1.0
27
+ self.c = 2.5;
28
+ }
29
+ pub fn set_nonlinear_molecule(&mut self) {
30
+ // Translation contribution = 1.5
31
+ // Rotation contribution = 1.5
32
+ self.c = 3.0;
33
+ }
34
+ pub fn set_wave_length(&mut self, waves: Vec<f64>) {
35
+ self.v = waves.iter().map(|wave| C * wave * 100.0).collect();
36
+ }
37
+ pub fn calc_cv(&self, T: f64) -> f64 {
38
+ R * (self.c
39
+ + self
40
+ .v
41
+ .iter()
42
+ .map(|vi| {
43
+ let temp = -FRAC_H_K * vi / T;
44
+ temp.exp() * (temp / temp.exp_m1()).powi(2)
45
+ })
46
+ .sum::<f64>())
47
+ }
48
+ pub fn calc_cp(&self, T: f64) -> f64 {
49
+ self.calc_cv(T) + R
50
+ }
51
+ }
52
+ const R: f64 = 8.314462618; // CODATA2018 (molar gas constant) J mol^-1 K^-1
53
+ const C: f64 = 299792458.0; // CODATA2018 (speed of light in vacuum) m s^-1
54
+ const H: f64 = 6.62607015E-34; // CODATA2018 (Planck constant) J Hz^-1
55
+ const K: f64 = 1.380649e-23; // CODATA2018 (Boltzmann constant) J K^-1
56
+ const FRAC_H_K: f64 = H / K; // K / Hz
@@ -32,3 +32,6 @@ pub use liquid_metal::LiquidMetal;
32
32
  /// PC-SAFT EOS
33
33
  mod pc_saft;
34
34
  pub use pc_saft::PcSaftPure;
35
+ /// Ideal Gas
36
+ mod ideal_gas;
37
+ pub use ideal_gas::IdealGas;
@@ -5,6 +5,7 @@ fn hello() -> PyResult<String> {
5
5
  Ok(String::from("Hello, Rust And Python."))
6
6
  }
7
7
  use crate::Helmholtz;
8
+ use crate::IdealGas;
8
9
  use crate::LiquidMetal;
9
10
  use crate::PcSaftPure;
10
11
  use crate::Pr;
@@ -23,5 +24,6 @@ pub fn pylib(m: &Bound<'_, PyModule>) -> PyResult<()> {
23
24
  m.add_class::<Helmholtz>()?;
24
25
  m.add_class::<LiquidMetal>()?;
25
26
  m.add_class::<PcSaftPure>()?;
27
+ m.add_class::<IdealGas>()?;
26
28
  Ok(())
27
29
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes