Commit 8b85fe1a authored by Gurecky, William's avatar Gurecky, William
Browse files

adds fmu transform msr test case

parent 83bf211e
Loading
Loading
Loading
Loading
+89 −0
Original line number Diff line number Diff line
# This is a single-channel model of the MSRE core region
# with coupled transform system model
# Tests:
# - Ability to lump rods together and to couple with system code
import sys
import os
import zipfile
sys.path.insert(0, '../../../')
import SubKit.build as skb
import SubKit.utils.UnitConversions as units
import numpy as np
pwd = os.path.dirname(os.path.abspath(__file__))


def main():
    height = 2.032  # m
    nLev = 20
    numChan = 569  # number of flow paths in the MSRE core
    # These are graphite blocks.  Needed for getting heat input into the model.
    numRods = 569
    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)

    unzipDir = pwd + '/transform_fmus/MSRE_HX_wPiping_v2_rev3_mflowpump'
    with zipfile.ZipFile(pwd + '/transform_fmus/MSRE_HX_wPiping_v2_rev3_mflowpump.fmu', 'r') as zip_ref:
        zip_ref.extractall(unzipDir)
    model.setExtSystemOptions(fmuUnzipDir=unzipDir)

    model.generateModel()


if __name__ == "__main__":
    main()