thermolib 0.7.6__tar.gz → 0.7.7__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.
- thermolib-0.7.7/Cargo.lock +252 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/Cargo.toml +1 -2
- {thermolib-0.7.6 → thermolib-0.7.7}/PKG-INFO +1 -1
- {thermolib-0.7.6 → thermolib-0.7.7}/src/helmholtz/alpha.rs +35 -28
- {thermolib-0.7.6 → thermolib-0.7.7}/src/liquid_metal.rs +15 -7
- {thermolib-0.7.6 → thermolib-0.7.7}/src/pc_saft.rs +165 -153
- {thermolib-0.7.6 → thermolib-0.7.7}/src/pr.rs +33 -25
- {thermolib-0.7.6 → thermolib-0.7.7}/src/rk.rs +32 -24
- {thermolib-0.7.6 → thermolib-0.7.7}/src/srk.rs +33 -25
- {thermolib-0.7.6 → thermolib-0.7.7}/src/vdw.rs +32 -24
- thermolib-0.7.6/Cargo.lock +0 -4125
- thermolib-0.7.6/src/bin/liquid_metal.rs +0 -100
- {thermolib-0.7.6 → thermolib-0.7.7}/.gitignore +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/LICENSE +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/README.md +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/pyproject.toml +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/res/22DimethylButane.json +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/res/23DimethylButane.json +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/res/3MethylPentane.json +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/res/C4F10.json +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/res/C5F12.json +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/res/C6F14.json +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/res/NH3.json +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/res/SO2.json +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/algorithms.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/helmholtz/alpha_i.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/helmholtz/alpha_r.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/helmholtz/anc_eqn.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/helmholtz/assoc.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/helmholtz/rho_ini.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/helmholtz.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/lib.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/liquid_metal/eta.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/liquid_metal/lambda.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/liquid_metal/metals.md +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/liquid_metal/rho.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/src/python.rs +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/tests/plot_ceos.py +0 -0
- {thermolib-0.7.6 → thermolib-0.7.7}/tests/test_fluids.rs +0 -0
@@ -0,0 +1,252 @@
|
|
1
|
+
# This file is automatically @generated by Cargo.
|
2
|
+
# It is not intended for manual editing.
|
3
|
+
version = 3
|
4
|
+
|
5
|
+
[[package]]
|
6
|
+
name = "anyhow"
|
7
|
+
version = "1.0.95"
|
8
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
9
|
+
checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04"
|
10
|
+
|
11
|
+
[[package]]
|
12
|
+
name = "autocfg"
|
13
|
+
version = "1.4.0"
|
14
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
15
|
+
checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26"
|
16
|
+
|
17
|
+
[[package]]
|
18
|
+
name = "cfg-if"
|
19
|
+
version = "1.0.0"
|
20
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
21
|
+
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
22
|
+
|
23
|
+
[[package]]
|
24
|
+
name = "heck"
|
25
|
+
version = "0.5.0"
|
26
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
27
|
+
checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
28
|
+
|
29
|
+
[[package]]
|
30
|
+
name = "indoc"
|
31
|
+
version = "2.0.5"
|
32
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
33
|
+
checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
|
34
|
+
|
35
|
+
[[package]]
|
36
|
+
name = "itoa"
|
37
|
+
version = "1.0.14"
|
38
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
39
|
+
checksum = "d75a2a4b1b190afb6f5425f10f6a8f959d2ea0b9c2b1d79553551850539e4674"
|
40
|
+
|
41
|
+
[[package]]
|
42
|
+
name = "libc"
|
43
|
+
version = "0.2.169"
|
44
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
45
|
+
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
46
|
+
|
47
|
+
[[package]]
|
48
|
+
name = "memchr"
|
49
|
+
version = "2.7.4"
|
50
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
51
|
+
checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
52
|
+
|
53
|
+
[[package]]
|
54
|
+
name = "memoffset"
|
55
|
+
version = "0.9.1"
|
56
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
57
|
+
checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"
|
58
|
+
dependencies = [
|
59
|
+
"autocfg",
|
60
|
+
]
|
61
|
+
|
62
|
+
[[package]]
|
63
|
+
name = "once_cell"
|
64
|
+
version = "1.20.2"
|
65
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
66
|
+
checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775"
|
67
|
+
|
68
|
+
[[package]]
|
69
|
+
name = "portable-atomic"
|
70
|
+
version = "1.10.0"
|
71
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
72
|
+
checksum = "280dc24453071f1b63954171985a0b0d30058d287960968b9b2aca264c8d4ee6"
|
73
|
+
|
74
|
+
[[package]]
|
75
|
+
name = "proc-macro2"
|
76
|
+
version = "1.0.92"
|
77
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
78
|
+
checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0"
|
79
|
+
dependencies = [
|
80
|
+
"unicode-ident",
|
81
|
+
]
|
82
|
+
|
83
|
+
[[package]]
|
84
|
+
name = "pyo3"
|
85
|
+
version = "0.22.6"
|
86
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
87
|
+
checksum = "f402062616ab18202ae8319da13fa4279883a2b8a9d9f83f20dbade813ce1884"
|
88
|
+
dependencies = [
|
89
|
+
"anyhow",
|
90
|
+
"cfg-if",
|
91
|
+
"indoc",
|
92
|
+
"libc",
|
93
|
+
"memoffset",
|
94
|
+
"once_cell",
|
95
|
+
"portable-atomic",
|
96
|
+
"pyo3-build-config",
|
97
|
+
"pyo3-ffi",
|
98
|
+
"pyo3-macros",
|
99
|
+
"unindent",
|
100
|
+
]
|
101
|
+
|
102
|
+
[[package]]
|
103
|
+
name = "pyo3-build-config"
|
104
|
+
version = "0.22.6"
|
105
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
106
|
+
checksum = "b14b5775b5ff446dd1056212d778012cbe8a0fbffd368029fd9e25b514479c38"
|
107
|
+
dependencies = [
|
108
|
+
"once_cell",
|
109
|
+
"target-lexicon",
|
110
|
+
]
|
111
|
+
|
112
|
+
[[package]]
|
113
|
+
name = "pyo3-ffi"
|
114
|
+
version = "0.22.6"
|
115
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
116
|
+
checksum = "9ab5bcf04a2cdcbb50c7d6105de943f543f9ed92af55818fd17b660390fc8636"
|
117
|
+
dependencies = [
|
118
|
+
"libc",
|
119
|
+
"pyo3-build-config",
|
120
|
+
]
|
121
|
+
|
122
|
+
[[package]]
|
123
|
+
name = "pyo3-macros"
|
124
|
+
version = "0.22.6"
|
125
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
126
|
+
checksum = "0fd24d897903a9e6d80b968368a34e1525aeb719d568dba8b3d4bfa5dc67d453"
|
127
|
+
dependencies = [
|
128
|
+
"proc-macro2",
|
129
|
+
"pyo3-macros-backend",
|
130
|
+
"quote",
|
131
|
+
"syn",
|
132
|
+
]
|
133
|
+
|
134
|
+
[[package]]
|
135
|
+
name = "pyo3-macros-backend"
|
136
|
+
version = "0.22.6"
|
137
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
138
|
+
checksum = "36c011a03ba1e50152b4b394b479826cad97e7a21eb52df179cd91ac411cbfbe"
|
139
|
+
dependencies = [
|
140
|
+
"heck",
|
141
|
+
"proc-macro2",
|
142
|
+
"pyo3-build-config",
|
143
|
+
"quote",
|
144
|
+
"syn",
|
145
|
+
]
|
146
|
+
|
147
|
+
[[package]]
|
148
|
+
name = "quote"
|
149
|
+
version = "1.0.38"
|
150
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
151
|
+
checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc"
|
152
|
+
dependencies = [
|
153
|
+
"proc-macro2",
|
154
|
+
]
|
155
|
+
|
156
|
+
[[package]]
|
157
|
+
name = "ryu"
|
158
|
+
version = "1.0.18"
|
159
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
160
|
+
checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f"
|
161
|
+
|
162
|
+
[[package]]
|
163
|
+
name = "serde"
|
164
|
+
version = "1.0.217"
|
165
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
166
|
+
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
|
167
|
+
dependencies = [
|
168
|
+
"serde_derive",
|
169
|
+
]
|
170
|
+
|
171
|
+
[[package]]
|
172
|
+
name = "serde_derive"
|
173
|
+
version = "1.0.217"
|
174
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
175
|
+
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
176
|
+
dependencies = [
|
177
|
+
"proc-macro2",
|
178
|
+
"quote",
|
179
|
+
"syn",
|
180
|
+
]
|
181
|
+
|
182
|
+
[[package]]
|
183
|
+
name = "serde_json"
|
184
|
+
version = "1.0.134"
|
185
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
186
|
+
checksum = "d00f4175c42ee48b15416f6193a959ba3a0d67fc699a0db9ad12df9f83991c7d"
|
187
|
+
dependencies = [
|
188
|
+
"itoa",
|
189
|
+
"memchr",
|
190
|
+
"ryu",
|
191
|
+
"serde",
|
192
|
+
]
|
193
|
+
|
194
|
+
[[package]]
|
195
|
+
name = "syn"
|
196
|
+
version = "2.0.93"
|
197
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
198
|
+
checksum = "9c786062daee0d6db1132800e623df74274a0a87322d8e183338e01b3d98d058"
|
199
|
+
dependencies = [
|
200
|
+
"proc-macro2",
|
201
|
+
"quote",
|
202
|
+
"unicode-ident",
|
203
|
+
]
|
204
|
+
|
205
|
+
[[package]]
|
206
|
+
name = "target-lexicon"
|
207
|
+
version = "0.12.16"
|
208
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
209
|
+
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
210
|
+
|
211
|
+
[[package]]
|
212
|
+
name = "thermolib"
|
213
|
+
version = "0.7.7"
|
214
|
+
dependencies = [
|
215
|
+
"anyhow",
|
216
|
+
"pyo3",
|
217
|
+
"serde",
|
218
|
+
"serde_json",
|
219
|
+
"thiserror",
|
220
|
+
]
|
221
|
+
|
222
|
+
[[package]]
|
223
|
+
name = "thiserror"
|
224
|
+
version = "1.0.69"
|
225
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
226
|
+
checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"
|
227
|
+
dependencies = [
|
228
|
+
"thiserror-impl",
|
229
|
+
]
|
230
|
+
|
231
|
+
[[package]]
|
232
|
+
name = "thiserror-impl"
|
233
|
+
version = "1.0.69"
|
234
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
235
|
+
checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"
|
236
|
+
dependencies = [
|
237
|
+
"proc-macro2",
|
238
|
+
"quote",
|
239
|
+
"syn",
|
240
|
+
]
|
241
|
+
|
242
|
+
[[package]]
|
243
|
+
name = "unicode-ident"
|
244
|
+
version = "1.0.14"
|
245
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
246
|
+
checksum = "adb9e6ca4f869e1180728b7950e35922a7fc6397f7b641499e8f3ef06e50dc83"
|
247
|
+
|
248
|
+
[[package]]
|
249
|
+
name = "unindent"
|
250
|
+
version = "0.2.3"
|
251
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
252
|
+
checksum = "c7de7d73e1754487cb58364ee906a499937a0dfabd86bcb980fa99ec8c8fa2ce"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
[package]
|
2
2
|
name = "thermolib"
|
3
|
-
version = "0.7.
|
3
|
+
version = "0.7.7"
|
4
4
|
edition = "2021"
|
5
5
|
license = "MIT"
|
6
6
|
description = "An open-source library for the calculation of fluid properties"
|
@@ -11,7 +11,6 @@ repository = "https://github.com/shaw-yu2020/thermolib"
|
|
11
11
|
[dependencies]
|
12
12
|
anyhow = "1.0"
|
13
13
|
thiserror = "1.0"
|
14
|
-
eframe = "0.27.2"
|
15
14
|
serde_json = "1.0.110"
|
16
15
|
|
17
16
|
[dependencies.serde]
|
@@ -3,6 +3,7 @@ use super::{HelmholtzErr, Phase};
|
|
3
3
|
use super::{IdealHelmholtz, ResidualHelmholtz};
|
4
4
|
use super::{PsEqn, RholEqn, RhovEqn};
|
5
5
|
use anyhow::anyhow;
|
6
|
+
#[cfg(feature = "with_pyo3")]
|
6
7
|
use pyo3::{pyclass, pymethods};
|
7
8
|
use serde::{Deserialize, Serialize};
|
8
9
|
/// Helmholtz EOS
|
@@ -26,7 +27,7 @@ use serde::{Deserialize, Serialize};
|
|
26
27
|
/// assert_eq!(96.51, (SO2.s().unwrap() * 1e2).round() / 1e2);
|
27
28
|
/// }
|
28
29
|
/// ```
|
29
|
-
#[pyclass]
|
30
|
+
#[cfg_attr(feature = "with_pyo3", pyclass)]
|
30
31
|
#[derive(Debug, Deserialize, Serialize)]
|
31
32
|
#[allow(non_snake_case)]
|
32
33
|
pub struct Helmholtz {
|
@@ -44,6 +45,35 @@ pub struct Helmholtz {
|
|
44
45
|
#[serde(skip, default)]
|
45
46
|
phase: Phase,
|
46
47
|
}
|
48
|
+
impl Helmholtz {
|
49
|
+
/// read helmholtz equation of state from fluid.json file
|
50
|
+
pub fn read_json(path: &str) -> anyhow::Result<Helmholtz> {
|
51
|
+
let mut file_json: Option<std::fs::File>;
|
52
|
+
file_json = match std::fs::File::open(std::path::Path::new(path)) {
|
53
|
+
Ok(file) => Some(file),
|
54
|
+
Err(_) => None,
|
55
|
+
};
|
56
|
+
if file_json.is_none() {
|
57
|
+
file_json = match std::fs::File::open(
|
58
|
+
std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
|
59
|
+
.join("res")
|
60
|
+
.join(path),
|
61
|
+
) {
|
62
|
+
Ok(file) => Some(file),
|
63
|
+
Err(_) => None,
|
64
|
+
};
|
65
|
+
};
|
66
|
+
let mut file_json = file_json.ok_or(anyhow!(HelmholtzErr::NoJson))?;
|
67
|
+
let mut str_json = String::new();
|
68
|
+
let _ = std::io::Read::read_to_string(&mut file_json, &mut str_json);
|
69
|
+
let eos: Option<Helmholtz> = match serde_json::from_str(&str_json) {
|
70
|
+
Ok(eos) => Some(eos),
|
71
|
+
Err(_) => None,
|
72
|
+
};
|
73
|
+
let eos = eos.ok_or(anyhow!(HelmholtzErr::NoHelmholtz))?;
|
74
|
+
Ok(eos)
|
75
|
+
}
|
76
|
+
}
|
47
77
|
#[allow(non_snake_case)]
|
48
78
|
impl Helmholtz {
|
49
79
|
fn calc_p(&self, T: f64, rho: f64) -> f64 {
|
@@ -119,36 +149,13 @@ impl Helmholtz {
|
|
119
149
|
/ delta
|
120
150
|
}
|
121
151
|
}
|
122
|
-
#[pymethods]
|
152
|
+
#[cfg_attr(feature = "with_pyo3", pymethods)]
|
123
153
|
#[allow(non_snake_case)]
|
124
154
|
impl Helmholtz {
|
125
|
-
|
155
|
+
#[cfg(feature = "with_pyo3")]
|
126
156
|
#[new]
|
127
|
-
pub fn
|
128
|
-
|
129
|
-
file_json = match std::fs::File::open(std::path::Path::new(path)) {
|
130
|
-
Ok(file) => Some(file),
|
131
|
-
Err(_) => None,
|
132
|
-
};
|
133
|
-
if file_json.is_none() {
|
134
|
-
file_json = match std::fs::File::open(
|
135
|
-
std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
|
136
|
-
.join("res")
|
137
|
-
.join(path),
|
138
|
-
) {
|
139
|
-
Ok(file) => Some(file),
|
140
|
-
Err(_) => None,
|
141
|
-
};
|
142
|
-
};
|
143
|
-
let mut file_json = file_json.ok_or(anyhow!(HelmholtzErr::NoJson))?;
|
144
|
-
let mut str_json = String::new();
|
145
|
-
let _ = std::io::Read::read_to_string(&mut file_json, &mut str_json);
|
146
|
-
let eos: Option<Helmholtz> = match serde_json::from_str(&str_json) {
|
147
|
-
Ok(eos) => Some(eos),
|
148
|
-
Err(_) => None,
|
149
|
-
};
|
150
|
-
let eos = eos.ok_or(anyhow!(HelmholtzErr::NoHelmholtz))?;
|
151
|
-
Ok(eos)
|
157
|
+
pub fn new_py(path: &str) -> anyhow::Result<Helmholtz> {
|
158
|
+
Self::read_json(path)
|
152
159
|
}
|
153
160
|
pub fn set_molar_unit(&mut self) {
|
154
161
|
if self.R > 10.0 {
|
@@ -1,7 +1,5 @@
|
|
1
|
-
|
1
|
+
#[cfg(feature = "with_pyo3")]
|
2
2
|
use pyo3::{pyclass, pymethods};
|
3
|
-
use std::collections::HashMap;
|
4
|
-
use std::sync::OnceLock;
|
5
3
|
use thiserror::Error;
|
6
4
|
#[derive(Debug, Error)]
|
7
5
|
enum LiquidMetalErr {
|
@@ -17,9 +15,12 @@ enum LiquidMetalErr {
|
|
17
15
|
mod eta;
|
18
16
|
mod lambda;
|
19
17
|
mod rho;
|
18
|
+
use anyhow::anyhow;
|
20
19
|
use eta::metals2etaparams;
|
21
20
|
use lambda::metals2lambdaparams;
|
22
21
|
use rho::metals2rhoparams;
|
22
|
+
use std::collections::HashMap;
|
23
|
+
use std::sync::OnceLock;
|
23
24
|
/// liquid metal
|
24
25
|
/// + Density, unit: kg/m3
|
25
26
|
/// + Thermal Conductivity, unit: W/m/K
|
@@ -35,15 +36,13 @@ use rho::metals2rhoparams;
|
|
35
36
|
/// let lambda = metal.calc_lambda(T).unwrap(); // W/m/K
|
36
37
|
/// assert_eq!(54.88, (lambda * 1e2).round() / 1e2);
|
37
38
|
/// ```
|
38
|
-
#[pyclass]
|
39
|
+
#[cfg_attr(feature = "with_pyo3", pyclass)]
|
39
40
|
#[allow(non_snake_case)]
|
40
41
|
pub struct LiquidMetal {
|
41
42
|
metal: Metals,
|
42
43
|
}
|
43
|
-
#[pymethods]
|
44
|
-
#[allow(non_snake_case)]
|
45
44
|
impl LiquidMetal {
|
46
|
-
#[
|
45
|
+
#[allow(non_snake_case)]
|
47
46
|
pub fn new_metal(name: &str) -> anyhow::Result<LiquidMetal> {
|
48
47
|
if let Some(metal) = string2metals().get(name) {
|
49
48
|
Ok(Self {
|
@@ -53,6 +52,15 @@ impl LiquidMetal {
|
|
53
52
|
Err(anyhow!(LiquidMetalErr::NoLiquidMetal))
|
54
53
|
}
|
55
54
|
}
|
55
|
+
}
|
56
|
+
#[cfg_attr(feature = "with_pyo3", pymethods)]
|
57
|
+
#[allow(non_snake_case)]
|
58
|
+
impl LiquidMetal {
|
59
|
+
#[cfg(feature = "with_pyo3")]
|
60
|
+
#[new]
|
61
|
+
pub fn new_py(name: &str) -> anyhow::Result<LiquidMetal> {
|
62
|
+
Self::new_metal(name)
|
63
|
+
}
|
56
64
|
/// calculate density of liquid metals at 0.1 MPa, unit: kg/m3
|
57
65
|
pub fn calc_rho(&self, T: f64) -> anyhow::Result<f64> {
|
58
66
|
if let Some(rho_params) = metals2rhoparams().get(&self.metal) {
|