pythermocalcdb 0.11.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. pythermocalcdb-0.11.0/LICENSE +201 -0
  2. pythermocalcdb-0.11.0/PKG-INFO +129 -0
  3. pythermocalcdb-0.11.0/README.md +101 -0
  4. pythermocalcdb-0.11.0/pyproject.toml +72 -0
  5. pythermocalcdb-0.11.0/pythermocalcdb/__init__.py +18 -0
  6. pythermocalcdb-0.11.0/pythermocalcdb/app.py +5 -0
  7. pythermocalcdb-0.11.0/pythermocalcdb/configs/__init__.py +15 -0
  8. pythermocalcdb-0.11.0/pythermocalcdb/configs/constants.py +18 -0
  9. pythermocalcdb-0.11.0/pythermocalcdb/configs/info.py +10 -0
  10. pythermocalcdb-0.11.0/pythermocalcdb/configs/thermo_props.py +48 -0
  11. pythermocalcdb-0.11.0/pythermocalcdb/core/__init__.py +10 -0
  12. pythermocalcdb-0.11.0/pythermocalcdb/core/calc.py +583 -0
  13. pythermocalcdb-0.11.0/pythermocalcdb/core/component_vapor.py +864 -0
  14. pythermocalcdb-0.11.0/pythermocalcdb/core/hsg_mixture.py +261 -0
  15. pythermocalcdb-0.11.0/pythermocalcdb/core/hsg_properties.py +1694 -0
  16. pythermocalcdb-0.11.0/pythermocalcdb/core/hsg_reaction.py +952 -0
  17. pythermocalcdb-0.11.0/pythermocalcdb/docs/__init__.py +0 -0
  18. pythermocalcdb-0.11.0/pythermocalcdb/docs/main.py +3 -0
  19. pythermocalcdb-0.11.0/pythermocalcdb/docs/sat.py +587 -0
  20. pythermocalcdb-0.11.0/pythermocalcdb/docs/thermo.py +1550 -0
  21. pythermocalcdb-0.11.0/pythermocalcdb/models/__init__.py +23 -0
  22. pythermocalcdb-0.11.0/pythermocalcdb/models/component_ref.py +317 -0
  23. pythermocalcdb-0.11.0/pythermocalcdb/models/density.py +41 -0
  24. pythermocalcdb-0.11.0/pythermocalcdb/models/enthalpy.py +93 -0
  25. pythermocalcdb-0.11.0/pythermocalcdb/models/heat_capacity.py +148 -0
  26. pythermocalcdb-0.11.0/pythermocalcdb/models/ref.py +22 -0
  27. pythermocalcdb-0.11.0/pythermocalcdb/models/vapor_pressure.py +103 -0
  28. pythermocalcdb-0.11.0/pythermocalcdb/reactions/__init__.py +23 -0
  29. pythermocalcdb-0.11.0/pythermocalcdb/reactions/reactions.py +540 -0
  30. pythermocalcdb-0.11.0/pythermocalcdb/reactions/rxn.py +413 -0
  31. pythermocalcdb-0.11.0/pythermocalcdb/reactions/source.py +254 -0
  32. pythermocalcdb-0.11.0/pythermocalcdb/thermo/__init__.py +1 -0
  33. pythermocalcdb-0.11.0/pythermocalcdb/thermo/density.py +140 -0
  34. pythermocalcdb-0.11.0/pythermocalcdb/thermo/enthalpy.py +1310 -0
  35. pythermocalcdb-0.11.0/pythermocalcdb/thermo/entropy.py +1244 -0
  36. pythermocalcdb-0.11.0/pythermocalcdb/thermo/gibbs.py +302 -0
  37. pythermocalcdb-0.11.0/pythermocalcdb/thermo/heat_capacity.py +638 -0
  38. pythermocalcdb-0.11.0/pythermocalcdb/thermo/vapor_pressure.py +247 -0
  39. pythermocalcdb-0.11.0/pythermocalcdb/utils/__init__.py +5 -0
  40. pythermocalcdb-0.11.0/pythermocalcdb/utils/component_tools.py +137 -0
  41. pythermocalcdb-0.11.0/pythermocalcdb/utils/conversions.py +50 -0
  42. pythermocalcdb-0.11.0/pythermocalcdb/utils/math_tools.py +128 -0
  43. pythermocalcdb-0.11.0/pythermocalcdb/utils/tools.py +66 -0
  44. pythermocalcdb-0.11.0/pythermocalcdb.egg-info/PKG-INFO +129 -0
  45. pythermocalcdb-0.11.0/pythermocalcdb.egg-info/SOURCES.txt +47 -0
  46. pythermocalcdb-0.11.0/pythermocalcdb.egg-info/dependency_links.txt +1 -0
  47. pythermocalcdb-0.11.0/pythermocalcdb.egg-info/requires.txt +7 -0
  48. pythermocalcdb-0.11.0/pythermocalcdb.egg-info/top_level.txt +4 -0
  49. pythermocalcdb-0.11.0/setup.cfg +4 -0
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,129 @@
1
+ Metadata-Version: 2.4
2
+ Name: pythermocalcdb
3
+ Version: 0.11.0
4
+ Summary: Python Thermodynamic Calculation Engine powered by PyThermoDB.
5
+ Author-email: Sina Gilassi <sina.gilassi@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/sinagilassi/pyThermoCalcDB
8
+ Project-URL: Source, https://github.com/sinagilassi/pyThermoCalcDB
9
+ Project-URL: Tracker, https://github.com/sinagilassi/pyThermoCalcDB/issues
10
+ Keywords: chemical-engineering,thermodynamics,thermodynamic-equations,thermodynamic-properties,process-simulation
11
+ Classifier: Development Status :: 1 - Planning
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Programming Language :: Python :: 3.11
14
+ Classifier: Operating System :: Unix
15
+ Classifier: Operating System :: MacOS :: MacOS X
16
+ Classifier: Operating System :: Microsoft :: Windows
17
+ Requires-Python: >=3.11
18
+ Description-Content-Type: text/markdown
19
+ License-File: LICENSE
20
+ Requires-Dist: scipy
21
+ Requires-Dist: pydantic
22
+ Requires-Dist: pycuc
23
+ Requires-Dist: pythermodb
24
+ Requires-Dist: pythermolinkdb
25
+ Requires-Dist: pythermodb-settings
26
+ Requires-Dist: pyreactlab-core
27
+ Dynamic: license-file
28
+
29
+ # PyThermoCalcDB
30
+
31
+ [![PyPI Downloads](https://static.pepy.tech/badge/pythermocalcdb/month)](https://pepy.tech/projects/pythermocalcdb)
32
+ ![PyPI](https://img.shields.io/pypi/v/PyThermoCalcDB)
33
+ ![Python Version](https://img.shields.io/pypi/pyversions/PyThermoCalcDB.svg)
34
+ ![License](https://img.shields.io/pypi/l/PyThermoCalcDB)
35
+ [![Download on the App Store](https://img.shields.io/badge/Download_on_the_App_Store-0D0D0D?logo=apple&logoColor=white)](https://apps.apple.com/ca/app/mozithermocalc/id6759209992)
36
+
37
+ **PyThermoCalcDB** — Python Thermodynamic Calculation Engine powered by PyThermoDB
38
+
39
+ PyThermoCalcDB is a companion package to PyThermoDB, designed to provide a robust set of thermodynamic calculations, utilities, and workflows — using thermodynamic properties, constants, and equations built with PyThermoDB.
40
+
41
+ Calculations can also be done on your mobile with the MoziThermoCalc iOS app: [Download on the App Store](https://apps.apple.com/ca/app/mozithermocalc/id6759209992).
42
+
43
+ ## 🚀 Why PyThermoCalcDB?
44
+
45
+ - **Seamless integration** with PyThermoDB: use the database of thermodynamic data (pure component properties, correlations, etc.) as the foundation.
46
+ - **Reusable calculation tools**: functions for various calculations.
47
+ - **Consistent with your thermodynamic ecosystem**: fits with existing packages like PyThermoModels, PyPhaseEQ, PyThermoFlash — offering a central “calculation engine” layer.
48
+ - **Minimal dependencies**: lean design, using PyThermoDB as core data source; optionally depend on well-known numerical libraries (e.g. NumPy, SciPy) if needed for complex calculations.
49
+ - **Flexible use-cases**: from quick property lookups to advanced process calculations, or integration in larger workflows or multi-agent systems.
50
+
51
+ ## 📦 Installation
52
+
53
+ ```bash
54
+ pip install pythermocalcdb
55
+ ```
56
+
57
+ ## 🚀 Usage
58
+
59
+ PyThermoCalcDB provides high-level thermodynamic routines built on PyThermoDB. It is optimized for scripts, notebooks, and pipelines ? the `examples/` directory contains runnable workflows.
60
+
61
+ ### 1) Build a ModelSource
62
+
63
+ - Collect ThermoDB pickle paths for your components and load them with `pyThermoLinkDB.load_and_build_model_source`.
64
+
65
+ ```python
66
+ import os
67
+ import pyThermoLinkDB as ptdblink
68
+ from pythermodb_settings.models import Component, ComponentRule, ComponentThermoDBSource, Temperature, Pressure
69
+
70
+ CO2 = Component(name="carbon dioxide", formula="CO2", state="g")
71
+ thermodb_dir = "/path/to/thermodb"
72
+ CO2_src = ComponentThermoDBSource(
73
+ component=CO2,
74
+ source=os.path.join(thermodb_dir, "carbon dioxide-g.pkl"),
75
+ )
76
+
77
+ model_source = ptdblink.load_and_build_model_source(
78
+ thermodb_sources=[CO2_src],
79
+ original_equation_label=False
80
+ )
81
+ ```
82
+
83
+ ### 2) Call helper modules
84
+
85
+ - **Thermodynamic properties** (`pythermocalcdb.docs.thermo`): `calc_En`, `calc_GiFrEn`, `calc_En_range`, `calc_GiFrEn_range`, `calc_dEn` (Delta H between temperatures), `calc_dEnt` (Delta S with pressures and phase), `calc_En_mix` (mixture enthalpy with optional departure/excess terms and `output_unit`).
86
+ - **Saturation & phase change** (`pythermocalcdb.docs.sat`): `calc_VaPr`, `calc_VaPr_range`, `calc_EnVap`, `calc_EnVap_range`, `calc_T_sat`, `calc_VaPr_sensitivity`, `calc_VaPr_sensitivity_range`.
87
+ - **Reactions** (`pythermocalcdb.reactions.reactions`): `dEn_rxn_STD` and `dGiFrEn_rxn_STD` for standard reaction energetics.
88
+
89
+ Example:
90
+
91
+ ```python
92
+ from pythermocalcdb.docs import thermo, sat
93
+ from pythermodb_settings.models import Temperature, Pressure
94
+
95
+ T = Temperature(value=300.0, unit="K")
96
+ P = Pressure(value=1.5e6, unit="Pa")
97
+
98
+ enthalpy = thermo.calc_En(component=CO2, model_source=model_source, temperature=T)
99
+ gibbs = thermo.calc_GiFrEn(component=CO2, model_source=model_source, temperature=T, phase="IG")
100
+ VaPr = sat.calc_VaPr(component=CO2, model_source=model_source, temperature=T)
101
+ Tsat = sat.calc_T_sat(
102
+ component=CO2,
103
+ model_source=model_source,
104
+ pressure=P,
105
+ temperature_guess=T,
106
+ method="least_squares",
107
+ )
108
+ ```
109
+
110
+ Notes:
111
+
112
+ - All helpers expect typed `Component`, `Temperature`, and `Pressure` inputs plus a `model_source` from PyThermoLinkDB.
113
+ - The optional `mode` kwarg accepts `silent`, `log`, or `attach` to control logging and timing.
114
+
115
+ ## 🤝 Contributing
116
+
117
+ Contributions are highly welcome — bug fixes, new calculation routines, mixture models, extended unit tests, documentation, etc.
118
+
119
+ ## 📝 License
120
+
121
+ This project is distributed under the Apache License, Version 2.0, which grants you broad freedom to use, modify, and integrate the software into your own applications or projects, provided that you comply with the conditions outlined in the license. Although Apache 2.0 does not require users to retain explicit author credit beyond standard copyright and license notices, I kindly request that if you incorporate this work into your own software, you acknowledge Sina Gilassi as the original author. Referencing the original repository or documentation is appreciated, as it helps recognize the effort invested in developing and maintaining this project.
122
+
123
+ ## ❓ FAQ
124
+
125
+ For any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/)
126
+
127
+ ## 👨‍💻 Authors
128
+
129
+ - [@sinagilassi](https://www.github.com/sinagilassi)
@@ -0,0 +1,101 @@
1
+ # PyThermoCalcDB
2
+
3
+ [![PyPI Downloads](https://static.pepy.tech/badge/pythermocalcdb/month)](https://pepy.tech/projects/pythermocalcdb)
4
+ ![PyPI](https://img.shields.io/pypi/v/PyThermoCalcDB)
5
+ ![Python Version](https://img.shields.io/pypi/pyversions/PyThermoCalcDB.svg)
6
+ ![License](https://img.shields.io/pypi/l/PyThermoCalcDB)
7
+ [![Download on the App Store](https://img.shields.io/badge/Download_on_the_App_Store-0D0D0D?logo=apple&logoColor=white)](https://apps.apple.com/ca/app/mozithermocalc/id6759209992)
8
+
9
+ **PyThermoCalcDB** — Python Thermodynamic Calculation Engine powered by PyThermoDB
10
+
11
+ PyThermoCalcDB is a companion package to PyThermoDB, designed to provide a robust set of thermodynamic calculations, utilities, and workflows — using thermodynamic properties, constants, and equations built with PyThermoDB.
12
+
13
+ Calculations can also be done on your mobile with the MoziThermoCalc iOS app: [Download on the App Store](https://apps.apple.com/ca/app/mozithermocalc/id6759209992).
14
+
15
+ ## 🚀 Why PyThermoCalcDB?
16
+
17
+ - **Seamless integration** with PyThermoDB: use the database of thermodynamic data (pure component properties, correlations, etc.) as the foundation.
18
+ - **Reusable calculation tools**: functions for various calculations.
19
+ - **Consistent with your thermodynamic ecosystem**: fits with existing packages like PyThermoModels, PyPhaseEQ, PyThermoFlash — offering a central “calculation engine” layer.
20
+ - **Minimal dependencies**: lean design, using PyThermoDB as core data source; optionally depend on well-known numerical libraries (e.g. NumPy, SciPy) if needed for complex calculations.
21
+ - **Flexible use-cases**: from quick property lookups to advanced process calculations, or integration in larger workflows or multi-agent systems.
22
+
23
+ ## 📦 Installation
24
+
25
+ ```bash
26
+ pip install pythermocalcdb
27
+ ```
28
+
29
+ ## 🚀 Usage
30
+
31
+ PyThermoCalcDB provides high-level thermodynamic routines built on PyThermoDB. It is optimized for scripts, notebooks, and pipelines ? the `examples/` directory contains runnable workflows.
32
+
33
+ ### 1) Build a ModelSource
34
+
35
+ - Collect ThermoDB pickle paths for your components and load them with `pyThermoLinkDB.load_and_build_model_source`.
36
+
37
+ ```python
38
+ import os
39
+ import pyThermoLinkDB as ptdblink
40
+ from pythermodb_settings.models import Component, ComponentRule, ComponentThermoDBSource, Temperature, Pressure
41
+
42
+ CO2 = Component(name="carbon dioxide", formula="CO2", state="g")
43
+ thermodb_dir = "/path/to/thermodb"
44
+ CO2_src = ComponentThermoDBSource(
45
+ component=CO2,
46
+ source=os.path.join(thermodb_dir, "carbon dioxide-g.pkl"),
47
+ )
48
+
49
+ model_source = ptdblink.load_and_build_model_source(
50
+ thermodb_sources=[CO2_src],
51
+ original_equation_label=False
52
+ )
53
+ ```
54
+
55
+ ### 2) Call helper modules
56
+
57
+ - **Thermodynamic properties** (`pythermocalcdb.docs.thermo`): `calc_En`, `calc_GiFrEn`, `calc_En_range`, `calc_GiFrEn_range`, `calc_dEn` (Delta H between temperatures), `calc_dEnt` (Delta S with pressures and phase), `calc_En_mix` (mixture enthalpy with optional departure/excess terms and `output_unit`).
58
+ - **Saturation & phase change** (`pythermocalcdb.docs.sat`): `calc_VaPr`, `calc_VaPr_range`, `calc_EnVap`, `calc_EnVap_range`, `calc_T_sat`, `calc_VaPr_sensitivity`, `calc_VaPr_sensitivity_range`.
59
+ - **Reactions** (`pythermocalcdb.reactions.reactions`): `dEn_rxn_STD` and `dGiFrEn_rxn_STD` for standard reaction energetics.
60
+
61
+ Example:
62
+
63
+ ```python
64
+ from pythermocalcdb.docs import thermo, sat
65
+ from pythermodb_settings.models import Temperature, Pressure
66
+
67
+ T = Temperature(value=300.0, unit="K")
68
+ P = Pressure(value=1.5e6, unit="Pa")
69
+
70
+ enthalpy = thermo.calc_En(component=CO2, model_source=model_source, temperature=T)
71
+ gibbs = thermo.calc_GiFrEn(component=CO2, model_source=model_source, temperature=T, phase="IG")
72
+ VaPr = sat.calc_VaPr(component=CO2, model_source=model_source, temperature=T)
73
+ Tsat = sat.calc_T_sat(
74
+ component=CO2,
75
+ model_source=model_source,
76
+ pressure=P,
77
+ temperature_guess=T,
78
+ method="least_squares",
79
+ )
80
+ ```
81
+
82
+ Notes:
83
+
84
+ - All helpers expect typed `Component`, `Temperature`, and `Pressure` inputs plus a `model_source` from PyThermoLinkDB.
85
+ - The optional `mode` kwarg accepts `silent`, `log`, or `attach` to control logging and timing.
86
+
87
+ ## 🤝 Contributing
88
+
89
+ Contributions are highly welcome — bug fixes, new calculation routines, mixture models, extended unit tests, documentation, etc.
90
+
91
+ ## 📝 License
92
+
93
+ This project is distributed under the Apache License, Version 2.0, which grants you broad freedom to use, modify, and integrate the software into your own applications or projects, provided that you comply with the conditions outlined in the license. Although Apache 2.0 does not require users to retain explicit author credit beyond standard copyright and license notices, I kindly request that if you incorporate this work into your own software, you acknowledge Sina Gilassi as the original author. Referencing the original repository or documentation is appreciated, as it helps recognize the effort invested in developing and maintaining this project.
94
+
95
+ ## ❓ FAQ
96
+
97
+ For any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/)
98
+
99
+ ## 👨‍💻 Authors
100
+
101
+ - [@sinagilassi](https://www.github.com/sinagilassi)
@@ -0,0 +1,72 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "pythermocalcdb"
7
+ version = "0.11.0"
8
+ description = "Python Thermodynamic Calculation Engine powered by PyThermoDB."
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "Apache-2.0"
12
+ license-files = ["LICENSE"]
13
+ authors = [
14
+ {name = "Sina Gilassi", email = "sina.gilassi@gmail.com"}
15
+ ]
16
+ keywords = [
17
+ "chemical-engineering",
18
+ "thermodynamics",
19
+ "thermodynamic-equations",
20
+ "thermodynamic-properties",
21
+ "process-simulation",
22
+ ]
23
+ classifiers = [
24
+ "Development Status :: 1 - Planning",
25
+ "Intended Audience :: Education",
26
+ "Programming Language :: Python :: 3.11",
27
+ "Operating System :: Unix",
28
+ "Operating System :: MacOS :: MacOS X",
29
+ "Operating System :: Microsoft :: Windows",
30
+ ]
31
+ dependencies = [
32
+ "scipy",
33
+ "pydantic",
34
+ "pycuc",
35
+ "pythermodb",
36
+ "pythermolinkdb",
37
+ "pythermodb-settings",
38
+ "pyreactlab-core",
39
+ ]
40
+
41
+ [project.urls]
42
+ Homepage = "https://github.com/sinagilassi/pyThermoCalcDB"
43
+ Source = "https://github.com/sinagilassi/pyThermoCalcDB"
44
+ Tracker = "https://github.com/sinagilassi/pyThermoCalcDB/issues"
45
+
46
+ [tool.setuptools]
47
+ include-package-data = true
48
+
49
+ [tool.setuptools.packages.find]
50
+ exclude = [
51
+ "tests",
52
+ "tests.*",
53
+ "examples",
54
+ "examples.*",
55
+ "notebooks",
56
+ "notebooks.*",
57
+ "statics",
58
+ "statics.*",
59
+ "private",
60
+ "private.*",
61
+ "app",
62
+ "app.*"
63
+ ]
64
+
65
+ [tool.setuptools.package-data]
66
+ pythermocalcdb = [
67
+ "config/*.yml",
68
+ "data/*.csv",
69
+ "templates/*.html",
70
+ "static/*",
71
+ "static/**/*"
72
+ ]
@@ -0,0 +1,18 @@
1
+ # config
2
+ from .configs import (
3
+ __version__,
4
+ __author__,
5
+ __description__,
6
+ __email__,
7
+ __license__,
8
+ )
9
+
10
+ __all__ = [
11
+ # config
12
+ "__version__",
13
+ "__author__",
14
+ "__description__",
15
+ "__email__",
16
+ "__license__",
17
+ # app
18
+ ]
@@ -0,0 +1,5 @@
1
+ # import libs
2
+ import logging
3
+
4
+ # NOTE: set up logger
5
+ logger = logging.getLogger(__name__)
@@ -0,0 +1,15 @@
1
+ from .info import (
2
+ __author__,
3
+ __description__,
4
+ __email__,
5
+ __license__,
6
+ __version__,
7
+ )
8
+
9
+ __all__ = [
10
+ "__author__",
11
+ "__description__",
12
+ "__email__",
13
+ "__license__",
14
+ "__version__",
15
+ ]
@@ -0,0 +1,18 @@
1
+ # import libs
2
+ from pythermodb_settings.models import Temperature
3
+
4
+ # SECTION: PyThermoDBLink/PyThermoDB
5
+ DATASOURCE = "datasource"
6
+ EQUATIONSOURCE = "equationsource"
7
+
8
+
9
+ # SECTION: constants
10
+ R_J_molK = 8.314462618 # universal gas constant in J/mol.K
11
+ T_ref_K = 298.15 # reference temperature in K
12
+ P_ref_Pa = 101325.0 # reference pressure in Pa
13
+
14
+ # NOTE: reference temperature
15
+ T_298_K: Temperature = Temperature(
16
+ value=298.15,
17
+ unit="K"
18
+ )
@@ -0,0 +1,10 @@
1
+ # version
2
+ __version__ = "0.11.0"
3
+ # author
4
+ __author__ = "Sina Gilassi"
5
+ # email
6
+ __email__ = "sina.gilassi@gmail.com"
7
+ # license
8
+ __license__ = "Apache-2.0"
9
+ # package description
10
+ __description__ = "Python Thermodynamic Calculation Engine powered by PyThermoDB."
@@ -0,0 +1,48 @@
1
+ # import libs
2
+
3
+ # SECTION: hsg properties
4
+ # NOTE: symbols
5
+ EnFo_IG_SYMBOL = 'EnFo_IG' # enthalpy of formation symbol
6
+ EnFo_LIQ_SYMBOL = 'EnFo_LIQ' # enthalpy of formation liquid symbol
7
+ EnFo_SOL_SYMBOL = 'EnFo_SOL' # enthalpy of formation solid symbol
8
+ Ent_STD_SYMBOL = 'Ent_STD' # entropy of formation symbol
9
+ GiEnFo_IG_SYMBOL = 'GiEnFo_IG' # Gibbs free energy of formation symbol
10
+ GiEnFo_LIQ_SYMBOL = 'GiEnFo_LIQ' # Gibbs free energy of formation symbol
11
+ GiEnFo_SOL_SYMBOL = 'GiEnFo_SOL' # Gibbs free energy of formation symbol
12
+ En_IG_SYMBOL = 'En_IG' # ideal gas enthalpy symbol
13
+ En_LIQ_SYMBOL = 'En_LIQ' # liquid enthalpy symbol
14
+ En_SOL_SYMBOL = 'En_SOL' # solid enthalpy symbol
15
+ GiEn_IG_SYMBOL = 'GiEn_IG' # ideal gas Gibbs energy symbol
16
+ GiEn_LIQ_SYMBOL = 'GiEn_LIQ' # liquid Gibbs energy symbol
17
+ GiEn_SOL_SYMBOL = 'GiEn_SOL' # solid Gibbs energy symbol
18
+ Cp_IG_SYMBOL = 'Cp_IG' # ideal gas heat capacity symbol
19
+ Cp_LIQ_SYMBOL = 'Cp_LIQ' # liquid heat capacity symbol
20
+ Cp_SOL_SYMBOL = 'Cp_SOL' # solid heat capacity symbol
21
+ VaPr_SYMBOL = 'VaPr' # vapor pressure symbol
22
+ EnVap_SYMBOL = 'EnVap' # enthalpy of vaporization symbol
23
+ EnSub_SYMBOL = 'EnSub' # enthalpy of sublimation symbol
24
+
25
+ # NOTE: units
26
+ # EnFo_IG_UNIT = 'J/mol' # enthalpy of formation unit
27
+ # EnFo_LIQ_UNIT = 'J/mol' # enthalpy of formation liquid unit
28
+ # EnFo_SOL_UNIT = 'J/mol' # enthalpy of formation solid unit
29
+ # Ent_STD_UNIT = 'J/mol.K' # entropy of formation unit
30
+ # GiEnFo_IG_UNIT = 'J/mol' # Gibbs free energy of formation unit
31
+ # GiEnFo_LIQ_UNIT = 'J/mol' # Gibbs free energy of formation liquid unit
32
+ # GiEnFo_SOL_UNIT = 'J/mol' # Gibbs free energy of formation solid unit
33
+ # En_IG_UNIT = 'J/mol' # ideal gas enthalpy unit
34
+ # En_LIQ_UNIT = 'J/mol' # liquid enthalpy unit
35
+ # En_SOL_UNIT = 'J/mol' # solid enthalpy unit
36
+ # GiEn_IG_UNIT = 'J/mol' # ideal gas Gibbs energy unit
37
+ # GiEn_LIQ_UNIT = 'J/mol' # liquid Gibbs energy unit
38
+ # GiEn_SOL_UNIT = 'J/mol' # solid Gibbs energy unit
39
+ # Cp_IG_UNIT = 'J/mol.K' # ideal gas heat capacity unit
40
+ # Cp_LIQ_UNIT = 'J/mol.K' # liquid heat capacity unit
41
+ # Cp_SOL_UNIT = 'J/mol.K' # solid heat capacity unit
42
+ # VaPr_UNIT = 'Pa' # vapor pressure unit
43
+ # EnVap_UNIT = 'J/mol' # enthalpy of vaporization unit
44
+ # EnSub_UNIT = 'J/mol' # enthalpy of sublimation unit
45
+
46
+ # NOTE: integration units
47
+ # Cp_IG_INTEGRATION_UNIT = 'J/mol' # ideal gas heat capacity integration unit
48
+ # Cp_LIQ_INTEGRATION_UNIT = 'J/mol' # liquid heat capacity integration unit
@@ -0,0 +1,10 @@
1
+ # NOTE: HSGReaction
2
+ from .hsg_reaction import HSGReaction
3
+
4
+ # NOTE: HSGProperties
5
+ from .hsg_properties import HSGProperties
6
+
7
+ __all__ = [
8
+ 'HSGReaction',
9
+ 'HSGProperties',
10
+ ]