25
25
26
26
27
27
import os
28
+ import sys
28
29
import numpy as np
29
30
import dassh
30
-
31
+ from . test_reactor import save_reactor_pytest
31
32
32
33
########################################################################
33
34
# RODDED REGION PRESSURE DROP TESTS
@@ -82,7 +83,7 @@ def test_pressure_drop_w_spacer_grid(testdir):
82
83
inp = dassh .DASSH_Input (inpath )
83
84
r = dassh .Reactor (inp , path = outpath , write_output = True )
84
85
r .temperature_sweep ()
85
- r . save ( )
86
+ save_reactor_pytest ( r )
86
87
87
88
# Check results using Reactor object attributes
88
89
dh = r .assemblies [0 ].rodded .bundle_params ['de' ]
@@ -126,7 +127,14 @@ def test_pressure_drop_w_spacer_grid(testdir):
126
127
def test_pressure_drop_output_table (testdir ):
127
128
"""Test output table generation"""
128
129
outpath = os .path .join (testdir , 'test_results' , 'single_spacer' )
129
- r = dassh .reactor .load (os .path .join (outpath , 'dassh_reactor.pkl' ))
130
+ if sys .version_info < (3 , 7 ):
131
+ inp = dassh .DASSH_Input (
132
+ os .path .join (
133
+ testdir , 'test_inputs' , 'input_single_spacer.txt' ))
134
+ r = dassh .Reactor (inp , path = outpath , write_output = True )
135
+ r .temperature_sweep ()
136
+ else :
137
+ r = dassh .reactor .load (os .path .join (outpath , 'dassh_reactor.pkl' ))
130
138
r .postprocess ()
131
139
with open (os .path .join (outpath , 'dassh.out' ), 'r' ) as f :
132
140
out = f .read ()
@@ -288,11 +296,12 @@ def test_pressure_drop_w_gravity(testdir):
288
296
r = dassh .Reactor (inp , path = outpath , write_output = True )
289
297
r .temperature_sweep ()
290
298
r .postprocess ()
291
- r . save ( )
299
+ save_reactor_pytest ( r )
292
300
293
301
# Check results using Reactor object attributes
294
302
# Gravity pressure head loss = rho * g * h
295
303
g = 9.80665
304
+
296
305
# CHECK 1: Each region
297
306
for a in r .assemblies :
298
307
for reg in a .region :
@@ -307,8 +316,8 @@ def test_pressure_drop_w_gravity(testdir):
307
316
print ('Answer:' , ans )
308
317
print ('Diff:' , diff )
309
318
print (reg .coolant .density )
310
-
311
319
assert pass_test
320
+
312
321
# CHECK 2: All assemblies have same gravity head loss because
313
322
# the core height is the same for all
314
323
ref = sum (reg ._pressure_drop ['gravity' ] for reg in r .assemblies [0 ].region )
@@ -332,12 +341,12 @@ def test_pressure_drop_csv(testdir):
332
341
'input_seven_asm_gravity.txt' )
333
342
outpath = os .path .join (testdir , 'test_results' , 'seven_asm_gravity' )
334
343
csvpath = os .path .join (outpath , 'pressure_drop.csv' )
335
- if not os .path .exists (csvpath ):
344
+ if not os .path .exists (csvpath ) or sys . version_info < ( 3 , 7 ) :
336
345
inp = dassh .DASSH_Input (inpath )
337
346
r = dassh .Reactor (inp , path = outpath , write_output = True )
338
347
r .temperature_sweep ()
339
348
r .postprocess ()
340
- r . save ( )
349
+ save_reactor_pytest ( r )
341
350
else :
342
351
r = dassh .reactor .load (os .path .join (outpath , 'dassh_reactor.pkl' ))
343
352
0 commit comments