Loading SubKit/build/CoreBuilder.py +38 −10 Original line number Diff line number Diff line Loading @@ -21,8 +21,11 @@ import Section class Core(object): """ Base class for building core maps.""" def __init__(me): me._model = None def __init__(me, model, dz, core_sym): me.model = model me.dz = dz me.core_sym = core_sym me._isinit = True def getSection(me): """ Returns the Section object that contains the core. """ Loading Loading @@ -64,6 +67,11 @@ class Core(object): return me.core_ch ### Core Base Attributes ### @property def isinit(me): """ Initialization boolian flag. """ return me._isinit @property def model(me): """ Model container """ Loading @@ -79,6 +87,23 @@ class Core(object): assert isinstance(my_model, Model.Model) me._model = my_model @property def core_sym(me): """ Core symmetry property. 1 == full sym 4 == qtr sym """ return me._core_sym @core_sym.setter def core_sym(me, core_sym_in): """ Set the core symmetry. """ assert core_sym_in in [1, 4] me._core_sym = core_sym_in @property def dz(me): """ Mesh partition heights """ Loading Loading @@ -120,7 +145,13 @@ class Core(object): @property def z_bounds_pairs(me): """ Axial level z boundary pairs ((zstart_i, zend_i), ...) """ """ Axial edit z boundary pairs. A 2D array consisting of location of each edit boundary i.e: [[z_0, z_1], # axial edit i=0 [z_1, z_2], # axial edit i=1 [z_2, z_3], ...] """ z_pairs = np.asarray((me.z_bounds[1:], me.z_bounds[:-1])).T return z_pairs Loading Loading @@ -173,6 +204,10 @@ class MSRE(Core): assert(isinstance(dz, list)) assert(len(dz)>0) assert(all(dz)>0.0) # call base class constructor super(MSRE, me).__init__(model, dz, sym_opt) if rodDomains: assert(utils.isArraySquare(rodDomains)) assert(len(rodDomains)==len(coreMap)) Loading @@ -192,11 +227,6 @@ class MSRE(Core): thisMap = np.array(coreMap) me.dz = np.array(dz) me.model=model me.grBlockWidth = grBlockWidth # Use an equivalent diameter to get the same cross sectional area of the graphite block Loading Loading @@ -511,7 +541,6 @@ class MSRE(Core): chans = chansInDomain[domainID] model.addChannelsToDomain(domainID, chans) def plotGraphiteBlockLocations(fname): """ Make a plot of the core region. Loading Loading @@ -586,7 +615,6 @@ class MSRE(Core): obj.power = radPowers[i] i=i+1 def getCoreEdgeBound(me): """ Returns the easternmost edge of the core assuming the origin is the center of the core map. Loading SubKit/build/SquareLatticeLWR_Nodal.py +22 −13 Original line number Diff line number Diff line Loading @@ -613,10 +613,11 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): objects because they are not heated. Setting this to True will override the default of not modeling them. Note that whether they are modeled or not, their effect on gap size and wall friction are always captured in the model. Not modeling them will save some computational time. sym_opt (int): Enter either 1 for full core geometry or 4 for quarter symmetry geometry. """ def __init__(me, model, coreMap, assemMaps, pitch, dz, solidGeoms, startChanIndex=1, assemPitch=None, baffleGap=0.0, sectionID=1, symOpt=1, assemLosses=None, assemLossLevels=None, rodDomains=None, modelGuideTubes=False): modelGuideTubes=False, sym_opt=1): assert(isinstance(model, Model.Model)) assert(len(coreMap)>0) assert(utils.isArraySquare(coreMap)) Loading @@ -626,6 +627,10 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): assert(len(dz)>0) assert(all(dz)>0.0) assert(startChanIndex>=1) assert(sym_opt==1) # call base class constructor super(SquareLatticeLWR_Nodal, me).__init__(model, dz, sym_opt) if isinstance(assemMaps, list): assemMapsDict = {1: assemMaps} Loading Loading @@ -800,10 +805,8 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): me.modelGuideTubes = modelGuideTubes model.addSection(sectionID, me.sec) me.model = model me.chMapObj = chMapObj me.nodalGeom = nodalGeom me.dz = dz def setEditOptions(me, chanVTK=None, rodVTK=None, ctfHDF5=None, veracsHDF5=None, chanASCII=None, rodEdits=None, dnbEdits=None): Loading Loading @@ -851,14 +854,13 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): if me.modelGuideTubes: raise RuntimeError("Model guide tubes is currently not supported " + \ "by the nodal veracsHDF5 writer. Set modelGuideTubes=False.") rodMap = np.zeros((len(me.chMapObj.chAssemIdx),2*len(me.chMapObj.chAssemIdx[0])), dtype=int) else: rodMap = np.zeros((len(me.chMapObj.chAssemIdx),len(me.chMapObj.chAssemIdx[0])), dtype=int) symOpt = 1 assert me.core_sym == 1 for obj in me.model.solidObjects.values(): # this only works in full sym mode for now assert(obj.symtype==1) symOpt = obj.symtype # create the rodMap for asm_i in range(me.chMapObj.getAssemDimLen()): Loading Loading @@ -890,7 +892,7 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): rodMap[asm_i * 2 + 1][asm_j * 2 + 1] = int(assemID) # convert rodMap to list of lists to be consistent with SubKit rodMap = list([list(rodRow) for rodRow in rodMap]) return rodMap, me.chMapObj.chAssemIdx, me.chMapObj.assemIdx, symOpt return rodMap, me.chMapObj.chAssemIdx, me.chMapObj.assemIdx, me.core_sym def setCoreInletBC(me, massflux, temperature, flowRamp=None): """ Sets the mass flux and temperature uniformly at the inlet of the core. Loading Loading @@ -996,6 +998,15 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): or 4 dim array. Contains power distribution with indexing (asm_i, asm_j, node_id, asm_axial) An example node layout for a 4 assembly model is: ------------- | 1 2 | 1 2 | | 3 4 | 3 4 | ------------- | 1 2 | 1 2 | | 3 4 | 3 4 | ------------- wgts (numpy.ndarray): Same shape as powerDist. Weights of powers (optional) coreStart (float): The axial location of the start of the core. In CTF, the bottom of the model is zero. If the core does not start at the bottom of the model, this must be provided Loading @@ -1020,7 +1031,7 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): def _setCorePowerShapeAsm3D(me, powerDist, wgts=None, coreStart=0.0): """ Set a 3D power distribution for the core. Each assembly can have it's own Set a 3D power distribution for the core. Each assembly can have its own axial power shape. Args: Loading @@ -1042,7 +1053,6 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): wgts = np.ones(powerDist.shape) assert wgts.shape == powerDist.shape powerDist *= wgts # powerDist /= np.average(powerDist[np.nonzero(powerDist)], weights=wgts) radPowers = [] weights = [] Loading Loading @@ -1071,14 +1081,14 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): def _setCorePowerShapeNodal3D(me, powerDist, wgts=None, coreStart=0.0): """ Set a 3D power distribution for the core. Each assembly can have it's own axial power shape. Set a 3D power distribution for the core. Each node within each assembly can have its own axial power shape. Args: powerDist (numpy.ndarray): 4 dim array. Contains power distribution with indexing (asm_i, asm_j, node_id, asm_axial) node_id is indexed from left to right, top to bottom: inter-asm node_id layout: intra-asm node_id layout: --------- | 0 | 1 | --------- Loading @@ -1103,7 +1113,6 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): wgts = np.ones(powerDist.shape) assert wgts.shape == powerDist.shape powerDist *= wgts # powerDist /= np.average(powerDist[np.nonzero(powerDist)], weights=wgts) radPowers = [] weights = [] Loading tests/test_script_mode.sh +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ # Pass in the Python exe to use PYTHON="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" echo "Using python found in: $PYTHON" PYTHON=python2 # Pass in "rebaseline" to do a rebaseline of all tests if [ "$1" == "rebaseline" ]; then Loading Loading
SubKit/build/CoreBuilder.py +38 −10 Original line number Diff line number Diff line Loading @@ -21,8 +21,11 @@ import Section class Core(object): """ Base class for building core maps.""" def __init__(me): me._model = None def __init__(me, model, dz, core_sym): me.model = model me.dz = dz me.core_sym = core_sym me._isinit = True def getSection(me): """ Returns the Section object that contains the core. """ Loading Loading @@ -64,6 +67,11 @@ class Core(object): return me.core_ch ### Core Base Attributes ### @property def isinit(me): """ Initialization boolian flag. """ return me._isinit @property def model(me): """ Model container """ Loading @@ -79,6 +87,23 @@ class Core(object): assert isinstance(my_model, Model.Model) me._model = my_model @property def core_sym(me): """ Core symmetry property. 1 == full sym 4 == qtr sym """ return me._core_sym @core_sym.setter def core_sym(me, core_sym_in): """ Set the core symmetry. """ assert core_sym_in in [1, 4] me._core_sym = core_sym_in @property def dz(me): """ Mesh partition heights """ Loading Loading @@ -120,7 +145,13 @@ class Core(object): @property def z_bounds_pairs(me): """ Axial level z boundary pairs ((zstart_i, zend_i), ...) """ """ Axial edit z boundary pairs. A 2D array consisting of location of each edit boundary i.e: [[z_0, z_1], # axial edit i=0 [z_1, z_2], # axial edit i=1 [z_2, z_3], ...] """ z_pairs = np.asarray((me.z_bounds[1:], me.z_bounds[:-1])).T return z_pairs Loading Loading @@ -173,6 +204,10 @@ class MSRE(Core): assert(isinstance(dz, list)) assert(len(dz)>0) assert(all(dz)>0.0) # call base class constructor super(MSRE, me).__init__(model, dz, sym_opt) if rodDomains: assert(utils.isArraySquare(rodDomains)) assert(len(rodDomains)==len(coreMap)) Loading @@ -192,11 +227,6 @@ class MSRE(Core): thisMap = np.array(coreMap) me.dz = np.array(dz) me.model=model me.grBlockWidth = grBlockWidth # Use an equivalent diameter to get the same cross sectional area of the graphite block Loading Loading @@ -511,7 +541,6 @@ class MSRE(Core): chans = chansInDomain[domainID] model.addChannelsToDomain(domainID, chans) def plotGraphiteBlockLocations(fname): """ Make a plot of the core region. Loading Loading @@ -586,7 +615,6 @@ class MSRE(Core): obj.power = radPowers[i] i=i+1 def getCoreEdgeBound(me): """ Returns the easternmost edge of the core assuming the origin is the center of the core map. Loading
SubKit/build/SquareLatticeLWR_Nodal.py +22 −13 Original line number Diff line number Diff line Loading @@ -613,10 +613,11 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): objects because they are not heated. Setting this to True will override the default of not modeling them. Note that whether they are modeled or not, their effect on gap size and wall friction are always captured in the model. Not modeling them will save some computational time. sym_opt (int): Enter either 1 for full core geometry or 4 for quarter symmetry geometry. """ def __init__(me, model, coreMap, assemMaps, pitch, dz, solidGeoms, startChanIndex=1, assemPitch=None, baffleGap=0.0, sectionID=1, symOpt=1, assemLosses=None, assemLossLevels=None, rodDomains=None, modelGuideTubes=False): modelGuideTubes=False, sym_opt=1): assert(isinstance(model, Model.Model)) assert(len(coreMap)>0) assert(utils.isArraySquare(coreMap)) Loading @@ -626,6 +627,10 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): assert(len(dz)>0) assert(all(dz)>0.0) assert(startChanIndex>=1) assert(sym_opt==1) # call base class constructor super(SquareLatticeLWR_Nodal, me).__init__(model, dz, sym_opt) if isinstance(assemMaps, list): assemMapsDict = {1: assemMaps} Loading Loading @@ -800,10 +805,8 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): me.modelGuideTubes = modelGuideTubes model.addSection(sectionID, me.sec) me.model = model me.chMapObj = chMapObj me.nodalGeom = nodalGeom me.dz = dz def setEditOptions(me, chanVTK=None, rodVTK=None, ctfHDF5=None, veracsHDF5=None, chanASCII=None, rodEdits=None, dnbEdits=None): Loading Loading @@ -851,14 +854,13 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): if me.modelGuideTubes: raise RuntimeError("Model guide tubes is currently not supported " + \ "by the nodal veracsHDF5 writer. Set modelGuideTubes=False.") rodMap = np.zeros((len(me.chMapObj.chAssemIdx),2*len(me.chMapObj.chAssemIdx[0])), dtype=int) else: rodMap = np.zeros((len(me.chMapObj.chAssemIdx),len(me.chMapObj.chAssemIdx[0])), dtype=int) symOpt = 1 assert me.core_sym == 1 for obj in me.model.solidObjects.values(): # this only works in full sym mode for now assert(obj.symtype==1) symOpt = obj.symtype # create the rodMap for asm_i in range(me.chMapObj.getAssemDimLen()): Loading Loading @@ -890,7 +892,7 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): rodMap[asm_i * 2 + 1][asm_j * 2 + 1] = int(assemID) # convert rodMap to list of lists to be consistent with SubKit rodMap = list([list(rodRow) for rodRow in rodMap]) return rodMap, me.chMapObj.chAssemIdx, me.chMapObj.assemIdx, symOpt return rodMap, me.chMapObj.chAssemIdx, me.chMapObj.assemIdx, me.core_sym def setCoreInletBC(me, massflux, temperature, flowRamp=None): """ Sets the mass flux and temperature uniformly at the inlet of the core. Loading Loading @@ -996,6 +998,15 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): or 4 dim array. Contains power distribution with indexing (asm_i, asm_j, node_id, asm_axial) An example node layout for a 4 assembly model is: ------------- | 1 2 | 1 2 | | 3 4 | 3 4 | ------------- | 1 2 | 1 2 | | 3 4 | 3 4 | ------------- wgts (numpy.ndarray): Same shape as powerDist. Weights of powers (optional) coreStart (float): The axial location of the start of the core. In CTF, the bottom of the model is zero. If the core does not start at the bottom of the model, this must be provided Loading @@ -1020,7 +1031,7 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): def _setCorePowerShapeAsm3D(me, powerDist, wgts=None, coreStart=0.0): """ Set a 3D power distribution for the core. Each assembly can have it's own Set a 3D power distribution for the core. Each assembly can have its own axial power shape. Args: Loading @@ -1042,7 +1053,6 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): wgts = np.ones(powerDist.shape) assert wgts.shape == powerDist.shape powerDist *= wgts # powerDist /= np.average(powerDist[np.nonzero(powerDist)], weights=wgts) radPowers = [] weights = [] Loading Loading @@ -1071,14 +1081,14 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): def _setCorePowerShapeNodal3D(me, powerDist, wgts=None, coreStart=0.0): """ Set a 3D power distribution for the core. Each assembly can have it's own axial power shape. Set a 3D power distribution for the core. Each node within each assembly can have its own axial power shape. Args: powerDist (numpy.ndarray): 4 dim array. Contains power distribution with indexing (asm_i, asm_j, node_id, asm_axial) node_id is indexed from left to right, top to bottom: inter-asm node_id layout: intra-asm node_id layout: --------- | 0 | 1 | --------- Loading @@ -1103,7 +1113,6 @@ class SquareLatticeLWR_Nodal(CoreBuilder.Core): wgts = np.ones(powerDist.shape) assert wgts.shape == powerDist.shape powerDist *= wgts # powerDist /= np.average(powerDist[np.nonzero(powerDist)], weights=wgts) radPowers = [] weights = [] Loading
tests/test_script_mode.sh +1 −0 Original line number Diff line number Diff line Loading @@ -3,6 +3,7 @@ # Pass in the Python exe to use PYTHON="$(cd "$(dirname "$1")"; pwd)/$(basename "$1")" echo "Using python found in: $PYTHON" PYTHON=python2 # Pass in "rebaseline" to do a rebaseline of all tests if [ "$1" == "rebaseline" ]; then Loading