Skip to content

Commit

Permalink
fix (some) errors found in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
longemen3000 committed Nov 12, 2024
1 parent eb501b4 commit 1862485
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 15 deletions.
17 changes: 6 additions & 11 deletions ext/ClapeyronSymbolicsExt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,21 +139,15 @@ const RealZ = Union{AbstractVector{<:Real},Real}

for f in (:eos,:VT_enthalpy,:VT_entropy,:VT_gibbs_free_energy,:VT_helmholtz_free_energy)
@eval begin
SymbolicUtils.promote_symtype(::typeof(Clapeyron.$f), args...) = Real
@register_symbolic Clapeyron.$f(model::EoSModel,p,T,z::AbstractVector) false
@register_symbolic Clapeyron.$f(model::EoSModel,p,T,z::Symbolics.Arr{Num,1}) false
@register_symbolic Clapeyron.$f(model::Clapeyron.IdealModel,p,T,z::AbstractVector) false
@register_symbolic Clapeyron.$f(model::Clapeyron.IdealModel,p,T,z::Symbolics.Arr{Num,1}) false
@register_symbolic Clapeyron.$f(model::EoSModel,V,T,z::AbstractVector{<:Number})
@register_symbolic Clapeyron.$f(model::EoSModel,V,T,z::Symbolics.Arr{Num,1}) false
end
end

SymbolicUtils.promote_symtype(::typeof(Clapeyron._volume), args...) = Real

#SymbolicUtils.promote_symtype(::typeof(Clapeyron.dfdv), args...) = Real

#SymbolicUtils.promote_symtype(::typeof(Clapeyron._volume), args...) = Real

@register_symbolic Clapeyron._volume(model::EoSModel,p,T,arr::AbstractVector,
sym::Union{String,Symbol},bool::Bool,x::Union{Real,Nothing}) false
sym::Union{String,Symbol},bool::Bool,x::Union{Real,Nothing})
@register_symbolic Clapeyron._volume(model::EoSModel,p,T,arr::Symbolics.Arr{Num,1},
sym::Union{String,Symbol},bool::Bool,x::Union{Real,Nothing}) false

Expand Down Expand Up @@ -212,4 +206,5 @@ Symbolics.@register_array_symbolic Clapeyron.p∂p∂V(model::EoSModel,p,T,z::Sy
size=(2,)
end

end #module
end #module

2 changes: 1 addition & 1 deletion src/base/EoSModel.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
abstract type EoSModel end

function eos_impl(model,V,T,z)
function eos_impl(model::EoSModel,V,T,z)
return Rgas(model)*sum(z)*T*a_eos(model,V,T,z) + reference_state_eval(model,V,T,z)
end

Expand Down
2 changes: 1 addition & 1 deletion src/methods/stability.jl
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ If the model is not an `IdealModel`, then `Clapeyron.idealmodel(model)` will be

function ideal_consistency(model,V,T,z =SA[1.0])
id = idealmodel(model)
if id === nothing
if id === nothing || id === model
f(∂V) = a_ideal(model,∂V,T,z)
∂f0∂V = Solvers.derivative(f,V)
n = sum(z)
Expand Down
1 change: 0 additions & 1 deletion src/models/ideal/AlyLeeIdeal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ function a_ideal_T(model::AlyLeeIdealModel,T,z)
logτi = log(τi)
@inbounds for i @comps
#we suppose ρc = Tc = 1
δi = ρ
Ai,Bi,Ci,Di,Ei,Fi,Gi,Hi,Ii = A[i],B[i],C[i],D[i],E[i],F[i],G[i],H[i],I[i]
#integrate constant:
#Tc,T0 = 1.0,298.15
Expand Down
2 changes: 1 addition & 1 deletion src/models/ideal/PPDSIdeal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ function a_ideal_T(model::PPDSIdealModel,T,z)
_G = model.params.G.values

Σz = sum(z)
res = zero(V+T+first(z))
res = zero(T+first(z))
τi = one(T)/T
Tr = one(T)
logτi = log(τi)
Expand Down

0 comments on commit 1862485

Please sign in to comment.