-
Notifications
You must be signed in to change notification settings - Fork 0
/
ICSolarSimple.py
111 lines (86 loc) · 2.84 KB
/
ICSolarSimple.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
"""
This defines the ICSolar model proposed by Assad Oberai
where we our problem is similar to this
|-------|w|---||
| 5 |w| ||
| |\ |w| ||
| | \ |w| ||
|--| 4|-|w|---||
| | / |w| ||
| |/ |w| ||
| |w| ||
exterior | 3 |w| || interior
| |w| ||
| |\ |w| ||
| | \ |w| ||
|--| 2|-|w|---||
| | / |w| ||
| |/ |w| ||
| 1 |w| ||
|-------|w|---||
with n modules, and 2*n+1 air regions, and 2*n+1 water regions
"""
""" Required Modules """
import src.blocks as b
import src.flux as f
import src.problem as p
import src.source as s
""" Optional Modules """
from numpy import cumsum # this is used once in tube geometry
""" Geometries used for fluxes """
# radius -> [inner, tubing, insulation]
L = 0.3
# this is the water tube geometry dictionary, consisting of two materials
# and corresponding radii.
tubeGeom = {'type':'wa','m':[]}
intGeom = {'type':'int','m':[]}
extGeom = {'type':'ext','m':[]}
""" Boundary flux blocks """
""" All these blocks remain constant """
# define inlet water with initial state
w0 = b.Block('water0','water',T = 13)
# define inlet air with initial state
a0 = b.Block('air0','air',T = 20)
# We will need mass flow rates for our fluxes, so initialize them here
# These are added to the class object, and are not part of the
# default block requirement
w0.mdot = 0.00005
a0.mdot = 0.005
# All these boundary blocks need are temperatures
# define Exterior boundary condition
aExt = b.Block('Exterior','air',T = 25.0)
# define Interior boundary condition
aInt = b.Block('Interior','air',T = 22.5)
""" Sources used in even numbered blocks """
# Here, constant sources are defined using the optional arguments
# to pass in information about the source variable (Temperature)
# and its value
qa = -0.008 # Heat flow into water from Module Heat Receiver
qw = -0.003 # Heat flow into air from Heat Loss from the Module
Sa = s.Source('const',T = qa)
Sw = s.Source('const',T = qw)
""" Block Initialization """
w1 = b.Block('water1','constWater',T=13)
w2 = b.Block('water2','constWater',T=13)
a1 = b.Block('air1','constAir',T=20)
a2 = b.Block('air2','constAir',T=20)
w1.mdot = w0.mdot
w2.mdot = w1.mdot
a1.mdot = a0.mdot
a2.mdot = a1.mdot
a2.addSource(Sa)
w2.addSource(Sw)
a1.addFlux(f.Flux(aExt,'heatCondSimple',extGeom))
a1.addFlux(f.Flux(aInt,'heatCondSimple',intGeom))
a1.addFlux(f.Flux(w1,'heatCondSimple',tubeGeom))
a1.addFlux(f.Flux(a0,'heatConvection'))
w1.addFlux(f.Flux(a1,'heatCondSimple',tubeGeom))
w1.addFlux(f.Flux(w0,'heatConvection'))
a2.addFlux(f.Flux(a1,'heatConvection'))
w2.addFlux(f.Flux(w1,'heatConvection'))
""" Problem Initialization """
# Start the problem with solvable blocks, which
# are all the blocks except the first two
ICSolar = p.Problem([a1,a2,w1,w2])
ICSolar.solve()
ICSolar.printSolution()