Skip to content

Commit 7226850

Browse files
committed
fix errors
1 parent 6fb5e27 commit 7226850

File tree

17 files changed

+107
-52
lines changed

17 files changed

+107
-52
lines changed

src/models/Activity/UNIFAC/UNIFAC.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ struct UNIFACParam{T} <: EoSParam
66
Q::SingleParam{T}
77
end
88

9+
UNIFACParam(A,B,C,R,Q) = build_parametric_param(UNIFACParam,A,B,C,R,Q)
10+
911
abstract type UNIFACModel <: ActivityModel end
1012

1113
struct UNIFAC{c<:EoSModel,T} <: UNIFACModel
@@ -14,7 +16,13 @@ struct UNIFAC{c<:EoSModel,T} <: UNIFACModel
1416
params::UNIFACParam{T}
1517
puremodel::EoSVectorParam{c}
1618
references::Array{String,1}
17-
unifac_cache::UNIFACCache
19+
unifac_cache::UNIFACCache{T}
20+
end
21+
22+
function UNIFAC(components,groups,params,puremodel,references,unifac_cache)
23+
c = eltype(puremodel)
24+
T = eltype(params)
25+
return UNIFAC{c,T}(components,groups,params,puremodel,references,unifac_cache)
1826
end
1927

2028
default_locations(::Type{UNIFAC}) = ["Activity/UNIFAC/UNIFAC_like.csv", "Activity/UNIFAC/UNIFAC_unlike.csv"]

src/models/Activity/UNIFAC/utils.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
#a GC averaged UNIFAC.
2-
struct UNIFACCache <: EoSModel
2+
struct UNIFACCache{T} <: EoSModel
33
components::Vector{String}
4-
r::Vector{Float64}
5-
q::Vector{Float64}
6-
q_p::Vector{Float64}
4+
r::Vector{T}
5+
q::Vector{T}
6+
q_p::Vector{T}
77
end
88

9+
UNIFACCache(components,r,q,q_p) = UNIFACCache{eltype(q_p)}(components,r,q,q_p)
10+
911
UNIFACCache(groups::GroupParam,params) = UNIFACCache(groups,params.Q,params.R)
1012

1113
function UNIFACCache(groups::GroupParam,Q,R)

src/models/Activity/UNIFAC/variants/PSRK.jl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ struct PSRKUNIFAC{c<:EoSModel,T} <: UNIFACModel
44
params::UNIFACParam{T}
55
puremodel::EoSVectorParam{c}
66
references::Array{String,1}
7-
unifac_cache::UNIFACCache
7+
unifac_cache::UNIFACCache{T}
88
end
99

10+
function PSRKUNIFAC(components,groups,params,puremodel,references,unifac_cache)
11+
c = eltype(puremodel)
12+
T = eltype(params)
13+
return PSRKUNIFAC{c,T}(components,groups,params,puremodel,references,unifac_cache)
14+
end
15+
16+
1017
default_locations(::Type{PSRKUNIFAC}) = ["Activity/UNIFAC/PSRK/PSRK_like.csv", "Activity/UNIFAC/PSRK/PSRK_unlike.csv"]
1118

1219

src/models/Activity/UNIFAC/variants/UNIFAC2.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ struct UNIFAC2{c<:EoSModel,T} <: UNIFACModel
44
params::UNIFACParam{T}
55
puremodel::EoSVectorParam{c}
66
references::Array{String,1}
7-
unifac_cache::UNIFACCache
7+
unifac_cache::UNIFACCache{T}
8+
end
9+
10+
function UNIFAC2(components,groups,params,puremodel,references,unifac_cache)
11+
c = eltype(puremodel)
12+
T = eltype(params)
13+
return UNIFAC2{c,T}(components,groups,params,puremodel,references,unifac_cache)
814
end
915

1016
default_locations(::Type{UNIFAC2}) = ["Activity/UNIFAC/UNIFAC_like.csv", "Activity/UNIFAC/UNIFAC2_unlike.csv"]

src/models/Activity/UNIFAC/variants/UNIFACFV.jl

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
#a GC averaged UNIFAC.
2-
struct UNIFACFVCache <: EoSModel
2+
struct UNIFACFVCache{T} <: EoSModel
33
components::Vector{String}
4-
r::Vector{Float64}
5-
q::Vector{Float64}
6-
m::Vector{Float64}
7-
Mw::Vector{Float64}
4+
r::Vector{T}
5+
q::Vector{T}
6+
m::Vector{T}
7+
Mw::Vector{T}
88
end
99

10-
UNIFACFVCache(groups::GroupParam,params) = UNIFACFVCache(groups,params.Q,params.R,params.Mw)
10+
UNIFACFVCache(components,r,q,q_p) = UNIFACFVCache{eltype(r)}(components,r,q,m,Mw)
1111

1212
function UNIFACFVCache(groups::GroupParam,Q,R,Mw)
1313
Mw = group_sum(groups,Mw.values)
1414
r = group_sum(groups,R.values) ./ Mw
1515
q = group_sum(groups,Q.values) ./ Mw
1616
m = group_sum(groups,nothing)
17-
1817
return UNIFACFVCache(groups.components,r,q,m,Mw)
1918
end
2019

@@ -38,6 +37,8 @@ struct UNIFACFVParam{T} <: EoSParam
3837
Mw::SingleParam{T}
3938
end
4039

40+
UNIFACFVParam(volume,A,R,Q,Mw) = build_parametric_param(UNIFACFVParam,volume,c,A,R,Q,Mw)
41+
4142
abstract type UNIFACFVModel <: ActivityModel end
4243

4344
struct UNIFACFV{c<:EoSModel,T} <: UNIFACFVModel
@@ -46,7 +47,13 @@ struct UNIFACFV{c<:EoSModel,T} <: UNIFACFVModel
4647
params::UNIFACFVParam{T}
4748
puremodel::EoSVectorParam{c}
4849
references::Array{String,1}
49-
UNIFACFV_cache::UNIFACFVCache
50+
UNIFACFV_cache::UNIFACFVCache{T}
51+
end
52+
53+
function UNIFACFV(components,groups,params,puremodel,references,unifac_cache)
54+
c = eltype(puremodel)
55+
T = eltype(params)
56+
return UNIFACFV{c,T}(components,groups,params,puremodel,references,unifac_cache)
5057
end
5158

5259
export UNIFACFV

src/models/Activity/UNIFAC/variants/UNIFACFVPoly.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ struct UNIFACFVPolyParam{T} <: EoSParam
77
Mw::SingleParam{T}
88
end
99

10+
UNIFACFVPolyParam(volume,c,A,R,Q,Mw) = build_parametric_param(UNIFACFVPolyParam,volume,c,A,R,Q,Mw)
11+
1012
abstract type UNIFACFVPolyModel <: UNIFACFVModel end
1113

1214
struct UNIFACFVPoly{c<:EoSModel,T} <: UNIFACFVPolyModel
@@ -15,7 +17,13 @@ struct UNIFACFVPoly{c<:EoSModel,T} <: UNIFACFVPolyModel
1517
params::UNIFACFVPolyParam{T}
1618
puremodel::EoSVectorParam{c}
1719
references::Array{String,1}
18-
UNIFACFV_cache::UNIFACFVCache
20+
UNIFACFV_cache::UNIFACFVCache{T}
21+
end
22+
23+
function UNIFACFVPoly(components,groups,params,puremodel,references,unifac_cache)
24+
c = eltype(puremodel)
25+
T = eltype(params)
26+
return UNIFACFVPoly{c,T}(components,groups,params,puremodel,references,unifac_cache)
1927
end
2028

2129
export UNIFACFVPoly

src/models/Activity/UNIFAC/variants/VTPR.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ struct VTPRUNIFAC{c<:EoSModel,T} <: VTPRUNIFACModel
88
references::Array{String,1}
99
end
1010

11+
function VTPRUNIFAC(components,groups,params,puremodel,references)
12+
c = eltype(puremodel)
13+
T = eltype(params)
14+
return VTPRUNIFAC{c,T}(components,groups,params,puremodel,references)
15+
end
16+
1117
export VTPRUNIFAC
1218

1319
"""

src/models/Activity/UNIFAC/variants/ogUNIFAC.jl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ struct ogUNIFACParam{T} <: EoSParam
44
Q::SingleParam{T}
55
end
66

7+
ogUNIFACParam(A,R,Q) = build_parametric_param(ogUNIFACParam,A,R,Q)
8+
79
abstract type ogUNIFACModel <: UNIFACModel end
810

911
struct ogUNIFAC{c<:EoSModel,T} <: ogUNIFACModel
@@ -12,7 +14,13 @@ struct ogUNIFAC{c<:EoSModel,T} <: ogUNIFACModel
1214
params::ogUNIFACParam{T}
1315
puremodel::EoSVectorParam{c}
1416
references::Array{String,1}
15-
unifac_cache::UNIFACCache
17+
unifac_cache::UNIFACCache{T}
18+
end
19+
20+
function ogUNIFAC(components,groups,params,puremodel,references,unifac_cache)
21+
c = eltype(puremodel)
22+
T = eltype(params)
23+
return ogUNIFAC{c,T}(components,groups,params,puremodel,references,unifac_cache)
1624
end
1725

1826
export ogUNIFAC

src/models/Activity/UNIFAC/variants/ogUNIFAC2.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,13 @@ struct ogUNIFAC2{c<:EoSModel,T} <: ogUNIFACModel
44
params::ogUNIFACParam{T}
55
puremodel::EoSVectorParam{c}
66
references::Array{String,1}
7-
unifac_cache::UNIFACCache
7+
unifac_cache::UNIFACCache{T}
8+
end
9+
10+
function ogUNIFAC2(components,groups,params,puremodel,references,unifac_cache)
11+
c = eltype(puremodel)
12+
T = eltype(params)
13+
return ogUNIFAC2{c,T}(components,groups,params,puremodel,references,unifac_cache)
814
end
915

1016
const ogUNIFAC2_0 = ogUNIFAC2

src/models/Electrolytes/Ion/GCMSABorn.jl

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
abstract type GCMSABornModel <: IonModel end
22

3-
struct GCMSABornParam <: EoSParam
4-
shapefactor::SingleParam{Float64}
5-
segment::SingleParam{Float64}
6-
sigma::SingleParam{Float64}
7-
gc_sigma::SingleParam{Float64}
8-
sigma_born::SingleParam{Float64}
9-
gc_sigma_born::SingleParam{Float64}
10-
charge::SingleParam{Float64}
3+
struct GCMSABornParam{T} <: EoSParam
4+
shapefactor::SingleParam{T}
5+
segment::SingleParam{T}
6+
sigma::SingleParam{T}
7+
gc_sigma::SingleParam{T}
8+
sigma_born::SingleParam{T}
9+
gc_sigma_born::SingleParam{T}
10+
charge::SingleParam{T}
1111
end
1212

13-
struct GCMSABorn{ϵ,G} <: GCMSABornModel
13+
GCMSABornParam(s,m,sigma,sigma_born,gc_sigma_born,Z) = build_parametric_param(s,m,sigma,sigma_born,gc_sigma_born,Z)
14+
15+
struct GCMSABorn{ϵ,T} <: GCMSABornModel
1416
components::Array{String,1}
15-
groups::GroupParam{G}
16-
params::GCMSABornParam
17+
groups::GroupParam{T}
18+
params::GCMSABornParam{T}
1719
RSPmodel:
1820
references::Array{String,1}
1921
end
@@ -82,7 +84,7 @@ function GCMSABorn(solvents,ions; RSPmodel=ConstRSP, userlocations=String[],RSPm
8284
references = String[]
8385
init_RSPmodel = @initmodel RSPmodel(solvents,ions,userlocations = RSPmodel_userlocations, verbose = verbose)
8486

85-
model = GCMSABorn(components, groups, packagedparams, init_RSPmodel,references)
87+
model = GCMSABorn{eltype(packagedparams)}(components, groups, packagedparams, init_RSPmodel,references)
8688
return model
8789
end
8890

0 commit comments

Comments
 (0)