Commit 2c8b2738 authored by Salko Jr, Robert's avatar Salko Jr, Robert
Browse files

Change formatting of output file to accomodate lumped rods

Description:
For more than 99 lumped rods, the format causes numers to run into one another.
Add a test that protects the feature.

Gitlab Ticket # - XXXX
parent 73a05f17
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -455,7 +455,7 @@ def writeDeck(model, filename):
            sym = 1.0
        sections = model.getSolidSections(pinID)
        iaxp = iaxpMap.getIndex(pin.powID)
        group8Data.append("{:7d}{:7d}{:7d}{:7d}{:8d}{:7.3f}{:12.4e}{:7d}{:12.4e}{:12.4e}{:9.3f}{:7d}{:7d}{:7d}{:7d}\n".format(
        group8Data.append("{:7d}{:7d}{:7d}{:7d}{:8d}{:12.4e}{:12.4e}{:7d}{:12.4e}{:12.4e}{:9.3f}{:7d}{:7d}{:7d}{:7d}\n".format(
            intID, solidTypeMap.getIndex(
                model.solidTypeIDs[pinID]), iaxp, 0, 0, pin.mult, pin.gapConductance,
            len(sections), 0.0, 0.0, sym, 0, 0, 1, 1))
+255 −0
Original line number Diff line number Diff line
***********************************************************************************************
*MAIN CONTROL DATA
***********************************************************************************************
*ICOBRA
      1
*INITIAL   DUMPF
       1       0
**    EPSO    OITMAX    IITMAX   COURANT
  1e-4             5       200  0.800000
*TITLE
ctf model
***********************************************************************************************
*GROUP 1 - Calculation Variables and Initial Conditions
***********************************************************************************************
**NGR
   1
**NGAS IRFC EDMD IMIX ISOL          GINIT NOTRN MESH MAPS IPRP MFLX IBTM PPV  NM14
     1    2    0    3    0    1.70995e+02     1    1    0   11    0    0   7     0
*Card 1.2
**         GTOT          AFLUX         DHFRAC
      170.99460       69.79200        0.97629
*Card 1.3
**         PREF            HIN           HGIN         VFRAC1         VFRAC2
        3.44738     -908.15000 288.4200000      1.0000000      0.9999000
*Card 1.4
**GTP(1)   VFRAC(3)  GTP(2) VFRAC(4)  GTP(3) VFRAC(5)  GTP(4) VFRAC(6)
     air     0.0001
***********************************************************************************************
*GROUP 2 - Channel Description
***********************************************************************************************
**NGR
    2
*Card 2.1
**  NCH NDM2 NDM3 NDM4 NDM5 NDM6 NDM7 NDM8 NDM9 NM10 NM11 NM12 NM13 NM14
   1    0    0    0    0    0    0    0    0    0    0    0    0    0
*Card 2.2
**   I          AN          PW ABOT ATOP NMGP           X           Y        XSIZ        YSIZ
     1  1.6360e-01  4.1286e+01  0.0  0.0    0  0.0000e+00  0.0000e+00  0.0000e+00  0.0000e+00
***********************************************************************************************
*GROUP 4 - Vertical Channel Connection Data
***********************************************************************************************
**NGR
    4
*Card 4.1
**NSEC NSIM IREB NDM4 NDM5 NDM6 NDM7 NDM8 NDM9 NM10 NM11 NM12 NM13 NM14
     1    1    0    0    0    0    0    0    0    0    0    0    0    0    0
*Card 4.2
**ISEC    NCHN  NONO         DXS     IVAR
     1         1    20  1.0160e-01          0
*Card 4.4
**    I   NCHA  KCHA(:)    NCHB  KCHB(:)
      1      0
             0
*Card4.5
**  IWDE
       1
*Card 4.6
**  MSIM
      20
***********************************************************************************************
*GROUP 7 - Grid Loss Coefficient Data
***********************************************************************************************
**NGR
    7
*Card 7.1
**  NCD NGT  IFGQF IFSDRP  IFESPV  IFTPE  IGTEMP  NFBS  NDM9 NDM10 NDM11 NDM12 NDM13 NDM14
      0   0      0      0       0      0       0     0     0     0     0     0     0     0
*Card 7.2
**   CDL    J   CD1   CD2   CD3   CD4   CD5   CD6   CD7   CD8   CD9  CD10  CD11  CD12
***********************************************************************************************
*GROUP 8 - Rod and Unheated Conductor Data
***********************************************************************************************
**NGR
    8
*Card 8.1
** NRRD   NSRD    NC  NRTB  NRAD  NLTY  NSTA   NXF  NCAN  RADF    W3 IHTC  DNBCHK NDM14
      1      0     1     1     0     0     1     1     0     0    -1     1     1     0
*Card 8.2
**    N   IFTY   IAXP   NRND DAXMIN       RMULT         HGAP  ISECR       HTAMB        TAMB  SYMROD  HTCMAP TKEMAP NSUBAX NSUBAZ
*Card 8.3
**NSCH   PIE  NSCH   PIE  NSCH   PIE  NSCH   PIE  NSCH   PIE  NSCH   PIE  NSCH   PIE NSCH   PIE
      1      1      1      0       0  5.6900e+02  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     1 1.000     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000     0 0.000
*Card 8.5
**    N   ISTYP      HPERIM     HPERIMI       RMULS  NOSLCH  NSLCHC       HTAMBS        TAMBS
*Card 8.6
**    I   NRT1   NST1   NRX1
      1      1      0      2
*Card 8.7
**IRTB1  IRTB2  IRTB3  IRTB4  IRTB5  IRTB6  IRTB7  IRTB8  IRTB9 IRTB10 IRTB11 IRTB12
      1
*Card 8.8
**ISTB1  ISTB2  ISTB3  ISTB4  ISTB5  ISTB6  ISTB7  ISTB8  ISTB9 ISTB10 ISTB11 ISTB12
*Card 8.9
**    AXIALT      TRINIT
 0.00000e+00 9.08150e+02
 2.03200e+00 9.08150e+02
***********************************************************************************************
*GROUP 9 - Conductor Geometry Description
***********************************************************************************************
**NGR
    9
*Card 9.1
** NFLT IRLF ICNF IMWR NDM5 NDM6 NDM7 NDM8 NDM9 NM10 NM11 NM12 NM13 NM14
      1    0    0    0    0    0    0    0    0    0    0    0    0    0
*Card 9.6
**  I FTYP           DROD            DIN   NFUL IMTF IMTC DUM8 DUM9  DUM10  DUM11  DUM12  DUM13  DUM14  EPSO
    1 hrod   5.053314e-02    0.00000e+00      1    0    0    0   0       0     0     0      0    0    0.0
*Card 9.7
** NODER  MATR          TREG   QREG
       3     1  2.526657e-02  1.0
***********************************************************************************************
*GROUP 10 - Material Properties Tables
***********************************************************************************************
*NGRP
   10
*NMAT NDM2 NDM3 NDM4 NDM5 NDM6 NDM7 NDM8 NDM9 NM10 NM11 NM12 NM13 NM14
     1    0    0    0    0    0    0    0    0    0    0    0    0    0
*   N NTDP     RCOLD              IMATAN
     1   20  1740.000            graphite
*    TPROP      CPF1      THCF
    250.00    0.5948  177.6810
    337.50    0.8370  155.8017
    425.00    1.0473  138.9136
    512.50    1.2283  125.4402
    600.00    1.3823  114.4129
    687.50    1.5118  105.2023
    775.00    1.6192   97.3804
    862.50    1.7069   90.6458
    950.00    1.7775   84.7795
   1037.50    1.8332   79.6184
   1125.00    1.8766   75.0385
   1212.50    1.9101   70.9437
   1300.00    1.9361   67.2582
   1387.50    1.9570   63.9215
   1475.00    1.9753   60.8846
   1562.50    1.9934   58.1076
   1650.00    2.0137   55.5572
   1737.50    2.0387   53.2058
   1825.00    2.0708   51.0303
   1912.50    2.1124   49.0109
*
***********************************************************************************************
*GROUP 11 - Core Power Distribution Information
***********************************************************************************************
*NGR group number
   11
**Card 11.1
* NQA  NAXP  MNXN    NQ NGPFF   NQR  NDM7  NDM8  NDM9 NDM10 NDM11 NDM12 NDM13 NDM14
    1     1     2     0     0     1     0     0     0     0     0     0     0     0
**Card 11.2
*           YQA
    0.00000e+00
**Card 11.3
*     I   NAXN
      1      2
**Card 11.4
*             Y         AXIALZ
    0.00000e+00    1.00000e+00
    2.03200e+00    1.00000e+00
**Radial power profile forcing function
**Card 11.7
*          YQR
    0.00000E+00
**Card 11.8
*    FQR1      FQR2      FQR3      FQR4      FQR5      FQR6      FQR7      FQR8
   1.00000
***********************************************************************************************
*GROUP 12 - Turbulent Mixing and Void Drift Data
***********************************************************************************************
**NGR
   12
*Card 12.2
**    AAAK      BETA     THETM
 0.140E+01 3.700e-02 0.500E+01
***********************************************************************************************
*GROUP 13 -  Boundary Condition Data
***********************************************************************************************
*NGR group number
   13
**Card 13.1
* NBND   NKBD NFUN NGBD VBC  NDM6 NDM7 NDM8 NDM9 NM10 NM11 NM12 NM13 NM14
     2      0    0    0  0    0    0    0    0    0    0    0    0    0
*Card 13.2
** NPTS
*Card 13.3
**Card 13.4
* IBD1   IBD2 ISPC N1FN N2FN N3FN     BCVALUE1     BCVALUE2     BCVALUE3 INITGAS
     1      1    2    0    0    0  1.70995e+02 -9.08150e+02  0.00000e+00       1
     1     22    1    0    0    0  0.00000e+00 -9.08150e+02  3.44738e+00       1
***********************************************************************************************
*GROUP 14 - Output Options
***********************************************************************************************
**NGR
  -14
**               KEY     VALUE
           rod_edits         0
             rod_vtk         0
         native_hdf5         1
           fluid_vtk         0
           dnb_edits         0
          chan_edits         0
                hdf5         0
         convergence         1
           gap_edits         0
end 14
***********************************************************************************************
*GROUP 15 - Time Domain Data
***********************************************************************************************
**NGR
   15
*Card 15.1
**        DTMIN          DTMAX           TEND          EDINT         DMPINT          RTWFP     MAXITS
    1.00000e-06    1.00000e-01     1.0000E-01  0.0000E+00  0.0000E+00     1.000000e+02      10000
***********************************************************************************************
*GROUP 19 - convergence Criteria for Steady State Solve
***********************************************************************************************
**NGR
   19
** Normalized l-infinity of checked solution terms must go below these tolerances for the case
** to be considered steady state.  The code converges if the following is true for each checked
** solution term:
**
**   abs((X-Xn))<=max(rtol*abs(Xn),atol)
**
** In this equation, 'X' is a vector of the checked solution terms from the current checkpoint
** and 'Xn' is the vector of the same solution terms, but from the previous checkpoint.  Checks
** are made every 0.05 seconds in the transient.  The relative tolerances are defined on Card
** 19.1 and the absolute tolerances are defined on Card 19.2.  This check is done for pressure,
** fluid temperature, solid temperature, and the three components of axial velocity.  There is
** also a check on void, but it does not invole the relative check because void is a
** dimensionless value; only the absolute check is done.
**
** The final check involves checking that the mass and energy balance over the system is below
** a tolerance as well.
** Balance of mass ((mass_in-mass_out)/mass_in) and balance of energy ((energy_in-energy_out)/
** energy_in) must go below tolerance values defined on Card 19.3 for case to be considered
** steady state.
*Card 19.1 - relative stopping criteria [unitless]
** LIPRESS   LITCOOL  LITSOLID      LIVL      LIVV      LIVD
 1.000e-03 1.000e-03 1.000e-03 1.000e-03 1.000e-03 1.000e-03
*Card 19.2 - absolute stopping criteria [pressure in psia|bar, velocity in ft/s|m/s,
** and temperature in F|C]
** LIAVOID  LIAPRESS  LIATCOOL LIATSOLID     LIAVL     LIAVV     LIAVD
 1.000e-04 1.000e-04 1.000e-04 1.000e-04 1.000e-04 1.000e-04 1.000e-04
*Card 19.2   [%]
** ENERGYBAL     MASSBAL
   1.000000e-01   1.000000e-01
*Card 19.4   [%]
** L2PRESS   L2TCOOL  L2TSOLID      L2VL      L2VV      L2VD
*Card 19.5 - absolute stopping criteria [pressure in psia|bar, velocity in ft/s|m/s,
 1.000e-04 1.000e-04 1.000e-04 1.000e-04 1.000e-04 1.000e-04
** and temperature in F|C]
** L2AVOID  L2APRESS  L2ATCOOL L2ATSOLID     L2AVL     L2AVV     L2AVD
 1.000e-04 1.000e-04 1.000e-04 1.000e-04 1.000e-04 1.000e-04 1.000e-04
+79 −0
Original line number Diff line number Diff line
# This is a single-channel model of the MSRE core region
# Tests:
# - Ability to lump rods together
import sys
import SubKit.build as skb
import SubKit.utils.UnitConversions as units
import numpy as np


def main():
    height = 2.032 # m
    nLev = 20
    numChan = 569 # number of flow paths in the MSRE core
    numRods = 569 # These are graphite blocks.  Needed for getting heat input into the model.
    inletTemp = units.F2K(1175.0)
    outletPressure = 3.44738 # bar
    inletFlow = 170.9946  # kg/s
    qPrime = 69.792  # kW/m
    dhfrac = 0.97629 # Set the direct heating high so most heat goes directly to the coolant
    # Calculate the flow area of a single flow path [m]
    chRadius = 0.2 * units.t_in_m
    chWidth = chRadius * 2
    chHeight = (2.0 - 2 * 0.4) * units.t_in_m
    chArea = (chHeight - 2 * chRadius) * chWidth + np.pi * chRadius**2

    # The wetted perimeter of a flow path [m]
    chPw = 2 * np.pi * chRadius + (chHeight - 2 * chRadius) * 2
    chPw = chPw

    model = skb.Model()
    model.setFluidProperties('flibe')

    def grCp(T):
        ''' Returns graphite specific heat in J/kg/K '''
        return 6.05e-7 * T**3 - 0.00269 * T**2 + 4.19 * T - 294

    def grK(T):
        ''' Returns graphite thermal conductivity in W/m/K'''
        return -13.2 + 2.5e4 / (T + 268)**0.78

    model.addMaterial('graphite', grCp, grK, 1740.0)

    section = skb.Section(nLev=nLev, height=height)
    section.addChannel(chID=1, area=chArea*numChan, pw=chPw*numChan)
    model.addSection(secID=1, section=section)

    # Assume a uniform axial power shape

    # Attach fluid channel to a single heated rod with graphite properites
    # The graphite blocks are 2cm by 2cm.  Calculate the area and an equivalent rod diameter, since CTF can
    # only model rod geometry
    grBlockWidth = 2 * units.t_in_cm * units.t_cm_m  # m
    area = grBlockWidth**2 - 2 * chArea
    rodDiameter = np.sqrt(4.0 * area / np.pi)
    model.addSolidType(solidTypeID=1, geoObj=skb.SolidRod(
            d_outer=rodDiameter, material='graphite'))
    pinobj = skb.HeatedSolid(mult=float(numRods))
    model.addSolid(solidID=1, solidTypeID=1, solidObject=pinobj)
    model.addSolidOuterChan(solidID=1, chID=1, percent=1.0)


    # Apply the boundary condition
    model.addBoundaryCondition(bc=skb.MassTemperature(
        mdot=inletFlow, T=inletTemp), chID=1, lev=1)
    model.addBoundaryCondition(bc=skb.PressureTemperature(
        pressure=outletPressure, T=inletTemp), chID=1, lev=nLev + 2)

    model.setAveragePower(qprime=qPrime, dhfrac=dhfrac)
    model.setInitial(mdot=inletFlow, temp=inletTemp,
                     pressure=outletPressure)
    model.setSolver('direct')
    model.setEditOptions(chanVTK=False, rodVTK=False, ctfHDF5=True, veracsHDF5=False, chanASCII=False,
                         rodEdits=False, dnbEdits=False)

    model.generateModel()


if __name__ == "__main__":
    main()
+1 −0
Original line number Diff line number Diff line
@@ -66,6 +66,7 @@ runScriptTest "scriptRegression/tubeFlow" "make_deck.py" "$rebaseline"
runScriptTest "scriptRegression/case1" "make_deck.py" "$rebaseline"
runScriptTest "scriptRegression/case2" "make_deck.py" "$rebaseline"
runScriptTest "scriptRegression/case3" "make_deck.py" "$rebaseline"
runScriptTest "scriptRegression/case4" "make_deck.py" "$rebaseline"

# Put these at the end because they take forever
runScriptTest "mcfr" "coreRegion.py" "$rebaseline"