Commit 75214af0 authored by Salko Jr, Robert's avatar Salko Jr, Robert
Browse files

Add better testing for the dnb summary script

Found two issues.  1) inlet temp was not actually being calculated from
the inlet and 2) inlet mass flux was not actually being calculated from
the inlet.  Both terms were being taken from the outlet.
parent a7316f05
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -148,10 +148,10 @@ class SummaryTools(object):
            sysPressure = me.h5.getAvePressure(state=state)
            if convert:
                sysPressure = sysPressure*t_bar_psi
            inletTemp = me.h5.getAveTemp(state=state)
            inletTemp = me.h5.getAveTemp(state=state, section=1, level=0)
            if convert:
                inletTemp = C2F(inletTemp)
            inletMflux = me.h5.getAveMassFlux(state=state)
            inletMflux = me.h5.getAveMassFlux(state=state, section=1, level=0)
            if convert:
                inletMflux = inletMflux*t_kg_lbm/t_m_ft**2/t_s_hr
            if convert:
(96.5 KiB)

File changed.

No diff preview for this file type.

+28 −0
Original line number Diff line number Diff line
@@ -16,6 +16,34 @@ class test_SummaryTools(unittest.TestCase):
       me.obj.genDNBSummary()
       me.assertTrue(os.path.isfile(name))

       # Make sure file contents are right
       f = open(name)
       lines = f.readlines()
       state1 = lines[5].split()
       state2 = lines[6].split()
       me.assertAlmostEqual(float(state1[0]), 155.0) # outlet pressure
       me.assertAlmostEqual(float(state1[1]), 292.71) # inlet temp
       numCh = 5
       coreArea = 8.536799999999999E-5*numCh
       inletMdotLiq = 0.2987878096096817*numCh
       inletMdotVap = 4.099618941285623E-8*numCh
       inletMdotDrp = 1.4939412889603416E-7*numCh
       inletMdot = inletMdotLiq+inletMdotVap+inletMdotDrp
       me.assertAlmostEqual(float(state1[2]), inletMdot/coreArea) # inlet mass flux
       me.assertAlmostEqual(float(state1[3]), 100.0) # dnbr - SummaryTools limits it to 100
       me.assertEqual(int(state1[4]), 7) # hot channel (corresponds to location of mdnbr)
       me.assertEqual(int(state1[5]), 1) # hot rod (where mdnbr occurs)

       # MDNBR happens at rod 1, level 5.
       # Channel 1/2 connects to levels 0 through 4 of the rod
       # Channel 6/7 connects to levels 5 through 7
       # The level getter gives back the scalar channel level adjacent the rod level, which will
       # be level 1 (0-based), this will correspond to the second momentum level of the channel (also 1)
       me.assertAlmostEqual(float(state1[6]), 1.25) # axial location
       me.assertAlmostEqual(float(state1[7]), round(0.32/8.536799999999999E-5, 1)) # mass flux
       me.assertAlmostEqual(float(state1[8]), round(-0.3435701294518748, 5)) # equilibrium quality
       me.assertAlmostEqual(float(state1[9]), round(9.673280499759728, 4)) # equilibrium quality

       name = 'customdnb.txt'
       if os.path.isfile(name): os.remove(name)
       me.obj.genDNBSummary(fname=name)