pyThermoDB 1.11.12__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.
- pythermodb-1.11.12/LICENSE +21 -0
- pythermodb-1.11.12/MANIFEST.in +20 -0
- pythermodb-1.11.12/PKG-INFO +424 -0
- pythermodb-1.11.12/README.md +391 -0
- pythermodb-1.11.12/pyThermoDB/__init__.py +21 -0
- pythermodb-1.11.12/pyThermoDB/api/__init__.py +1 -0
- pythermodb-1.11.12/pyThermoDB/api/manage.py +68 -0
- pythermodb-1.11.12/pyThermoDB/app.py +535 -0
- pythermodb-1.11.12/pyThermoDB/config/__init__.py +2 -0
- pythermodb-1.11.12/pyThermoDB/config/constants.py +8 -0
- pythermodb-1.11.12/pyThermoDB/config/reference.yml +1267 -0
- pythermodb-1.11.12/pyThermoDB/config/setting.py +6 -0
- pythermodb-1.11.12/pyThermoDB/config/symbols.yml +29 -0
- pythermodb-1.11.12/pyThermoDB/data/Antoine constants.csv +70 -0
- pythermodb-1.11.12/pyThermoDB/data/CO2 hydrogenation - General Data.csv +8 -0
- pythermodb-1.11.12/pyThermoDB/data/CO2 hydrogenation - The Molar Heat Capacities of Gases in the Ideal Gas (Zero-Pressure) State.csv +8 -0
- pythermodb-1.11.12/pyThermoDB/data/CO2 hydrogenation - Vapor Pressure.csv +8 -0
- pythermodb-1.11.12/pyThermoDB/data/Critical constants and acentric factors.csv +74 -0
- pythermodb-1.11.12/pyThermoDB/data/Section C Ideal Gas and Liquid Heat Capacities.csv +311 -0
- pythermodb-1.11.12/pyThermoDB/data/TABLE 2-141 Critical Constants and Acentric Factors of Inorganic and Organic Compounds.csv +348 -0
- pythermodb-1.11.12/pyThermoDB/data/TABLE 2-153 Heat Capacities of Inorganic and Organic Liquids.csv +351 -0
- pythermodb-1.11.12/pyThermoDB/data/TABLE 2-155 Heat Capacity at Constant Pressure of Inorganic and Organic Compounds in the Ideal Gas.csv +64 -0
- pythermodb-1.11.12/pyThermoDB/data/TABLE 2-179 Enthalpies and Gibbs Energies of Formation, Entropies, and Net Enthalpies of Combustion.csv +348 -0
- pythermodb-1.11.12/pyThermoDB/data/TABLE 2-32 Densities of Inorganic and Organic Liquids.csv +349 -0
- pythermodb-1.11.12/pyThermoDB/data/TABLE 2-8 Vapor Pressure of Inorganic and Organic Liquids.csv +348 -0
- pythermodb-1.11.12/pyThermoDB/data/Table A.1 General data for selected compounds.csv +47 -0
- pythermodb-1.11.12/pyThermoDB/data/Table A.2 Vapor pressure correlations for selected compounds.csv +50 -0
- pythermodb-1.11.12/pyThermoDB/data/Table A.3 Liquid density correlations for selected compounds.csv +46 -0
- pythermodb-1.11.12/pyThermoDB/data/Table A.4 Enthalpy of vaporization correlations for selected compounds.csv +47 -0
- pythermodb-1.11.12/pyThermoDB/data/Table A.5 Liquid heat capacity correlations for selected compounds.csv +47 -0
- pythermodb-1.11.12/pyThermoDB/data/Table A.II The Molar Heat Capacities of Gases in the Ideal Gas (Zero-Pressure) State.csv +105 -0
- pythermodb-1.11.12/pyThermoDB/data/Table A.IV Enthalpies and Gibbs Energies of Formation.csv +130 -0
- pythermodb-1.11.12/pyThermoDB/data/Table B.1 Characteristic Properties of Pure Species.csv +92 -0
- pythermodb-1.11.12/pyThermoDB/data/Table B.2 Constants for the Antoine Equation for Vapor Pressures of Pure Species.csv +45 -0
- pythermodb-1.11.12/pyThermoDB/data/__init__.py +1 -0
- pythermodb-1.11.12/pyThermoDB/data/ref.py +10 -0
- pythermodb-1.11.12/pyThermoDB/docs/__init__.py +33 -0
- pythermodb-1.11.12/pyThermoDB/docs/compbuilder.py +662 -0
- pythermodb-1.11.12/pyThermoDB/docs/compexporter.py +177 -0
- pythermodb-1.11.12/pyThermoDB/docs/customref.py +644 -0
- pythermodb-1.11.12/pyThermoDB/docs/managedata.py +1407 -0
- pythermodb-1.11.12/pyThermoDB/docs/tabledata.py +358 -0
- pythermodb-1.11.12/pyThermoDB/docs/tableequation.py +964 -0
- pythermodb-1.11.12/pyThermoDB/docs/tablematrixdata.py +1105 -0
- pythermodb-1.11.12/pyThermoDB/docs/tablematrixequation.py +1091 -0
- pythermodb-1.11.12/pyThermoDB/docs/tableref.py +994 -0
- pythermodb-1.11.12/pyThermoDB/docs/thermo.py +2350 -0
- pythermodb-1.11.12/pyThermoDB/docs/transdata.py +72 -0
- pythermodb-1.11.12/pyThermoDB/docs/transmatrixdata.py +62 -0
- pythermodb-1.11.12/pyThermoDB/handlers/__init__.py +0 -0
- pythermodb-1.11.12/pyThermoDB/handlers/errors.py +32 -0
- pythermodb-1.11.12/pyThermoDB/models/__init__.py +9 -0
- pythermodb-1.11.12/pyThermoDB/models/ref.py +64 -0
- pythermodb-1.11.12/pyThermoDB/references/__init__.py +17 -0
- pythermodb-1.11.12/pyThermoDB/references/builder.py +292 -0
- pythermodb-1.11.12/pyThermoDB/references/checker.py +1245 -0
- pythermodb-1.11.12/pyThermoDB/references/config.py +122 -0
- pythermodb-1.11.12/pyThermoDB/references/content.py +138 -0
- pythermodb-1.11.12/pyThermoDB/references/databook.py +523 -0
- pythermodb-1.11.12/pyThermoDB/references/main.py +75 -0
- pythermodb-1.11.12/pyThermoDB/references/reference.py +353 -0
- pythermodb-1.11.12/pyThermoDB/references/table.py +391 -0
- pythermodb-1.11.12/pyThermoDB/source/__init__.py +0 -0
- pythermodb-1.11.12/pyThermoDB/static/css/styles.css +110 -0
- pythermodb-1.11.12/pyThermoDB/static/css/styles2.css +111 -0
- pythermodb-1.11.12/pyThermoDB/static/img/logo-2.png +0 -0
- pythermodb-1.11.12/pyThermoDB/static/js/app.js +413 -0
- pythermodb-1.11.12/pyThermoDB/static/js/app2.js +925 -0
- pythermodb-1.11.12/pyThermoDB/templates/__init__.py +0 -0
- pythermodb-1.11.12/pyThermoDB/templates/index.html +283 -0
- pythermodb-1.11.12/pyThermoDB/templates/table_view.html +200 -0
- pythermodb-1.11.12/pyThermoDB/ui/__init__.py +2 -0
- pythermodb-1.11.12/pyThermoDB/ui/launch.py +117 -0
- pythermodb-1.11.12/pyThermoDB/ui/launcher.py +157 -0
- pythermodb-1.11.12/pyThermoDB/utils/__init__.py +12 -0
- pythermodb-1.11.12/pyThermoDB/utils/convertor.py +163 -0
- pythermodb-1.11.12/pyThermoDB/utils/logger.py +27 -0
- pythermodb-1.11.12/pyThermoDB/utils/result_generator.py +31 -0
- pythermodb-1.11.12/pyThermoDB/utils/utility.py +26 -0
- pythermodb-1.11.12/pyThermoDB/utils/validators.py +20 -0
- pythermodb-1.11.12/pyThermoDB.egg-info/SOURCES.txt +81 -0
- pythermodb-1.11.12/pyproject.toml +75 -0
- pythermodb-1.11.12/setup.cfg +4 -0
- pythermodb-1.11.12/setup.py +80 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Sina Gilassi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
include pyThermoDB/templates/*.html
|
|
2
|
+
include pyThermoDB/static/*
|
|
3
|
+
include pyThermoDB/static/**/*
|
|
4
|
+
recursive-include pyThermoDB/templates *
|
|
5
|
+
recursive-include pyThermoDB/static *
|
|
6
|
+
|
|
7
|
+
# Exclude unwanted directories
|
|
8
|
+
global-exclude tests/*
|
|
9
|
+
global-exclude examples/*
|
|
10
|
+
global-exclude notebooks/*
|
|
11
|
+
global-exclude statics/*
|
|
12
|
+
global-exclude private/*
|
|
13
|
+
global-exclude app/*
|
|
14
|
+
global-exclude venv/*
|
|
15
|
+
global-exclude .venv/*
|
|
16
|
+
global-exclude env/*
|
|
17
|
+
global-exclude ENV/*
|
|
18
|
+
global-exclude *.egg-info/*
|
|
19
|
+
global-exclude __pycache__/*
|
|
20
|
+
global-exclude .pytest_cache/*
|
|
@@ -0,0 +1,424 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pyThermoDB
|
|
3
|
+
Version: 1.11.12
|
|
4
|
+
Summary: PyThermoDB is a lightweight and user-friendly Python package designed to provide quick access to essential thermodynamic data.
|
|
5
|
+
Home-page: https://github.com/sinagilassi/PyThermoDB
|
|
6
|
+
Author: Sina Gilassi
|
|
7
|
+
Author-email: Sina Gilassi <sina.gilassi@gmail.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
Project-URL: Homepage, https://github.com/sinagilassi/PyThermoDB
|
|
10
|
+
Project-URL: Documentation, https://pythermodb.readthedocs.io/en/latest/
|
|
11
|
+
Project-URL: Source, https://github.com/sinagilassi/PyThermoDB
|
|
12
|
+
Project-URL: Tracker, https://github.com/sinagilassi/PyThermoDB/issues
|
|
13
|
+
Keywords: chemical-engineering,thermodynamics,thermodynamic-data,thermodynamic-equations,thermodynamic-properties
|
|
14
|
+
Classifier: Development Status :: 1 - Planning
|
|
15
|
+
Classifier: Intended Audience :: Education
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Operating System :: Unix
|
|
18
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
19
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: pandas
|
|
24
|
+
Requires-Dist: requests
|
|
25
|
+
Requires-Dist: numpy
|
|
26
|
+
Requires-Dist: PyYAML
|
|
27
|
+
Provides-Extra: web
|
|
28
|
+
Requires-Dist: jinja2; extra == "web"
|
|
29
|
+
Dynamic: author
|
|
30
|
+
Dynamic: home-page
|
|
31
|
+
Dynamic: license-file
|
|
32
|
+
Dynamic: requires-python
|
|
33
|
+
|
|
34
|
+
# 🧪 Python Thermodynamics Databook
|
|
35
|
+
|
|
36
|
+

|
|
37
|
+
|
|
38
|
+
[](https://pepy.tech/projects/pythermodb)
|
|
39
|
+

|
|
40
|
+

|
|
41
|
+

|
|
42
|
+

|
|
43
|
+
|
|
44
|
+
PyThermoDB is a lightweight and user-friendly Python package designed to provide quick access to essential thermodynamic data. Whether you're a student, researcher, or engineer, this package serves as a valuable resource for retrieving thermodynamic properties, equations, and constants from your `custom thermodynamic database` (csv files).
|
|
45
|
+
|
|
46
|
+
## ✨ Key Features:
|
|
47
|
+
|
|
48
|
+
- 📚 **Handbook Data**: The package sources its data from well-established thermodynamics handbooks, ensuring accuracy and reliability (*updated regularly*).
|
|
49
|
+
- 🔧 **Custom Thermodynamic Database**: It is possible to builtin your own thermodynamic databook for your project.
|
|
50
|
+
- 🧩 **Minimal Dependencies**: Built with simplicity in mind, the package has minimal external dependencies, making it easy to integrate into your projects.
|
|
51
|
+
- 🌐 **Open Source**: Feel free to explore, contribute, and customize the package according to your needs.
|
|
52
|
+
|
|
53
|
+
## 📓 Interactive Notebooks with Binder
|
|
54
|
+
|
|
55
|
+
Try PyThermoDB directly in your browser without any installation using Binder. You can find examples regarding the following contents:
|
|
56
|
+
|
|
57
|
+
- **Import Libraries**: Import the necessary libraries including pyThermoDB and rich.
|
|
58
|
+
- **Check Versions**: Print the version of pyThermoDB.
|
|
59
|
+
- **App Initialization**: Initialize the pyThermoDB application.
|
|
60
|
+
- **Databook List**: List all available databooks.
|
|
61
|
+
- **Table List**: List all tables in a specific databook.
|
|
62
|
+
- **Table Info**: Get information about a specific table.
|
|
63
|
+
- **Load Tables**: Load and display data and equations from tables.
|
|
64
|
+
- **Check Component Availability**: Check if a component is available in a specific table.
|
|
65
|
+
- **Build Data**: Build data for a specific component from a table.
|
|
66
|
+
- **Build Equation**: Build an equation for a specific component from a table.
|
|
67
|
+
|
|
68
|
+
Click on any of the following links to launch interactive Jupyter notebooks:
|
|
69
|
+
|
|
70
|
+
* [Basic Usage 1](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fdoc1.ipynb)
|
|
71
|
+
* [Custom Reference](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Fref-external.ipynb)
|
|
72
|
+
* [Check Reference](https://mybinder.org/v2/gh/sinagilassi/PyThermoDB/HEAD?urlpath=%2Fdoc%2Ftree%2Fnotebooks%2Ftable-view.ipynb)
|
|
73
|
+
|
|
74
|
+
## 🛠️ Examples
|
|
75
|
+
|
|
76
|
+
The repository includes an `examples` folder with various sample applications and use cases to help you get started with PyThermoDB. These examples demonstrate different methods and features of the package, including:
|
|
77
|
+
|
|
78
|
+
- 🧰 **Basic Usage Examples**: Learn how to use PyThermoDB for common tasks.
|
|
79
|
+
- 📂 **Custom Thermodynamic Databases**: Work with your own thermodynamic data.
|
|
80
|
+
- 🔍 **Data Manipulation**: Load, search, and manipulate thermodynamic data.
|
|
81
|
+
- 📐 **Equations and Calculations**: Use equations for thermodynamic calculations.
|
|
82
|
+
|
|
83
|
+
Browse through these examples to learn how to use different methods and features of PyThermoDB in your own projects.
|
|
84
|
+
|
|
85
|
+
## 🔬 Google Colab Examples
|
|
86
|
+
|
|
87
|
+
Try PyThermoDB directly in your browser with these interactive examples:
|
|
88
|
+
|
|
89
|
+
- 🔍 **Search Database**
|
|
90
|
+
[](https://colab.research.google.com/drive/1y5GIE4DH73SwOF2JhsTug2_U_h9Fqexx?usp=sharing)
|
|
91
|
+
|
|
92
|
+
- 📊 **CO₂ Thermodynamic Data**
|
|
93
|
+
[](https://colab.research.google.com/drive/1mzu70kACdvoB_jO6gTGVegGtK_ssOOHq?usp=sharing)
|
|
94
|
+
|
|
95
|
+
- 🔎 **Check Component Availability**
|
|
96
|
+
[](https://colab.research.google.com/drive/1HdGHS_uypEf_yzsq7fZyLZH3dWnjYVSg?usp=sharing)
|
|
97
|
+
|
|
98
|
+
- 📘 **Basic Usage 2**
|
|
99
|
+
[](https://colab.research.google.com/drive/1vj84afCy0qKfHZzQdvLiJRiVstiCX0so?usp=sharing)
|
|
100
|
+
|
|
101
|
+
- 🔰 **Basic Usage 1**
|
|
102
|
+
[](https://colab.research.google.com/drive/1jWkaSJ280AZFn9t8X7_bqz_pYtY2QKbr?usp=sharing)
|
|
103
|
+
|
|
104
|
+
## 🚀 Streamlit App
|
|
105
|
+
|
|
106
|
+
Check out `PyThermoDB` live! [🔗 PyThermoDB on Streamlit](https://pythermodb.streamlit.app/)
|
|
107
|
+
|
|
108
|
+
## 📥 Installation
|
|
109
|
+
|
|
110
|
+
Install PyThermoDB with pip:
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
import pyThermoDB as ptdb
|
|
114
|
+
# check version
|
|
115
|
+
print(ptdb.__version__)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## 🔍 Search a Component Name or Formula
|
|
119
|
+
|
|
120
|
+
PyThermoDB allows you to search for a specific component by its name or formula within a databook and table. This feature helps you quickly locate the relevant data and makes it easier to build a ThermoDB for the component.
|
|
121
|
+
|
|
122
|
+

|
|
123
|
+
|
|
124
|
+
### **🔎 Search for a Component**
|
|
125
|
+
|
|
126
|
+
Use the following method to search for a component:
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
# Search for a component in a databook and table
|
|
130
|
+
# open all tables in the browser
|
|
131
|
+
tdb.tables_view()
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### **📋 Search Results**
|
|
135
|
+
|
|
136
|
+
The search results will include:
|
|
137
|
+
|
|
138
|
+
- **📚 Databook Name and ID**: The databook where the component is found.
|
|
139
|
+
- **📋 Table Name and ID**: The table containing the component's data.
|
|
140
|
+
|
|
141
|
+
## 🛠️ Usage Examples
|
|
142
|
+
|
|
143
|
+
* **Databook reference initialization**:
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
# databook reference initialization
|
|
147
|
+
tdb = ptdb.init()
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
* **📚 DATABOOK LIST**:
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
# databook
|
|
154
|
+
db_list = tdb.list_databooks()
|
|
155
|
+
print(db_list)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
* **📋 TABLE LIST**:
|
|
159
|
+
|
|
160
|
+
list_tables(`databook_name or databook_id`)
|
|
161
|
+
|
|
162
|
+
```python
|
|
163
|
+
# table list
|
|
164
|
+
tb_lists = tdb.list_tables(1)
|
|
165
|
+
print(tb_lists)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
* **ℹ️ TABLE INFO**:
|
|
169
|
+
|
|
170
|
+
table_info(`databook_name or id`, `table_name or id`)
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
# display a table
|
|
174
|
+
tb_info = tdb.table_info(1, 2)
|
|
175
|
+
print(tb_info)
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
* **📊 LOAD TABLE DATA/EQUATION**:
|
|
179
|
+
|
|
180
|
+
table_data(`databook_name or id`, `table_name or id`)
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
# table load
|
|
184
|
+
res_ = tdb.table_data(1, 2)
|
|
185
|
+
print(res_)
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
* **🌐 VIEW TABLE CONTENT IN THE BROWSER**
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
table_view(`databook_name or id`, `table_name or id`)
|
|
192
|
+
|
|
193
|
+
```python
|
|
194
|
+
# install Jinja2
|
|
195
|
+
pip install Jinja2
|
|
196
|
+
|
|
197
|
+
# VIEW table CONTENT
|
|
198
|
+
tdb.table_view(1, 2)
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
* **📥 LOAD TABLES DATA|EQUATION STRUCTURE** (before building):
|
|
202
|
+
|
|
203
|
+
equation_load(`databook_name or id`, `table_name or id`)
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
# load equation to check
|
|
207
|
+
vapor_pressure_tb = tdb.equation_load(1, 4)
|
|
208
|
+
print(vapor_pressure_tb.eq_structure(1))
|
|
209
|
+
# load data to check
|
|
210
|
+
data_table = tdb.data_load(1, 2)
|
|
211
|
+
print(data_table.data_structure())
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
* **🔍 CHECK COMPONENT AVAILABILITY IN A TABLE**:
|
|
215
|
+
|
|
216
|
+
get_component_data(`component name`, `databook_name or id`, `table_name or id`, ...)
|
|
217
|
+
|
|
218
|
+
```python
|
|
219
|
+
# check component availability in the databook and table
|
|
220
|
+
comp1 = "carbon Dioxide"
|
|
221
|
+
|
|
222
|
+
# method 1
|
|
223
|
+
# CO2_check_availability = tdb.check_component(comp1, 1, 2)
|
|
224
|
+
|
|
225
|
+
# method 2:
|
|
226
|
+
comp_data = tdb.get_component_data(comp1, 1, 2, dataframe=True)
|
|
227
|
+
print(comp_data)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
* **🏗️ BUILD DATA OBJECT**:
|
|
231
|
+
|
|
232
|
+
build_data(`component name`, `databook_name or id`, `table_name or id`)
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
# build data
|
|
236
|
+
CO2_data = tdb.build_data(comp1, 1, 2)
|
|
237
|
+
print(CO2_data.data_structure())
|
|
238
|
+
print(CO2_data.get_property(4))
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
* **📐 BUILD EQUATION OBJECT**:
|
|
242
|
+
|
|
243
|
+
build_equation(`component name`, `databook_name or id`, `table_name or id`)
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
# build an equation
|
|
247
|
+
eq = tdb.build_equation(comp1, 1, 4)
|
|
248
|
+
print(eq.args)
|
|
249
|
+
res = eq.cal(T=298.15)
|
|
250
|
+
print(res*1e-5)
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
## 🧱 Build ThermoDB for Components
|
|
254
|
+
|
|
255
|
+
DataTable & EquationTable saved as an object in `Carbon Dioxide.pkl`
|
|
256
|
+
|
|
257
|
+
* **🔨 BUILD THERMODB**:
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
# build a thermodb
|
|
261
|
+
thermo_db = ptdb.build_thermodb()
|
|
262
|
+
print(type(thermo_db))
|
|
263
|
+
|
|
264
|
+
# version
|
|
265
|
+
print(thermo_db.build_version)
|
|
266
|
+
|
|
267
|
+
# thermodb name
|
|
268
|
+
print(thermo_db.thermodb_name)
|
|
269
|
+
|
|
270
|
+
# * add TableData
|
|
271
|
+
thermo_db.add_data('general', comp1_data)
|
|
272
|
+
# * add TableEquation
|
|
273
|
+
thermo_db.add_data('heat-capacity', comp1_eq)
|
|
274
|
+
thermo_db.add_data('vapor-pressure', vapor_pressure_eq)
|
|
275
|
+
# add string
|
|
276
|
+
# thermo_db.add_data('dHf', {'dHf_IG': 152})
|
|
277
|
+
# file name
|
|
278
|
+
# thermodb_file_path = os.path.join(os.getcwd(), f'{comp1}')
|
|
279
|
+
# save
|
|
280
|
+
thermo_db.save(
|
|
281
|
+
f'{comp1}', file_path='..\\pyThermoDB\\tests')
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
* **🔍 CHECK THERMODB**:
|
|
285
|
+
|
|
286
|
+
```python
|
|
287
|
+
# check all properties and functions registered
|
|
288
|
+
print(thermo_db.check_properties())
|
|
289
|
+
print(thermo_db.check_functions())
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## 📂 Load a ThermoDB
|
|
293
|
+
|
|
294
|
+
`Carbon Dioxide.pkl` can be loaded as:
|
|
295
|
+
|
|
296
|
+
* **📤 LOAD THERMODB FILE**:
|
|
297
|
+
|
|
298
|
+
```python
|
|
299
|
+
# ref
|
|
300
|
+
thermodb_file = 'Carbon Dioxide.pkl'
|
|
301
|
+
thermodb_path = os.path.join(os.getcwd(), thermodb_file)
|
|
302
|
+
print(thermodb_path)
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
* **📥 LOAD THERMODB**:
|
|
306
|
+
|
|
307
|
+
```python
|
|
308
|
+
# load thermodb
|
|
309
|
+
CO2_thermodb = ptdb.load_thermodb(thermodb_path)
|
|
310
|
+
print(type(CO2_thermodb))
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
* **✅ CHECK THERMODB**:
|
|
314
|
+
|
|
315
|
+
```python
|
|
316
|
+
# check all properties and functions registered
|
|
317
|
+
print(CO2_thermodb.check())
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
## 🧮 Custom Integral
|
|
321
|
+
|
|
322
|
+
* **Step 1**:
|
|
323
|
+
|
|
324
|
+
Modify `yml file` by adding `CUSTOM-INTEGRAL`.
|
|
325
|
+
|
|
326
|
+
* **Step 2**:
|
|
327
|
+
|
|
328
|
+
Add a name for the new integral body.
|
|
329
|
+
|
|
330
|
+
* **Step 3**:
|
|
331
|
+
|
|
332
|
+
Add a list containing the integral body.
|
|
333
|
+
|
|
334
|
+
```yml
|
|
335
|
+
CUSTOM-INTEGRAL:
|
|
336
|
+
Cp/R:
|
|
337
|
+
- A1 = parms['a0']*args['T1']
|
|
338
|
+
- B1 = (parms['a1']/2)*(args['T1']**2)
|
|
339
|
+
- C1 = (parms['a2']/3)*(args['T1']**3)
|
|
340
|
+
- D1 = (parms['a3']/4)*(args['T1']**4)
|
|
341
|
+
- E1 = (parms['a4']/5)*(args['T1']**5)
|
|
342
|
+
- res1 = A1 + B1 + C1 + D1 + E1
|
|
343
|
+
- A2 = parms['a0']*args['T2']
|
|
344
|
+
- B2 = (parms['a1']/2)*(args['T2']**2)
|
|
345
|
+
- C2 = (parms['a2']/3)*(args['T2']**3)
|
|
346
|
+
- D2 = (parms['a3']/4)*(args['T2']**4)
|
|
347
|
+
- E2 = (parms['a4']/5)*(args['T2']**5)
|
|
348
|
+
- res2 = A2 + B2 + C2 + D2 + E2
|
|
349
|
+
- res = res2 - res1
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
* **🔬 CHECK AS**:
|
|
353
|
+
|
|
354
|
+
```python
|
|
355
|
+
# check custom integral
|
|
356
|
+
print(comp1_eq.custom_integral)
|
|
357
|
+
# check body
|
|
358
|
+
print(comp1_eq.check_custom_integral_equation_body('Cp/R'))
|
|
359
|
+
|
|
360
|
+
# Cp/R
|
|
361
|
+
Cp_cal_custom_integral_Cp__R = comp1_eq.cal_custom_integral(
|
|
362
|
+
'Cp/R', T1=298.15, T2=320)
|
|
363
|
+
print(Cp_cal_custom_integral_Cp__R)
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
## 📚 Custom Databook & Table
|
|
367
|
+
|
|
368
|
+
PyThermoDB allows you to define and use custom databooks and tables for your specific thermodynamic data needs. Here's how you can set up and use a custom databook and table:
|
|
369
|
+
|
|
370
|
+
* **📝 Define Custom Reference**
|
|
371
|
+
|
|
372
|
+
Check `csv` and `yml` files to be familiar with the right format!
|
|
373
|
+
|
|
374
|
+
```python
|
|
375
|
+
# Define custom reference
|
|
376
|
+
custom_ref = {
|
|
377
|
+
'reference': ['nrtl.yml'],
|
|
378
|
+
'tables': [
|
|
379
|
+
'Non-randomness parameters of the NRTL equation.csv',
|
|
380
|
+
'Interaction parameters of the NRTL equation.csv'
|
|
381
|
+
]
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
* **📋 List Tables in Databook**
|
|
386
|
+
|
|
387
|
+
```python
|
|
388
|
+
# List tables in databook
|
|
389
|
+
tb_lists = tdb.list_tables('NRTL', res_format='json')
|
|
390
|
+
print(tb_lists)
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
* **📂 Load Table Data**
|
|
394
|
+
|
|
395
|
+
table_data(`databook_name or id`, `table_name or id`)
|
|
396
|
+
|
|
397
|
+
```python
|
|
398
|
+
# Load table data
|
|
399
|
+
tb_data = tdb.table_data(7, 1)
|
|
400
|
+
print(tb_data)
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
* **🏗️ Build ThermoDB for the Custom Reference**
|
|
404
|
+
|
|
405
|
+
```python
|
|
406
|
+
# Build ThermoDB
|
|
407
|
+
thermo_db = ptdb.build_thermodb()
|
|
408
|
+
thermo_db.add_data('nrtl_alpha', nrtl_alpha)
|
|
409
|
+
thermo_db.add_data('nrtl_tau', nrtl_tau_eq)
|
|
410
|
+
thermo_db.save('thermodb_nrtl_0', file_path='notebooks')
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
## 📝 License
|
|
414
|
+
|
|
415
|
+
This project is licensed under the MIT License. You are free to use, modify, and distribute this software in your own applications or projects. However, if you choose to use this app in another app or software, please ensure that my name, Sina Gilassi, remains credited as the original author. This includes retaining any references to the original repository or documentation where applicable. By doing so, you help acknowledge the effort and time invested in creating this project.
|
|
416
|
+
|
|
417
|
+
## ❓ FAQ
|
|
418
|
+
|
|
419
|
+
For any question, contact me on [LinkedIn](https://www.linkedin.com/in/sina-gilassi/)
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
## 👨💻 Authors
|
|
423
|
+
|
|
424
|
+
- [@sinagilassi](https://www.github.com/sinagilassi)
|