Skip to content

Commit

Permalink
Merge pull request #27 from ClapeyronThermo/vini/thermolangmuirmodel
Browse files Browse the repository at this point in the history
Vini/thermolangmuirmodel
  • Loading branch information
viniviena authored Dec 11, 2024
2 parents 4d48887 + b29eea3 commit 3188e7d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
TableOperations = "ab02a1b2-a7df-11e8-156e-fb1833f50b87"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"

[weakdeps]
DynamicQuantities = "06fc5a27-2a28-4c7c-a15d-362465fb6821"

[extensions]
LangmuirDynamicQuantitiesExt = "DynamicQuantities"

[compat]
BlackBoxOptim = "^0.6.2"
CommonSolve = "0.2.4"
Expand All @@ -33,12 +39,6 @@ TableOperations = "1"
Tables = "^1.8"
julia = "1.9"

[weakdeps]
DynamicQuantities = "06fc5a27-2a28-4c7c-a15d-362465fb6821"

[extensions]
LangmuirDynamicQuantitiesExt = "DynamicQuantities"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

Expand Down
12 changes: 6 additions & 6 deletions src/methods/isotherm_methods.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ function sp_res(model, p, T)
return sp_res_numerical(model, p, T)
end

function sp_res_numerical(model, p, T; solver = QuadGKJL(), abstol = 1e-6, reltol = 1e-6)
function sp_res_numerical(model::IsothermModel, p, T; solver = QuadGKJL(), abstol = 1e-6, reltol = 1e-6)
#For cases where the sp_res is not analytical, we use numerical integration

#Part 1 integral
ϵ = sqrt(eps(Base.promote_eltype(model, p, T)))

∫₁ni_p⁻¹ = henry_coefficient(model, T)*ϵ
∫₁ni_p⁻¹dp = henry_coefficient(model, T)*ϵ

#Part 2 integral
f(p) = loading(model, p, T)/p
f(p, T) = loading(model, p, T)/p

prob = IntegralProblem((u, p) -> f(u), (ϵ, p))
prob = IntegralProblem(IntegralFunction(f), (ϵ, p), T)

∫₂ni_p⁻¹ = Integrals.solve(prob, solver; reltol = reltol, abstol = abstol).u
∫₂ni_p⁻¹dp = Integrals.solve(prob, solver; reltol = reltol, abstol = abstol).u

π_i = ∫₁ni_p⁻¹ + ∫₂ni_p⁻¹
π_i = ∫₁ni_p⁻¹dp + ∫₂ni_p⁻¹dp

return π_i

Expand Down

0 comments on commit 3188e7d

Please sign in to comment.