Loading SubKit/build/Model.py +22 −22 Original line number Diff line number Diff line Loading @@ -1024,15 +1024,15 @@ class Model: if chfModel: 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: 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 Loading Loading @@ -1193,8 +1193,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): Loading Loading @@ -1317,8 +1317,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 Loading Loading @@ -1397,8 +1397,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(): Loading Loading @@ -1577,8 +1577,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 Loading Loading @@ -1679,30 +1679,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""" Loading Loading @@ -1747,8 +1747,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 Loading Loading
SubKit/build/Model.py +22 −22 Original line number Diff line number Diff line Loading @@ -1024,15 +1024,15 @@ class Model: if chfModel: 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: 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 Loading Loading @@ -1193,8 +1193,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): Loading Loading @@ -1317,8 +1317,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 Loading Loading @@ -1397,8 +1397,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(): Loading Loading @@ -1577,8 +1577,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 Loading Loading @@ -1679,30 +1679,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""" Loading Loading @@ -1747,8 +1747,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 Loading