tespy 0.2.1__tar.gz → 0.2.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.
- {TESPy-0.2.1 → TESPy-0.2.2}/PKG-INFO +5 -4
- {TESPy-0.2.1 → TESPy-0.2.2}/README.rst +4 -3
- {TESPy-0.2.1 → TESPy-0.2.2}/TESPy.egg-info/PKG-INFO +5 -4
- {TESPy-0.2.1 → TESPy-0.2.2}/TESPy.egg-info/SOURCES.txt +1 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/setup.py +1 -1
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/__init__.py +1 -1
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/basics.py +2 -20
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/combustion.py +52 -41
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/components.py +31 -62
- TESPy-0.2.2/tespy/components/customs.py +742 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/heat_exchangers.py +128 -160
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/nodes.py +8 -8
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/piping.py +25 -26
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/reactors.py +23 -17
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/turbomachinery.py +36 -38
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/connections.py +2 -2
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/data/char_lines.json +39 -20
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/data/char_maps.json +3 -2
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/networks/network_reader.py +7 -3
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/networks/networks.py +56 -38
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/tools/characteristics.py +78 -19
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/tools/fluid_properties.py +2 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/tools/helpers.py +10 -14
- {TESPy-0.2.1 → TESPy-0.2.2}/TESPy.egg-info/dependency_links.txt +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/TESPy.egg-info/requires.txt +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/TESPy.egg-info/top_level.txt +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/setup.cfg +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/__init__.py +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/components/subsystems.py +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/data/__init__.py +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/networks/__init__.py +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/tools/__init__.py +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/tools/data_containers.py +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/tools/global_vars.py +0 -0
- {TESPy-0.2.1 → TESPy-0.2.2}/tespy/tools/logger.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.2
|
|
2
2
|
Name: TESPy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Thermal Engineering Systems in Python (TESPy)
|
|
5
5
|
Home-page: http://github.com/oemof/tespy
|
|
6
6
|
Author: Francesco Witte
|
|
@@ -71,9 +71,10 @@ Description: .. image:: https://coveralls.io/repos/github/oemof/tespy/badge.svg?
|
|
|
71
71
|
|
|
72
72
|
For a short introduction on how TESPy works and how you can use it, we provide
|
|
73
73
|
some
|
|
74
|
-
`examples and tutorials <
|
|
75
|
-
go and check them out. You can download the python scripts of all example plants
|
|
76
|
-
the
|
|
74
|
+
`examples and tutorials <https://tespy.readthedocs.io/en/master/tutorials_examples.html>`_,
|
|
75
|
+
go and check them out. You can download the python scripts of all example plants
|
|
76
|
+
from the
|
|
77
|
+
`tespy_examples <https://github.com/oemof/oemof-examples/tree/master/oemof_examples/tespy>`_
|
|
77
78
|
repository.
|
|
78
79
|
|
|
79
80
|
License
|
|
@@ -63,9 +63,10 @@ Examples
|
|
|
63
63
|
|
|
64
64
|
For a short introduction on how TESPy works and how you can use it, we provide
|
|
65
65
|
some
|
|
66
|
-
`examples and tutorials <
|
|
67
|
-
go and check them out. You can download the python scripts of all example plants
|
|
68
|
-
the
|
|
66
|
+
`examples and tutorials <https://tespy.readthedocs.io/en/master/tutorials_examples.html>`_,
|
|
67
|
+
go and check them out. You can download the python scripts of all example plants
|
|
68
|
+
from the
|
|
69
|
+
`tespy_examples <https://github.com/oemof/oemof-examples/tree/master/oemof_examples/tespy>`_
|
|
69
70
|
repository.
|
|
70
71
|
|
|
71
72
|
License
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 1.2
|
|
2
2
|
Name: TESPy
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Thermal Engineering Systems in Python (TESPy)
|
|
5
5
|
Home-page: http://github.com/oemof/tespy
|
|
6
6
|
Author: Francesco Witte
|
|
@@ -71,9 +71,10 @@ Description: .. image:: https://coveralls.io/repos/github/oemof/tespy/badge.svg?
|
|
|
71
71
|
|
|
72
72
|
For a short introduction on how TESPy works and how you can use it, we provide
|
|
73
73
|
some
|
|
74
|
-
`examples and tutorials <
|
|
75
|
-
go and check them out. You can download the python scripts of all example plants
|
|
76
|
-
the
|
|
74
|
+
`examples and tutorials <https://tespy.readthedocs.io/en/master/tutorials_examples.html>`_,
|
|
75
|
+
go and check them out. You can download the python scripts of all example plants
|
|
76
|
+
from the
|
|
77
|
+
`tespy_examples <https://github.com/oemof/oemof-examples/tree/master/oemof_examples/tespy>`_
|
|
77
78
|
repository.
|
|
78
79
|
|
|
79
80
|
License
|
|
@@ -356,7 +356,7 @@ class subsystem_interface(component):
|
|
|
356
356
|
printout: boolean
|
|
357
357
|
Include this component in the network's results printout.
|
|
358
358
|
|
|
359
|
-
num_inter : float/tespy.
|
|
359
|
+
num_inter : float/tespy.tools.data_containers.dc_simple
|
|
360
360
|
Number of interfaces for subsystem.
|
|
361
361
|
|
|
362
362
|
Note
|
|
@@ -494,24 +494,6 @@ class subsystem_interface(component):
|
|
|
494
494
|
######################################################################
|
|
495
495
|
# all derivatives are static
|
|
496
496
|
|
|
497
|
-
def fluid_deriv(self):
|
|
498
|
-
r"""
|
|
499
|
-
Calculate the partial derivatives for all fluid balance equations.
|
|
500
|
-
|
|
501
|
-
Returns
|
|
502
|
-
-------
|
|
503
|
-
deriv : list
|
|
504
|
-
Matrix with partial derivatives for the fluid equations.
|
|
505
|
-
"""
|
|
506
|
-
deriv = np.zeros((self.num_nw_fluids * self.num_i,
|
|
507
|
-
2 * self.num_i,
|
|
508
|
-
self.num_nw_vars))
|
|
509
|
-
for i in range(self.num_i):
|
|
510
|
-
for j in range(self.num_nw_fluids):
|
|
511
|
-
deriv[i * self.num_nw_fluids + j, i, j + 3] = 1
|
|
512
|
-
deriv[i * self.num_nw_fluids + j, self.num_i + i, j + 3] = -1
|
|
513
|
-
return deriv.tolist()
|
|
514
|
-
|
|
515
497
|
def inout_deriv(self, pos):
|
|
516
498
|
r"""
|
|
517
499
|
Calculate partial derivatives.
|
|
@@ -534,4 +516,4 @@ class subsystem_interface(component):
|
|
|
534
516
|
deriv[i, i, pos] = 1
|
|
535
517
|
for j in range(self.num_i):
|
|
536
518
|
deriv[j, j + self.num_i, pos] = -1
|
|
537
|
-
return deriv
|
|
519
|
+
return deriv
|
|
@@ -105,10 +105,10 @@ class combustion_chamber(component):
|
|
|
105
105
|
printout: boolean
|
|
106
106
|
Include this component in the network's results printout.
|
|
107
107
|
|
|
108
|
-
lamb : float/tespy.
|
|
108
|
+
lamb : float/tespy.tools.data_containers.dc_cp
|
|
109
109
|
Actual oxygen to stoichiometric oxygen ratio, :math:`\lambda/1`.
|
|
110
110
|
|
|
111
|
-
ti : float/tespy.
|
|
111
|
+
ti : float/tespy.tools.data_containers.dc_cp
|
|
112
112
|
Thermal input, (:math:`{LHV \cdot \dot{m}_f}`),
|
|
113
113
|
:math:`ti/\text{W}`.
|
|
114
114
|
|
|
@@ -759,7 +759,6 @@ class combustion_chamber(component):
|
|
|
759
759
|
try:
|
|
760
760
|
flow = [0, p, 0, {self.h2o: 1}]
|
|
761
761
|
h_steam = h_mix_pQ(flow, 1)
|
|
762
|
-
# CP.PropsSI('H', 'P', p, 'Q', 1, self.h2o)
|
|
763
762
|
except ValueError:
|
|
764
763
|
flow = [0, 615, 0, {self.h2o: 1}]
|
|
765
764
|
h_steam = h_mix_pQ(flow, 1)
|
|
@@ -986,7 +985,7 @@ class combustion_chamber(component):
|
|
|
986
985
|
|
|
987
986
|
m = 0
|
|
988
987
|
for i in inl:
|
|
989
|
-
if i.
|
|
988
|
+
if i.good_starting_values is False:
|
|
990
989
|
if i.m.val_SI < 0 and not i.m.val_set:
|
|
991
990
|
i.m.val_SI = 0.01
|
|
992
991
|
m += i.m.val_SI
|
|
@@ -994,7 +993,7 @@ class combustion_chamber(component):
|
|
|
994
993
|
######################################################################
|
|
995
994
|
# check fluid composition
|
|
996
995
|
for o in outl:
|
|
997
|
-
if o.
|
|
996
|
+
if o.good_starting_values is False:
|
|
998
997
|
fluids = [f for f in o.fluid.val.keys()
|
|
999
998
|
if not o.fluid.val_set[f]]
|
|
1000
999
|
for f in fluids:
|
|
@@ -1031,7 +1030,7 @@ class combustion_chamber(component):
|
|
|
1031
1030
|
######################################################################
|
|
1032
1031
|
# flue gas propagation
|
|
1033
1032
|
for o in outl:
|
|
1034
|
-
if o.
|
|
1033
|
+
if o.good_starting_values is False:
|
|
1035
1034
|
if o.m.val_SI < 0 and not o.m.val_set:
|
|
1036
1035
|
o.m.val_SI = 10
|
|
1037
1036
|
nw.init_target(o, o.t)
|
|
@@ -1045,7 +1044,7 @@ class combustion_chamber(component):
|
|
|
1045
1044
|
# search fuel and air inlet
|
|
1046
1045
|
for i in inl:
|
|
1047
1046
|
fuel_found = False
|
|
1048
|
-
if i.
|
|
1047
|
+
if i.good_starting_values is False:
|
|
1049
1048
|
fuel = 0
|
|
1050
1049
|
for f in self.fuel_list:
|
|
1051
1050
|
fuel += i.fluid.val[f]
|
|
@@ -1236,10 +1235,10 @@ class combustion_chamber_stoich(combustion_chamber):
|
|
|
1236
1235
|
path : str
|
|
1237
1236
|
Path to existing fluid property table.
|
|
1238
1237
|
|
|
1239
|
-
lamb : float/tespy.
|
|
1238
|
+
lamb : float/tespy.tools.data_containers.dc_cp
|
|
1240
1239
|
Air to stoichiometric air ratio, :math:`\lambda/1`.
|
|
1241
1240
|
|
|
1242
|
-
ti : float/tespy.
|
|
1241
|
+
ti : float/tespy.tools.data_containers.dc_cp
|
|
1243
1242
|
Thermal input, (:math:`{LHV \cdot \dot{m}_f}`),
|
|
1244
1243
|
:math:`ti/\text{W}`.
|
|
1245
1244
|
|
|
@@ -2040,8 +2039,8 @@ class combustion_engine(combustion_chamber):
|
|
|
2040
2039
|
0 = p_{1,in} \cdot pr1 - p_{1,out}\\
|
|
2041
2040
|
0 = p_{2,in} \cdot pr2 - p_{2,out}
|
|
2042
2041
|
|
|
2043
|
-
- :func:`tespy.components.components.component.zeta_func`
|
|
2044
|
-
- :func:`tespy.components.components.component.
|
|
2042
|
+
- loop 1 :func:`tespy.components.components.component.zeta_func`
|
|
2043
|
+
- loop 2 :func:`tespy.components.components.component.zeta_func`
|
|
2045
2044
|
|
|
2046
2045
|
Available fuels
|
|
2047
2046
|
|
|
@@ -2090,49 +2089,49 @@ class combustion_engine(combustion_chamber):
|
|
|
2090
2089
|
printout: boolean
|
|
2091
2090
|
Include this component in the network's results printout.
|
|
2092
2091
|
|
|
2093
|
-
lamb : float/tespy.
|
|
2092
|
+
lamb : float/tespy.tools.data_containers.dc_cp
|
|
2094
2093
|
Air to stoichiometric air ratio, :math:`\lambda/1`.
|
|
2095
2094
|
|
|
2096
|
-
ti : float/tespy.
|
|
2095
|
+
ti : float/tespy.tools.data_containers.dc_cp
|
|
2097
2096
|
Thermal input, (:math:`{LHV \cdot \dot{m}_f}`),
|
|
2098
2097
|
:math:`ti/\text{W}`.
|
|
2099
2098
|
|
|
2100
|
-
P : str/float/tespy.
|
|
2099
|
+
P : str/float/tespy.tools.data_containers.dc_cp
|
|
2101
2100
|
Power output, :math:`P/\text{W}`.
|
|
2102
2101
|
|
|
2103
|
-
Q1 :
|
|
2102
|
+
Q1 : float/tespy.tools.data_containers.dc_cp
|
|
2104
2103
|
Heat output 1, :math:`\dot Q/\text{W}`.
|
|
2105
2104
|
|
|
2106
|
-
Q2 :
|
|
2105
|
+
Q2 : float/tespy.tools.data_containers.dc_cp
|
|
2107
2106
|
Heat output 2, :math:`\dot Q/\text{W}`.
|
|
2108
2107
|
|
|
2109
|
-
Qloss : str/float/tespy.
|
|
2108
|
+
Qloss : str/float/tespy.tools.data_containers.dc_cp
|
|
2110
2109
|
Heat loss, :math:`\dot Q_{loss}/\text{W}`.
|
|
2111
2110
|
|
|
2112
|
-
pr1 :
|
|
2111
|
+
pr1 : float/tespy.tools.data_containers.dc_cp
|
|
2113
2112
|
Pressure ratio heat outlet 1, :math:`pr/1`.
|
|
2114
2113
|
|
|
2115
|
-
pr2 :
|
|
2114
|
+
pr2 : float/tespy.tools.data_containers.dc_cp
|
|
2116
2115
|
Pressure ratio heat outlet 2, :math:`pr/1`.
|
|
2117
2116
|
|
|
2118
|
-
zeta1 :
|
|
2119
|
-
|
|
2117
|
+
zeta1 : float/tespy.tools.data_containers.dc_cp
|
|
2118
|
+
Geometry independent friction coefficient heating loop 1,
|
|
2120
2119
|
:math:`\zeta/\frac{1}{\text{m}^4}`.
|
|
2121
2120
|
|
|
2122
|
-
zeta2 :
|
|
2123
|
-
|
|
2121
|
+
zeta2 : float/tespy.tools.data_containers.dc_cp
|
|
2122
|
+
Geometry independent friction coefficient heating loop 2,
|
|
2124
2123
|
:math:`\zeta/\frac{1}{\text{m}^4}`.
|
|
2125
2124
|
|
|
2126
|
-
tiP_char :
|
|
2125
|
+
tiP_char : tespy.tools.charactersitics.char_line/tespy.tools.data_containers.dc_cc
|
|
2127
2126
|
Characteristic line linking fuel input to power output.
|
|
2128
2127
|
|
|
2129
|
-
Q1_char :
|
|
2128
|
+
Q1_char : tespy.tools.charactersitics.char_line/tespy.tools.data_containers.dc_cc
|
|
2130
2129
|
Characteristic line linking heat output 1 to power output.
|
|
2131
2130
|
|
|
2132
|
-
Q2_char :
|
|
2131
|
+
Q2_char : tespy.tools.charactersitics.char_line/tespy.tools.data_containers.dc_cc
|
|
2133
2132
|
Characteristic line linking heat output 2 to power output.
|
|
2134
2133
|
|
|
2135
|
-
Qloss_char :
|
|
2134
|
+
Qloss_char : tespy.tools.charactersitics.char_line/tespy.tools.data_containers.dc_cc
|
|
2136
2135
|
Characteristic line linking heat loss to power output.
|
|
2137
2136
|
|
|
2138
2137
|
Note
|
|
@@ -2391,12 +2390,14 @@ class combustion_engine(combustion_chamber):
|
|
|
2391
2390
|
# equations for specified zeta values at cooling loops
|
|
2392
2391
|
if self.zeta1.is_set:
|
|
2393
2392
|
if np.absolute(self.vec_res[k]) > err ** 2 or self.it % 4 == 0:
|
|
2394
|
-
self.vec_res[k] = self.zeta_func(
|
|
2393
|
+
self.vec_res[k] = self.zeta_func(
|
|
2394
|
+
zeta='zeta1', inconn=0, outconn=0)
|
|
2395
2395
|
k += 1
|
|
2396
2396
|
|
|
2397
2397
|
if self.zeta2.is_set:
|
|
2398
2398
|
if np.absolute(self.vec_res[k]) > err ** 2 or self.it % 4 == 0:
|
|
2399
|
-
self.vec_res[k] = self.
|
|
2399
|
+
self.vec_res[k] = self.zeta_func(
|
|
2400
|
+
zeta='zeta2', inconn=1, outconn=1)
|
|
2400
2401
|
k += 1
|
|
2401
2402
|
|
|
2402
2403
|
def derivatives(self, vec_z):
|
|
@@ -2601,29 +2602,39 @@ class combustion_engine(combustion_chamber):
|
|
|
2601
2602
|
if self.zeta1.is_set:
|
|
2602
2603
|
f = self.zeta_func
|
|
2603
2604
|
if not vec_z[0, 0]:
|
|
2604
|
-
self.mat_deriv[k, 0, 0] = self.numeric_deriv(
|
|
2605
|
+
self.mat_deriv[k, 0, 0] = self.numeric_deriv(
|
|
2606
|
+
f, 'm', 0, zeta='zeta1', inconn=0, outconn=0)
|
|
2605
2607
|
if not vec_z[0, 1]:
|
|
2606
|
-
self.mat_deriv[k, 0, 1] = self.numeric_deriv(
|
|
2608
|
+
self.mat_deriv[k, 0, 1] = self.numeric_deriv(
|
|
2609
|
+
f, 'p', 0, zeta='zeta1', inconn=0, outconn=0)
|
|
2607
2610
|
if not vec_z[0, 2]:
|
|
2608
|
-
self.mat_deriv[k, 0, 2] = self.numeric_deriv(
|
|
2611
|
+
self.mat_deriv[k, 0, 2] = self.numeric_deriv(
|
|
2612
|
+
f, 'h', 0, zeta='zeta1', inconn=0, outconn=0)
|
|
2609
2613
|
if not vec_z[4, 1]:
|
|
2610
|
-
self.mat_deriv[k, 4, 1] = self.numeric_deriv(
|
|
2614
|
+
self.mat_deriv[k, 4, 1] = self.numeric_deriv(
|
|
2615
|
+
f, 'p', 4, zeta='zeta1', inconn=0, outconn=0)
|
|
2611
2616
|
if not vec_z[4, 2]:
|
|
2612
|
-
self.mat_deriv[k, 4, 2] = self.numeric_deriv(
|
|
2617
|
+
self.mat_deriv[k, 4, 2] = self.numeric_deriv(
|
|
2618
|
+
f, 'h', 4, zeta='zeta1', inconn=0, outconn=0)
|
|
2613
2619
|
k += 1
|
|
2614
2620
|
|
|
2615
2621
|
if self.zeta2.is_set:
|
|
2616
|
-
f = self.
|
|
2622
|
+
f = self.zeta_func
|
|
2617
2623
|
if not vec_z[1, 0]:
|
|
2618
|
-
self.mat_deriv[k, 1, 0] = self.numeric_deriv(
|
|
2624
|
+
self.mat_deriv[k, 1, 0] = self.numeric_deriv(
|
|
2625
|
+
f, 'm', 1, zeta='zeta2', inconn=1, outconn=1)
|
|
2619
2626
|
if not vec_z[1, 1]:
|
|
2620
|
-
self.mat_deriv[k, 1, 1] = self.numeric_deriv(
|
|
2627
|
+
self.mat_deriv[k, 1, 1] = self.numeric_deriv(
|
|
2628
|
+
f, 'p', 1, zeta='zeta2', inconn=1, outconn=1)
|
|
2621
2629
|
if not vec_z[1, 2]:
|
|
2622
|
-
self.mat_deriv[k, 1, 2] = self.numeric_deriv(
|
|
2630
|
+
self.mat_deriv[k, 1, 2] = self.numeric_deriv(
|
|
2631
|
+
f, 'h', 1, zeta='zeta2', inconn=1, outconn=1)
|
|
2623
2632
|
if not vec_z[5, 1]:
|
|
2624
|
-
self.mat_deriv[k, 5, 1] = self.numeric_deriv(
|
|
2633
|
+
self.mat_deriv[k, 5, 1] = self.numeric_deriv(
|
|
2634
|
+
f, 'p', 5, zeta='zeta2', inconn=1, outconn=1)
|
|
2625
2635
|
if not vec_z[5, 2]:
|
|
2626
|
-
self.mat_deriv[k, 5, 2] = self.numeric_deriv(
|
|
2636
|
+
self.mat_deriv[k, 5, 2] = self.numeric_deriv(
|
|
2637
|
+
f, 'h', 5, zeta='zeta2', inconn=1, outconn=1)
|
|
2627
2638
|
k += 1
|
|
2628
2639
|
|
|
2629
2640
|
def fluid_func(self):
|
|
@@ -2735,7 +2746,7 @@ class combustion_engine(combustion_chamber):
|
|
|
2735
2746
|
.. math::
|
|
2736
2747
|
|
|
2737
2748
|
\begin{split}
|
|
2738
|
-
|
|
2749
|
+
res = & \sum_i \dot{m}_{in,i} \cdot
|
|
2739
2750
|
\left( h_{in,i} - h_{in,i,ref} \right)\\
|
|
2740
2751
|
& - \sum_j \dot{m}_{out,3} \cdot
|
|
2741
2752
|
\left( h_{out,3} - h_{out,3,ref} \right)\\
|
|
@@ -492,13 +492,15 @@ class component:
|
|
|
492
492
|
Vector of residual values for component's fluid balance.
|
|
493
493
|
|
|
494
494
|
.. math::
|
|
495
|
-
|
|
496
|
-
|
|
495
|
+
|
|
496
|
+
0 = fluid_{i,in_{j}} - fluid_{i,out_{j}} \;
|
|
497
|
+
\forall i \in \mathrm{fluid}, \; \forall j \in inlets/outlets
|
|
497
498
|
"""
|
|
498
499
|
vec_res = []
|
|
499
500
|
|
|
500
|
-
for
|
|
501
|
-
|
|
501
|
+
for i in range(self.num_i):
|
|
502
|
+
for fluid, x in self.inl[0].fluid.val.items():
|
|
503
|
+
vec_res += [x - self.outl[0].fluid.val[fluid]]
|
|
502
504
|
return vec_res
|
|
503
505
|
|
|
504
506
|
def fluid_deriv(self):
|
|
@@ -510,14 +512,13 @@ class component:
|
|
|
510
512
|
deriv : list
|
|
511
513
|
Matrix with partial derivatives for the fluid equations.
|
|
512
514
|
"""
|
|
513
|
-
deriv = np.zeros((self.num_nw_fluids,
|
|
514
|
-
2 + self.num_vars,
|
|
515
|
+
deriv = np.zeros((self.num_nw_fluids * self.num_i,
|
|
516
|
+
2 * self.num_i + self.num_vars,
|
|
515
517
|
self.num_nw_vars))
|
|
516
|
-
i
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
i += 1
|
|
518
|
+
for i in range(self.num_i):
|
|
519
|
+
for j in range(self.num_nw_fluids):
|
|
520
|
+
deriv[i * self.num_nw_fluids + j, i, j + 3] = 1
|
|
521
|
+
deriv[i * self.num_nw_fluids + j, self.num_i + i, j + 3] = -1
|
|
521
522
|
return deriv
|
|
522
523
|
|
|
523
524
|
# %%
|
|
@@ -651,10 +652,22 @@ class component:
|
|
|
651
652
|
|
|
652
653
|
# %%
|
|
653
654
|
|
|
654
|
-
def zeta_func(self):
|
|
655
|
+
def zeta_func(self, zeta='', inconn=0, outconn=0):
|
|
655
656
|
r"""
|
|
656
657
|
Calculate residual value of :math:`\zeta`-function.
|
|
657
658
|
|
|
659
|
+
Parameters
|
|
660
|
+
----------
|
|
661
|
+
zeta : str
|
|
662
|
+
Component parameter to evaluate the zeta_func on, e. g.
|
|
663
|
+
:code:`zeta1`.
|
|
664
|
+
|
|
665
|
+
inconn : int
|
|
666
|
+
Connection index of inlet.
|
|
667
|
+
|
|
668
|
+
outconn : int
|
|
669
|
+
Connection index of outlet.
|
|
670
|
+
|
|
658
671
|
Returns
|
|
659
672
|
-------
|
|
660
673
|
val : float
|
|
@@ -681,59 +694,15 @@ class component:
|
|
|
681
694
|
\frac{\zeta}{D^4} = \frac{\Delta p \cdot \pi^2}
|
|
682
695
|
{8 \cdot \dot{m}^2 \cdot v}
|
|
683
696
|
"""
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
val = self.zeta.val
|
|
688
|
-
else:
|
|
689
|
-
val = self.zeta1.val
|
|
697
|
+
zeta = self.get_attr(zeta).val
|
|
698
|
+
i = self.inl[inconn].to_flow()
|
|
699
|
+
o = self.outl[outconn].to_flow()
|
|
690
700
|
|
|
691
701
|
if abs(i[0]) < 1e-4:
|
|
692
702
|
return i[1] - o[1]
|
|
693
703
|
|
|
694
704
|
else:
|
|
695
|
-
v_i = v_mix_ph(i, T0=self.inl[
|
|
696
|
-
v_o = v_mix_ph(o, T0=self.outl[
|
|
697
|
-
return (
|
|
698
|
-
(8 * abs(i[0]) * i[0] * (v_i + v_o) / 2))
|
|
699
|
-
|
|
700
|
-
def zeta2_func(self):
|
|
701
|
-
r"""
|
|
702
|
-
Calculate residual value of :math:`\zeta_2`-function.
|
|
703
|
-
|
|
704
|
-
Returns
|
|
705
|
-
-------
|
|
706
|
-
val : float
|
|
707
|
-
Residual value of function.
|
|
708
|
-
|
|
709
|
-
.. math::
|
|
710
|
-
|
|
711
|
-
val = \begin{cases}
|
|
712
|
-
p_{in} - p_{out} & |\dot{m}| < \epsilon \\
|
|
713
|
-
\frac{\zeta_2}{D^4} - \frac{(p_{2,in} - p_{2,out}) \cdot \pi^2}
|
|
714
|
-
{8 \cdot \dot{m}_{2,in} \cdot |\dot{m}_{2,in}| \cdot
|
|
715
|
-
\frac{v_{2,in} + v_{2,out}}{2}} &
|
|
716
|
-
|\dot{m}| > \epsilon
|
|
717
|
-
\end{cases}
|
|
718
|
-
|
|
719
|
-
Note
|
|
720
|
-
----
|
|
721
|
-
The zeta value is caluclated on the basis of a given pressure loss at
|
|
722
|
-
a given flow rate in the design case. As the cross sectional area A
|
|
723
|
-
will not change, it is possible to handle the equation in this way:
|
|
724
|
-
|
|
725
|
-
.. math::
|
|
726
|
-
|
|
727
|
-
\frac{\zeta_2}{D^4} = \frac{\Delta p_2 \cdot \pi^2}
|
|
728
|
-
{8 \cdot \dot{m}_2^2 \cdot v}
|
|
729
|
-
"""
|
|
730
|
-
i = self.inl[1].to_flow()
|
|
731
|
-
o = self.outl[1].to_flow()
|
|
732
|
-
|
|
733
|
-
if abs(i[0]) < 1e-4:
|
|
734
|
-
return i[1] - o[1]
|
|
735
|
-
else:
|
|
736
|
-
v_i = v_mix_ph(i, T0=self.inl[1].T.val_SI)
|
|
737
|
-
v_o = v_mix_ph(o, T0=self.outl[1].T.val_SI)
|
|
738
|
-
return (self.zeta2.val - (i[1] - o[1]) * np.pi ** 2 /
|
|
705
|
+
v_i = v_mix_ph(i, T0=self.inl[inconn].T.val_SI)
|
|
706
|
+
v_o = v_mix_ph(o, T0=self.outl[outconn].T.val_SI)
|
|
707
|
+
return (zeta - (i[1] - o[1]) * np.pi ** 2 /
|
|
739
708
|
(8 * abs(i[0]) * i[0] * (v_i + v_o) / 2))
|