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

Autopep

parent 2bf44a60
Loading
Loading
Loading
Loading
+24 −24
Original line number Diff line number Diff line
@@ -342,7 +342,8 @@ class Model:
            raise RuntimeError("`setInitialConditionsMassFlux` already called")
        warnings.warn(
            "`setInitialConditionsMassFlux` has been deprecated.  Switch to using `setInitial` instead..", Warning)
        me.setInitial(massflux=massFluxInit, temp=tempInit, pressure=pressureInit)
        me.setInitial(massflux=massFluxInit,
                      temp=tempInit, pressure=pressureInit)
        me.setInitialConditionsMassFluxCalled = True

    def setInitial(me, **kwargs):
@@ -421,7 +422,6 @@ class Model:

        me.setInitialCalled = True


    def setAveragePower(me, qprime, dhfrac=0.0):
        """ Set the average linear heat rate applied to the model.

@@ -1119,15 +1119,15 @@ class Model:

        if chfModel is not None:
            if chfModel not in valid:
                raise ValueError("The selected CHF model: "
                                 + str(chfModel) + " is not valid")
                raise ValueError("The selected CHF model: " +
                                 str(chfModel) + " is not valid")
            me.conductorOptions['chfModel'] = chfModel
            me.conductorOptionsSet['chfModel'] = True

        if postChfCheck is not None:
            if postChfCheck not in valid:
                raise ValueError("The selected CHF model: "
                                 + str(postChfCheck) + " is not valid")
                raise ValueError("The selected CHF model: " +
                                 str(postChfCheck) + " is not valid")
            me.conductorOptions['postChfCheck'] = postChfCheck
            me.conductorOptionsSet['postChfCheck'] = True

@@ -1288,8 +1288,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):
@@ -1412,8 +1412,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
@@ -1492,8 +1492,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():
@@ -1668,8 +1668,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

@@ -1770,30 +1770,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"""
@@ -1838,8 +1838,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
+2 −1
Original line number Diff line number Diff line
@@ -51,7 +51,8 @@ def main():
        pressure=30.0, h=3.05035e+02), chID=1, lev=nLev + 2)

    model.setAveragePower(qprime=31.41593)
    model.setInitial(massflux=1000.0, enthalpy=3.05035e+02, pressure=30.0, temp_solid=233.85845)
    model.setInitial(massflux=1000.0, enthalpy=3.05035e+02,
                     pressure=30.0, temp_solid=233.85845)
    model.setSolver('direct')
    model.setFluidProperties('asme_1968')
    model.setEditOptions(chanVTK=False, rodVTK=False, ctfHDF5=True, veracsHDF5=False, chanASCII=False,
+1 −1

File changed.

Contains only whitespace changes.