Commit 839ed8a4 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. Additionally, the fuel rod gap conductance should be set to 0.0 if the dynamic gap model is being used.

Gitlab Ticket # - 4654
parent 73a05f17
Loading
Loading
Loading
Loading
+33 −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():
@@ -1731,8 +1731,15 @@ class Model:
                        if pinObj.gapConductance <= 0.0:
                            raise RuntimeError(
                                "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))
                    else:
                        # Set to reasonable default
                        if geom.gapModel == 'dynamic':
                            pinObj.gapConductance = 0.0
                        else:
                            pinObj.gapConductance = DEFAULT_FUEL_ROD_GAP_CONDUCTANCE
                else:
                    # This is not a fuel rod, so the gap conductance should be zero
@@ -1892,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

@@ -1994,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"""
@@ -2062,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
+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))
+10 −10
Original line number Diff line number Diff line
@@ -382,23 +382,23 @@ ctf model
**    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  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      1      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     1 0.250     2 0.250     5 0.250     6 0.250     0 0.000     0 0.000     0 0.000     0 0.000
      2      1      1      0       0  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      2      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     2 0.250     3 0.250     6 0.250     7 0.250     0 0.000     0 0.000     0 0.000     0 0.000
      3      1      1      0       0  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      3      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     3 0.250     4 0.250     7 0.250     8 0.250     0 0.000     0 0.000     0 0.000     0 0.000
      4      1      1      0       0  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      4      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     5 0.250     6 0.250     9 0.250    10 0.250     0 0.000     0 0.000     0 0.000     0 0.000
      5      1      1      0       0  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      5      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     6 0.250     7 0.250    10 0.250    11 0.250     0 0.000     0 0.000     0 0.000     0 0.000
      6      1      1      0       0  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      6      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     7 0.250     8 0.250    11 0.250    12 0.250     0 0.000     0 0.000     0 0.000     0 0.000
      7      1      1      0       0  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      7      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
     9 0.250    10 0.250    13 0.250    14 0.250     0 0.000     0 0.000     0 0.000     0 0.000
      8      1      1      0       0  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      8      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
    10 0.250    11 0.250    14 0.250    15 0.250     0 0.000     0 0.000     0 0.000     0 0.000
      9      1      1      0       0  1.000  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      9      1      1      0       0  1.0000e+00  0.0000e+00      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
    11 0.250    12 0.250    15 0.250    16 0.250     0 0.000     0 0.000     0 0.000     0 0.000
*Card 8.5
**    N   ISTYP      HPERIM     HPERIMI       RMULS  NOSLCH  NSLCHC       HTAMBS        TAMBS
+773 −773

File changed.

Preview size limit exceeded, changes collapsed.

+2 −2
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ ctf model
**    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  1.000  5.7000e+03      1  0.0000e+00  0.0000e+00    1.000      0      0      1      1
      1      1      1      0       0  1.0000e+00  5.7000e+03      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
Loading