Skip to content

Commit

Permalink
added PV in QuickStates
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 committed Oct 27, 2020
1 parent b78623b commit 216b944
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 10 additions & 0 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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}

Expand Down Expand Up @@ -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

Expand Down
16 changes: 16 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Test
using ThermoState
using ThermoState.Types
using ThermoState.QuickStates

using Unitful


Expand Down Expand Up @@ -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

2 comments on commit 216b944

@longemen3000
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request updated: JuliaRegistries/General/23706

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.4 -m "<description of version>" 216b9444f720abae1aa91119b7ef8ec4d9632e0c
git push origin v0.4.4

Please sign in to comment.