Skip to content

Commit

Permalink
Merge pull request #22 from se-schmitt/Thermal-Conducitivity-RefpropRES
Browse files Browse the repository at this point in the history
Add thermal conductivity for Refprop RES models
  • Loading branch information
se-schmitt authored Jan 12, 2025
2 parents 45475cc + 8954940 commit db3c88f
Show file tree
Hide file tree
Showing 12 changed files with 241 additions and 53 deletions.
6 changes: 3 additions & 3 deletions database/ChapmanEnskog.csv
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,11 @@ substance,Mw/(kg/mol),ε/(kB*K),σ/Å,ref,ref_id
"hexafluoroethane|perfluoroethane|r116",0.138010,226.160000,5.250000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"dichlorodifluoromethane|r12",0.120910,297.240000,5.190000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"*|r1216",NaN,285.000000,5.140000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"*|r1224ydz",NaN,340.420000,5.300000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"cis-1-chloro-2,3,3,3-tetrafluoropropene|r1224yd(z)|r1224ydz",NaN,340.420000,5.300000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"2,2-dichloro-1,1,1-trifluoroethane|r123",0.152930,275.160000,5.910000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1-chloro-3,3,3-trifluoro-1-propene|1-chloro-3,3,3-trifluoroprop-1-ene|r1233zde",0.130490,349.080000,5.240000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1-chloro-3,3,3-trifluoro-1-propene|1-chloro-3,3,3-trifluoroprop-1-ene|r1233zd(e)|r1233zde",0.130490,349.080000,5.240000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"2,3,3,3-tetrafluoropropene|r1234yf",0.114040,281.140000,5.330000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1,3,3,3-tetrafluoroprop-1-ene|r1234zee",0.114040,303.800000,5.000000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1,3,3,3-tetrafluoroprop-1-ene|trans-1,3,3,3-tetrafluoropropene|r1234ze(e)|r1234zee",0.114040,303.800000,5.000000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1-propene, 1,3,3,3-tetrafluoro-, (1z)-|r1234zez",NaN,336.110000,5.100000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"2-chloro-1,1,1,2-tetrafluoroethane|r124",0.136470,275.800000,5.500000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"3,3,3-trifluoropropene|r1243zf",0.096050,299.300000,4.970000,"Yang et al. (2022)",10.1007/s10765-022-03096-9
Expand Down
40 changes: 40 additions & 0 deletions database/RefpropRES_thermal_conductivity.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
substance,ξ,n1,n2,n3,n4,φ0/m,Γ,qD/m,Tref/K,ref,ref_id
"carbon dioxide|carbonic anhydride|dry ice|r744",1.0000,1.763756,-2.335416,2.966431,-0.378041,1.500000e-10,0.052000,2.500000e+09,4.561900e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"ammonia|azane|r717",1.0000,0.900567,0.092923,2.405172,-0.453455,1.400000e-10,0.053000,2.500000e+09,6.083400e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"trifluoromethyl iodide|trifluoroiodomethane|r13t1|r13i1",0.9398,3.636446,-5.328258,4.543762,-0.643352,2.100000e-10,0.057000,1.672241e+09,5.946600e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"hexane|n-hexane|r602",1.0000,11.957110,-16.710510,9.678780,-1.358100,2.364000e-10,0.058000,1.356852e+09,7.617300e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"dimethyl ether|methoxymethane|methyl ether|re170",1.0000,1.150569,-2.152294,3.352374,-0.583704,1.890000e-10,0.057000,1.851852e+09,6.005700e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"isopentane|2-methylbutane|r601a",0.9603,3.636446,-5.328258,4.543762,-0.643352,2.270000e-10,0.058000,1.506024e+09,6.905300e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"pentane|n-pentane|r601",1.0000,8.559778,-9.732189,5.680082,-0.689633,2.270000e-10,0.058000,1.497006e+09,7.045500e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"isobutane|2-methylpropane|r600a",1.0000,7.196463,-12.298890,8.211696,-1.249244,1.940000e-10,0.049600,1.520450e+09,6.117300e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"butane|n-butane|r600",1.0000,9.100215,-14.459120,9.133255,-1.354971,1.940000e-10,0.049600,1.142335e+09,6.376800e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"propane|n-propane|dimethylmethane|r290",1.0000,8.216700,-13.053200,8.444621,-1.253928,1.940000e-10,0.049600,1.395479e+09,5.547300e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"ethane|r170",1.0000,2.394613,-3.191853,2.957558,-0.190342,1.900000e-10,0.056300,1.834862e+09,6.106600e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"propylene|propene|prop-1-ene|1-propene|methylethylene|methylethene|r1270",1.0000,3.367645,-4.672640,4.672619,-0.818900,1.980000e-10,0.057000,2.325581e+09,5.463200e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"ethylene|ethene|acetene|elayl|olefiant gas|r1150",1.0000,0.376136,1.546136,0.062843,0.267046,1.810000e-10,0.058000,2.040816e+09,4.235300e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"2,3,3,3-tetrafluoropropene|r1234yf",1.0000,-2.351211,5.425486,-1.942264,0.591178,1.940000e-10,0.049600,1.713796e+09,5.517750e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1,3,3,3-tetrafluoroprop-1-ene|trans-1,3,3,3-tetrafluoropropene|r1234ze(e)",1.0000,-1.439895,0.317785,2.202817,-0.331856,1.940000e-10,0.049600,1.713796e+09,5.737800e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"(2z)-1,1,1,4,4,4-hexafluorobut-2-ene|cis-1,1,1,4,4,4-hexafluoro-2-butene|r1336mzz(z)",1.0000,-1.511739,5.492849,-2.297970,0.626166,2.210000e-10,0.058000,1.468429e+09,6.667500e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"trans-1-chloro-3,3,3-trifluoropropene|r1233zd(e)",1.0000,1.323190,-2.803198,3.532045,-0.512081,2.130000e-10,0.059000,1.672241e+09,6.594000e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"cis-1-chloro-2,3,3,3-tetrafluoropropene|r1224yd(z)",1.0000,-8.436949,22.804810,-14.587490,3.320995,2.140000e-10,0.058000,1.547988e+09,6.430400e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"trifluoromethane|fluoroform|r23",1.0000,5.269381,-6.789808,5.052312,-0.761283,1.940000e-10,0.049600,1.892148e+09,6.186600e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"difluoromethane|r32",1.0000,1.031907,0.178320,1.589211,-0.202022,1.940000e-10,0.049600,1.791152e+09,5.268830e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"pentafluoroethane|r125",1.0000,2.277767,-2.782096,2.979536,-0.354292,1.940000e-10,0.049600,1.713796e+09,5.087480e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1,1,1,2-tetrafluoroethane|r134a",1.0000,1.658814,-1.255594,1.943987,-0.175645,1.940000e-10,0.049600,1.892148e+09,5.614110e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1,1,1-trifluoroethane|r143a",1.0000,-6.004818,12.495360,-6.220483,1.437848,1.930000e-10,0.055000,4.347826e+09,5.187900e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1,1-difluoroethane|difluoroethane|r152a",1.0000,1.025531,-0.303002,1.578896,-0.157973,1.894000e-10,0.048700,2.288330e+09,5.796170e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1,1,1,2,3,3,3-heptafluoropropane|r227ea",1.0000,-1.460787,6.192086,-3.669657,1.150156,1.940000e-10,0.049600,2.000000e+09,5.623280e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1,1,1,3,3,3-hexafluoropropane|r236fa",1.0000,2.138702,-6.461302,6.416797,-1.143998,2.090000e-10,0.060000,1.560062e+09,5.971050e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1,1,1,3,3-pentafluoropropane|r245fa",1.0000,-5.207724,5.991181,-0.640152,0.136517,2.040000e-10,0.060000,1.597444e+09,6.405200e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"hexafluoroethane|perfluoroethane|r116",0.9674,3.636446,-5.328258,4.543762,-0.643352,1.940000e-10,0.049600,2.000000e+09,4.395450e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"perfluoropropane|perflutren|octafluoropropane|r218",1.0000,3.550701,-3.988278,3.513260,-0.392861,2.190000e-10,0.061000,1.517451e+09,5.175300e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"trichlorofluoromethane|fluorotrichloromethane|rmf|r11",1.0000,-0.036449,0.194595,2.357770,-0.369874,1.940000e-10,0.049600,1.892148e+09,7.066650e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"dichlorodifluoromethane|r12",1.0000,2.884165,-3.795080,3.937080,-0.568196,1.940000e-10,0.049600,1.892148e+09,5.776800e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"chlorotrifluoromethane|trifluoromethyl chloride|r13",1.0000,4.331146,-6.437883,5.306889,-0.791856,1.940000e-10,0.049600,2.860412e+09,4.530000e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"chloropentafluoroethane|r115",1.0000,0.628296,-0.344268,1.932946,-0.176035,1.940000e-10,0.049600,2.681684e+09,5.296500e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"chlorodifluoromethane|difluorochloromethane|r22",1.0000,3.403590,-4.427346,4.109770,-0.636604,1.940000e-10,0.049600,1.892148e+09,5.539430e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"dichlorofluoromethane|dichloromonofluoromethane|rf 21|r21",1.0000,-1.439458,3.276890,-0.008620,0.099076,1.940000e-10,0.049600,2.000000e+09,6.772200e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"2,2-dichloro-1,1,1-trifluoroethane|r123",1.0000,23.707010,-32.435900,16.530350,-2.404820,2.160000e-10,0.058000,1.555210e+09,6.852500e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"2-chloro-1,1,1,2-tetrafluoroethane|r124|1-chloro-1,2,2,2-tetrafluoroethane",1.0000,1.475653,-1.250491,1.859839,-0.110598,1.940000e-10,0.049600,2.000000e+09,5.931380e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1,1-dichloro-1-fluoroethane|r141b",1.0000,-0.088824,-6.172072,7.141372,-1.327207,1.940000e-10,0.049600,2.000000e+09,7.199400e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
"1-chloro-1,1-difluoroethane|r142b",1.0000,1.287769,-0.858585,1.780923,-0.119783,1.940000e-10,0.049600,1.624168e+09,6.153900e+02,"Yang et al. (2021)",10.1021/acs.iecr.1c02154
6 changes: 3 additions & 3 deletions database/RefpropRES_viscosity.csv
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,11 @@ substance,ξ,n1,n2,n3,n4,ref,ref_id
"hexafluoroethane|perfluoroethane|r116",0.8675,-0.448046,1.012681,-0.381869,0.054674,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"dichlorodifluoromethane|r12",1.0000,0.046502,0.092489,0.176708,-0.054179,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"*|r1216",1.0000,-0.448046,1.012681,-0.381869,0.054674,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"*|r1224ydz",1.0000,-0.247442,0.377731,0.035523,-0.029350,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"cis-1-chloro-2,3,3,3-tetrafluoropropene|r1224yd(z)|r1224ydz",1.0000,-0.247442,0.377731,0.035523,-0.029350,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"2,2-dichloro-1,1,1-trifluoroethane|r123",1.0000,-0.254732,0.701225,-0.230030,0.029718,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1-chloro-3,3,3-trifluoro-1-propene|1-chloro-3,3,3-trifluoroprop-1-ene|r1233zde",1.1249,-0.448046,1.012681,-0.381869,0.054674,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1-chloro-3,3,3-trifluoro-1-propene|1-chloro-3,3,3-trifluoroprop-1-ene|r1233zd(e)|r1233zde",1.1249,-0.448046,1.012681,-0.381869,0.054674,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"2,3,3,3-tetrafluoropropene|r1234yf",1.0709,-0.448046,1.012681,-0.381869,0.054674,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1,3,3,3-tetrafluoroprop-1-ene|r1234zee",1.0000,-0.271954,0.627868,-0.173580,0.017966,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1,3,3,3-tetrafluoroprop-1-ene|trans-1,3,3,3-tetrafluoropropene|r1234ze(e)|r1234zee",1.0000,-0.271954,0.627868,-0.173580,0.017966,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"1-propene, 1,3,3,3-tetrafluoro-, (1z)-|r1234zez",1.0000,-0.448046,1.012681,-0.381869,0.054674,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"2-chloro-1,1,1,2-tetrafluoroethane|r124",1.0000,-0.792595,1.486421,-0.602246,0.087380,"Yang et al. (2022)",10.1007/s10765-022-03096-9
"3,3,3-trifluoropropene|r1243zf",1.1500,-0.448046,1.012681,-0.381869,0.054674,"Yang et al. (2022)",10.1007/s10765-022-03096-9
Expand Down
12 changes: 12 additions & 0 deletions docs/src/refs.bib
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,18 @@ @article{kim_high-accuracy_2014
pages = {358--373},
}

@article{yang_entropy_2021,
title = {Entropy scaling of thermal conductivity: {Application} to refrigerants and their mixtures},
volume = {60},
url = {https://pubs.acs.org/doi/10.1021/acs.iecr.1c02154},
doi = {10.1021/acs.iecr.1c02154},
number = {35},
journal = {Industrial \& Engineering Chemistry Research},
author = {Yang, Xiaoxian and Kim, Dongchan and May, Eric F. and Bell, Ian H.},
year = {2021},
pages = {13052--13070},
}

@article{wilke_viscosity_1950,
title = {A viscosity equation for gas mixtures},
volume = {18},
Expand Down
29 changes: 23 additions & 6 deletions ext/ClapeyronExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,36 @@ const SA1 = CL.SA[1.0]
# Bulk properties
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.molar_density(eos::EoSModel, p, T, z = SA1; phase=:unknown, ϱ0=nothing) = begin
molar_density(eos, p, T, z; phase, vol0=isnothing(ϱ0) ? nothing : 1/ϱ0)
end
ES.molar_density(eos::CL.EoSVectorParam, p, T, z = SA1; phase=:unknown, ϱ0=nothing) = begin
ES.molar_density(eos.model, p, T, z; phase, ϱ0)
end

#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::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)
ES.second_virial_coefficient(eos::CL.EoSVectorParam, T, z = SA1) = ES.second_virial_coefficient(eos.model, T, z)

ES.isobaric_heat_capacity(eos::EoSModel, ϱ, T, z = SA1) = CL.VT_isobaric_heat_capacity(eos, 1.0/ϱ, T, z)
ES.isobaric_heat_capacity(eos::CL.EoSVectorParam, ϱ, T, z = SA1) = ES.isobaric_heat_capacity(eos.model, ϱ, T, z)

ES.isochoric_heat_capacity(eos::EoSModel, ϱ, T, z = SA1) = CL.VT_isochoric_heat_capacity(eos, 1.0/ϱ, T, z)
ES.isochoric_heat_capacity(eos::CL.EoSVectorParam, ϱ, T, z = SA1) = ES.isochoric_heat_capacity(eos.model, ϱ, T, z)

# Critical properties
ES.crit_pure(eos::EoSModel) = crit_pure(eos)[1:2]
ES.crit_pure(eos::EoSModel) = begin
Tc,pc,vc = crit_pure(eos)
return Tc,pc,1/vc
end
ES.crit_mix(eos::EoSModel, z) = begin
Tc,pc,vc = crit_mix(eos, z)
return Tc,pc,1/vc
end

# Utility functions
ES.split_model(eos::EoSModel) = split_model(eos)
Expand All @@ -40,7 +57,7 @@ ES._eos_cache(eos::CL.EoSVectorParam) = eos
ES._eos_cache(eos::MultiFluid) = eos

# Model specific wrapper
ES.RefpropRESModel(comps::String) = RefpropRESModel([comps])
ES.RefpropRESModel(comps::Vector{String}) = RefpropRESModel(MultiFluid(comps), comps)
ES.RefpropRESModel(comps::AbstractString) = RefpropRESModel([comps])
ES.RefpropRESModel(comps::Vector{<:AbstractString}) = RefpropRESModel(MultiFluid(comps; estimate_mixing=:lb), comps)

end #module
16 changes: 11 additions & 5 deletions src/general/chapman_enskog.jl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ end
ChapmanEnskogModel(comps::String; kwargs...) = ChapmanEnskogModel([comps]; kwargs...)
function ChapmanEnskogModel(comps::Vector{String}; Mw=[], ref="", ref_id="", collision_integral=KimMonroe())
out = load_params(ChapmanEnskogModel, "", comps; ref, ref_id)
ismissing(out) ? throw(MissingException("No CE parameters found for system [$(join(comps,", "))]")) : nothing
Mw_db, ε, σ, refs = out
if isempty(Mw)
Mw = Mw_db
Expand Down Expand Up @@ -275,20 +276,21 @@ function correspondence_principle(Tc, pc)
end

function correspondence_principle(eos)
Tc,Pc = crit_pure(eos)
return correspondence_principle(Tc, Pc)
Tc,pc,_ = crit_pure(eos)
return correspondence_principle(Tc, pc)
end

# Viscosity, thermal conductivity: Wilke and Mason and Saxena
struct Wilke <: AbstractTransportPropertyMixing end
struct MasonSaxena <: AbstractTransportPropertyMixing end

function mix_CE(::Wilke,model::AbstractChapmanEnskogModel, Y, x)
function mix_CE(::Union{Wilke,MasonSaxena}, model::AbstractChapmanEnskogModel, Y, x; YΦ=Y)
Y₀_mix = zero(Base.promote_eltype(Y,x))
enum_M = enumerate(model.Mw)
for (i,Mi) in enum_M
= zero(Y₀_mix)
for (j,Mj) in enum_M
+= x[j] * (1+√(Y[i]/Y[j])*√√(Mj/Mi))^2 / (8*(1+Mi/Mj))
+= x[j] * (1+√([i]/[j])*√√(Mj/Mi))^2 / (8*(1+Mi/Mj))
end
Y₀_mix += x[i]*Y[i]/
end
Expand All @@ -306,8 +308,12 @@ function mix_CE(prop::DiffusionCoefficient, model::AbstractChapmanEnskogModel,Y,
return mix_CE(MillerCarman(),model,Y,x)
end

function mix_CE(prop::Union{Viscosity, ThermalConductivity}, model::AbstractChapmanEnskogModel, Y, x)
function mix_CE(prop::Viscosity, model::AbstractChapmanEnskogModel, Y, x)
return mix_CE(Wilke(),model,Y,x)
end

function mix_CE(prop::ThermalConductivity, model::AbstractChapmanEnskogModel, Y, x)
return mix_CE(MasonSaxena(),model,Y,x)
end

calc_M_CE(Mw) = 2.0/sum(inv,Mw)
8 changes: 3 additions & 5 deletions src/general/properties.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function ϱT_viscosity(model::AbstractEntropyScalingModel, ϱ, T, z=Z1)
param = model[Viscosity()]
s = entropy_conf(model.eos, ϱ, T, z)
= scaling_variable(param, s, z)
ηˢ = exp(scaling_model(param, sˢ, z))
ηˢ = scaling_model(param, sˢ, z)
return scaling(param, model.eos, ηˢ, T, ϱ, s, z; inv=true)
end

Expand Down Expand Up @@ -59,12 +59,10 @@ function ϱT_self_diffusion_coefficient(model::AbstractEntropyScalingModel, ϱ,
param = model[SelfDiffusionCoefficient()]
s = entropy_conf(model.eos, ϱ, T)
= scaling_variable(param, s)
= exp(scaling_model(param, sˢ))
= scaling_model(param, sˢ)
return scaling(param, model.eos, Dˢ, T, ϱ, s; inv=true)
end



"""
MS_diffusion_coefficient(model::EntropyScalingModel, p, T, z; phase=:unknown)
Expand All @@ -81,6 +79,6 @@ function ϱT_MS_diffusion_coefficient(model::AbstractEntropyScalingModel, ϱ, T,
param = model[InfDiffusionCoefficient()]
s = entropy_conf(model.eos, ϱ, T, z)
= scaling_variable(param, s, z)
= exp(scaling_model(param, sˢ, z))
= scaling_model(param, sˢ, z)
return scaling(param, model.eos, Dˢ, T, ϱ, s, z; inv=true)
end
12 changes: 6 additions & 6 deletions src/models/framework.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,16 +175,16 @@ function FrameworkModel(eos, datasets::Vector{TPD}; opts::FitOptions=FitOptions(
= scaling.(param, eos, data.Y, data.T, data.ϱ, s)

# Fit
f_log(x) = prop isa ThermalConductivity ? x : log(x)
function resid!(du, p, xy)
(xs,ys) = xy
param.α[what_fit] .= p
du .= scaling_model.(param,xs) .- ys
du .= f_log.(scaling_model.(param,xs)) .- ys
return nothing
end
Yˢ_fit = prop == ThermalConductivity() ?: log.(Yˢ)
prob = NonlinearLeastSquaresProblem(
NonlinearFunction(resid!, resid_prototype=similar(Yˢ)),
randn(sum(what_fit)), (sˢ, Yˢ_fit),
randn(sum(what_fit)), (sˢ, f_log.(Yˢ)),
)
sol = solve(prob, SimpleGaussNewton(), reltol=1e-8)
α_fit = get_α0_framework(prop)
Expand All @@ -199,15 +199,15 @@ end
# Scaling model (correlation: Yˢ = Yˢ(sˢ,α,g))
function scaling_model(param::FrameworkParams{<:AbstractViscosity}, s, x=[1.])
g = (-1.6386, 1.3923)
return generic_scaling_model(param, s, x, g)
return exp(generic_scaling_model(param, s, x, g))
end
function scaling_model(param::FrameworkParams{<:AbstractThermalConductivity}, s, x=[1.])
g = (-1.9107, 1.0725)
return generic_scaling_model(param, s, x, g)
end
function scaling_model(param::FrameworkParams{<:DiffusionCoefficient}, s, x=[1.])
g = (0.6632, 9.4714)
return generic_scaling_model(param, s, x, g)
return exp(generic_scaling_model(param, s, x, g))
end

function generic_scaling_model(param::FrameworkParams, s, x, g)
Expand Down Expand Up @@ -256,7 +256,7 @@ function ϱT_self_diffusion_coefficient(model::FrameworkModel, ϱ, T, z)

for i in 1:length(model.eos)
param = FrameworkParams(param_self, param_inf, i)
= exp(scaling_model(param, sˢ, z))
= scaling_model(param, sˢ, z)
Di[i] = scaling(param, model.eos, Dˢ, T, ϱ, s, z; inv=true)
end

Expand Down
Loading

0 comments on commit db3c88f

Please sign in to comment.