Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Database records can be changed by reference (C++, Python) #70

Merged
merged 279 commits into from
Jul 23, 2024
Merged
Changes from 3 commits
Commits
Show all changes
279 commits
Select commit Hold shift + click to select a range
0005c76
fix test script execution
gdmiron Nov 25, 2019
473609c
fix test script execution
gdmiron Nov 25, 2019
f47d5ec
tests only excuted in linux ci
gdmiron Nov 25, 2019
6c76a65
Merge branch 'master' into development
gdmiron Nov 25, 2019
2667fc3
Merged in development (pull request #25)
gdmiron Nov 25, 2019
b8365a4
Merge branch 'master' into development
gdmiron Nov 25, 2019
381b69b
Merge branch 'master' of github.com:gdmiron/thermofun
gdmiron Nov 25, 2019
184cee1
Merge branch 'master' into development
gdmiron Nov 25, 2019
2dd39d5
Update test.sh
gdmiron Nov 25, 2019
8c647c3
Update install.sh
gdmiron Nov 25, 2019
8d51e8f
Update test.sh
gdmiron Nov 25, 2019
0eda2ec
1e-13 accepted differences for tests
gdmiron Nov 25, 2019
4078893
Merge branch 'master' of github.com:gdmiron/thermofun into development
gdmiron Nov 26, 2019
cde4b6d
Introduced function appendData to existing database.
gdmiron Dec 5, 2019
a78fa68
Merged in development (pull request #26)
gdmiron Dec 5, 2019
43a69fc
Merged in development (pull request #27)
gdmiron Dec 6, 2019
abb8292
fix for json parse crash in release mode, yet unknown reason
gdmiron Dec 6, 2019
6a4eed8
temporarily disabled tests in travis ci
gdmiron Dec 6, 2019
141eb84
Merged in development (pull request #28)
gdmiron Dec 6, 2019
9aa8f17
changed binder link to jupyter lab, fixes to readme
gdmiron Dec 6, 2019
872795e
Merged in development (pull request #29)
gdmiron Dec 6, 2019
13f64a3
Update README.md
gdmiron Dec 6, 2019
b029706
Update README.md
gdmiron Dec 6, 2019
f5ad769
using pytest approx function with abs and rel tolerances. Re-activate…
gdmiron Dec 8, 2019
e6fd905
changes to accomodate new database structure containing lists of 'sub…
gdmiron Dec 9, 2019
93a4811
Merge branch 'dev-database' into pytests
gdmiron Dec 9, 2019
2f1ceb2
added test for database parsing
gdmiron Dec 9, 2019
8376b86
test for appending data to database
gdmiron Dec 10, 2019
1476430
Merged in dev-database (pull request #30)
gdmiron Dec 10, 2019
91a24e2
Merged in pytests (pull request #31)
gdmiron Dec 10, 2019
a7a52ea
fixed merge conflicts
gdmiron Dec 10, 2019
feee298
removed check if record exists from set functions
gdmiron Dec 10, 2019
3c7628a
removed duplicate database file
gdmiron Dec 10, 2019
17392d3
Merged in github (pull request #33)
gdmiron Dec 10, 2019
f809fb5
removed version pinning for pybind11 and nlohmann_json
gdmiron Dec 11, 2019
e2103a4
Merge branch 'master' into github
gdmiron Dec 11, 2019
7b9cbff
Merged in github (pull request #34)
gdmiron Dec 11, 2019
1266832
Merged in github (pull request #35)
gdmiron Dec 11, 2019
01ccc5d
converted databases to new structure
gdmiron Dec 11, 2019
4cca715
Merge branch 'master' of github.com:gdmiron/thermofun into github
gdmiron Dec 11, 2019
3649958
fix overloaded functions
gdmiron Dec 11, 2019
e4ed92c
Merge branch 'master' of github.com:gdmiron/thermofun into github
gdmiron Dec 11, 2019
e1f9009
temporarily disabling python bindings
gdmiron Dec 11, 2019
3585521
re-activated python bindings
gdmiron Dec 11, 2019
6f69137
removed overloaded appendData
gdmiron Dec 11, 2019
7ffe014
added back overloaded appendData
gdmiron Dec 11, 2019
aa104e6
set reaction using reaction equation, calculate properties given a re…
gdmiron Dec 11, 2019
eb9cb70
Merge branch 'master' of github.com:thermomod/thermofun into dev-reac…
gdmiron Dec 11, 2019
ba471bc
Merge branch 'master' of github.com:gdmiron/thermofun into dev-reactions
gdmiron Dec 11, 2019
22c7dcc
fix for correct removal of space, tab, newline in reaction parser
gdmiron Dec 12, 2019
fe08b4d
Merged in dev-reactions (pull request #36)
gdmiron Dec 12, 2019
1fc692a
Database object can now be constructed using a file or a string conta…
gdmiron Dec 18, 2019
47b19d1
fixed division by zero problem in the propagation of derivatives
gdmiron Dec 20, 2019
01946b5
fix calculation of derivatives in Cp f(T) method at reference T-P
gdmiron Dec 20, 2019
ca50af9
example properties reaction
gdmiron Feb 6, 2020
f4c1163
bugfix entropy of reaction
gdmiron Feb 17, 2020
360cd59
Merged in development (pull request #37)
gdmiron Feb 17, 2020
1d2710f
fixed conflicts
gdmiron Feb 17, 2020
789eebd
std T and P default values, bugfix
gdmiron Mar 10, 2020
15d462e
extended with derived units for powers of K^ and bar^
gdmiron Mar 11, 2020
3ef288a
converting read units to default upon parsing of data, added ThermoPa…
gdmiron Mar 11, 2020
677e8b2
added test for cp of reaction at high T and P
gdmiron Mar 11, 2020
d8b1e9a
fix for units conversion, extended tests with landau, BM, AD models
gdmiron Mar 12, 2020
a2a3b4b
fix for HKF units
gdmiron Mar 27, 2020
6a1923a
extended aggregateState options compatible with Cox, J. D. (1982)
gdmiron Mar 29, 2020
4833b70
Overloaded thermoProperties functions
gdmiron Mar 30, 2020
0ace5fd
tests for reactions, now calculate proeprties functions can be called…
gdmiron Mar 30, 2020
16abb1d
Merged in bugfix (pull request #39)
gdmiron Mar 31, 2020
8784a12
Merge branch 'master' into development
gdmiron Mar 31, 2020
e1f8c91
Merged in bugfix (pull request #40)
gdmiron Apr 7, 2020
2e492d0
Merge branch 'master' into origin-bucket
gdmiron Apr 7, 2020
cedfe1d
fixed merge conflicts
gdmiron Apr 7, 2020
2bb61e8
version 0.3.2
gdmiron Apr 7, 2020
72c0c3f
Merged in origin-hub (pull request #41)
gdmiron Apr 7, 2020
5d2a789
Merge branch 'master' into origin-bucket
gdmiron Apr 7, 2020
8fdfb48
removed schemas folder, used only by ThermoFunGui
gdmiron Apr 8, 2020
034dda1
changed enum indexes
gdmiron Apr 8, 2020
e7e1bb6
sync with master, bumped to 0.3.3
gdmiron Apr 8, 2020
3f70b49
kept thermo_ref_prop() for reaction properties as is used in ThermoMatch
gdmiron Apr 9, 2020
45134c0
Merged in development (pull request #38)
gdmiron Apr 9, 2020
d7d2d26
fixed conflict
gdmiron Apr 9, 2020
efe1b9b
fixed conflicts
gdmiron Apr 9, 2020
7e548c5
Merged in origin-hub (pull request #42)
gdmiron Apr 9, 2020
240a4b7
Merge remote-tracking branch 'gdmiron-hub/origin-bucket' into origin-hub
gdmiron Apr 9, 2020
acc76a2
Merged in origin-hub (pull request #43)
gdmiron Apr 9, 2020
3993d80
Merge branch 'master' into origin-bucket
gdmiron Apr 9, 2020
6c53a0f
Merge branch 'origin-hub' into origin-bucket
gdmiron Apr 9, 2020
a37a002
removed tests on macos
gdmiron Apr 9, 2020
f0ddd17
Update README.md
gdmiron Apr 9, 2020
9bf5b53
Merge branch 'origin-hub' into calc_const_reference_props
gdmiron May 3, 2020
834137a
added option for constant properties
gdmiron Jun 3, 2020
c2d8245
install.bat edited online with Bitbucket
gdmiron Jun 3, 2020
5c137e5
install.bat edited online with Bitbucket
gdmiron Jun 3, 2020
5bea848
Merged in calc_const_reference_props (pull request #44)
gdmiron Jun 4, 2020
0a9090b
changes for wasm build
gdmiron Aug 3, 2020
33e69d3
json Dump function results in cheerp clang crash
gdmiron Aug 3, 2020
6070e1d
uncommented json dump
gdmiron Aug 3, 2020
d502a3b
build static lib
gdmiron Sep 3, 2020
1e97fd0
build static lib
gdmiron Sep 3, 2020
806350a
fixed reaction volume unit in RB model
gdmiron Nov 17, 2020
9b2fa33
fix to allow appending elements to the database
gdmiron Nov 30, 2020
9508b9d
added automatic tests for RB model, thermofun v0.3.5
gdmiron Nov 30, 2020
188d1e1
test for appending elements
gdmiron Nov 30, 2020
aafc509
Merged in RB-fix (pull request #45)
gdmiron Nov 30, 2020
9ec23a3
Merge branch 'master' into origin-bucket
gdmiron Nov 30, 2020
5b32d43
fixed merge conflicts
gdmiron Nov 30, 2020
e34699b
removed old functions
gdmiron Nov 30, 2020
8c30a84
Merged in origin-hub (pull request #46)
gdmiron Nov 30, 2020
2f60e25
Merge remote-tracking branch 'origin-hub/master' into origin-hub
gdmiron Jan 6, 2021
0b7919b
Merged master into origin-hub
gdmiron Jan 6, 2021
86fe73f
fix for Cp=f(T) phase transition, problems with the derivatives
gdmiron Jan 6, 2021
5452e32
Merged in origin-hub (pull request #47)
gdmiron Jan 6, 2021
76fd2ea
added default valences anf fixed formula parser bug
gdmiron Jan 6, 2021
eb4ec07
tests for formula parser and CpfT with phase transition
gdmiron Jan 6, 2021
f582925
Merged in fix-formula-parser (pull request #48)
gdmiron Jan 6, 2021
e0ee1f6
fixed unit of Pc to bar, added test for PRSV gas
gdmiron Mar 6, 2021
c78454d
Merged in fix_unit (pull request #49)
gdmiron Mar 6, 2021
5d9d1dd
fixed conflicts
gdmiron Mar 6, 2021
85cf2b5
Merged in origin-hub (pull request #50)
gdmiron Mar 6, 2021
9306a0f
v0.3.7
gdmiron Mar 6, 2021
ff3ad80
Aded path to c:/usr/local
sdmytrievs Mar 29, 2021
5b8eeda
ThermoEngine.cpp edited online with Bitbucket
gdmiron Jun 9, 2021
a14e521
ThermoEngine.cpp edited online with Bitbucket
gdmiron Jun 9, 2021
90f59ac
extended error output
gdmiron Jun 10, 2021
8f43435
EmpiricalCpIntegration.cpp edited online with Bitbucket
gdmiron Jun 10, 2021
b92d519
Merged in jsonio17-move (pull request #51)
gdmiron Jun 10, 2021
897c013
Merge branch 'master' of bitbucket.org:gems4/thermofun
gdmiron Jun 24, 2021
4979339
Merged in merge-fix (pull request #52)
gdmiron Jun 25, 2021
38dd3d5
add records as json strings, literals, functions to list available TP…
gdmiron Jun 25, 2021
2d21030
Merge remote-tracking branch 'origin-hub/master' into origin-hub
gdmiron Jun 25, 2021
d6db893
Merge branch 'master' into origin-hub
gdmiron Jun 25, 2021
3d1a482
Merged in origin-hub (pull request #53)
gdmiron Jun 25, 2021
447a9b2
Merge branch 'master' into enhancements
Jun 26, 2021
75ebd03
functions to list available properties to calculate
gdmiron Jun 26, 2021
a9b6599
functions to list available properties to calculate
gdmiron Jun 26, 2021
051cecd
reaction with equation gets split in reactants
gdmiron Jun 26, 2021
f6257c6
test for calc reacdc props
gdmiron Jun 26, 2021
62431a4
Merged in enhancements (pull request #54)
gdmiron Jun 27, 2021
4762e12
Moved implementation to ChemicalFun
sdmytrievs Oct 1, 2021
a71a3c9
Changed API FormulaToken
sdmytrievs Oct 5, 2021
a5bd5b1
Remove link to ninternal DBElements data
sdmytrievs Oct 8, 2021
40bb111
fix logK coeff calculation
gdmiron Oct 18, 2021
05a5b1d
Merge branch 'fix_logK' into chemicalfun
gdmiron Oct 18, 2021
4cbaf12
fix test
gdmiron Oct 18, 2021
d4937c3
Use new config
sdmytrievs Oct 25, 2021
03b2735
Fixed after rename functions
sdmytrievs Jan 4, 2022
b224f22
Merge remote-tracking branch 'origin-hub/master' into origin-hub
gdmiron Jan 12, 2022
97e9d5b
Merge branch 'master' into origin-hub
gdmiron Jan 12, 2022
492e26b
Merge branch 'origin-hub' into chemicalfun
gdmiron Jan 12, 2022
bc2e3d7
chemicalfun to environment file
gdmiron Jan 12, 2022
6500bca
fix link to chemicalfun
gdmiron Jan 12, 2022
d2329ad
fix forward declaration
gdmiron Jan 12, 2022
35a654c
fix for MSVC build
gdmiron Jan 12, 2022
1473ef4
disabled build on mingw, issue with linking to chemicalfun which is c…
gdmiron Jan 12, 2022
e3e8d6d
Merged in chemicalfun (pull request #55)
sdmytrievs Jan 12, 2022
cf8dd56
v0.3.9
gdmiron Jan 13, 2022
73ff40a
Merge branch 'master' into origin-hub
gdmiron Jan 13, 2022
a9ab781
Merged in origin-hub (pull request #56)
gdmiron Jan 13, 2022
d8b6bd7
Changed install-dependencies.sh to use ChimicalFun
sdmytrievs Feb 11, 2022
0c5867c
Fixed install-dependencies.sh to use ChimicalFun
sdmytrievs Feb 11, 2022
903bf7b
Merged in change-install-dependencies (pull request #57)
sdmytrievs Feb 15, 2022
8426f2a
GEMS-203: Replace cout output with logging (spdlog) into ThermoFun
sdmytrievs May 27, 2022
9a0c547
Changed CI appveyor to C:\Miniconda3-x64
sdmytrievs Jun 22, 2022
f285bda
Try fix build CI
sdmytrievs Jun 27, 2022
154663a
Try fix build CI
sdmytrievs Jun 27, 2022
36e30c9
Try fix build CI
sdmytrievs Jun 27, 2022
ba73b20
installVS.bat edited online with Bitbucket
gdmiron Jun 28, 2022
4a0f493
removed namespace std
gdmiron Jun 30, 2022
fc6c128
trying to fix CI for win
gdmiron Jun 30, 2022
cea0f77
trying to fix CI for win
gdmiron Jun 30, 2022
f9cd9b4
pybind11 msvc compiler bug https://github.com/microsoft/onnxruntime/i…
gdmiron Jun 30, 2022
4d7719c
Removed test fix CI
sdmytrievs Jun 30, 2022
2de44c3
changes to use of logger
gdmiron Jun 30, 2022
86db0fb
GEMS-210 Added function for set up logging level and log to file
sdmytrievs Jul 6, 2022
c0eba1d
GEMS-210 Added function for set up logging level and log to file for …
sdmytrievs Jul 6, 2022
003dfd0
adjustments to logger
gdmiron Jul 15, 2022
7ca369f
updated pipelines CI to macos12
gdmiron Jul 15, 2022
3de7ddc
Merged in add-logger (pull request #58)
sdmytrievs Jul 15, 2022
53e4fd3
Merge remote-tracking branch 'origin-hub/master' into origin-hub
gdmiron Jul 15, 2022
cda412e
Merge branch 'master' into origin-hub
gdmiron Jul 15, 2022
725f4fe
Merged in origin-hub (pull request #59)
gdmiron Jul 15, 2022
8526b9b
set C++ standard to 17
gdmiron Jul 16, 2022
479584c
link to spdlog
gdmiron Jul 16, 2022
9597fa1
fix versions for spdlog and fmt libs$
gdmiron Jul 16, 2022
e4c4641
Merged master into test-17
gdmiron Jul 16, 2022
cb52350
linking to fmt, psdlog
gdmiron Jul 16, 2022
3a0f4a2
Merge branch 'test-17' of bitbucket.org:gems4/thermofun into test-17
gdmiron Jul 16, 2022
56c96ef
link to spdlog in win and macos
gdmiron Jul 16, 2022
09fe03c
added fmt link in macos
gdmiron Jul 16, 2022
b05d064
import test macos
gdmiron Jul 16, 2022
ab43818
import test macos
gdmiron Jul 16, 2022
1134f95
define the CMake variable SPDLOG_FMT_EXTERNAL to use external fmt
gdmiron Jul 16, 2022
2d054d8
Add python path to build
sdmytrievs Jul 18, 2022
05e6211
Hide fmt
sdmytrievs Jul 18, 2022
10ed389
sinhronize with chemicalfun
sdmytrievs Jul 18, 2022
24f0da4
changed macos
sdmytrievs Jul 18, 2022
b6ea48b
azure-pipelines.yml edited online with Bitbucket
gdmiron Jul 19, 2022
f01936f
test with new chfun, link to spdlog for all os
gdmiron Jul 21, 2022
ba43cda
removed eigen
gdmiron Jul 21, 2022
f351881
fix conflict
gdmiron Jul 21, 2022
1578aa8
fixes
gdmiron Jul 21, 2022
ffcee06
Merged in test-17 (pull request #60)
gdmiron Jul 21, 2022
64464b9
Merge remote-tracking branch 'origin-hub/master' into origin-bucket
gdmiron Jul 21, 2022
1697bc9
Merge remote-tracking branch 'origin-hub/master' into origin-hub
gdmiron Nov 24, 2022
3cb430c
fixed merge
gdmiron Nov 24, 2022
ad95567
fixing spdlog link
gdmiron Nov 24, 2022
99642f7
activate tests in osx
gdmiron Nov 25, 2022
3a49012
fix build
gdmiron Nov 25, 2022
b185bfa
fix test
gdmiron Nov 25, 2022
ddb2ff7
fix test
gdmiron Nov 25, 2022
dbfc28d
fix for tests at Psat
gdmiron Nov 25, 2022
546c7ea
fix psat
gdmiron Nov 25, 2022
0f9302d
fixed tests
gdmiron Nov 25, 2022
7279a7c
fix macos ci
gdmiron Nov 25, 2022
caf6ad4
Merged in origin-hub (pull request #61)
gdmiron Nov 25, 2022
4852213
Merge branch 'master' into origin-bucket
gdmiron Nov 25, 2022
385bd75
Update environment.devenv.yml
gdmiron Nov 25, 2022
ecd7b51
revert
gdmiron Nov 25, 2022
aa9275e
Increment CACHE_NUMBER to reset cached conda packages
allanleal Nov 25, 2022
6d4ec1f
Removed option `use-only-tar-bz2: true` in GitHub workflows.
allanleal Nov 26, 2022
3d7c3f0
Merge remote-tracking branch 'origin-hub/master' into origin-hub
gdmiron Dec 6, 2022
26a0c90
Merge branch 'master' into origin-hub
gdmiron Dec 6, 2022
da2f852
GEMS-221: Fixed build spdlog in header-only mode or as lib for therm…
sdmytrievs Feb 8, 2023
6fb3782
GEMS-221: Set spdlog in header-only mode for thermofun project, check…
sdmytrievs Feb 9, 2023
e37645f
Restore fixed
sdmytrievs Feb 9, 2023
4368b3b
Fixed local install python code
sdmytrievs Feb 10, 2023
2addfd4
GEMS-217: Fixed memory leaks which were definitely lost t in ThermoFu…
sdmytrievs Feb 16, 2023
1244b54
Fixed python install for win64
sdmytrievs Mar 1, 2023
39e0f22
Fixed version in install dependent
sdmytrievs Mar 1, 2023
3bb2660
Fixed
sdmytrievs Mar 1, 2023
f6a8751
Merge remote-tracking branch 'origin-hub/master' into origin-hub
gdmiron Mar 2, 2023
4d7caa0
Merged in spdlog-221 (pull request #62)
sdmytrievs Mar 2, 2023
a1471ee
fixed merge conflicts
gdmiron Mar 2, 2023
eb826f8
v0.4.3
gdmiron Mar 2, 2023
edf86d7
Merge remote-tracking branch 'origin/origin-hub' into origin-bucket
gdmiron Mar 2, 2023
7a50ad4
removed setuptools and version of chemicalfun
gdmiron Mar 2, 2023
d6026d3
Merged in origin-hub (pull request #63)
gdmiron Mar 2, 2023
c669c98
GEMS-232: Fixed refresh all_elements data after setElement, addElement
sdmytrievs Apr 24, 2024
ac4af1d
GEMS-232: Added reference functions to C API
sdmytrievs Apr 24, 2024
1b8d663
GEMS-232: Added trace output functionality for the database API
sdmytrievs Apr 26, 2024
8cb8de7
GEMS-232: Added new functionality to the python API
sdmytrievs Apr 27, 2024
f676894
GEMS-232: Implemented test script of new functions into the Python API
sdmytrievs Apr 29, 2024
22d50fc
install.sh edited online with Bitbucket
gdmiron Apr 30, 2024
a91c6d5
install.sh edited online with Bitbucket
gdmiron Apr 30, 2024
bf7aa97
install.sh edited online with Bitbucket
gdmiron Apr 30, 2024
244193a
Merged in ref_api_232 (pull request #64)
sdmytrievs Apr 30, 2024
4f07752
fixed conflicts
gdmiron Jul 23, 2024
3442538
Merged master into origin-hub
gdmiron Jul 23, 2024
a458cda
Merged in origin-hub (pull request #65)
gdmiron Jul 23, 2024
6a0aa37
Merge branch 'master' into origin-bucket
gdmiron Jul 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 33 additions & 7 deletions ThermoFun/Reactions/LogK_function_of_T.cpp
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ auto thermoPropertiesReaction_LogK_fT(Reaktoro_::Temperature TK, Reaktoro_::Pres
auto R_T = TK * R_CONSTANT;
auto ref_tpr = reaction.thermo_ref_prop();
auto A = reaction.thermo_parameters().reaction_logK_fT_coeff;
auto Cp = reaction.thermo_parameters().reaction_Cp_fT_coeff;
auto CpCoeff = reaction.thermo_parameters().reaction_Cp_fT_coeff;
auto dVr = ref_tpr.reaction_volume; //Gr = rc[q].Gs[0];
auto dHr = ref_tpr.reaction_enthalpy;
auto dSr = ref_tpr.reaction_entropy;
@@ -22,11 +22,6 @@ auto thermoPropertiesReaction_LogK_fT(Reaktoro_::Temperature TK, Reaktoro_::Pres
auto Tr = reaction.referenceT();

/// deal with Cp and A parameters conversion
// if (A.size() == 0 && Cp.size() > 4)

// if (Cp.size() == 0 && A.size() > 6)
// convert

switch (CE)
{
case MethodCorrT_Thrift::type::CTM_EK0: // 1-term lgK = const
@@ -58,6 +53,37 @@ auto thermoPropertiesReaction_LogK_fT(Reaktoro_::Temperature TK, Reaktoro_::Pres
break;
case MethodCorrT_Thrift::type::CTM_LGK: // full 7-term logK approx
case MethodCorrT_Thrift::type::CTM_LGX: // (derived from dCp=f(T))
if (A.size() == 0 && CpCoeff.size() > 0)
{
//from Cp to A
A.resize(7, 0.0);
CpCoeff.resize(5, 0.0);

// calculation of logK=f(T) coeffs (only first 5 Cp coefficients, conforming to Haas-Fisher function)
A[0] = (( dSr - CpCoeff[0] - CpCoeff[0]*log(TK) - CpCoeff[1]*TK + CpCoeff[2]/(2.0*TK*TK)
+ 2.0*CpCoeff[3]/pow(TK,0.5) - CpCoeff[4]*TK*TK/2.0 ) / Rln10).val;
A[1] = CpCoeff[1]/(2.0*Rln10);
A[2] = (-( dHr - CpCoeff[0]*TK - CpCoeff[1]*TK*TK/2.0 + CpCoeff[2]/TK
- 2.0*CpCoeff[3]*pow(TK,0.5) - CpCoeff[4]*TK*TK*TK/3.0 ) / Rln10).val;
A[3] = CpCoeff[0]/Rln10;
A[4] = CpCoeff[2]/(2.0*Rln10);
A[5] = CpCoeff[4]/(6.0*Rln10);
A[6] = -4.0*CpCoeff[3]/Rln10;
}

if (CpCoeff.size() == 0 && A.size() > 0)
{
//from A to Cp
A.resize(7, 0.0);
CpCoeff.resize(5, 0.0);

CpCoeff[0] = Rln10 * A[3];
CpCoeff[1] = Rln10 * 2.0 * A[1];
CpCoeff[2] = Rln10 * 2.0 * A[4];
CpCoeff[3] = -Rln10 * 0.25 * A[6];
CpCoeff[4] = Rln10 * 6.0 * A[5];
}

lgK = A[0] + A[1] * TK + A[2]/TK + A[3] * log(TK) + A[4] / (TK*TK) +
A[5] * (TK*TK) + A[6] / pow(TK,0.5);
dHr = Rln10 *( A[1]*(TK*TK) - A[2] + A[3]*TK - 2.0*A[4]/TK
@@ -66,7 +92,7 @@ auto thermoPropertiesReaction_LogK_fT(Reaktoro_::Temperature TK, Reaktoro_::Pres
A[4]/(TK*TK) + 3.0*A[5]*(TK*TK) + 0.5*A[6]/pow(TK,0.5) );
// dGr_d = dHr - dSr * T;
// if( rc[q].DCp )
dCpr = Cp[0] + Cp[1]*TK + Cp[2]/(TK*TK) + Cp[4]*(TK*TK) + Cp[3]/pow(TK,0.5);
dCpr = CpCoeff[0] + CpCoeff[1]*TK + CpCoeff[2]/(TK*TK) + CpCoeff[4]*(TK*TK) + CpCoeff[3]/pow(TK,0.5);
// dHr = Rln10 * T_2 * ( A[1] - A[2]/T_2 + A[3]/T -
// 2.0*A[4]/T_3 + 2.0*A[5]*T - 0.5*A[6]/T_15 );
// dSr = Rln10 * ( A[0] + 2.0*A[1]*T + A[3]*(1.0+lnT) -
2 changes: 1 addition & 1 deletion ThermoFun/Substances/Solute/SoluteHKFgems.cpp
Original file line number Diff line number Diff line change
@@ -224,7 +224,7 @@ auto gShok2(Reaktoro_::Temperature TC, Reaktoro_::Pressure Pbar, const Propertie
g.gTT = a * dDbdTT + 2.0e0 * dDbdT * dadT + Db * dadTT;

// Check if the point (T,P) is inside region II, as depicted in Fig. 6 of Shock and others (1992), on page 809
if ((TC > 155.0 && TC < 355.0 && Pbar < 1000.0) || (TC>=355 && Pbar >=500 && Pbar < 1000))
if ((TC > 155.0 && TC < 355.0 && Pbar < 1000.0) || (TC>=355 && Pbar >=500 && Pbar < 1000) || (TC>=355 && Pbar<500))
{
tempy = ((TC - 155.0) / 300.0);
ft = pow(tempy,4.8) + cC[0] * pow(tempy,16.);
2 changes: 1 addition & 1 deletion ThermoFun/Substances/Solute/SoluteHKFreaktoro.cpp
Original file line number Diff line number Diff line change
@@ -259,7 +259,7 @@ auto functionG(Reaktoro_::Temperature T, Reaktoro_::Pressure P, const Properties
gPP = gP * (gP/g + beta + betaP/beta + r*beta/(1 - r));

// Check if the point (T,P) is inside region II, as depicted in Fig. 6 of Shock and others (1992), on page 809
if ((TdegC > 155.0 && TdegC < 355.0 && Pbar < 1000.0) || (TdegC>=355 && Pbar >=500 && Pbar < 1000))
if ((TdegC > 155.0 && TdegC < 355.0 && Pbar < 1000.0) || (TdegC>=355 && Pbar >=500 && Pbar < 1000) || (TdegC>=355 && Pbar<500))
{
// Use equations (32)-(44) of Shock and others (1992) to compute the function g and its partial derivatives on region II
const auto af1 = 3.666660e+01; // unit: K
6 changes: 3 additions & 3 deletions ThermoFun/Substances/Solvent/WaterHGK-JNgems.cpp
Original file line number Diff line number Diff line change
@@ -485,9 +485,9 @@ auto WaterHGKgems::calculateWaterHGKgems(double T, double &P) -> void
memcpy(&wl, &wr, sizeof(WPROPS));
memcpy(&wr, &tw, sizeof(WPROPS));

double temp = aSta.Dens[0];
aSta.Dens[0] = aSta.Dens[1];
aSta.Dens[1] = temp;
//double temp = aSta.Dens[0];
//aSta.Dens[0] = aSta.Dens[1];
//aSta.Dens[1] = temp;
}
else
{
17 changes: 16 additions & 1 deletion ThermoFun/ThermoEngine.cpp
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ struct ThermoEngine::Impl
preferences.method_P = preferences.workSubstance.method_P();

// check for H+
if (preferences.workSubstance.name() == "H+")
if (preferences.workSubstance.symbol() == "H+")
preferences.isHydrogen = true;
else
preferences.isHydrogen = false;
@@ -548,6 +548,13 @@ struct ThermoEngine::Impl
// auto methodP = reac.method_P();
if (!pref.isReacFromReactants)
{
switch (pref.method_genEOS)
{
case MethodGenEoS_Thrift::type::CTPM_REA:
pref.method_T = MethodCorrT_Thrift::type::CTM_LGK;

}

switch (pref.method_T)
{
case MethodCorrT_Thrift::type::CTM_LGX:
@@ -654,6 +661,14 @@ struct ThermoEngine::Impl
{
auto coeff = reactant.second;
auto substance = reactant.first;
auto s = database.getSubstance(substance);

// check if substance is correctly defined
if (!s.methodGenEOS() && !s.method_P() && !s.method_T() && s.reactionSymbol() == symbol)
{
errorMethodNotFound("reaction", symbol, __LINE__, __FILE__);
}

auto tps = thermo_properties_substance_fn(T, P,P, substance); /*thermoPropertiesSubstance(T, P, substance);*/

tpr.reaction_heat_capacity_cp += tps.heat_capacity_cp*coeff;
61 changes: 61 additions & 0 deletions pytests/Reactions/test-logKfT-thermofun.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"datasources": [
"db.thermohub.org"
],
"date": "05.03.2020 12:00:00",
"elements": [],
"reactions": [
{
"symbol": "NaHCO3@",
"equation": "1.000 Na+ + 1.000 HCO3- = NaHCO3@",
"reactants": [
{
"symbol": "NaHCO3@",
"coefficient": 1
},
{
"symbol": "Na+",
"coefficient": -1
},
{
"symbol": "HCO3-",
"coefficient": -1
}
],
"Tst": 298.15,
"Pst": 100000,
"TPMethods": [
{
"method": {
"0": "logk_fpt_function"
},
"logk_ft_coeffs": {
"values": [
1.8528,
0,
-606.24
]
}
}
]
}
],
"substances": [
{
"symbol": "NaHCO3@",
"formula": "NaHCO3@",
"reaction": "NaHCO3@",
"aggregate_state": {
"4": "AS_AQUEOUS"
},
"class_": {
"3": "SC_AQSOLVENT"
},
"Tst": 298.15,
"Pst": 100000
}
],
"thermodataset": [
"AQ17"
]
}
15 changes: 15 additions & 0 deletions pytests/Reactions/test_logKfT.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import thermofun as thermofun
import pytest as pytest
import unittest


class TestThermoEngine(unittest.TestCase):

def setUp(self):
self.engine = thermofun.ThermoEngine('pytests/Reactions/test-logKfT-thermofun.json')

def test_properties_logKfT_reaction(self):
assert self.engine.thermoPropertiesReaction(298.15, 1e5, "NaHCO3@").log_equilibrium_constant.val == pytest.approx(-0.1805389, 1e-5, 1e-14)
assert self.engine.thermoPropertiesReaction(298.15, 1e5, "NaHCO3@").reaction_heat_capacity_cp.val == pytest.approx(0.0, 1e-5, 1e-14)
assert self.engine.thermoPropertiesReaction(298.15, 1e5, "NaHCO3@").reaction_entropy.val == pytest.approx(35.4716, 1e-5, 1e-14)
assert self.engine.thermoPropertiesReaction(298.15, 1e5, "NaHCO3@").reaction_enthalpy.val == pytest.approx(11606.384, 1e-5, 1e-14)
7 changes: 6 additions & 1 deletion tests/interfaceTest/src/main.cpp
Original file line number Diff line number Diff line change
@@ -59,10 +59,15 @@


// Test
ThermoEngine engine("slop98-thermofun.json");
ThermoEngine engine("aq17-thermofun.json");

engine.appendData("append-thermofun.json");

auto P = 1e5;

engine.thermoPropertiesReaction(298.15, P, "NaHCO3@");
auto tps = engine.thermoPropertiesSubstance(298.15, P, "NaHCO3@");

auto tpr = engine.thermoPropertiesReaction(298.15, P, "Cal = Ca+2 + CO3-2");

auto elements = engine.parseSubstanceFormula("H2O@");