From 9c3a9164e44ffafadf30d3ccdf5d94980b042e1a Mon Sep 17 00:00:00 2001 From: longemen3000 Date: Mon, 2 Sep 2024 00:24:09 -0400 Subject: [PATCH 01/13] demote to 0.1 --- Project.toml | 3 ++- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 56 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 994d4e3..bd58814 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "AdsorbedSolutionTheory" uuid = "c62cc850-d7ca-4cc1-a95b-48008b40dc90" authors = ["Andrés Riedemann ", "Vinicius Santana "] -version = "1.0.0" +version = "0.1.0" [deps] BlackBoxOptim = "a134a8b2-14d6-55f6-9291-3336d3ab0209" @@ -17,6 +17,7 @@ StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" [compat] +BlackBoxOptim = "^0.6.2" CommonSolve = "0.2.4" ForwardDiff = "^0.10" Integrals = "4" diff --git a/README.md b/README.md index 3db957b..d94b60e 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,62 @@ # AdsorbedSolutionTheory.jl [![Build Status](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml?query=branch%3Amain) - +[![codecov](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl) +[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/AdsorbedSolutionTheory.jl/dev) This package implements single adsorption and multicomponent adsorption through Ideal Absorbed Solution Theory (IAST). Some major features are: - Explicit single component adsorption properties: loading, bulk phase properties - Multicomponent adsorption + +## Examples: + +```julia +using AdsorbedSolutionTheory +const AST = AdsorbedSolutionTheory + +#example from doi.org/10.1002/aic.14684 + +v = @MultiSite{Langmuir,Langmuir} #we create a multisite model, consisting + + x1 = [1.468 + 0.024 + 0 + 7.891 + 0.001645 + 0] + + x2 = [2.847 + 0.028 + 0. + 2.223 + 1.228 + 0.] + + x3 = [2.581 + 0.84 + 0.0 + 2.901 + 0.021 + 0.0] + + #creation of isotherms from vectors or other iterables. + #you can also use AdsorbedSolutionTheory.from_vec! or AdsorbedSolutionTheory.from_vec + #to create (or fill) vectors from isotherm models + m1,m2,m3 = AST.from_vec(v,x1),AST.from_vec(v,x2),AST.from_vec(v,x3) + models = (m1,m2,m3) + + #calculate loading of a single isotherm + #there are also functions to calculate the reduced spreading pressure, and inverse algorithms + l1 = loading(m1,p,T) + kh1 = henry_coefficient(m1,T) + lmax = saturated_loading(m1,T) + + y = [0.5,0.25,0.25] + T = 300 + p = 1000 + + + #total adsorbed amount, fractions of adsorbed components. + q_tot,x,status = iast(models,p,T,y) +``` From 2b1d3afe51a83c1804dc8daa3f995612044656e5 Mon Sep 17 00:00:00 2001 From: longemen3000 Date: Mon, 2 Sep 2024 00:38:59 -0400 Subject: [PATCH 02/13] add documenter job --- .github/workflows/CI.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index de6fc5c..7314e0a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -39,3 +39,13 @@ jobs: - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/julia-buildpkg@latest + - uses: julia-actions/julia-docdeploy@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} \ No newline at end of file From 0073a2da6efd7d8e23ad1ab992a47dac0dbaf61a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Riedemann?= <38795484+longemen3000@users.noreply.github.com> Date: Sun, 22 Sep 2024 18:55:16 -0300 Subject: [PATCH 03/13] Update Project.toml --- Project.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Project.toml b/Project.toml index e8e53f4..74462a3 100644 --- a/Project.toml +++ b/Project.toml @@ -28,6 +28,7 @@ NLSolvers = "0.5" PolyLog = "^2.5.0" Roots = "2.1" StaticArrays = "1" +TableOperations = "1" Tables = "^1.8" julia = "1.9" From 9097016ffddc45e3a08564935333f34b676ede46 Mon Sep 17 00:00:00 2001 From: pw0908 Date: Mon, 30 Sep 2024 13:24:57 -0700 Subject: [PATCH 04/13] Update logo --- README.md | 6 +- docs/Langmuir_logo.svg | 175 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 177 insertions(+), 4 deletions(-) create mode 100644 docs/Langmuir_logo.svg diff --git a/README.md b/README.md index d94b60e..3a99ad7 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ -# AdsorbedSolutionTheory.jl +[![Build Status](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml?query=branch%3Amain) [![codecov](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/AdsorbedSolutionTheory.jl/dev) -[![Build Status](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml?query=branch%3Amain) -[![codecov](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl) -[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/AdsorbedSolutionTheory.jl/dev) +![logo](/docs/Langmuir_logo.svg){width=100%} This package implements single adsorption and multicomponent adsorption through Ideal Absorbed Solution Theory (IAST). Some major features are: diff --git a/docs/Langmuir_logo.svg b/docs/Langmuir_logo.svg new file mode 100644 index 0000000..2cead74 --- /dev/null +++ b/docs/Langmuir_logo.svg @@ -0,0 +1,175 @@ + +image/svg+xmlLangmuir + \ No newline at end of file From 41b7a927bb0b1d706b2a12d61ecac0c8d8e41856 Mon Sep 17 00:00:00 2001 From: pw0908 Date: Mon, 30 Sep 2024 13:26:47 -0700 Subject: [PATCH 05/13] Minor fix with logo width --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a99ad7..d416a07 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build Status](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml?query=branch%3Amain) [![codecov](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/AdsorbedSolutionTheory.jl/dev) -![logo](/docs/Langmuir_logo.svg){width=100%} +![logo](/docs/Langmuir_logo.svg | width=100) This package implements single adsorption and multicomponent adsorption through Ideal Absorbed Solution Theory (IAST). Some major features are: From 3495c0734687ce07f8cbac3c992d46fb3a47e840 Mon Sep 17 00:00:00 2001 From: pw0908 Date: Mon, 30 Sep 2024 13:33:46 -0700 Subject: [PATCH 06/13] Remove width settings --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d416a07..cfd954c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build Status](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml?query=branch%3Amain) [![codecov](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/AdsorbedSolutionTheory.jl/dev) -![logo](/docs/Langmuir_logo.svg | width=100) +![logo](/docs/Langmuir_logo.svg) This package implements single adsorption and multicomponent adsorption through Ideal Absorbed Solution Theory (IAST). Some major features are: From 9e7c651ac9edc011ca2213bdda0edc671b440e1b Mon Sep 17 00:00:00 2001 From: Vinicius Viena Santana <59452198+viniviena@users.noreply.github.com> Date: Thu, 3 Oct 2024 22:04:26 +0200 Subject: [PATCH 07/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cfd954c..a8aeda6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml?query=branch%3Amain) [![codecov](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/AdsorbedSolutionTheory.jl/dev) +[![Build Status](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml?query=branch%3Amain) [![codecov](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/Langmuir.jl/dev) ![logo](/docs/Langmuir_logo.svg) From c05fdf9aa51dd3237568711c040948c02af5ca5e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Riedemann?= <38795484+longemen3000@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:21:19 -0300 Subject: [PATCH 08/13] Update README.md --- README.md | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index a8aeda6..1a7ccb9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![Build Status](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/AdsorbedSolutionTheory.jl/actions/workflows/CI.yml?query=branch%3Amain) [![codecov](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/AdsorbedSolutionTheory.jl) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/Langmuir.jl/dev) +[![Build Status](https://github.com/ClapeyronThermo/Langmuir.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/ClapeyronThermo/Langmuir.jl/actions/workflows/CI.yml?query=branch%3Amain) [![codecov](https://codecov.io/gh/ClapeyronThermo/Langmuir.jl/branch/main/graph/badge.svg?token=ZVGGR4AAFB)](https://codecov.io/gh/ClapeyronThermo/Langmuir.jl) [![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://clapeyronthermo.github.io/Langmuir.jl/dev) ![logo](/docs/Langmuir_logo.svg) @@ -10,12 +10,11 @@ This package implements single adsorption and multicomponent adsorption through ## Examples: ```julia -using AdsorbedSolutionTheory -const AST = AdsorbedSolutionTheory +using Langmuir #example from doi.org/10.1002/aic.14684 -v = @MultiSite{Langmuir,Langmuir} #we create a multisite model, consisting +v = @MultiSite{LangmuirS1,LangmuirS1} #we create a multisite model, consisting x1 = [1.468 0.024 @@ -39,9 +38,9 @@ v = @MultiSite{Langmuir,Langmuir} #we create a multisite model, consisting 0.0] #creation of isotherms from vectors or other iterables. - #you can also use AdsorbedSolutionTheory.from_vec! or AdsorbedSolutionTheory.from_vec + #you can also use Langmuir.from_vec! or Langmuir.from_vec #to create (or fill) vectors from isotherm models - m1,m2,m3 = AST.from_vec(v,x1),AST.from_vec(v,x2),AST.from_vec(v,x3) + m1,m2,m3 = Langmuir.from_vec(v,x1),Langmuir.from_vec(v,x2),AST.from_vec(v,x3) models = (m1,m2,m3) #calculate loading of a single isotherm From 15291b120864fe155684f03b0b527574128450b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Riedemann?= <38795484+longemen3000@users.noreply.github.com> Date: Thu, 3 Oct 2024 17:28:06 -0300 Subject: [PATCH 09/13] Update LICENSE --- LICENSE | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE b/LICENSE index ddc8ae8..c4b6d0c 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2024 longemen3000 and contributors +Copyright (c) 2024 Andrés Riedemann, Vinicius Viena, Pierre Walker, and contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From 2d7d76c685a2e61ee71dcd468a05589711f4a136 Mon Sep 17 00:00:00 2001 From: longemen3000 Date: Thu, 3 Oct 2024 17:43:15 -0300 Subject: [PATCH 10/13] activate codecov --- .github/workflows/CI.yml | 39 ++++++++++++++++------------- .github/workflows/Documentation.yml | 25 ++++++++++++++++++ README.md | 4 +-- 3 files changed, 48 insertions(+), 20 deletions(-) create mode 100644 .github/workflows/Documentation.yml diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 7314e0a..3b4a0e3 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -1,21 +1,29 @@ name: CI on: - push: - branches: - - main - tags: ['*'] pull_request: - workflow_dispatch: + branches: + - master + paths-ignore: + - 'docs/**' + #- 'examples/**' + push: + paths-ignore: + - 'docs/**' + #- 'examples/**' +# needed to allow julia-actions/cache to delete old caches that it has created +permissions: + actions: write + contents: read concurrency: # Skip intermediate builds: always. - # Cancel intermediate builds: only if it is a pull request build. + # Cancel intermediate builds: always. group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }} + cancel-in-progress: true jobs: test: name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }} runs-on: ${{ matrix.os }} - timeout-minutes: 60 + timeout-minutes: 30 permissions: # needed to allow julia-actions/cache to proactively delete old caches that it has created actions: write contents: read @@ -39,13 +47,8 @@ jobs: - uses: julia-actions/cache@v2 - uses: julia-actions/julia-buildpkg@v1 - uses: julia-actions/julia-runtest@v1 - docs: - name: Documentation - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: julia-actions/julia-buildpkg@latest - - uses: julia-actions/julia-docdeploy@latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} \ No newline at end of file + - uses: julia-actions/julia-processcoverage@v1 + - uses: codecov/codecov-action@v4 + with: + file: lcov.info + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/Documentation.yml b/.github/workflows/Documentation.yml new file mode 100644 index 0000000..3762ab3 --- /dev/null +++ b/.github/workflows/Documentation.yml @@ -0,0 +1,25 @@ +name: Documentation +on: + push: + branches: + - main +# needed to allow julia-actions/cache to delete old caches that it has created +permissions: + actions: write + contents: read +concurrency: + # Skip intermediate builds: always. + # Cancel intermediate builds: always. + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + docs: + name: Documentation + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: julia-actions/julia-buildpkg@latest + - uses: julia-actions/julia-docdeploy@latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} \ No newline at end of file diff --git a/README.md b/README.md index 1a7ccb9..e1ab76c 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ This package implements single adsorption and multicomponent adsorption through Ideal Absorbed Solution Theory (IAST). Some major features are: - - Explicit single component adsorption properties: loading, bulk phase properties - - Multicomponent adsorption +- Explicit single component adsorption properties: loading, bulk phase properties +- Multicomponent adsorption ## Examples: From 4ff2006ccd4b49fdec9ae94a9df204d489843db2 Mon Sep 17 00:00:00 2001 From: longemen3000 Date: Wed, 23 Oct 2024 14:40:18 -0300 Subject: [PATCH 11/13] move DynamicQuantities to extension --- Project.toml | 8 +++++++- ext/LangmuirDynamicQuantitiesExt.jl | 11 +++++++++++ src/models/models.jl | 4 ---- 3 files changed, 18 insertions(+), 5 deletions(-) create mode 100644 ext/LangmuirDynamicQuantitiesExt.jl diff --git a/Project.toml b/Project.toml index f35f19b..73727bf 100644 --- a/Project.toml +++ b/Project.toml @@ -6,7 +6,6 @@ version = "0.1.0" [deps] BlackBoxOptim = "a134a8b2-14d6-55f6-9291-3336d3ab0209" CommonSolve = "38540f10-b2f7-11e9-35d8-d573e4eb0ff2" -DynamicQuantities = "06fc5a27-2a28-4c7c-a15d-362465fb6821" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" Integrals = "de52edbc-65ea-441a-8357-d3a637375a31" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" @@ -21,6 +20,7 @@ Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" [compat] BlackBoxOptim = "^0.6.2" CommonSolve = "0.2.4" +DynamicQuantities = "1" ForwardDiff = "^0.10" Integrals = "4" LinearAlgebra = "1" @@ -33,6 +33,12 @@ 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" diff --git a/ext/LangmuirDynamicQuantitiesExt.jl b/ext/LangmuirDynamicQuantitiesExt.jl new file mode 100644 index 0000000..cbe7382 --- /dev/null +++ b/ext/LangmuirDynamicQuantitiesExt.jl @@ -0,0 +1,11 @@ +module LangmuirDynamicQuantitiesExt + +import Langmuir +import DynamicQuantities +using DynamicQuantities: @u_str + +function Langmuir.Rgas(model::Langmuir.IsothermModel{<:DynamicQuantities.Quantity}) + return 8.31446261815324u"J/mol/K" +end + +end #module \ No newline at end of file diff --git a/src/models/models.jl b/src/models/models.jl index 360c1ff..84ddfa5 100644 --- a/src/models/models.jl +++ b/src/models/models.jl @@ -6,10 +6,6 @@ end Rgas(model) = 8.31446261815324 #J.mol⁻¹.K⁻¹ -function Rgas(model::IsothermModel{<:Quantity}) - return 8.31446261815324u"J/mol/K" -end - """ model_length(model::IsothermModel) From 25ed7be3ab5e7867c1b3e3276843dd08a98520ce Mon Sep 17 00:00:00 2001 From: longemen3000 Date: Wed, 23 Oct 2024 14:45:28 -0300 Subject: [PATCH 12/13] remove DynamicQuantities from deps --- src/Langmuir.jl | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Langmuir.jl b/src/Langmuir.jl index 7d27e5c..8fa87bb 100644 --- a/src/Langmuir.jl +++ b/src/Langmuir.jl @@ -6,7 +6,6 @@ using ForwardDiff using LogExpFunctions using StaticArrays using Integrals -using DynamicQuantities using Tables, TableOperations using Roots: Roots, solve import PolyLog From a39842c4fa728385e6d866eda7291810d8512436 Mon Sep 17 00:00:00 2001 From: longemen3000 Date: Sat, 16 Nov 2024 19:37:22 -0300 Subject: [PATCH 13/13] FastIAS: fix convergence criteria, add tests --- src/methods/iast.jl | 3 ++- test/runtests.jl | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/methods/iast.jl b/src/methods/iast.jl index ec0eb92..8d08931 100644 --- a/src/methods/iast.jl +++ b/src/methods/iast.jl @@ -233,7 +233,8 @@ function iast_step!(::FastIAS, models, p, T, y, state::S, maxiters, reltol, abst end end ΔRes = norm(δ,Inf) - ΔRes <= min(abstol,norm(Res,Inf)*reltol) && (converged = true) + ΔRes <= abstol && (converged = true) + norm(δ,1) <= reltol && (converged = true) return (;η,K,Diag,Res,δ,x,q_tot,iters,converged) end diff --git a/test/runtests.jl b/test/runtests.jl index f90c4ad..99ad8d4 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -128,6 +128,22 @@ end @test iast(models,p,T,y,FastIAS())[1] ≈ q_tot @test iast(models,p,T,y,IASTNestedLoop())[1] ≈ q_tot @test iast(models,p,T,y,IASTNestedLoop(),x0 = x0)[1] ≈ q_tot + + ethane_isotherm = Quadratic{Float64}(2.5087482698420104e-7, 2.1373377526197646e-19, 3.641079631515442, -6898.20708031339, -47789.60001500269) + ethylene_isotherm = Quadratic{Float64}(2.599227350906123e-8, 7.128313806215397e-19, 3.832139235999132, -11790.383728687304, -41702.74723166111) + p2 = 101325.0 + T2 = 303.0 + models2 = (ethane_isotherm,ethylene_isotherm) + yx = range(0.0, 1.00, 51) + for yi in yx + y = [yi,1-yi] + n1,w1,status1 = iast(models2,p2,T2,y,FastIAS()) + n2,w2,status2 = iast(models2,p2,T2,y,IASTNestedLoop()) + @test status1 == :success + @test status2 == :success + @test n1 ≈ n2 + @test w1 ≈ w2 + end end