Skip to content

Commit 6616817

Browse files
AtzAtz
Atz
authored and
Atz
committed
v0.6.3: fixed bug in low-fidelity model region energy balance with mesh disagreement and in gap subchannel adjacency map; added tests to demonstrate core-wide ebal with low-fidelity models
1 parent 03255ea commit 6616817

15 files changed

+373
-404
lines changed

dassh/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# permissions and limitations under the License.
1515
########################################################################
1616
"""
17-
date: 2021-05-25
17+
date: 2021-05-26
1818
author: Milos Atz, Micheal Smith
1919
"""
2020
########################################################################
@@ -44,4 +44,4 @@
4444
np.set_printoptions(threshold=sys.maxsize, linewidth=500)
4545

4646

47-
__version__ = '0.6.2-dev'
47+
__version__ = '0.6.3-dev'

dassh/core.py

+18-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# permissions and limitations under the License.
1515
########################################################################
1616
"""
17-
date: 2021-05-03
17+
date: 2021-05-26
1818
author: matz
1919
Methods to describe the layout of assemblies in the reactor core and
2020
the coolant in the gap between them
@@ -189,6 +189,7 @@ def load(self, asms):
189189
self.gap_params['asm wp'] = self._calculate_asm_sc_wp()
190190
self.gap_params['area'] = self._calculate_sc_area()
191191
self.gap_params['L'] = self._calculate_dist_between_sc()
192+
assert not np.any(0 in np.sum(self.gap_params['L'], axis=1))
192193
self.gap_params['de'] = self._calculate_sc_de()
193194

194195
# Core-total parameters
@@ -318,6 +319,10 @@ def _map_asm_gap_adjacency(self):
318319
# Add the temporary arrays to main arrays
319320
asm_adj_sc.append(tmp_asm_adj_sc)
320321

322+
# Cast all value as int
323+
for i in range(len(asm_adj_sc)):
324+
for j in range(len(asm_adj_sc[i])):
325+
asm_adj_sc[i][j] = [int(x) for x in asm_adj_sc[i][j]]
321326
return asm_adj_sc
322327

323328
def _calculate_gap_xbnds(self):
@@ -911,7 +916,8 @@ def _find_adjacent_sc(self, asm_sc_adj):
911916
for ai in range(len(asm_sc_adj)):
912917
asm_sc = asm_sc_adj[ai]
913918
for side in range(len(asm_sc)):
914-
for sci in range(len(asm_sc[side]) - 1):
919+
# for sci in range(len(asm_sc[side]) - 1):
920+
for sci in range(len(asm_sc[side])):
915921
# Look to trailing corner on previous side
916922
if sci == 0:
917923
# Fill trailing corner's value into active index
@@ -931,15 +937,16 @@ def _find_adjacent_sc(self, asm_sc_adj):
931937
idx = np.where(sc_adj[sc - 1] == 0)[0][0]
932938
sc_adj[sc - 1, idx] = asm_sc[side][sci]
933939
# For the sc in current index: map the sc in next index
934-
sc = asm_sc[side][sci]
935-
if asm_sc[side][sci + 1] not in sc_adj[sc - 1]:
936-
idx = np.where(sc_adj[sc - 1] == 0)[0][0]
937-
sc_adj[sc - 1, idx] = asm_sc[side][sci + 1]
938-
# For the sc in next index; map the sc in current index
939-
sc = asm_sc[side][sci + 1]
940-
if asm_sc[side][sci] not in sc_adj[sc - 1]:
941-
idx = np.where(sc_adj[sc - 1] == 0)[0][0]
942-
sc_adj[sc - 1, idx] = asm_sc[side][sci]
940+
if sci < len(asm_sc[side]) - 1:
941+
sc = asm_sc[side][sci]
942+
if asm_sc[side][sci + 1] not in sc_adj[sc - 1]:
943+
idx = np.where(sc_adj[sc - 1] == 0)[0][0]
944+
sc_adj[sc - 1, idx] = asm_sc[side][sci + 1]
945+
# For the sc in next index; map the sc in current index
946+
sc = asm_sc[side][sci + 1]
947+
if asm_sc[side][sci] not in sc_adj[sc - 1]:
948+
idx = np.where(sc_adj[sc - 1] == 0)[0][0]
949+
sc_adj[sc - 1, idx] = asm_sc[side][sci]
943950
return sc_adj
944951

945952
def _calculate_sc_wp(self):

dassh/reactor.py

+16-15
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ def _calculate_asm_temperatures(self, asm, i, z, dz, dump_step):
12801280
if self.core.model is None:
12811281
gap_temp = np.ones(asm.duct_outer_surf_temp.shape[0])
12821282
gap_htc = np.ones(asm.duct_outer_surf_temp.shape[0])
1283-
elif asm.active_region.is_rodded:
1283+
# elif asm.active_region.is_rodded:
12841284
# gap_temp = dassh.mesh_functions.interpolate_quad(
12851285
# self.core.x_pts,
12861286
# self.core.adjacent_coolant_gap_temp(i),
@@ -1291,6 +1291,7 @@ def _calculate_asm_temperatures(self, asm, i, z, dz, dump_step):
12911291
# self.core.x_pts,
12921292
# self.core.adjacent_coolant_gap_temp(i),
12931293
# asm.x_pts)
1294+
else:
12941295
gap_htc = dassh.mesh_functions.map_across_gap(
12951296
self.core.adjacent_coolant_gap_htc(i),
12961297
asm.active_region._map['gap2duct'])
@@ -1299,20 +1300,20 @@ def _calculate_asm_temperatures(self, asm, i, z, dz, dump_step):
12991300
* self.core.adjacent_coolant_gap_htc(i)),
13001301
asm.active_region._map['gap2duct'])
13011302
gap_temp = gap_temp / gap_htc
1302-
else:
1303-
gap_htc = dassh.mesh_functions.map_across_gap(
1304-
self.core.adjacent_coolant_gap_htc(i),
1305-
asm.active_region._map['gap2duct'])
1306-
gap_temp = dassh.mesh_functions.map_across_gap(
1307-
self.core.adjacent_coolant_gap_temp(i),
1308-
asm.active_region._map['gap2duct']) / gap_htc
1309-
# poop = self.core.adjacent_coolant_gap_temp(i).reshape(6, -1)
1310-
# gap_temp = gap_temp.reshape(6, -1)
1311-
# gap_temp[:, -1] = poop[:, -1]
1312-
# gap_temp = gap_temp.flatten()
1313-
# gap_adj_temps = map_across_gap(
1314-
# self.core.adjacent_coolant_gap_temp(i),
1315-
# asm.active_region._map['gap2duct'])
1303+
# else:
1304+
# gap_htc = dassh.mesh_functions.map_across_gap(
1305+
# self.core.adjacent_coolant_gap_htc(i),
1306+
# asm.active_region._map['gap2duct'])
1307+
# gap_temp = dassh.mesh_functions.map_across_gap(
1308+
# self.core.adjacent_coolant_gap_temp(i),
1309+
# asm.active_region._map['gap2duct']) / gap_htc
1310+
# # poop = self.core.adjacent_coolant_gap_temp(i).reshape(6, -1)
1311+
# # gap_temp = gap_temp.reshape(6, -1)
1312+
# # gap_temp[:, -1] = poop[:, -1]
1313+
# # gap_temp = gap_temp.flatten()
1314+
# # gap_adj_temps = map_across_gap(
1315+
# # self.core.adjacent_coolant_gap_temp(i),
1316+
# # asm.active_region._map['gap2duct'])
13161317
asm.calculate(z, dz, gap_temp, gap_htc,
13171318
self._is_adiabatic, self._options['ebal'])
13181319
# Write the results

dassh/region_unrodded.py

+27-11
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# permissions and limitations under the License.
1515
########################################################################
1616
"""
17-
date: 2021-05-20
17+
date: 2021-05-26
1818
author: matz
1919
Methods for unrodded axial regions; to be used within Assembly objects
2020
"""
@@ -147,7 +147,8 @@ def __init__(self, z_lo, z_hi, duct_ftf, vf_cool, flow_rate,
147147
range(0, len(duct_ftf), 2)]
148148
self.duct_ftf = duct_ftf[-1]
149149
self.duct_thickness = (self.duct_ftf[1] - self.duct_ftf[0]) / 2
150-
self.duct_perim = self.duct_ftf[0] * 6 / _sqrt3
150+
# self.duct_perim = self.duct_ftf[0] * 6 / _sqrt3
151+
self.duct_perim = self.duct_ftf[1] * 6 / _sqrt3
151152
# One sixth of the duct perimeter for the coolant temp calc
152153
# (self.duct_perimeter defined in SingleNodeHomogeneous)
153154
self.duct_perim_over_6 = self.duct_perim / 6
@@ -357,11 +358,18 @@ def calculate(self, dz, power, t_gap, htc_gap,
357358
None
358359
359360
"""
361+
# Interior coolant temperatures: calculate using coolant
362+
# properties from previous axial step
360363
self.temp['coolant_int'] += self._calc_coolant_temp(
361364
dz, power, adiabatic_duct, ebal)
365+
366+
# Update coolant properties for the duct wall calculation
367+
self._update_coolant_params(self.temp['coolant_int'][0])
368+
369+
# Duct temperatures: calculate with new coolant properties
362370
self._calc_duct_temp(t_gap, htc_gap, adiabatic_duct)
363371

364-
# Update pressure drop
372+
# Update pressure drop (now that correlations are updated)
365373
self._pressure_drop += self.calculate_pressure_drop(dz)
366374

367375
def activate2(self, previous_reg, t_gap, h_gap, adiabatic):
@@ -412,8 +420,7 @@ def _calc_coolant_temp(self, dz, power, adiabatic=False, ebal=False):
412420
413421
"""
414422
# Update coolant parameters and material properties
415-
Tj = self.avg_coolant_int_temp # <-- dont wanna calc everytim
416-
self._update_coolant_params(Tj)
423+
# Tj = self.avg_coolant_int_temp # <-- dont wanna calc everytim
417424

418425
# Calculate change in temperature from heat generation
419426
dT = power['refl']
@@ -425,9 +432,11 @@ def _calc_coolant_temp(self, dz, power, adiabatic=False, ebal=False):
425432
/ self.duct.thermal_conductivity)
426433
R += 1 / self.coolant_params['htc']
427434
dT_duct = (self.duct_perim_over_6 / R
428-
* (self.temp['duct_mw'][0] - Tj))
435+
* (self.temp['duct_mw'][0]
436+
- self.temp['coolant_int'][0]))
429437
else:
430-
dT_duct = ((self.temp['duct_surf'][0, 0] - Tj)
438+
dT_duct = ((self.temp['duct_surf'][0, 0]
439+
- self.temp['coolant_int'][0])
431440
* self.coolant_params['htc']
432441
* self.duct_perim_over_6)
433442

@@ -478,17 +487,24 @@ def _calc_duct_temp(self, temp_gap, htc_gap, adiabatic=False):
478487

479488
else:
480489
# Update coolant parameters and material properties
481-
self._update_coolant_params(self.avg_coolant_int_temp)
490+
# self._update_coolant_params(self.avg_coolant_int_temp)
482491
self.duct.update(self.avg_duct_mw_temp[0])
483492
L_over_2 = self.duct_thickness / 2
493+
# c1 = (self.coolant_params['htc']
494+
# * (temp_gap - self.temp['coolant_int'])
495+
# / (self.coolant_params['htc'] * self.duct_thickness
496+
# + (self.duct.thermal_conductivity
497+
# * (1 + self.coolant_params['htc'] / htc_gap[1]))))
498+
# c2 = (temp_gap
499+
# - c1 * (L_over_2
500+
# + self.duct.thermal_conductivity / htc_gap[1]))
484501
c1 = (self.coolant_params['htc']
485502
* (temp_gap - self.temp['coolant_int'])
486503
/ (self.coolant_params['htc'] * self.duct_thickness
487504
+ (self.duct.thermal_conductivity
488-
* (1 + self.coolant_params['htc'] / htc_gap[1]))))
505+
* (1 + self.coolant_params['htc'] / htc_gap))))
489506
c2 = (temp_gap
490-
- c1 * (L_over_2
491-
+ self.duct.thermal_conductivity / htc_gap[1]))
507+
- c1 * (L_over_2 + self.duct.thermal_conductivity / htc_gap))
492508
self.temp['duct_mw'][0] = c2
493509
self.temp['duct_surf'][0, 0] = c1 * -L_over_2 + c2
494510
self.temp['duct_surf'][0, 1] = c1 * L_over_2 + c2

tests/test_assembly.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# permissions and limitations under the License.
1515
########################################################################
1616
"""
17-
date: 2021-04-02
17+
date: 2021-05-26
1818
author: matz
1919
Test the DASSH Assembly object
2020
"""
@@ -73,7 +73,8 @@ def test_temperature_unrodded_asm(c_shield_asm):
7373
# Try calculating temperature; shouldn't fail
7474
dz = 0.005
7575
tgap = np.ones(6) * 623.15
76-
htc_gap = [1e5, 1e5]
76+
htc_gap = np.ones(6) * 1e5
77+
c_shield_asm.active_region._update_coolant_params(623.15)
7778
c_shield_asm.calculate(dz, dz, tgap, htc_gap)
7879
assert c_shield_asm.avg_coolant_temp > 623.15
7980

tests/test_inputs/VARPOW.out

-69.9 KB
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
########################################################################
2+
# author: Milos Atz
3+
# date: 2021-05-26
4+
# comment: DASSH input example (2 rings, but only 2 assemblies)
5+
########################################################################
6+
# SETUP: Problem setup, user options, etc
7+
8+
[Setup]
9+
[[Units]]
10+
temperature = Celsius
11+
length = cm
12+
mass_flow_rate = kg/s
13+
[[Options]]
14+
calc_energy_balance = True
15+
[[Dump]]
16+
coolant = True
17+
gap = True
18+
gap_fine = True
19+
duct = True
20+
21+
22+
########################################################################
23+
# NEUTRONICS AND GEOMETRY FILES
24+
25+
[ARC]
26+
pmatrx = ../test_data/seven_asm_vac/PMATRX
27+
geodst = ../test_data/seven_asm_vac/GEODST
28+
ndxsrf = ../test_data/seven_asm_vac/NDXSRF
29+
znatdn = ../test_data/seven_asm_vac/ZNATDN
30+
labels = ../test_data/seven_asm_vac/LABELS
31+
nhflux = ../test_data/seven_asm_vac/NHFLUX
32+
ghflux = ../test_data/seven_asm_vac/GHFLUX
33+
34+
35+
########################################################################
36+
# CORE DETAILS: Describe characteristics of the reactor core
37+
38+
[Core]
39+
coolant_inlet_temp = 350.0
40+
fuel_material = metal
41+
fuel_alloy = zr
42+
coolant_heating = sodium
43+
coolant_material = sodium_se2anl_425
44+
length = 375.0
45+
assembly_pitch = 12.0
46+
bypass_fraction = 0.1
47+
gap_model = flow
48+
power_model = pin_only
49+
total_power = 0.0
50+
51+
52+
########################################################################
53+
# ASSEMBLY DETAILS: Describe a group of assemblies
54+
# NAME identifies a group of assemblies (e.g. "INNER_DRIVER")
55+
# Can be repeated for as many assemblies as required by the user.
56+
57+
[Assembly]
58+
59+
[[fuel]]
60+
num_rings = 3
61+
pin_pitch = 2.4200
62+
pin_diameter = 2.0000
63+
clad_thickness = 0.0500
64+
wire_pitch = 20.000
65+
wire_diameter = 0.4100
66+
duct_ftf = 11.25, 11.75
67+
duct_material = HT9_se2anl_425
68+
69+
[[other]]
70+
num_rings = 5
71+
pin_pitch = 1.37
72+
pin_diameter = 1.13
73+
clad_thickness = 0.05
74+
wire_pitch = 20.0
75+
wire_diameter = 0.24
76+
duct_ftf = 11.25, 11.75
77+
duct_material = HT9_se2anl_425
78+
use_low_fidelity_model = True
79+
convection_factor = 1.0
80+
81+
82+
########################################################################
83+
# ASSIGN assemblies to positions in the core; assign fixed
84+
# flow rates or temperature limits to one or multiple assemblies.
85+
# Indicate which assemblies must be grouped together in an orificing
86+
# calculation.
87+
88+
[Assignment]
89+
[[ByPosition]]
90+
fuel = 1, 1, 1, FLOWRATE = 1.0
91+
other = 2, 1, 1, FLOWRATE = 1.0

0 commit comments

Comments
 (0)