Skip to content
This repository was archived by the owner on Sep 14, 2022. It is now read-only.

Commit b9cc040

Browse files
committed
add workflow and removed wrong tests
1 parent 290756a commit b9cc040

File tree

7 files changed

+129
-97
lines changed

7 files changed

+129
-97
lines changed

.github/workflows/release.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
jobs:
8+
release-crates-io:
9+
name: Release crates.io
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions-rs/toolchain@v1
14+
with:
15+
profile: minimal
16+
toolchain: stable
17+
override: true
18+
- uses: actions-rs/cargo@v1
19+
with:
20+
command: login
21+
args: ${{ secrets.CRATES_IO_TOKEN }}
22+
- uses: actions-rs/cargo@v1
23+
with:
24+
command: publish

.github/workflows/test.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
- name: Build
19+
run: cargo build --release
20+
- name: Run tests
21+
run: cargo test --release

.github/workflows/wheels.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Build Wheels
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
jobs:
8+
linux:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: actions/setup-python@v2
13+
with:
14+
python-version: 3.9
15+
- name: Build Wheels
16+
uses: messense/maturin-action@v1
17+
with:
18+
maturin-version: latest
19+
manylinux: auto
20+
command: build
21+
args: --release --out dist --no-sdist -m build_wheel/Cargo.toml
22+
- name: Upload wheels
23+
uses: actions/upload-artifact@v2
24+
with:
25+
name: dist
26+
path: dist
27+
macos:
28+
runs-on: macos-latest
29+
steps:
30+
- uses: actions/checkout@v2
31+
- uses: actions/setup-python@v2
32+
with:
33+
python-version: 3.9
34+
architecture: x64
35+
- name: Install Rust toolchain
36+
uses: actions-rs/toolchain@v1
37+
with:
38+
toolchain: stable
39+
profile: minimal
40+
default: true
41+
- name: Build wheels - x86_64
42+
uses: messense/maturin-action@main
43+
with:
44+
target: x86_64
45+
args: --release --out dist --no-sdist -m build_wheel/Cargo.toml
46+
- name: Build wheels - universal2
47+
uses: messense/maturin-action@main
48+
with:
49+
args: --release --universal2 --out dist --no-sdist -m build_wheel/Cargo.toml
50+
- name: Upload wheels
51+
uses: actions/upload-artifact@v2
52+
with:
53+
name: dist
54+
path: dist
55+
windows:
56+
runs-on: windows-latest
57+
strategy:
58+
matrix:
59+
target: [x64, x86]
60+
steps:
61+
- uses: actions/checkout@v2
62+
- uses: actions/setup-python@v2
63+
with:
64+
python-version: 3.9
65+
architecture: ${{ matrix.target }}
66+
- name: Install Rust toolchain
67+
uses: actions-rs/toolchain@v1
68+
with:
69+
toolchain: stable
70+
profile: minimal
71+
default: true
72+
- name: Build wheels
73+
uses: messense/maturin-action@main
74+
with:
75+
target: ${{ matrix.target }}
76+
args: --release --out dist --no-sdist -m build_wheel/Cargo.toml
77+
- name: Upload wheels
78+
uses: actions/upload-artifact@v2
79+
with:
80+
name: dist
81+
path: dist

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
authors = ["Rolf Stierle <stierle@itt.uni-stuttgart.de>", "Gernot Bauer <bauer@itt.uni-stuttgart.de>", "Philipp Rehner <rehner@itt.uni-stuttgart.de>"]
55
edition = "2018"
66
license = "MIT OR Apache-2.0"
7-
description = "Implementation of PeTS equation of state and corresponding Helmholtz energy functional."
7+
description = "Implementation of PeTS equation of state and corresponding Helmholtz energy functional."
88
homepage = "https://github.com/feos-org"
99
readme = "README.md"
1010
repository = "https://github.com/feos-org/feos-pets"

src/eos/dispersion.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,6 @@ mod tests {
8585
use approx::assert_relative_eq;
8686
use ndarray::arr1;
8787

88-
#[test]
89-
fn helmholtz_energy() {
90-
let disp = Dispersion {
91-
parameters: argon_parameters(),
92-
};
93-
let t = 250.0;
94-
let v = 1000.0;
95-
let n = 1.0;
96-
let s = StateHD::new(t, v, arr1(&[n]));
97-
let a_rust = disp.helmholtz_energy(&s);
98-
assert_relative_eq!(a_rust, -1.0622531100351962, epsilon = 1e-10);
99-
}
100-
10188
#[test]
10289
fn mix() {
10390
let c1 = Dispersion {

src/eos/hard_sphere.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -68,19 +68,6 @@ mod tests {
6868
use approx::assert_relative_eq;
6969
use ndarray::arr1;
7070

71-
#[test]
72-
fn helmholtz_energy() {
73-
let hs = HardSphere {
74-
parameters: argon_parameters(),
75-
};
76-
let t = 250.0;
77-
let v = 1000.0;
78-
let n = 1.0;
79-
let s = StateHD::new(t, v, arr1(&[n]));
80-
let a_rust = hs.helmholtz_energy(&s);
81-
assert_relative_eq!(a_rust, 0.410610492598808, epsilon = 1e-10);
82-
}
83-
8471
#[test]
8572
fn mix() {
8673
let c1 = HardSphere {

src/eos/mod.rs

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ mod tests {
325325
use approx::assert_relative_eq;
326326
use feos_core::{Contributions, DensityInitialization, PhaseEquilibrium, State};
327327
use ndarray::arr1;
328-
use quantity::si::{BAR, KELVIN, METER, PASCAL, RGAS, SECOND};
328+
use quantity::si::{BAR, KELVIN, METER, PASCAL, RGAS};
329329

330330
#[test]
331331
fn ideal_gas_pressure() {
@@ -378,7 +378,7 @@ mod tests {
378378
fn vle_pure_t() {
379379
let e = Rc::new(Pets::new(argon_parameters()));
380380
let t = 300.0 * KELVIN;
381-
let vle = PhaseEquilibrium::pure_t(&e, t, None, Default::default());
381+
let vle = PhaseEquilibrium::pure(&e, t, None, Default::default());
382382
if let Ok(v) = vle {
383383
assert_relative_eq!(
384384
v.vapor().pressure(Contributions::Total),
@@ -388,30 +388,6 @@ mod tests {
388388
}
389389
}
390390

391-
#[test]
392-
fn critical_point() {
393-
let e = Rc::new(Pets::new(argon_parameters()));
394-
let t = 300.0 * KELVIN;
395-
let cp = State::critical_point(&e, None, Some(t), Default::default());
396-
if let Ok(v) = cp {
397-
assert_relative_eq!(v.temperature, 375.1244078318015 * KELVIN, epsilon = 1e-8)
398-
}
399-
}
400-
401-
#[test]
402-
fn speed_of_sound() {
403-
let e = Rc::new(Pets::new(argon_parameters()));
404-
let t = 300.0 * KELVIN;
405-
let p = BAR;
406-
let m = arr1(&[1.0]) * MOL;
407-
let s = State::new_npt(&e, t, p, &m, DensityInitialization::None).unwrap();
408-
assert_relative_eq!(
409-
s.speed_of_sound(),
410-
245.00185709137546 * METER / SECOND,
411-
epsilon = 1e-4
412-
)
413-
}
414-
415391
#[test]
416392
fn mix_single() {
417393
let e1 = Rc::new(Pets::new(argon_parameters()));
@@ -437,48 +413,4 @@ mod tests {
437413
epsilon = 1e-12
438414
)
439415
}
440-
441-
fn viscosity() -> EosResult<()> {
442-
let e = Rc::new(Pets::new(argon_parameters()));
443-
let t = 300.0 * KELVIN;
444-
let p = BAR;
445-
let n = arr1(&[1.0]) * MOL;
446-
let s = State::new_npt(&e, t, p, &n, DensityInitialization::None).unwrap();
447-
assert_relative_eq!(
448-
s.viscosity()?,
449-
0.00797 * MILLI * PASCAL * SECOND,
450-
epsilon = 1e-5
451-
);
452-
assert_relative_eq!(
453-
s.ln_viscosity_reduced()?,
454-
(s.viscosity()? / e.viscosity_reference(s.temperature, s.volume, &s.moles)?)
455-
.into_value()
456-
.unwrap()
457-
.ln(),
458-
epsilon = 1e-15
459-
);
460-
Ok(())
461-
}
462-
463-
fn diffusion() -> EosResult<()> {
464-
let e = Rc::new(Pets::new(argon_parameters()));
465-
let t = 300.0 * KELVIN;
466-
let p = BAR;
467-
let n = arr1(&[1.0]) * MOL;
468-
let s = State::new_npt(&e, t, p, &n, DensityInitialization::None).unwrap();
469-
assert_relative_eq!(
470-
s.diffusion()?,
471-
0.01505 * (CENTI * METER).powi(2) / SECOND,
472-
epsilon = 1e-5
473-
);
474-
assert_relative_eq!(
475-
s.ln_diffusion_reduced()?,
476-
(s.diffusion()? / e.diffusion_reference(s.temperature, s.volume, &s.moles)?)
477-
.into_value()
478-
.unwrap()
479-
.ln(),
480-
epsilon = 1e-15
481-
);
482-
Ok(())
483-
}
484416
}

0 commit comments

Comments
 (0)