gaspype 0.0.0__py3-none-any.whl

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.

Potentially problematic release.


This version of gaspype might be problematic. Click here for more details.

gaspype/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ def info():
2
+ print('is coming')
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.2
2
+ Name: gaspype
3
+ Version: 0.0.0
4
+ Summary: Calculates thermodynamics of gases
5
+ Author-email: Nicolas Kruse <nicolas.kruse@nonan.net>
6
+ Project-URL: Homepage, https://github.com/Nonannet/gaspype
7
+ Project-URL: Issues, https://github.com/Nonannet/gaspype/issues
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Python: >=3.9
12
+ Description-Content-Type: text/markdown
13
+
14
+ # Gaspype
15
+
16
+ The Gaspype package will provide an high performance library for thermodynamic calculations.
17
+
18
+ ## Usage will be like as follows
19
+
20
+ Gaspype provides two main classes: ```fluid``` and ```elements```.
21
+
22
+ ### Fluid
23
+
24
+ A fluid class describes a mixture of molecular species and their individual molar amounts.
25
+
26
+ ``` python
27
+ import gaspype as gp
28
+ fl = gp.fluid({'H2O': 1, 'H2':2})
29
+ fl
30
+ ```
31
+ ```
32
+ Total 3.000e+00 mol
33
+ H2O 33.33 %
34
+ H2 66.67 %
35
+ ```
36
+
37
+ Its' functions provides thermodynamic, mass balance and ideal gas properties of the mixture.
38
+
39
+ ``` python
40
+ cp = fl.get_cp(t=800+273.15)
41
+ mass = fl.get_mass()
42
+ gas_volume = fl.get_v(t=800+273.15, p=1e5)
43
+ ```
44
+
45
+ The arguments can be provided as numpy-arrays:
46
+
47
+ ``` python
48
+ t_range = np.linspace(600, 800, 5) + 273.15
49
+ fl.get_density(t=t_range, p=1e5)
50
+ ```
51
+ ```
52
+ array([0.10122906, 0.09574625, 0.09082685, 0.08638827, 0.08236328])
53
+ ```
54
+ A ```fluid``` object can have multiple compositions. A multidimensional ```fluid``` object can be created for example by multiplication with a numpy array:
55
+
56
+ ``` python
57
+ fl2 = gp.fluid({'H2O': 1, 'N2':2}) + \
58
+ np.linspace(0, 10, 4) * gp.fluid({'H2': 1})
59
+ fl2
60
+ ```
61
+ ```
62
+ Total mol:
63
+ array([ 3. , 6.33333333, 9.66666667, 13. ])
64
+ Species:
65
+ H2O N2 H2
66
+ Molar fractions:
67
+ array([[0.33333333, 0.66666667, 0. ],
68
+ [0.15789474, 0.31578947, 0.52631579],
69
+ [0.10344828, 0.20689655, 0.68965517],
70
+ [0.07692308, 0.15384615, 0.76923077]])
71
+ ```
72
+ A fluid object can be converted to a pandas dataframe:
73
+ ``` python
74
+ import pandas as pd
75
+ pd.DataFrame(list(fl2))
76
+ ```
77
+ | | H2O | N2 | H2
78
+ |----|-----|-----|-------
79
+ |0 | 1.0 | 2.0 | 0.000000
80
+ |1 | 1.0 | 2.0 | 3.333333
81
+ |2 | 1.0 | 2.0 | 6.666667
82
+ |3 | 1.0 | 2.0 | 10.000000
83
+
84
+ The broadcasting behavior is not limited to 1D-arrays:
85
+
86
+ ``` python
87
+ fl3 = gp.fluid({'H2O': 1}) + \
88
+ np.linspace(0, 10, 4) * gp.fluid({'H2': 1}) + \
89
+ np.expand_dims(np.linspace(1, 3, 3), axis=1) * gp.fluid({'N2': 1})
90
+ fl3
91
+ ```
92
+ ```
93
+ Total mol:
94
+ array([[ 2. , 5.33333333, 8.66666667, 12. ],
95
+ [ 3. , 6.33333333, 9.66666667, 13. ],
96
+ [ 4. , 7.33333333, 10.66666667, 14. ]])
97
+ Species:
98
+ H2O N2 H2
99
+ Molar fractions:
100
+ array([[[0.5 , 0.5 , 0. ],
101
+ [0.1875 , 0.1875 , 0.625 ],
102
+ [0.11538462, 0.11538462, 0.76923077],
103
+ [0.08333333, 0.08333333, 0.83333333]],
104
+
105
+ [[0.33333333, 0.66666667, 0. ],
106
+ [0.15789474, 0.31578947, 0.52631579],
107
+ [0.10344828, 0.20689655, 0.68965517],
108
+ [0.07692308, 0.15384615, 0.76923077]],
109
+
110
+ [[0.25 , 0.75 , 0. ],
111
+ [0.13636364, 0.40909091, 0.45454545],
112
+ [0.09375 , 0.28125 , 0.625 ],
113
+ [0.07142857, 0.21428571, 0.71428571]]])
114
+ ```
115
+ In some cases not the molecular but the atomic composition is of interest. The ```elements``` class can be used for atom based balances and works similar:
116
+
117
+ ``` python
118
+ el = gp.elements({'N': 1, 'Cl': 2})
119
+ el.get_mass()
120
+ ```
121
+ ```
122
+ 0.084907
123
+ ```
124
+ A ```elements``` object can be as well instantiated from a ```fluid``` object. Arithmetic operations between ```elements``` and ```fluid``` result in an ```elements``` object:
125
+ ``` python
126
+ el2 = gp.elements(fl) + el - 0.3 * fl
127
+ el2
128
+ ```
129
+ ```
130
+ Cl 2.000e+00 mol
131
+ N 1.000e+00 mol
132
+ O 7.000e-01 mol
133
+ H 4.200e+00 mol
134
+ ```
135
+
136
+ Going from an atomic composition to an molecular composition is a little bit less straight forward, since there is no universal approach. One way is to calculate the thermodynamic equilibrium for a mixture:
137
+
138
+ ``` python
139
+ fs = gp.fluid_system('CH4, H2, CO, CO2, O2')
140
+ el3 = gp.elements({'C': 1, 'H': 2, 'O':1}, fs)
141
+ fl3 = gp.equilibrium(el3, t=800)
142
+ fl3
143
+ ```
144
+ ```
145
+ Total 1.204e+00 mol
146
+ CH4 33.07 %
147
+ H2 16.93 %
148
+ CO 16.93 %
149
+ CO2 33.07 %
150
+ O2 0.00 %
151
+ ```
152
+
153
+ The ```equilibrium``` function can be called with a ```fluid``` or ```elements``` object as first argument. ```fluid``` and ```elements``` referencing a ```fluid_system``` object witch can be be set as shown above during the object instantiation. If not provided, a new one will be created automatically. Providing a ```fluid_system``` gives more control over which molecular species are included in derived ```fluid``` objects. Furthermore arithmetic operations between objects with the same ```fluid_system``` are potentially faster:
154
+
155
+ ``` python
156
+ fl3 + gp.fluid({'CH4': 1}, fs)
157
+ ```
158
+ ```
159
+ Total 2.204e+00 mol
160
+ CH4 63.44 %
161
+ H2 9.24 %
162
+ CO 9.24 %
163
+ CO2 18.07 %
164
+ O2 0.00 %
165
+ ```
166
+
167
+ Especially if the ```fluid_system``` of one of the operants has not a subset of molecular species of the other ```fluid_system``` a new ```fluid_system``` will be created for the operation which might degrade performance:
168
+
169
+ ``` python
170
+ fl3 + gp.fluid({'NH3': 1})
171
+ ```
172
+ ```
173
+ Total 2.204e+00 mol
174
+ NH3 45.38 %
175
+ CH4 18.07 %
176
+ H2 9.24 %
177
+ O2 0.00 %
178
+ CO 9.24 %
179
+ CO2 18.07 %
180
+ ```
@@ -0,0 +1,5 @@
1
+ gaspype/__init__.py,sha256=JpnDftXLRkqfScKtyTGalsQMnlA4wHicVIVM6B_dAGU,35
2
+ gaspype-0.0.0.dist-info/METADATA,sha256=MDhV7vLNOr1xKWzzAvjBKcfI_y9xBVi3Pu8Gbci3_hE,5804
3
+ gaspype-0.0.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
4
+ gaspype-0.0.0.dist-info/top_level.txt,sha256=o4INzqytKrZTbtISQH4YVEB_5k6E9rfURCAQQFWqLdU,8
5
+ gaspype-0.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ gaspype