Skip to content

Commit e53173f

Browse files
committed
Reset main to v0.9.3 (drop breaking changes)
1 parent 523110c commit e53173f

File tree

41 files changed

+161
-150
lines changed

Some content is hidden

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

41 files changed

+161
-150
lines changed

CHANGELOG.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Fixed `None` transformation when binary parameters are provided to `PyParameters` to properly raise errors. [#334](https://github.com/feos-org/feos/pull/334)
1313
- Fixed the calculation of critical points and tp-flashes when one or more of the mixture components have zero composition. [#331](https://github.com/feos-org/feos/pull/331)
1414

15-
### Packaging
16-
- Updated `quantity` dependency to 0.13 and removed the `typenum` dependency. [#323](https://github.com/feos-org/feos/pull/323)
17-
1815
## [0.9.2] - 2025-12-11
1916
### Fixed
2017
- Fixed calculation of enthalpies of adsorption for mixtures. [#329](https://github.com/feos-org/feos/pull/329)

Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ keywords = [
2222
categories = ["science"]
2323

2424
[workspace.dependencies]
25-
quantity = "0.13"
25+
quantity = "0.12"
2626
num-dual = "0.13"
2727
ndarray = "0.17"
2828
nalgebra = "0.34"
@@ -33,6 +33,7 @@ serde = "1.0"
3333
serde_json = "1.0"
3434
indexmap = "2.0"
3535
itertools = "0.14"
36+
typenum = "1.16"
3637
rayon = "1.11"
3738
petgraph = "0.8"
3839
rustdct = "0.7"

crates/feos-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ serde = { workspace = true, features = ["derive"] }
2525
serde_json = { workspace = true, features = ["preserve_order"] }
2626
indexmap = { workspace = true, features = ["serde"] }
2727
rayon = { workspace = true, optional = true }
28+
typenum = { workspace = true }
2829
itertools = { workspace = true }
2930

3031
[dev-dependencies]

crates/feos-core/src/equation_of_state/residual.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ use nalgebra::{DVector, DefaultAllocator, Dim, Dyn, OMatrix, OVector, U1, alloca
33
use num_dual::{DualNum, Gradients, partial, partial2, second_derivative, third_derivative};
44
use quantity::ad::first_derivative;
55
use quantity::*;
6-
use std::ops::{Deref, Div};
6+
use std::ops::Deref;
77
use std::sync::Arc;
8-
9-
type Quot<T1, T2> = <T1 as Div<T2>>::Output;
8+
use typenum::Quot;
109

1110
/// Molar weight of all components.
1211
///

crates/feos-core/src/lib.rs

Lines changed: 24 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#![warn(clippy::allow_attributes)]
44
use quantity::{Quantity, SIUnit};
55
use std::ops::{Div, Mul};
6+
use typenum::Integer;
67

78
/// Print messages with level `Verbosity::Iter` or higher.
89
#[macro_export]
@@ -131,20 +132,20 @@ const fn powi(x: f64, n: i32) -> f64 {
131132
/// Conversion between reduced units and SI units.
132133
pub trait ReferenceSystem {
133134
type Inner;
134-
const T: i8;
135-
const L: i8;
136-
const M: i8;
137-
const I: i8;
138-
const THETA: i8;
139-
const N: i8;
140-
const J: i8;
141-
const FACTOR: f64 = powi(REFERENCE_VALUES[0], Self::T as i32)
142-
* powi(REFERENCE_VALUES[1], Self::L as i32)
143-
* powi(REFERENCE_VALUES[2], Self::M as i32)
144-
* powi(REFERENCE_VALUES[3], Self::I as i32)
145-
* powi(REFERENCE_VALUES[4], Self::THETA as i32)
146-
* powi(REFERENCE_VALUES[5], Self::N as i32)
147-
* powi(REFERENCE_VALUES[6], Self::J as i32);
135+
type T: Integer;
136+
type L: Integer;
137+
type M: Integer;
138+
type I: Integer;
139+
type THETA: Integer;
140+
type N: Integer;
141+
type J: Integer;
142+
const FACTOR: f64 = powi(REFERENCE_VALUES[0], Self::T::I32)
143+
* powi(REFERENCE_VALUES[1], Self::L::I32)
144+
* powi(REFERENCE_VALUES[2], Self::M::I32)
145+
* powi(REFERENCE_VALUES[3], Self::I::I32)
146+
* powi(REFERENCE_VALUES[4], Self::THETA::I32)
147+
* powi(REFERENCE_VALUES[5], Self::N::I32)
148+
* powi(REFERENCE_VALUES[6], Self::J::I32);
148149

149150
fn from_reduced(value: Self::Inner) -> Self
150151
where
@@ -160,25 +161,17 @@ pub trait ReferenceSystem {
160161
}
161162

162163
/// Conversion to and from reduced units
163-
impl<
164-
Inner,
165-
const T: i8,
166-
const L: i8,
167-
const M: i8,
168-
const I: i8,
169-
const THETA: i8,
170-
const N: i8,
171-
const J: i8,
172-
> ReferenceSystem for Quantity<Inner, SIUnit<T, L, M, I, THETA, N, J>>
164+
impl<Inner, T: Integer, L: Integer, M: Integer, I: Integer, THETA: Integer, N: Integer, J: Integer>
165+
ReferenceSystem for Quantity<Inner, SIUnit<T, L, M, I, THETA, N, J>>
173166
{
174167
type Inner = Inner;
175-
const T: i8 = T;
176-
const L: i8 = L;
177-
const M: i8 = M;
178-
const I: i8 = I;
179-
const THETA: i8 = THETA;
180-
const N: i8 = N;
181-
const J: i8 = J;
168+
type T = T;
169+
type L = L;
170+
type M = M;
171+
type I = I;
172+
type THETA = THETA;
173+
type N = N;
174+
type J = J;
182175
fn from_reduced(value: Inner) -> Self
183176
where
184177
Inner: Mul<f64, Output = Inner>,

crates/feos-core/src/phase_equilibria/bubble_dew.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use ndarray::Array1;
1212
use num_dual::linalg::LU;
1313
use num_dual::{DualNum, DualStruct, Gradients};
1414
use quantity::{Density, Dimensionless, Moles, Pressure, Quantity, RGAS, SIUnit, Temperature};
15+
use typenum::{N1, N2, P1, Z0};
1516

1617
const MAX_ITER_INNER: usize = 5;
1718
const TOL_INNER: f64 = 1e-9;
@@ -93,7 +94,7 @@ impl<D: DualNum<f64> + Copy> TemperatureOrPressure<D> for Temperature<D> {
9394
// used instead of the explicit unit. Maybe the type is too complicated for the
9495
// compiler?
9596
impl<D: DualNum<f64> + Copy> TemperatureOrPressure<D>
96-
for Quantity<D, SIUnit<-2, -1, 1, 0, 0, 0, 0>>
97+
for Quantity<D, SIUnit<N2, N1, P1, Z0, Z0, Z0, Z0>>
9798
{
9899
type Other = Temperature<D>;
99100
const IDENTIFIER: &'static str = "pressure";

crates/feos-core/src/state/builder.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,25 @@ use quantity::*;
1414
/// # use quantity::*;
1515
/// # use nalgebra::dvector;
1616
/// # use approx::assert_relative_eq;
17+
/// # use typenum::P3;
1718
/// # fn main() -> FeosResult<()> {
1819
/// // Create a state for given T,V,N
1920
/// let eos = &PengRobinson::new(PengRobinsonParameters::new_simple(&[369.8], &[41.9 * 1e5], &[0.15], &[15.0])?);
2021
/// let state = StateBuilder::new(&eos)
2122
/// .temperature(300.0 * KELVIN)
22-
/// .volume(12.5 * METER.powi::<3>())
23+
/// .volume(12.5 * METER.powi::<P3>())
2324
/// .moles(&(dvector![2.5] * MOL))
2425
/// .build()?;
25-
/// assert_eq!(state.density, 0.2 * MOL / METER.powi::<3>());
26+
/// assert_eq!(state.density, 0.2 * MOL / METER.powi::<P3>());
2627
///
2728
/// // For a pure component, the composition does not need to be specified.
2829
/// let eos = &PengRobinson::new(PengRobinsonParameters::new_simple(&[369.8], &[41.9 * 1e5], &[0.15], &[15.0])?);
2930
/// let state = StateBuilder::new(&eos)
3031
/// .temperature(300.0 * KELVIN)
31-
/// .volume(12.5 * METER.powi::<3>())
32+
/// .volume(12.5 * METER.powi::<P3>())
3233
/// .total_moles(2.5 * MOL)
3334
/// .build()?;
34-
/// assert_eq!(state.density, 0.2 * MOL / METER.powi::<3>());
35+
/// assert_eq!(state.density, 0.2 * MOL / METER.powi::<P3>());
3536
///
3637
/// // The state can be constructed without providing any extensive property.
3738
/// let eos = &PengRobinson::new(
@@ -44,10 +45,10 @@ use quantity::*;
4445
/// );
4546
/// let state = StateBuilder::new(&eos)
4647
/// .temperature(300.0 * KELVIN)
47-
/// .partial_density(&(dvector![0.2, 0.6] * MOL / METER.powi::<3>()))
48+
/// .partial_density(&(dvector![0.2, 0.6] * MOL / METER.powi::<P3>()))
4849
/// .build()?;
4950
/// assert_relative_eq!(state.molefracs, dvector![0.25, 0.75]);
50-
/// assert_relative_eq!(state.density, 0.8 * MOL / METER.powi::<3>());
51+
/// assert_relative_eq!(state.density, 0.8 * MOL / METER.powi::<P3>());
5152
/// # Ok(())
5253
/// # }
5354
/// ```

crates/feos-core/src/state/cache.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
use nalgebra::allocator::Allocator;
22
use nalgebra::{DefaultAllocator, Dim, OVector, Scalar};
33
use quantity::*;
4-
use std::ops::Sub;
54
use std::sync::OnceLock;
6-
7-
type Diff<T1, T2> = <T1 as Sub<T2>>::Output;
5+
use typenum::Diff;
86

97
#[derive(Clone, Debug)]
108
#[expect(clippy::type_complexity)]

crates/feos-core/src/state/mod.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -798,51 +798,52 @@ mod critical_point;
798798
mod tests {
799799
use super::*;
800800
use nalgebra::dvector;
801+
use typenum::P3;
801802

802803
#[test]
803804
fn test_validate() {
804805
let temperature = 298.15 * KELVIN;
805-
let density = 3000.0 * MOL / METER.powi::<3>();
806+
let density = 3000.0 * MOL / METER.powi::<P3>();
806807
let molefracs = dvector![0.03, 0.02, 0.05];
807808
assert!(validate(temperature, density, &molefracs).is_ok());
808809
}
809810

810811
#[test]
811812
fn test_negative_temperature() {
812813
let temperature = -298.15 * KELVIN;
813-
let density = 3000.0 * MOL / METER.powi::<3>();
814+
let density = 3000.0 * MOL / METER.powi::<P3>();
814815
let molefracs = dvector![0.03, 0.02, 0.05];
815816
assert!(validate(temperature, density, &molefracs).is_err());
816817
}
817818

818819
#[test]
819820
fn test_nan_temperature() {
820821
let temperature = f64::NAN * KELVIN;
821-
let density = 3000.0 * MOL / METER.powi::<3>();
822+
let density = 3000.0 * MOL / METER.powi::<P3>();
822823
let molefracs = dvector![0.03, 0.02, 0.05];
823824
assert!(validate(temperature, density, &molefracs).is_err());
824825
}
825826

826827
#[test]
827828
fn test_negative_mole_number() {
828829
let temperature = 298.15 * KELVIN;
829-
let density = 3000.0 * MOL / METER.powi::<3>();
830+
let density = 3000.0 * MOL / METER.powi::<P3>();
830831
let molefracs = dvector![-0.03, 0.02, 0.05];
831832
assert!(validate(temperature, density, &molefracs).is_err());
832833
}
833834

834835
#[test]
835836
fn test_nan_mole_number() {
836837
let temperature = 298.15 * KELVIN;
837-
let density = 3000.0 * MOL / METER.powi::<3>();
838+
let density = 3000.0 * MOL / METER.powi::<P3>();
838839
let molefracs = dvector![f64::NAN, 0.02, 0.05];
839840
assert!(validate(temperature, density, &molefracs).is_err());
840841
}
841842

842843
#[test]
843844
fn test_negative_density() {
844845
let temperature = 298.15 * KELVIN;
845-
let density = -3000.0 * MOL / METER.powi::<3>();
846+
let density = -3000.0 * MOL / METER.powi::<P3>();
846847
let molefracs = dvector![0.01, 0.02, 0.05];
847848
assert!(validate(temperature, density, &molefracs).is_err());
848849
}

crates/feos-dft/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ num-traits = { workspace = true }
2525
libm = { workspace = true }
2626
gauss-quad = { workspace = true, optional = true }
2727
petgraph = { workspace = true }
28+
typenum = { workspace = true }
2829

2930
feos-core = { workspace = true }
3031

0 commit comments

Comments
 (0)