From 216b9444f720abae1aa91119b7ef8ec4d9632e0c Mon Sep 17 00:00:00 2001 From: longemen3000 Date: Tue, 27 Oct 2020 02:01:05 -0300 Subject: [PATCH] added PV in QuickStates --- README.md | 1 + src/types.jl | 10 ++++++++++ test/runtests.jl | 16 ++++++++++++++++ 3 files changed, 27 insertions(+) diff --git a/README.md b/README.md index 88f4c8b..9470f71 100644 --- a/README.md +++ b/README.md @@ -218,6 +218,7 @@ Some abstract tuple types are saved on `ThermoState.QuickStates`. the tuple type - `SinglePT,MultiPT` - `SingleVT,MultiVT` +- `SinglePV,MultiPV` - `SinglePS,MultiPS` - `SinglePH,MultiPH` - `SingleSatT,MultiSatT` (Two phase equilibrium) diff --git a/src/types.jl b/src/types.jl index 94b4644..f8fbd21 100644 --- a/src/types.jl +++ b/src/types.jl @@ -282,6 +282,15 @@ pt() = (Pressure(),Temperature(),SingleComponent()) ptx() = (Pressure(),Temperature(),MaterialCompounds{MOLAR,FRACTION}()) ptn() = (Pressure(),Temperature(),MaterialCompounds{MOLAR,TOTAL_AMOUNT}()) +const SinglePV = Tuple{Pressure,VolumeAmount,SingleComponent} +const MultiPV = Tuple{Pressure,VolumeAmount,MaterialCompounds} + +pv() = (Pressure(),VolumeAmount{MOLAR,VOLUME}(),SingleComponent()) +pvx() = (Pressure(),VolumeAmount{MOLAR,VOLUME}(),MaterialCompounds{MOLAR,FRACTION}()) +pvn() = (Pressure(),VolumeAmount{MOLAR,VOLUME}(),MaterialCompounds{MOLAR,TOTAL_AMOUNT}()) + + + const SingleVT = Tuple{VolumeAmount,Temperature,SingleComponent} const MultiVT = Tuple{VolumeAmount,Temperature,MaterialCompounds} @@ -367,6 +376,7 @@ export SingleΦmT,MultiΦmT export SingleΦmP,MultiΦmP export SingleΦnT,MultiΦnT export SingleΦnP,MultiΦnP +export SinglePV,MultiPV end diff --git a/test/runtests.jl b/test/runtests.jl index d6f8139..4fbe2ca 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,8 @@ using Test using ThermoState using ThermoState.Types +using ThermoState.QuickStates + using Unitful @@ -324,4 +326,18 @@ end sp0 = spec(t=t0) sp1 = spec(t=λ) @test sp1(t0) == sp0 +end + +@testset "state_type" begin + st = state(t=1,p=2) + @test state_type(st) isa SinglePT + + st = state(t=1,p=2,n=rand(5)) + @test state_type(st) isa MultiPT + + st = state(v=1,p=2) + @test state_type(st) isa SinglePV + + st = state(v=1,p=2,n=rand(5)) + @test state_type(st) isa MultiPT end \ No newline at end of file