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

Refactor package organization

Split it up into build, process, and utils sub-packages.
Also make chan_edits off by default and no longer disable
native HDF5 edits for parallel models.
Rebaseline all tests that changed as a result.
parent 6913ec0a
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
from Model import Model
from Section import Section
from BoundaryCondition import BoundaryCondition, Mass, MassEnthalpy, MassTemperature, PressureEnthalpy, PressureTemperature
from Solid import SolidRod, HeatedSolid, UnheatedSolid, SolidGeo, Tube, FuelRod
import SaltProps
import UnitConversions
from CoreBuilder import MSRE
import InpParse
+21 −21
Original line number Diff line number Diff line
@@ -10,10 +10,10 @@ mpl.use('Agg')
import matplotlib.pyplot as plt
import matplotlib.patches as patches
import numpy as np
import SMBuilder as cdb
import Model
import SMBuilder.utils.utils as utils
import Solid
import Section
import utils


class Core(object):
@@ -85,7 +85,7 @@ class MSRE(Core):
   """
   def __init__(me, model, coreMap, sym_opt, grBlockWidth, dz, startChanIndex, chLen, chWidth, chArea, chPw, rodDomains=None):

      assert(isinstance(model, cdb.Model))
      assert(isinstance(model, Model.Model))
      assert(len(coreMap)>0)
      assert(utils.isArraySquare(coreMap))
      assert(grBlockWidth>0)
@@ -122,7 +122,7 @@ class MSRE(Core):
      # Use an equivalent diameter to get the same cross sectional area of the graphite block
      area        = grBlockWidth**2 - 2*chArea
      rodDiameter = np.sqrt( 4.0 * area / np.pi )
      me.model.addSolidType(solidTypeID=1, geoObj=cdb.SolidRod(d_outer=rodDiameter, material='graphite'))
      me.model.addSolidType(solidTypeID=1, geoObj=Solid.SolidRod(d_outer=rodDiameter, material='graphite'))

      # Add a buffer around the PinMap that is empty to make processing the map easier
      # Fill up the "array" with None
+6 −4
Original line number Diff line number Diff line
@@ -2,15 +2,17 @@
import os
myPath = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
import sys
import Model
import Section
import InpParse
sys.path.insert(0, myPath)
import SMBuilder as cdb
import numpy as np
import argparse

class InpBuilder(object):
    def __init__(me, inpFileName):
        me.model = cdb.Model()
        me.inp = cdb.InpParse.InpParse(inpFileName)
        me.model = Model.Model()
        me.inp = InpParse.InpParse(inpFileName)
        me.genModel()

    def genModel(me):
@@ -21,7 +23,7 @@ class InpBuilder(object):

        for secID in secIDs:
            Dz = me.inp.getAxialMeshLevels(secID)
            sec = cdb.Section(dz=Dz)
            sec = Section.Section(dz=Dz)
            #Add Channels
            for chID in me.inp.getChannelIDs(secID):
                sec.addChannel(chID=chID, area=me.inp.getChannelArea(chID), pw=me.inp.getChannelPw(chID), x=me.inp.getChannelxLoc(chID), y=me.inp.getChannelyLoc(chID), xsiz=me.inp.getChannelxSize(chID), ysiz=me.inp.getChannelySize(chID))
+13 −12
Original line number Diff line number Diff line
# Input Parser Base class for Input Parser Builder
import numpy as np
import SMBuilder as cdb
import BoundaryCondition as BC
import Solid
import utils
import os
import sys
@@ -319,15 +320,15 @@ class InpParse(object):
                   massflux = None

               if mdot and temperature:
                   BCs.append(cdb.MassTemperature(mdot=mdot, T=temperature['value']))
                   BCs.append(BC.MassTemperature(mdot=mdot, T=temperature['value']))
               elif mdot and enthalpy:
                   BCs.append(cdb.MassEnthalpy(mdot=mdot, h=enthalpy['value']))
                   BCs.append(BC.MassEnthalpy(mdot=mdot, h=enthalpy['value']))
               elif pressure and temperature:
                   BCs.append(cdb.PressureTemperature(pressure=pressure['value'], T=temperature['value']))
                   BCs.append(BC.PressureTemperature(pressure=pressure['value'], T=temperature['value']))
               elif pressure and enthalpy:
                   BCs.append(cdb.PressureEnthalpy(pressure=pressure['value'], h=enthalpy['value']))
                   BCs.append(BC.PressureEnthalpy(pressure=pressure['value'], h=enthalpy['value']))
               else:
                   BCs.append(cdb.Mass(mdot=mdot))
                   BCs.append(BC.Mass(mdot=mdot))
        else:
            massflux =  me.getInitialMassFlux()
            mdotin = me.getInitialmdot()
@@ -337,8 +338,8 @@ class InpParse(object):
                mdot = massflux * me.getChannelArea(chID)
            if mdotin:
                mdot = mdotin * me.getChannelArea(chID)/me.getInFlowArea()
            BCs.append(cdb.MassTemperature(mdot=mdot, T=temperature))
            BCs.append(cdb.PressureTemperature(pressure=pressure, T=temperature))
            BCs.append(BC.MassTemperature(mdot=mdot, T=temperature))
            BCs.append(BC.PressureTemperature(pressure=pressure, T=temperature))
        return BCs

    def getSolidGeoms(me):
@@ -373,7 +374,7 @@ class InpParse(object):
                raise InputError("Either Clad thickness or fuel rod inner diameter has to be defined for solid_geo:"+str(geoID))
            if tclad:
                din = dout - 2*tclad
            geo = cdb.FuelRod(d_outer=dout,d_inner=din,d_pellet=dfuel)
            geo = Solid.FuelRod(d_outer=dout,d_inner=din,d_pellet=dfuel)
        else: # tube
            if not dout:
                raise InputError("Outer tube diameter is not defined for solid_geo:"+str(geoID))
@@ -385,7 +386,7 @@ class InpParse(object):
                raise InputError("Either tube thickness or tube inner diameter has to be defined for solid_geo:"+str(geoID))
            if tclad:
                din = dout - 2*tclad
            geo = cdb.Tube(d_outer=dout,d_inner=din,material=material)
            geo = Solid.Tube(d_outer=dout,d_inner=din,material=material)
        return geo

    def getSolidIDs(me):
@@ -430,9 +431,9 @@ class InpParse(object):
        solid = me._getSolid(solidID)
        if 'axpow' in solid:
            axial_power = solid['axpow']['value']
            return cdb.HeatedSolid(x=0.0, y=0.0, powID=axial_power)
            return Solid.HeatedSolid(x=0.0, y=0.0, powID=axial_power)
        else:
            return cdb.HeatedSolid(x=0.0, y=0.0)
            return Solid.HeatedSolid(x=0.0, y=0.0)

    def getAxialPowerIDs(me):
        """ Returns the axial power IDs """
Loading