Skip to content

Commit 57e30d8

Browse files
authored
Removes MolarWeight trait and moves molar_weight method to Residual (#177)
* remove MolarWeight trait and add molar_weight function to Residual trait * renamed some properties * ran formatter * added Contributions to enthalpy and entropy functions of StateVec and extended to_dict function of PyPhaseDiagram to include specific properties * fixed bug in molar_weight for He * updated docs * updated changelogs * implemented review suggestions * added molar versions of Helmholtz energy and entropy and replaced molar definitions throughout the code * ran formatter, added tests, fixed bug in entropy
1 parent 78f6038 commit 57e30d8

47 files changed

Lines changed: 671 additions & 550 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717
- Adjusted all models' implementation of the `Parameter` trait which now requires `Result`s in some methods. [#161](https://github.com/feos-org/feos/pull/161)
1818
- Renamed `EosVariant` to `ResidualModel`. [#158](https://github.com/feos-org/feos/pull/158)
1919
- Added methods to add an ideal gas contribution to an initialized equation of state object in Python. [#158](https://github.com/feos-org/feos/pull/158)
20+
- Moved `molar_weight` impls to `Residual` due to removal of `MolarWeight` trait. [#177](https://github.com/feos-org/feos/pull/158)
2021

2122
### Packaging
2223
- Updated `num-dual` dependency to 0.7. [#137](https://github.com/feos-org/feos/pull/137)

benches/state_properties.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ fn properties_pcsaft(c: &mut Criterion) {
6161
b.iter(|| property_no_contributions((&eos, S::ln_phi, t, v, &m)))
6262
});
6363
group.bench_function("c_v", |b| {
64-
b.iter(|| property_no_contributions((&eos, S::c_v_res, t, v, &m)))
64+
b.iter(|| {
65+
property_no_contributions((&eos, S::residual_molar_isochoric_heat_capacity, t, v, &m))
66+
})
6567
});
6668
group.bench_function("partial_molar_volume", |b| {
6769
b.iter(|| property_no_contributions((&eos, S::partial_molar_volume, t, v, &m)))
@@ -94,7 +96,9 @@ fn properties_pcsaft_polar(c: &mut Criterion) {
9496
b.iter(|| property_no_contributions((&eos, S::ln_phi, t, v, &m)))
9597
});
9698
group.bench_function("c_v", |b| {
97-
b.iter(|| property_no_contributions((&eos, S::c_v_res, t, v, &m)))
99+
b.iter(|| {
100+
property_no_contributions((&eos, S::residual_molar_isochoric_heat_capacity, t, v, &m))
101+
})
98102
});
99103
group.bench_function("partial_molar_volume", |b| {
100104
b.iter(|| property_no_contributions((&eos, S::partial_molar_volume, t, v, &m)))

docs/api/eos.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,24 @@ If you want to adjust parameters of a model to experimental data you can use cla
1818
EquationOfState.gc_pcsaft
1919
EquationOfState.peng_robinson
2020
EquationOfState.pets
21-
EquationOfState.python
21+
EquationOfState.python_residual
22+
EquationOfState.python_ideal_gas
2223
EquationOfState.uvtheory
2324
EquationOfState.saftvrqmie
2425
```
2526

27+
### Models defined in Python
28+
29+
```{eval-rst}
30+
.. currentmodule:: feos.eos
31+
32+
.. autosummary::
33+
:toctree: generated/
34+
35+
EquationOfState.python_residual
36+
EquationOfState.python_ideal_gas
37+
```
38+
2639
## Other data types
2740

2841
```{eval-rst}
@@ -34,6 +47,7 @@ If you want to adjust parameters of a model to experimental data you can use cla
3447
Contributions
3548
Verbosity
3649
State
50+
StateVec
3751
PhaseEquilibrium
3852
PhaseDiagram
3953
```

docs/api/gc_pcsaft.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ from feos.gc_pcsaft import GcPcSaftParameters
2020
Identifier
2121
IdentifierOption
2222
ChemicalRecord
23-
JobackRecord
2423
AssociationRecord
2524
SegmentRecord
2625
BinarySegmentRecord

docs/api/ideal_gas.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# `feos.ideal_gas`
2+
3+
Utilities to build parameters for ideal gas models.
4+
5+
## Example: Combine the ideal gas model of Joback & Reid with PC-SAFT
6+
7+
```python
8+
from feos.eos import EquationOfState
9+
from feos.pcsaft import PcSaftParameters
10+
from feos.ideal_gas import JobackParameters
11+
12+
pc_saft_parameters = PcSaftParameters.from_json(
13+
['methane', 'ethane'],
14+
'pc_saft_parameters.json'
15+
)
16+
joback_parameters = JobackParameters.from_json(
17+
['methane', 'ethane'],
18+
'joback_parameters.json'
19+
)
20+
eos = EquationOfState.pcsaft(pc_saft_parameters).joback(joback_parameters)
21+
```
22+
23+
## Data types
24+
25+
```{eval-rst}
26+
.. currentmodule:: feos.ideal_gas
27+
28+
.. autosummary::
29+
:toctree: generated/
30+
31+
JobackRecord
32+
JobackParameters
33+
```

docs/api/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
:maxdepth: 1
88
99
si
10+
ideal_gas
1011
eos
1112
dft
1213
```

docs/api/pcsaft.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ parameters = PcSaftParameters.from_json(['methane', 'ethane'], 'parameters.json'
2020
2121
Identifier
2222
ChemicalRecord
23-
JobackRecord
2423
PureRecord
2524
SegmentRecord
2625
BinaryRecord

docs/api/peng_robinson.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
1818
Identifier
1919
ChemicalRecord
20-
JobackRecord
2120
PureRecord
2221
BinaryRecord
2322
PengRobinsonRecord

docs/api/pets.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
1414
Identifier
1515
ChemicalRecord
16-
JobackRecord
1716
PureRecord
1817
BinaryRecord
1918
PetsRecord

docs/api/saftvrqmie.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ parameters = SaftVRQMieParameters.from_json(['hydrogen', 'neon'], 'parameters.js
2020
2121
FeynmanHibbsOrder
2222
Identifier
23-
JobackRecord
2423
PureRecord
2524
BinaryRecord
2625
SaftVRQMieRecord

0 commit comments

Comments
 (0)