pyglenn 0.1.2__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.
pyglenn-0.1.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Glenn
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,12 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+
5
+ recursive-include src/pyglenn/data *.inp
6
+ recursive-include docs *.md *.txt
7
+
8
+ prune tests
9
+ prune conda.recipe
10
+ global-exclude __pycache__
11
+ global-exclude *.pyc
12
+ global-exclude .DS_Store
pyglenn-0.1.2/PKG-INFO ADDED
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: pyglenn
3
+ Version: 0.1.2
4
+ Summary: Thermochemical properties calculator — computes Cp(T), H°(T), S°(T) from NASA polynomial coefficients stored in SQLite
5
+ Author-email: "Dr. Reginaldo G. Leão Jr." <prof.reginaldo.leao@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://profleao.github.io/pyglenn
8
+ Project-URL: Repository, https://github.com/ProfLeao/pyglenn
9
+ Project-URL: Issues, https://github.com/ProfLeao/pyglenn/issues
10
+ Keywords: thermochemistry,thermodynamics,NASA-polynomials,heat-capacity,enthalpy,entropy
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Science/Research
13
+ Classifier: Operating System :: OS Independent
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.9
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Topic :: Scientific/Engineering :: Chemistry
20
+ Classifier: Topic :: Scientific/Engineering :: Physics
21
+ Requires-Python: >=3.9
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Provides-Extra: dev
25
+ Requires-Dist: pytest>=7.0; extra == "dev"
26
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
27
+ Requires-Dist: ruff>=0.5.0; extra == "dev"
28
+ Requires-Dist: mypy>=1.10.0; extra == "dev"
29
+ Requires-Dist: pre-commit>=3.7.0; extra == "dev"
30
+ Provides-Extra: examples
31
+ Requires-Dist: jupyterlab>=4.0; extra == "examples"
32
+ Requires-Dist: matplotlib>=3.7; extra == "examples"
33
+ Provides-Extra: doc
34
+ Requires-Dist: sphinx>=7.0; extra == "doc"
35
+ Requires-Dist: renku-sphinx-theme>=0.5.0; extra == "doc"
36
+ Requires-Dist: myst-nb>=1.1.0; extra == "doc"
37
+ Requires-Dist: matplotlib>=3.7; extra == "doc"
38
+ Dynamic: license-file
39
+
40
+ # pyglenn — Thermochemical Properties Calculator
41
+
42
+ [![CI](https://github.com/ProfLeao/pyglenn/actions/workflows/ci.yml/badge.svg)](https://github.com/ProfLeao/pyglenn/actions/workflows/ci.yml)
43
+ [![Docs](https://github.com/ProfLeao/pyglenn/actions/workflows/docs.yml/badge.svg)](https://profleao.github.io/pyglenn)
44
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
45
+
46
+ Computes **Cp(T)**, **H°(T)**, **S°(T)** from NASA polynomial coefficients stored in a SQLite database, converted from FORTRAN `thermo.inp` files.
47
+
48
+ **Author:** Dr. Reginaldo G. Leão Jr. — [prof.reginaldo.leao@gmail.com](mailto:prof.reginaldo.leao@gmail.com)
49
+
50
+ 📖 **Documentation:** [profleao.github.io/pyglenn](https://profleao.github.io/pyglenn)
51
+
52
+ ## Features
53
+
54
+ - Parse NASA-format `thermo.inp` (FORTRAN Appendix C) → SQLite3 database
55
+ - Query species by name, phase, molecular weight
56
+ - Calculate Cp(T), H°(T), S°(T) at any valid temperature
57
+ - Enthalpy of formation lookup
58
+ - Enthalpy change between two temperatures
59
+ - Command-line interface
60
+ - ~2030 species, 3772 temperature intervals
61
+
62
+ ## Installation
63
+
64
+ ### From PyPI (pip)
65
+
66
+ ```bash
67
+ pip install pyglenn
68
+ ```
69
+
70
+ ### From source
71
+
72
+ ```bash
73
+ git clone https://github.com/ProfLeao/pyglenn.git
74
+ cd pyglenn
75
+ pip install .
76
+ ```
77
+
78
+ ### Conda
79
+
80
+ ```bash
81
+ conda build conda.recipe/
82
+ conda install --use-local pyglenn
83
+ ```
84
+
85
+ ## Quick Start
86
+
87
+ The database is **bundled with the package** — no manual build step needed.
88
+
89
+ ### Python API
90
+
91
+ ```python
92
+ from pyglenn import ThermochemicalCalculator
93
+
94
+ # No need to specify a DB file — uses the bundled thermo.db
95
+ calc = ThermochemicalCalculator()
96
+ calc.connect()
97
+
98
+ # Find O2
99
+ species = calc.get_available_species('O2')
100
+ o2 = species[0]
101
+
102
+ # Calculate properties at 1000 K
103
+ props = calc.calculate_properties(o2['id'], 1000.0)
104
+ print(f"Cp = {props['cp']:.2f} J/(mol·K)")
105
+ print(f"H° = {props['h_relative']:.1f} J/mol")
106
+ print(f"S° = {props['s']:.3f} J/(mol·K)")
107
+
108
+ calc.close()
109
+ ```
110
+
111
+ Or use the **context manager** for automatic cleanup:
112
+
113
+ ```python
114
+ from pyglenn import ThermochemicalCalculator
115
+
116
+ with ThermochemicalCalculator() as calc:
117
+ species = calc.get_available_species('CH4')
118
+ props = calc.calculate_properties(species[0]['id'], 500.0)
119
+ print(f"Cp = {props['cp']:.2f} J/(mol·K)")
120
+ ```
121
+
122
+ ### CLI
123
+
124
+ ```bash
125
+ pyglenn query -s O2
126
+ ```
127
+
128
+ ### Rebuilding the database
129
+
130
+ Only needed if the database is corrupted or you modify ``thermo.inp`` manually:
131
+
132
+ ```bash
133
+ pyglenn build -i thermo.inp -o thermo.db
134
+ ```
135
+
136
+ ## Database Structure
137
+
138
+ | Table | Description |
139
+ |---|---|
140
+ | `species` | Chemical species (name, formula, phase, MW, ΔH°f) |
141
+ | `temperature_intervals` | Valid T ranges per species |
142
+ | `coefficients` | NASA-7 polynomial coefficients (a1–a7, b1, b2) |
143
+ | `file_metadata` | Global file metadata |
144
+
145
+ ## Requirements
146
+
147
+ - Python ≥ 3.9
148
+ - SQLite3 (stdlib)
149
+
150
+ ## License
151
+
152
+ MIT — see [LICENSE](LICENSE) file.
@@ -0,0 +1,113 @@
1
+ # pyglenn — Thermochemical Properties Calculator
2
+
3
+ [![CI](https://github.com/ProfLeao/pyglenn/actions/workflows/ci.yml/badge.svg)](https://github.com/ProfLeao/pyglenn/actions/workflows/ci.yml)
4
+ [![Docs](https://github.com/ProfLeao/pyglenn/actions/workflows/docs.yml/badge.svg)](https://profleao.github.io/pyglenn)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
6
+
7
+ Computes **Cp(T)**, **H°(T)**, **S°(T)** from NASA polynomial coefficients stored in a SQLite database, converted from FORTRAN `thermo.inp` files.
8
+
9
+ **Author:** Dr. Reginaldo G. Leão Jr. — [prof.reginaldo.leao@gmail.com](mailto:prof.reginaldo.leao@gmail.com)
10
+
11
+ 📖 **Documentation:** [profleao.github.io/pyglenn](https://profleao.github.io/pyglenn)
12
+
13
+ ## Features
14
+
15
+ - Parse NASA-format `thermo.inp` (FORTRAN Appendix C) → SQLite3 database
16
+ - Query species by name, phase, molecular weight
17
+ - Calculate Cp(T), H°(T), S°(T) at any valid temperature
18
+ - Enthalpy of formation lookup
19
+ - Enthalpy change between two temperatures
20
+ - Command-line interface
21
+ - ~2030 species, 3772 temperature intervals
22
+
23
+ ## Installation
24
+
25
+ ### From PyPI (pip)
26
+
27
+ ```bash
28
+ pip install pyglenn
29
+ ```
30
+
31
+ ### From source
32
+
33
+ ```bash
34
+ git clone https://github.com/ProfLeao/pyglenn.git
35
+ cd pyglenn
36
+ pip install .
37
+ ```
38
+
39
+ ### Conda
40
+
41
+ ```bash
42
+ conda build conda.recipe/
43
+ conda install --use-local pyglenn
44
+ ```
45
+
46
+ ## Quick Start
47
+
48
+ The database is **bundled with the package** — no manual build step needed.
49
+
50
+ ### Python API
51
+
52
+ ```python
53
+ from pyglenn import ThermochemicalCalculator
54
+
55
+ # No need to specify a DB file — uses the bundled thermo.db
56
+ calc = ThermochemicalCalculator()
57
+ calc.connect()
58
+
59
+ # Find O2
60
+ species = calc.get_available_species('O2')
61
+ o2 = species[0]
62
+
63
+ # Calculate properties at 1000 K
64
+ props = calc.calculate_properties(o2['id'], 1000.0)
65
+ print(f"Cp = {props['cp']:.2f} J/(mol·K)")
66
+ print(f"H° = {props['h_relative']:.1f} J/mol")
67
+ print(f"S° = {props['s']:.3f} J/(mol·K)")
68
+
69
+ calc.close()
70
+ ```
71
+
72
+ Or use the **context manager** for automatic cleanup:
73
+
74
+ ```python
75
+ from pyglenn import ThermochemicalCalculator
76
+
77
+ with ThermochemicalCalculator() as calc:
78
+ species = calc.get_available_species('CH4')
79
+ props = calc.calculate_properties(species[0]['id'], 500.0)
80
+ print(f"Cp = {props['cp']:.2f} J/(mol·K)")
81
+ ```
82
+
83
+ ### CLI
84
+
85
+ ```bash
86
+ pyglenn query -s O2
87
+ ```
88
+
89
+ ### Rebuilding the database
90
+
91
+ Only needed if the database is corrupted or you modify ``thermo.inp`` manually:
92
+
93
+ ```bash
94
+ pyglenn build -i thermo.inp -o thermo.db
95
+ ```
96
+
97
+ ## Database Structure
98
+
99
+ | Table | Description |
100
+ |---|---|
101
+ | `species` | Chemical species (name, formula, phase, MW, ΔH°f) |
102
+ | `temperature_intervals` | Valid T ranges per species |
103
+ | `coefficients` | NASA-7 polynomial coefficients (a1–a7, b1, b2) |
104
+ | `file_metadata` | Global file metadata |
105
+
106
+ ## Requirements
107
+
108
+ - Python ≥ 3.9
109
+ - SQLite3 (stdlib)
110
+
111
+ ## License
112
+
113
+ MIT — see [LICENSE](LICENSE) file.
@@ -0,0 +1,156 @@
1
+ ================================================================================
2
+ SQLite3 DATABASE - DOCUMENTATION
3
+ File: thermo.db
4
+ ================================================================================
5
+
6
+ DESCRIPTION:
7
+ This database contains thermochemical data in structured format,
8
+ converted from the thermo.inp file (NASA FORTRAN format) following the
9
+ record logic defined in TABLE C1 (Appendix C).
10
+
11
+ ================================================================================
12
+
13
+ TABLE STRUCTURE:
14
+
15
+ 1. file_metadata
16
+ ├─ id (INTEGER PRIMARY KEY)
17
+ ├─ temp_min_global (REAL) - Global minimum temperature
18
+ ├─ temp_500_K (REAL) - Temperature at 500K
19
+ ├─ temp_1500_K (REAL) - Temperature at 1500K
20
+ ├─ temp_max_global (REAL) - Global maximum temperature
21
+ ├─ reference_date (TEXT) - File reference date
22
+ └─ total_species (INTEGER) - Total number of species
23
+
24
+ 2. species
25
+ ├─ id (INTEGER PRIMARY KEY AUTOINCREMENT)
26
+ ├─ name (TEXT UNIQUE) - Species name or formula
27
+ ├─ formula (TEXT) - Extracted chemical formula
28
+ ├─ comments (TEXT) - Comments and data sources
29
+ ├─ reference_code (TEXT) - Reference code (g, j, tpis, n, bar, etc.)
30
+ ├─ phase (TEXT) - Phase: 'gas' or 'condensed'
31
+ ├─ molecular_weight (REAL) - Molecular weight in g/mol
32
+ ├─ heat_of_formation_298K (REAL) - Heat of formation at 298.15 K in J/mol
33
+ ├─ num_intervals (INTEGER) - Number of temperature intervals
34
+ └─ created_at (TIMESTAMP) - Record creation date/time
35
+
36
+ 3. temperature_intervals
37
+ ├─ id (INTEGER PRIMARY KEY AUTOINCREMENT)
38
+ ├─ species_id (INTEGER FK) - Reference to species table
39
+ ├─ interval_number (INTEGER) - Interval number (1, 2, 3...)
40
+ ├─ temp_min (REAL NOT NULL) - Minimum temperature in K
41
+ ├─ temp_max (REAL NOT NULL) - Maximum temperature in K
42
+ └─ h_298_to_0 (REAL) - H(298.15) - H(0) in J/mol (if available)
43
+
44
+ 4. coefficients
45
+ ├─ id (INTEGER PRIMARY KEY AUTOINCREMENT)
46
+ ├─ interval_id (INTEGER FK UNIQUE) - Reference to temperature_intervals table
47
+ ├─ a1 (REAL) - Coefficient a1
48
+ ├─ a2 (REAL) - Coefficient a2
49
+ ├─ a3 (REAL) - Coefficient a3
50
+ ├─ a4 (REAL) - Coefficient a4
51
+ ├─ a5 (REAL) - Coefficient a5
52
+ ├─ a6 (REAL) - Coefficient a6
53
+ ├─ a7 (REAL) - Coefficient a7
54
+ ├─ b1 (REAL) - Integration constant b1 (enthalpy)
55
+ └─ b2 (REAL) - Integration constant b2 (entropy)
56
+
57
+ ================================================================================
58
+
59
+ RELATIONSHIPS:
60
+
61
+ species (1) ──────── (N) temperature_intervals ──────── (1) coefficients
62
+ id species_id interval_id
63
+
64
+ ================================================================================
65
+
66
+ POLYNOMIAL EQUATIONS USED:
67
+
68
+ Heat Capacity:
69
+ Cp(T)/R = a1·T⁻² + a2·T⁻¹ + a3 + a4·T + a5·T² + a6·T³ + a7·T⁴
70
+
71
+ Relative Enthalpy:
72
+ H°(T)/RT = -a1·T⁻² + a2·ln(T) + a3 + a4·T/2 + a5·T²/3 + a6·T³/4 + a7·T⁴/5 + b1/T
73
+
74
+ Relative Entropy:
75
+ S°(T)/R = -a1·T⁻²/2 - a2·T⁻¹ + a3·ln(T) + a4·T + a5·T²/2 + a6·T³/3 + a7·T⁴/4 + b2
76
+
77
+ ================================================================================
78
+
79
+ SQL QUERY EXAMPLES:
80
+
81
+ 1. List all species:
82
+ SELECT id, name, phase, molecular_weight, heat_of_formation_298K
83
+ FROM species
84
+ LIMIT 10;
85
+
86
+ 2. Search species by name:
87
+ SELECT s.*, ti.temp_min, ti.temp_max, c.*
88
+ FROM species s
89
+ JOIN temperature_intervals ti ON s.id = ti.species_id
90
+ JOIN coefficients c ON ti.id = c.interval_id
91
+ WHERE s.name = 'O2'
92
+ ORDER BY ti.interval_number;
93
+
94
+ 3. Find species in a temperature range:
95
+ SELECT DISTINCT s.name, s.phase, ti.temp_min, ti.temp_max
96
+ FROM species s
97
+ JOIN temperature_intervals ti ON s.id = ti.species_id
98
+ WHERE ti.temp_min <= 1000 AND ti.temp_max >= 1000
99
+ ORDER BY s.name;
100
+
101
+ 4. Count species by phase:
102
+ SELECT phase, COUNT(*) as count
103
+ FROM species
104
+ GROUP BY phase;
105
+
106
+ 5. Database statistics:
107
+ SELECT
108
+ (SELECT COUNT(*) FROM species) as total_species,
109
+ (SELECT COUNT(*) FROM temperature_intervals) as total_intervals,
110
+ (SELECT COUNT(*) FROM coefficients) as total_coeff_sets,
111
+ (SELECT AVG(molecular_weight) FROM species) as avg_molecular_weight
112
+ FROM file_metadata;
113
+
114
+ ================================================================================
115
+
116
+ LOADING INFORMATION:
117
+
118
+ • Total Species Loaded: 2030
119
+ • Total Temperature Intervals: 3772
120
+ • Total Coefficient Sets: 3772
121
+ • Skipped Data Lines: 100 (malformed or inconsistent lines)
122
+
123
+ ================================================================================
124
+
125
+ IMPORTANT NOTES:
126
+
127
+ 1. The database uses Foreign Key (FOREIGN KEY) with DELETE CASCADE
128
+ to maintain referential integrity.
129
+
130
+ 2. Each species can have multiple temperature intervals for better
131
+ accuracy in polynomial equations across different ranges.
132
+
133
+ 3. Coefficients with NULL value indicate absence of data in that field.
134
+
135
+ 4. Phase is classified as:
136
+ - 'gas': for gaseous species (code = 0)
137
+ - 'condensed': for condensed species (code ≠ 0)
138
+
139
+ 5. To convert between coefficient notation, all numbers
140
+ in FORTRAN notation (e.g., 1.5D+03) were converted to Python float.
141
+
142
+ 6. Temperature in Kelvin (K), Energy in Joules (J), Heat Capacity in J/(mol·K)
143
+
144
+ ================================================================================
145
+
146
+ DATA REFERENCE CODES:
147
+
148
+ g - Glenn Research Center
149
+ j - NIST-JANAF Thermochemical Tables (Chase, 1998)
150
+ tpis - Thermodynamic Properties of Individual Substances (Gurvich, 1978-1996)
151
+ n - TRC Thermodynamic Tables (NIST)
152
+ bar - Barin: Thermochemical Data of Pure Substances (Barin, 1989)
153
+ coda - CODATA Key Values for Thermodynamics (Cox, 1989)
154
+ srd - Standard Reference Data (J. Phys. Chem. Ref. Data journal)
155
+
156
+ ================================================================================
@@ -0,0 +1,248 @@
1
+ ================================================================================
2
+ README - THERMOCHEMICAL CONVERSION PROJECT (thermo.inp → SQLite3)
3
+ ================================================================================
4
+
5
+ OVERVIEW:
6
+ This project converts thermochemical data from FORTRAN format (thermo.inp)
7
+ into a normalized SQLite3 database, facilitating queries and analysis
8
+ of thermodynamic properties of chemical species.
9
+
10
+ ================================================================================
11
+
12
+ PROJECT FILES:
13
+
14
+ 1. referencia.pdf / referencia.txt
15
+ - Documentation of Table C1 (original FORTRAN format)
16
+ - Describes the logic of FORTRAN records for thermochemical data
17
+
18
+ 2. logicofthermo.txt / logicofthermo.md
19
+ - Summary in Portuguese/English of FORTRAN record logic
20
+ - Explains structure: Records 1-5 and their meaning
21
+
22
+ 3. thermo.inp
23
+ - Original file with thermochemical data (FORTRAN format)
24
+ - Contains ~2030 species and their polynomial coefficients
25
+
26
+ 4. thermo_to_sqlite.py
27
+ - Python script that converts thermo.inp to SQLite3
28
+ - Uses robust parser to handle format variations
29
+ - Creates normalized structure with 4 main tables
30
+
31
+ 5. thermo.db
32
+ - Generated SQLite3 database
33
+ - 2030 species, 3772 temperature intervals
34
+ - 3772 polynomial coefficient sets
35
+
36
+ 6. query_thermo_db.py
37
+ - Example script with queries and calculations
38
+ - Demonstrates how to use the database for thermochemical analyses
39
+
40
+ 7. DATABASE_DOCUMENTATION.txt
41
+ - Complete SQLite3 schema documentation
42
+ - Includes SQL query examples
43
+
44
+ 8. conversion_log.txt
45
+ - Conversion execution log
46
+
47
+ ================================================================================
48
+
49
+ DATABASE STRUCTURE:
50
+
51
+ ┌─────────────────┐
52
+ │ file_metadata │ (file metadata)
53
+ └─────────────────┘
54
+
55
+ ┌─────────────────┐
56
+ │ species │ (2030 chemical species)
57
+ │ (id, name...) │
58
+ └─────────────────┘
59
+
60
+ ┌────────────────────────────┐
61
+ │ temperature_intervals │ (3772 intervals)
62
+ │ (species_id, temp_min/max) │
63
+ └────────────────────────────┘
64
+
65
+ ┌──────────────────────────────┐
66
+ │ coefficients │ (3772 sets)
67
+ │ (a1-a7, b1, b2 coefficients) │
68
+ └──────────────────────────────┘
69
+
70
+ ================================================================================
71
+
72
+ HOW TO USE:
73
+
74
+ 1. CONVERT FILE (if necessary):
75
+ $ python thermo_to_sqlite.py
76
+
77
+ Result:
78
+ - Creates/updates thermo.db file
79
+ - Log: conversion_log.txt
80
+
81
+ 2. QUERY DATABASE:
82
+ $ python query_thermo_db.py
83
+
84
+ Examples executed:
85
+ - General statistics
86
+ - Species search
87
+ - Thermochemical calculations (Cp, H°, S°)
88
+ - Data pagination
89
+
90
+ 3. DIRECT SQL QUERIES:
91
+ $ sqlite3 thermo.db
92
+
93
+ Examples:
94
+ .mode column
95
+ SELECT * FROM species LIMIT 5;
96
+ SELECT s.name, ti.temp_min, ti.temp_max
97
+ FROM species s JOIN temperature_intervals ti ON s.id=ti.species_id
98
+ WHERE s.name='O2';
99
+
100
+ ================================================================================
101
+
102
+ DATA LOADED:
103
+
104
+ ✓ Species: 2030
105
+ - Gaseous: 1264
106
+ - Condensed: 766
107
+
108
+ ✓ Temperature Intervals: 3772
109
+ - Global range: 200 K to 20000 K
110
+ - Multiple intervals per species for better accuracy
111
+
112
+ ✓ Polynomial Coefficients: 3772 sets
113
+ - 7 coefficients (a1-a7) for Cp
114
+ - 2 integration constants (b1, b2)
115
+
116
+ ✓ Molecular Weight: ~3100 available data points
117
+ - Range: 0.0005 to ~500 g/mol
118
+
119
+ ================================================================================
120
+
121
+ AVAILABLE FEATURES:
122
+
123
+ 1. Direct SQL queries to the database
124
+ 2. Calculation of thermodynamic properties:
125
+ - Cp(T)/R - Reduced heat capacity
126
+ - H°(T)/RT - Reduced relative enthalpy
127
+ - S°(T)/R - Reduced relative entropy
128
+ 3. Species search by:
129
+ - Exact or partial name
130
+ - Chemical formula
131
+ - Temperature range
132
+ - Phase (gas/condensed)
133
+ 4. Data analysis:
134
+ - General statistics
135
+ - Distribution by phase
136
+ - Molecular weights
137
+
138
+ ================================================================================
139
+
140
+ POLYNOMIAL EQUATIONS:
141
+
142
+ Data is stored as coefficients (a1-a7, b1-b2) that reproduce
143
+ the following equations in specific temperature intervals:
144
+
145
+ Cp(T)/R = a1·T⁻² + a2·T⁻¹ + a3 + a4·T + a5·T² + a6·T³ + a7·T⁴
146
+
147
+ H°(T)/RT = -a1·T⁻² + a2·ln(T) + a3 + a4·T/2 + a5·T²/3 +
148
+ a6·T³/4 + a7·T⁴/5 + b1/T
149
+
150
+ S°(T)/R = -a1·T⁻²/2 - a2·T⁻¹ + a3·ln(T) + a4·T + a5·T²/2 +
151
+ a6·T³/3 + a7·T⁴/4 + b2
152
+
153
+ ================================================================================
154
+
155
+ EXAMPLE PROGRAMMATIC USE (Python):
156
+
157
+ from query_thermo_db import ThermoDBQuery
158
+
159
+ # Connect to database
160
+ db = ThermoDBQuery('thermo.db')
161
+ db.connect()
162
+
163
+ # Search for species
164
+ species = db.find_species('O2')
165
+ print(species[0]['name']) # O2
166
+
167
+ # Get species data
168
+ data = db.get_species_data(species[0]['id'])
169
+
170
+ # Calculate Cp at 1000 K
171
+ coeffs = data['intervals'][0]['coefficients']
172
+ cp_r = db.calculate_cp(coeffs, 1000)
173
+ print(f"Cp(1000K)/R = {cp_r}")
174
+
175
+ db.close()
176
+
177
+ ================================================================================
178
+
179
+ ORIGINAL REFERENCES:
180
+
181
+ Source: NASA Polynomial Database
182
+ - Chase, M.W., et al. (1998). NIST-JANAF Thermochemical Tables
183
+ - Publication: NASA/TP—2002-211556
184
+ - Format: FORTRAN with structured records (Appendix C)
185
+
186
+ Data reference codes:
187
+ - g: Glenn Research Center
188
+ - j: NIST-JANAF Thermochemical Tables
189
+ - tpis: Thermodynamic Properties of Individual Substances
190
+ - n: TRC Thermodynamic Tables (NIST)
191
+ - bar: Barin Thermochemical Data
192
+ - coda: CODATA Key Values
193
+ - srd: Standard Reference Data
194
+
195
+ ================================================================================
196
+
197
+ TECHNICAL NOTES:
198
+
199
+ 1. Adapted FORTRAN Parser:
200
+ - Recognizes D notation (e.g., 1.5D+03)
201
+ - Identifies records by patterns (temperatures, coefficients)
202
+ - Handles formatting variations
203
+
204
+ 2. Data Normalization:
205
+ - Separation of concerns (species, intervals, coefficients)
206
+ - Referential integrity with FOREIGN KEY and CASCADE DELETE
207
+ - Implicit indexes on PRIMARY KEYs
208
+
209
+ 3. Validation:
210
+ - Duplicate species avoided
211
+ - Malformed data recorded but not loaded
212
+ - Loading statistics available
213
+
214
+ ================================================================================
215
+
216
+ SUGGESTED NEXT STEPS:
217
+
218
+ 1. Create additional indexes for better performance:
219
+ CREATE INDEX idx_species_name ON species(name);
220
+ CREATE INDEX idx_intervals_species ON temperature_intervals(species_id);
221
+
222
+ 2. Export data in other formats (JSON, CSV, HDF5)
223
+
224
+ 3. Develop web interface for interactive queries
225
+
226
+ 4. Implement more complex thermodynamic calculations:
227
+ - Chemical reactions
228
+ - Thermodynamic equilibrium
229
+ - Phase diagrams
230
+
231
+ 5. Add support for other thermochemical databases
232
+
233
+ ================================================================================
234
+
235
+ SUPPORT AND DOCUMENTATION:
236
+
237
+ - DATABASE_DOCUMENTATION.txt: Complete schema and SQL examples
238
+ - logicofthermo.txt: Detailed explanation of original format
239
+ - query_thermo_db.py: Practical usage examples
240
+ - conversion_log.txt: History of last conversion
241
+
242
+ ================================================================================
243
+
244
+ CREATION DATE: 2026-07-04
245
+ VERSION: 1.0
246
+ AUTHOR: Automated Thermochemical Data Conversion System
247
+
248
+ ================================================================================