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

autopep

parent d15e594f
Loading
Loading
Loading
Loading
+27 −26
Original line number Diff line number Diff line
@@ -1346,12 +1346,12 @@ class Model:
            if type(value) is not type(me.conductorOptions[name]['value']):
                # Assume all entries must have the same type as the
                # default entry set in this class.
                raise TypeError(name + " must be " + str(type(me.conductorOptions[name]['value']))
                                + " but it was provided as " + str(type(value)))
                raise TypeError(name + " must be " + str(type(me.conductorOptions[name]['value'])) +
                                " but it was provided as " + str(type(value)))
            if value not in me.conductorOptions[name]['validEntries']:
                raise ValueError("The value provided for " + name + " (" + str(value) +
                                 ") is not one of the valid values: " +
                                 str(me.conductorOptions[name]['validEntries']))
                raise ValueError("The value provided for " + name + " (" + str(value)
                                 + ") is not one of the valid values: "
                                 + str(me.conductorOptions[name]['validEntries']))
            me.conductorOptions[name]['value'] = value
            me.conductorOptions[name]['set'] = True

@@ -1512,8 +1512,8 @@ class Model:
        sec1 = me.getSectionOfChannel(me.gaps[gapID].ii)
        sec2 = me.getSectionOfChannel(me.gaps[gapID].jj)
        if sec1 != sec2:
            raise RuntimeError("Gap {:d} connects Channels {:d} and {:d} which are in different sections " +
                               "{:d} and {:d}.  This is not allowed".format(gapID, me.gaps[gapID].ii, me.gaps[gapID].jj, sec1, sec2))
            raise RuntimeError("Gap {:d} connects Channels {:d} and {:d} which are in different sections "
                               + "{:d} and {:d}.  This is not allowed".format(gapID, me.gaps[gapID].ii, me.gaps[gapID].jj, sec1, sec2))
        return sec1

    def getSectionOfChannel(me, chID):
@@ -1636,8 +1636,8 @@ class Model:
        if me.channelsInDomain:
            # Make sure same number of domains were defined for rods
            if len(me.channelsInDomain) != len(me.rodsInDomain):
                raise RuntimeError("Number of domains defined for channels " + len(me.channelsInDomain) +
                                   " must equal number of domains defined for rods " + len(me.rodsInDomain))
                raise RuntimeError("Number of domains defined for channels " + len(me.channelsInDomain)
                                   + " must equal number of domains defined for rods " + len(me.rodsInDomain))
            rodDomains = sorted(me.rodsInDomain.keys())
            chanDomains = sorted(me.channelsInDomain.keys())
            # Domain numbering must start at 1 and increase sequentially
@@ -1716,8 +1716,8 @@ class Model:
                if obj.material:
                    # A material was defined for this solid type
                    if obj.material not in me.materials:
                        raise RuntimeError("The material: " + str(obj.material) +
                                           " defined for solid type " + str(key) + " was not defined in the model.")
                        raise RuntimeError("The material: " + str(obj.material)
                                           + " defined for solid type " + str(key) + " was not defined in the model.")

        # Set gap conductance to default value if not set by user
        for solidID in me.solidObjects.keys():
@@ -1733,7 +1733,8 @@ class Model:
                                "Gap conductance for pin " + str(solidID) + " is invalid: " + str(pinObj.gapConductance))
                        # Cannot use the dynamic gap model if gap conductance was manually set
                        if geom.gapModel == 'dynamic':
                            raise RuntimeError("Cannot set gap conductance for pin: "+str(solidID)+" which uses a solid geometry that uses the dynamic gap model: "+str(solidTypeID))
                            raise RuntimeError("Cannot set gap conductance for pin: " + str(
                                solidID) + " which uses a solid geometry that uses the dynamic gap model: " + str(solidTypeID))
                    else:
                        # Set to reasonable default
                        if geom.gapModel == 'dynamic':
@@ -1898,8 +1899,8 @@ class Model:
        def getPressureBCOutlet(ch, topLev):
            """ Returns the pressure of the outlet BC if the channel has one"""
            for i, bc in enumerate(ch.bcLevels):
                if ch.bcLevels[i] == topLev and (isinstance(ch.bcs[i], BoundaryCondition.PressureTemperature) or
                                                 isinstance(ch.bcs[i], BoundaryCondition.PressureEnthalpy)):
                if ch.bcLevels[i] == topLev and (isinstance(ch.bcs[i], BoundaryCondition.PressureTemperature)
                                                 or isinstance(ch.bcs[i], BoundaryCondition.PressureEnthalpy)):
                    return ch.bcs[i].pressure
            return None, None

@@ -2000,30 +2001,30 @@ class Model:
                gapSectionBelow = me.getSectionOfGap(gapBelow)
                # Make sure the section of the gap below is actually the section below this gap's section
                if gapSectionBelow != gapSection - 1:
                    raise RuntimeError("Gap {:d} connects to Gap {:d} below, but Gap {:d} is in Section {:d} and " +
                                       "Gap {:d} is in Section {:d}, which are not correctly axially aligned".format(gapID,
                    raise RuntimeError("Gap {:d} connects to Gap {:d} below, but Gap {:d} is in Section {:d} and "
                                       + "Gap {:d} is in Section {:d}, which are not correctly axially aligned".format(gapID,
                                                                                                                     gapBelow, gapID, gapSection, gapBelow, gapSectionBelow))
                # If the gap below does not have gapAbove set to be consistent with this one, set it
                if me.gaps[gapBelow].gapAbove == 0:
                    me.gaps[gapBelow].gapAbove = gapID
                # If the gap below was set, but is not equal to this gapID, throw an error
                if me.gaps[gapBelow].gapAbove != gapID:
                    raise RuntimeError("Gap {:d} had gapAbove set to {:d}, but this is not consistent with what " +
                                       "gapBelow was set to for {:d}".format(gapBelow, me.gaps[gapBelow].gapAbove, gapID))
                    raise RuntimeError("Gap {:d} had gapAbove set to {:d}, but this is not consistent with what "
                                       + "gapBelow was set to for {:d}".format(gapBelow, me.gaps[gapBelow].gapAbove, gapID))
            gapAbove = me.gaps[gapID].gapAbove
            if gapAbove != 0:
                gapSectionAbove = me.getSectionOfGap(gapAbove)
                if gapSectionAbove != gapSection + 1:
                    raise RuntimeError("Gap {:d} connects to Gap {:d} above, but Gap {:d} is in Section {:d} and " +
                                       "Gap {:d} is in Section {:d}, which are not correctly axially aligned".format(gapID,
                    raise RuntimeError("Gap {:d} connects to Gap {:d} above, but Gap {:d} is in Section {:d} and "
                                       + "Gap {:d} is in Section {:d}, which are not correctly axially aligned".format(gapID,
                                                                                                                     gapAbove, gapID, gapSection, gapAbove, gapSectionAbove))
                # If the gap above does not have gapAbove set to be consistent with this one, set it
                if me.gaps[gapAbove].gapBelow == 0:
                    me.gaps[gapAbove].gapBelow = gapID
                # If the gap above was set, but is not equal to this gapID, throw an error
                if me.gaps[gapAbove].gapBelow != gapID:
                    raise RuntimeError("Gap {:d} had gapBelow set to {:d}, but this is not consistent with what " +
                                       "gapAbove was set to for {:d}".format(gapAbove, me.gaps[gapAbove].gapBelow, gapID))
                    raise RuntimeError("Gap {:d} had gapBelow set to {:d}, but this is not consistent with what "
                                       + "gapAbove was set to for {:d}".format(gapAbove, me.gaps[gapAbove].gapBelow, gapID))

    def _validateBoundaryConditions(me):
        """ Ensure boundary conditions were setup correctly"""
@@ -2068,8 +2069,8 @@ class Model:
                sections.append(me.getSectionOfChannel(ch))
            unique = list(set(sections))
            if len(innerChan) > 0 and len(unique) > 1:
                raise RuntimeError("For solidID: " + str(solidID) +
                                   " has internal connections and exists in multiple sections, which is not currently allowed.")
                raise RuntimeError("For solidID: " + str(solidID)
                                   + " has internal connections and exists in multiple sections, which is not currently allowed.")
            # Loop through each section connected to this rod
            for u in unique:
                # In each section, ensure that all percentages of connections add up to 1.0
+8 −8
Original line number Diff line number Diff line
@@ -11,7 +11,8 @@ 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.
    # 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
@@ -58,7 +59,6 @@ def main():
    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)