Skip to content

Commit

Permalink
Merge pull request #16 from longemen3000/refprop-visc
Browse files Browse the repository at this point in the history
Refprop viscosity RES model
  • Loading branch information
se-schmitt authored Dec 17, 2024
2 parents dd4e23e + 24296ee commit ccca2a6
Show file tree
Hide file tree
Showing 15 changed files with 646 additions and 321 deletions.
7 changes: 6 additions & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ version = "0.2.0"

[deps]
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"
ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210"
LogExpFunctions = "2ab3a3ac-af41-5b50-aa03-7779005ae688"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
SimpleNonlinearSolve = "727e6d20-b764-4bd8-a329-72de5adea6c7"
StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91"
Expand All @@ -21,7 +23,9 @@ MicthermExt = "MATLAB"
[compat]
Clapeyron = "0.6"
DelimitedFiles = "1.9.1"
FillArrays = "1"
ForwardDiff = "0.10"
LogExpFunctions = "0.3"
MATLAB = "0.8"
Optimization = "4.0.5"
SimpleNonlinearSolve = "2.0.0"
Expand All @@ -30,8 +34,9 @@ julia = "1.10"

[extras]
Clapeyron = "7c7805af-46cc-48c9-995b-ed0ed2dc909a"
CoolProp = "e084ae63-2819-5025-826e-f8e611a84251"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test", "Clapeyron", "DelimitedFiles"]
test = ["Test", "Clapeyron", "DelimitedFiles", "CoolProp"]
16 changes: 10 additions & 6 deletions ext/ClapeyronExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ ES.pressure(eos::EoSModel, ϱ, T, z = SA1) = pressure(eos, 1.0./ϱ, T, z)
ES.molar_density(eos::EoSModel, p, T, z = SA1; phase=:unknown) = molar_density(eos, p, T, z; phase)
ES.molar_density(eos::CL.EoSVectorParam, p, T, z = SA1; phase=:unknown) = ES.molar_density(eos.model, p, T, z; phase)

ES.entropy_conf(eos::EoSModel, ϱ, T, z = SA1) = CL.VT_entropy_res(eos, 1.0./ϱ, T, z)
#note: On Clapeyron, each EoSModel can set its own gas constant. here we divide by that and multiply
#by the constant used by EntropyScaling, so calculations are consistent between models
ES.entropy_conf(eos::EoSModel, ϱ, T, z = SA1) = CL.VT_entropy_res(eos, 1.0./ϱ, T, z)*ES.R/CL.Rgas(eos)
ES.entropy_conf(eos::CL.EoSVectorParam, ϱ, T, z = SA1) = ES.entropy_conf(eos.model, ϱ, T, z)

ES.second_virial_coefficient(eos::EoSModel, T, z = SA1) = second_virial_coefficient(eos, T, z)
Expand All @@ -21,18 +23,20 @@ ES.crit_pure(eos::EoSModel) = crit_pure(eos)[1:2]

# Utility functions
ES.split_model(eos::EoSModel) = split_model(eos)
ES.split_model(eos::SingleFluid) = [eos]
ES.split_model(eos::MultiFluid) = eos.pures
ES.split_model(eos::CL.EoSVectorParam) = eos.pure
ES.get_Mw(eos::EoSModel) = eos.params.Mw.values .* 1e-3
ES.get_Mw(eos::EoSModel) = Clapeyron.mw(eos) .* 1e-3
ES.get_Mw(eos::CL.EoSVectorParam) = ES.get_Mw(eos.model)

ES.get_m(eos::EoSModel) = :segment in fieldnames(typeof(eos.params)) ? eos.params.segment.values : ones(length(eos.name))
ES.get_m(eos::CL.EoSVectorParam) = ES.get_m(eos.model)

ES.get_m(eos::SingleFluid) = SA1
ES.get_m(eos::CL.SAFTgammaMieModel) = ES.get_m(eos.vr_model)
ES.get_components(eos::EoSModel) = eos.components

ES._framework_cache(eos::EoSModel) = CL.EoSVectorParam(eos)
ES._framework_cache(eos::CL.EoSVectorParam) = eos
ES._framework_cache(eos::MultiFluid) = eos
ES._eos_cache(eos::EoSModel) = CL.EoSVectorParam(eos)
ES._eos_cache(eos::CL.EoSVectorParam) = eos
ES._eos_cache(eos::MultiFluid) = eos

end #module
9 changes: 7 additions & 2 deletions src/EntropyScaling.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ module EntropyScaling

# Load public modules
using SimpleNonlinearSolve, Optimization, StatsBase, ForwardDiff, DelimitedFiles

import LogExpFunctions #loaded by StatsBase.jl
import FillArrays #loaded by Optimization.jl
const Z1 = FillArrays.Fill(1.0,1)
# Definition of Constants
get_kBNAR() = (kB=1.380649e-23; NA=6.02214076e23; return (kB,NA,kB*NA))
(kB, NA, R) = get_kBNAR()
const (kB, NA, R) = get_kBNAR()

const DB_PATH = normpath(Base.pkgdir(EntropyScaling),"data")

Expand All @@ -21,14 +23,17 @@ end
include("general/types.jl")
include("general/scalings.jl")
include("general/chapman_enskog.jl")
include("general/properties.jl")

# Utils
include("utils/data.jl")
include("utils/thermo.jl")
include("utils/misc.jl")

# Models
include("models/base.jl")
include("models/framework.jl")
include("models/refprop_res.jl")

# Extensions
if !isdefined(Base,:get_extension)
Expand Down
Empty file added src/database/RefpropRES.csv
Empty file.
Loading

0 comments on commit ccca2a6

Please sign in to comment.