-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ccdf865
commit 888fbb3
Showing
3 changed files
with
278 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
program main | ||
use yaeos, only: pr, R | ||
use yaeos, only: Groups, setup_unifac, UNIFAC | ||
|
||
type(UNIFAC) :: model | ||
|
||
integer, parameter :: nc = 3, ng = 4 | ||
|
||
type(Groups) :: molecules(nc) | ||
|
||
real(pr) :: n(nc), T, n_t | ||
|
||
real(pr) :: He, HeT, Hen(nc) | ||
real(pr) :: Se, SeT, Sen(nc) | ||
|
||
T = 150 | ||
n = [20.0, 70.0, 10.0] | ||
n_t = sum(n) | ||
|
||
! ! Ethane [CH3] | ||
molecules(1)%groups_ids = [1] | ||
molecules(1)%number_of_groups = [2] | ||
|
||
! ! Ethanol [CH3, CH2, OH] | ||
molecules(2)%groups_ids = [1, 2, 14] | ||
molecules(2)%number_of_groups = [1, 1, 1] | ||
|
||
! ! Methylamine [H3C-NH2] | ||
molecules(3)%groups_ids = [28] | ||
molecules(3)%number_of_groups = [1] | ||
|
||
! setup UNIFAC model | ||
model = setup_unifac(molecules) | ||
|
||
call model%excess_enthalpy(n, T, He=He, HeT=HeT, Hen=Hen) | ||
call model%excess_entropy(n, T, Se=Se, SeT=SeT, Sen=Sen) | ||
|
||
print *, 'Excess enthalpy:', He / n_t, -8.12666342863807_pr | ||
print *, 'Excess entropy:', Se / n_t, -0.03268447167877293_pr | ||
|
||
print *, 'dHe/dT:', HeT / n_t, 0.05391608033744438_pr | ||
print *, 'dSe/dT:', SeT / n_t, 0.0003594405355829625_pr | ||
|
||
print *, 'dHe/dn:', Hen / n_t, [150.72393613, -573.71657621, -4412.09526745] | ||
print *, 'dSe/dn:', Sen / n_t, [-6.01538894_pr, -2.23972167_pr, -4.97564211_pr] | ||
|
||
|
||
end program main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 8, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from thermo import UNIFAC\n", | ||
"from thermo.unifac import UFIP, UFSG\n", | ||
"import numpy as np\n", | ||
"\n", | ||
"\n", | ||
"GE = UNIFAC.from_subgroups(\n", | ||
" chemgroups=[{1:2}, {1:1, 2:1, 14:1}, {28: 1}], \n", | ||
" T=150, \n", | ||
" xs=[0.2, 0.7, 0.1], \n", | ||
" version=0, \n", | ||
" interaction_data=UFIP, \n", | ||
" subgroups=UFSG\n", | ||
")" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 9, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"-0.03268447167877293" | ||
] | ||
}, | ||
"execution_count": 9, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"GE.SE() / 100" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"0.0003594405355829625" | ||
] | ||
}, | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"GE.dSE_dT() / 100" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 22, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"array([-6.01538894, -2.23972167, -4.97564211])" | ||
] | ||
}, | ||
"execution_count": 22, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"np.array(GE.dSE_dxs())" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 14, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"-8.12666342863807" | ||
] | ||
}, | ||
"execution_count": 14, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"GE.HE() / 100" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 15, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"0.05391608033744438" | ||
] | ||
}, | ||
"execution_count": 15, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"GE.dHE_dT() / 100" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 25, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"array([ 9.63390279, 2.38949767, -35.99428925])" | ||
] | ||
}, | ||
"execution_count": 25, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"np.array(GE.dHE_dns()) / 100" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "yaeos", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.10.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters