-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathA1_solid.py
41 lines (34 loc) · 1.67 KB
/
A1_solid.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
from A1A_heatstructure import HeatStructure
from A1B_fuelrod import FuelRod
#--------------------------------------------------------------------------------------------------
class Solid:
#----------------------------------------------------------------------------------------------
# constructor: self is a 'solid' object created in B
def __init__(self, reactor):
# INITIALIZATION
if 'fuelrod' in reactor.solve:
# number of fuel rods specified in input
self.nfuelrods = len([x['id'] for x in reactor.control.input['fuelrod']])
# create an object for every fuel rod
self.fuelrod = []
for i in range(self.nfuelrods):
self.fuelrod.append(FuelRod(i, reactor))
if 'htstr' in reactor.solve:
# number of heat structures specified in input
self.nhtstr = len([x['id'] for x in reactor.control.input['htstr']])
# create an object for every heat structure
self.htstr = []
for i in range(self.nhtstr):
self.htstr.append(HeatStructure(i, reactor))
#----------------------------------------------------------------------------------------------
# compose right-hand side list: self is a 'solid' object created in B
def compose_rhs(self, reactor, t):
# construct right-hand side list
rhs = []
if 'fuelrod' in reactor.solve:
for i in range(self.nfuelrods):
rhs += self.fuelrod[i].compose_rhs(i, reactor, t)
if 'htstr' in reactor.solve:
for i in range(self.nhtstr):
rhs += self.htstr[i].compose_rhs(reactor, t)
return rhs