From 9989df23568770dd098790c1e1dc3393d6e222cb Mon Sep 17 00:00:00 2001 From: Andrew T Till Date: Thu, 21 Apr 2016 16:05:37 -0500 Subject: [PATCH] Generalizing indicators input Can now specify a list of materials to indicators.py and a list of materials and importances in indicators_clustering.py. Fixed bug in indicators_clustering.py where showing numbers didn't work. Adding more multi-temperature options to materials_materials.py --- src/indicators.py | 40 +++++--- src/indicators_clustering.py | 36 ++++--- src/materials.py | 2 +- src/materials_materials.py | 187 ++++++++++++++++++++++++++++++++++- 4 files changed, 236 insertions(+), 29 deletions(-) diff --git a/src/indicators.py b/src/indicators.py index e1f43d5..7af170f 100755 --- a/src/indicators.py +++ b/src/indicators.py @@ -61,19 +61,23 @@ def define_defaults(): #WattConstants = [0.966, 2.842] # thermal fission from Pu-239 WattConstants = [0.988, 2.2249] #thermal fission from U-235 - # Specify which materials to use + # Specify which set of materials to use #materialOpt = '3' #materialOpt = '4' ##materialOpt = '5' #materialOpt = 'c5g7' #materialOpt = 'graphite' - materialOpt = 'iron' + #materialOpt = 'iron' + materialOpt = 'manual' + + # If materialOpt is 'manual', list of materials to use + materialsList = ['deb'] # Specify energy mesh for output weights / fluxes #meshName = 'clust-{r}' meshName = 'res-{r}' - return {'verbosity': verbosity, 'workopt': workOpt, 'resolution':resolution, 'energyspacing': energySpacing, 'rrr': rrrRange,'groupopt': groupOpt, 'materialopt': materialOpt, 'meshname': meshName, 'fastspectrumparam': WattConstants} + return {'verbosity': verbosity, 'workopt': workOpt, 'resolution':resolution, 'energyspacing': energySpacing, 'rrr': rrrRange,'groupopt': groupOpt, 'materialopt': materialOpt, 'meshname': meshName, 'fastspectrumparam': WattConstants, 'listmaterials': materialsList} def do_all(inputDict): '''Create Sigma_t for the specified materials on a proper grid for later clustering''' @@ -82,6 +86,7 @@ def do_all(inputDict): plotOutput = inputDict['plot'] workOpt = inputDict['workopt'] materialOpt = inputDict['materialopt'] + materialsList = inputDict['listmaterials'] pwResFactor = inputDict['resolution'] eSpacing = inputDict['energyspacing'] rrrRange = inputDict['rrr'] @@ -89,6 +94,7 @@ def do_all(inputDict): meshName = inputDict['meshname'] useLowZScat = inputDict['Zlow'] noScatOpt = inputDict['totalonly'] + temperatureDependence = inputDict['temperaturedependence'] WattConstants = inputDict['fastspectrumparam'] # Initialize options @@ -106,7 +112,6 @@ def do_all(inputDict): # Specify materials materials = [] - temperatureDependence = False if materialOpt == '3': materials.append(mat.get_inner_hot_mox_material()) materials.append(mat.get_middle_hot_mox_material()) @@ -215,6 +220,11 @@ def do_all(inputDict): materials.append(mat.get_triga_grid_plate_material()) elif materialOpt == 'deb': materials.append(mat.get_bruss_enriched_rod_fuel_material()) + else: + #materialOpt == 'manual' + materialFunctionDict = mat.get_materials_name2function_dict() + for materialName in materialsList: + materials.append(materialFunctionDict[materialName]()) # For each material, compute total cross sections or infinite-medium fluxes if verbosity: @@ -307,7 +317,7 @@ def compute_infinite_medium_flux(materials, linearTol, maxFluxJump, maxdEJump, e # Determine cross sections on union grid unionEnergyGrid = np.unique(np.concatenate(energyGridDict.values())) - if plotOutput and verbosity > 3: + if plotOutput > 2: plot_dE(unionEnergyGrid, 'de_flux_0_union') materialIndexDict = {} @@ -324,7 +334,7 @@ def compute_infinite_medium_flux(materials, linearTol, maxFluxJump, maxdEJump, e unionEnergyGrid, unionXSMat = thin_grid(unionEnergyGrid, unionXSMat, linearTol, verbosity) if verbosity > 1: compute_thinning_error(fullEnergyGrid, fullXSMat, unionEnergyGrid, unionXSMat, True) - if plotOutput and verbosity > 3: + if plotOutput > 2: plot_dE(unionEnergyGrid, 'de_flux_1_after_xs_thin') # Thicken the grid so the maximum relative jump in energy is bounded (for downscattering) @@ -351,7 +361,7 @@ def compute_infinite_medium_flux(materials, linearTol, maxFluxJump, maxdEJump, e perform_slowing_down_calc(energyGridDict, scatXSDict, unionFluxMat, materialIndexDict, alphaDict, unionXSMat, unionEnergyGrid, materials, WattConstants, escapeXS, normalizeSource, useLowZScat, noScatOpt, plotOutput) if verbosity: print 'Performed slowing-down calculation in {0} sec'.format(time.time() - t0) - if plotOutput and verbosity > 2: + if plotOutput > 1: plot_sigma(materials, materialIndexDict, unionEnergyGrid, unionFluxMat, 'flux_2_after_dE_thick', 'Flux(E)/M(E)') # Thin grid to linear tolerance on flux @@ -360,13 +370,13 @@ def compute_infinite_medium_flux(materials, linearTol, maxFluxJump, maxdEJump, e unionEnergyGrid, unionFluxMat = thin_grid(unionEnergyGrid, unionFluxMat, linearTol, verbosity) if verbosity > 1: compute_thinning_error(fullEnergyGrid, fullFluxMat, unionEnergyGrid, unionFluxMat, True) - if plotOutput and verbosity > 3: + if plotOutput > 2: plot_dE(unionEnergyGrid, 'de_flux_3_after_sigma_thin') plot_sigma(materials, materialIndexDict, unionEnergyGrid, unionFluxMat, 'flux_3_after_sigma_thin', 'Flux(E)/M(E)') # Thicken the grid so the maximum relative jump in the flux is bounded unionEnergyGrid, unionFluxMat = thicken_grid(unionEnergyGrid, unionFluxMat, maxFluxJump, 'y', verbosity) - if plotOutput and verbosity > 2: + if plotOutput > 1: plot_dE(unionEnergyGrid, 'de_flux_4_after_sigma_thick') plot_sigma(materials, materialIndexDict, unionEnergyGrid, unionFluxMat, 'flux_4_after_sigma_thick', 'Flux(E)/M(E)') @@ -427,7 +437,7 @@ def compute_total_xs(materials, linearTol, maxXSJump, maxdEJump, temperatureDepe materialIndexDict = {} unionMacroTotalXSMat = np.zeros((numMaterials, len(unionEnergyGrid))) compute_macro_xs(materialIndexDict, unionMacroTotalXSMat, unionEnergyGrid, energyGridDict, totalXSDict, materials, globalZATList) - if plotOutput and verbosity > 2: + if plotOutput > 1: plot_sigma(materials, materialIndexDict, unionEnergyGrid, unionMacroTotalXSMat, 'xs_0_union') plot_dE(unionEnergyGrid, 'de_xs_0_union') @@ -437,7 +447,7 @@ def compute_total_xs(materials, linearTol, maxXSJump, maxdEJump, temperatureDepe unionEnergyGrid, unionMacroTotalXSMat = thin_grid(unionEnergyGrid, unionMacroTotalXSMat, linearTol, verbosity) if verbosity > 1: compute_thinning_error(fullEnergyGrid, fullMacroTotalXSMat, unionEnergyGrid, unionMacroTotalXSMat, True) - if plotOutput and verbosity > 2: + if plotOutput > 1: plot_sigma(materials, materialIndexDict, unionEnergyGrid, unionMacroTotalXSMat, 'xs_1_after_xs_thin') plot_dE(unionEnergyGrid, 'de_xs_1_after_xs_thin') @@ -445,7 +455,7 @@ def compute_total_xs(materials, linearTol, maxXSJump, maxdEJump, temperatureDepe unionEnergyGrid, unionMacroTotalXSMat = thicken_grid(unionEnergyGrid, unionMacroTotalXSMat, maxXSJump, 'y', verbosity) if verbosity > 1: compute_thinning_error(fullEnergyGrid, fullMacroTotalXSMat, unionEnergyGrid, unionMacroTotalXSMat, True) - if plotOutput and verbosity > 2: + if plotOutput > 1: plot_sigma(materials, materialIndexDict, unionEnergyGrid, unionMacroTotalXSMat, 'xs_2_after_xs_thick') plot_dE(unionEnergyGrid, 'de_xs_2_after_xs_thick') @@ -1231,7 +1241,7 @@ def define_input_parser(): defaults = define_defaults() # If nothing is specified, verbosity is False. If -v or --verbose is specified, verbosity is 1. If -v N is specified, verbosity is N. parser.add_argument('-v', '--verbose', dest='verbosity', nargs='?', const=1, default=defaults['verbosity'], choices=[0,1,2,3,4], type=int) - parser.add_argument('-p', '--plot', help='Make various diagnostic plots (depends on verbosity level)', action='store_true', default=False) + parser.add_argument('-p', '--plot', help='Make various diagnostic plots depending on desired level of prolificity', nargs='?', const=1, type=int, choices=[0,1,2,3], default=0) parser.add_argument('-f', '--fastspectrumparam', help="The 'a' and 'b' parameters to determine the Maxwellian used for the fast spectrum. See MCNP manual for examples.", type=float, nargs=2, default=defaults['fastspectrumparam']) parser.add_argument('-T', '--totalonly', help='If specified, do not calculate downscattering.', action='store_true', default=False) parser.add_argument('-Z', '--Zlow', help='If specified, add low-Z components to the elastic scattering source and turn off the 1/E fixed source. If not specified, the elastic scattering source comes only from high-Z components and low-Z components are taken into account with a 1/E fixed source.', action='store_true', default=False) @@ -1240,7 +1250,9 @@ def define_input_parser(): parser.add_argument('-G', '--groupopt', help="Base coarse group structure file head. If the flux work option is used, the output group structure is the base coarse group structure with the RRR overwritten by the hyperfine group structure. Some examples include 'c5g7', 'scale-44', and 'res-N' where N=1,..9. Always looks in default directory of makegroups.", default=defaults['groupopt']) parser.add_argument('-r', '--resolution', help='Resolution to use for the pointwise flux calculations', type=int, choices=range(11), default=defaults['resolution']) parser.add_argument('-E', '--energyspacing', help='The maximum energy jump in the final grid is equal to this factor multiplied by a jump normalization based on downscattering distance off a heavy nucleus.', type=float, default=defaults['energyspacing']) - parser.add_argument('-m', '--materialopt', help='Which materials to use. Specify in aggregate, not individually.', choices=['3','4','5','c5g7', 'graphite', 'iron', 'kpin', 'kenrichedpin', 'kcladpin', 'kpin2d', 'kenrichedpin2d', 'kmoxpin2d', 'kmoxenrichedpin2d', 'trigafuel', 'trigamore', 'deb'], default=defaults['materialopt']) + parser.add_argument('-m', '--materialopt', help=" Unless 'manual' is used, specifies a set of materials to use. If 'manual' is used, give a space-separated list of material names in 'listmaterials'.", choices=['3','4','5','c5g7', 'graphite', 'iron', 'kpin', 'kenrichedpin', 'kcladpin', 'kpin2d', 'kenrichedpin2d', 'kmoxpin2d', 'kmoxenrichedpin2d', 'trigafuel', 'trigamore', 'deb', 'manual'], default=defaults['materialopt']) + parser.add_argument('-i', '--indicatormaterials', dest='listmaterials', help="When manual 'materialopt' is used, specify the materials to use.", nargs='+', default=defaults['listmaterials'], choices=mat.get_materials_name2function_dict().keys()) + parser.add_argument('-t', '--temperaturedependence', help="If specified, use the temperature in the PENDF file that corresponds to the temperature of the material (as specified in 'materials_materials.py'). If this temperature does not exist, an error is thrown. If not specified, the first temperature in the PENDF file is used. This flag is added for 'materialopt' of '3'.", action='store_true', default=False) parser.add_argument('-M', '--meshname', help="The energy mesh on which the output fluxes are constructed. {r} is replaced by the resolution. If the 'flux' workopt is used, the mesh file is written to. Else, is it read from. If no file type is specified, '.txt' is used. If no directory is specified, the 'energyDat' directory from directories is used.", default=defaults['meshname']) return parser diff --git a/src/indicators_clustering.py b/src/indicators_clustering.py index a042cad..ff324d9 100755 --- a/src/indicators_clustering.py +++ b/src/indicators_clustering.py @@ -62,13 +62,16 @@ def define_defaults(): # Specify how many elements to use in each coarse group listNumElements = [] - # Specify which materials to use + # Specify which set of materials to use #materialOpt = '4' - materialOpt = 'c5g7' - - return {'verbosity': verbosity, 'numelements': numElements, 'apportionopt': apportionOpt, 'workopt': workOpt, 'resolution':resolution, 'coarsebdrs': coarseBdrs, 'numcoarsegroups': numCoarseGroups, 'materialopt': materialOpt, 'shownumbers': showNumbers, 'condensesubelements': condenseSubelements, 'plotopt': plotOpt, 'energypenalty': energyPenalty, 'dpi': dpi, 'listnumelements': listNumElements} + #materialOpt = 'c5g7' + materialOpt = 'manual' + # If materialOpt is 'manual', list of materials to use + materialsList = ['deb'] + importancesLst = [] + return {'verbosity': verbosity, 'numelements': numElements, 'apportionopt': apportionOpt, 'workopt': workOpt, 'resolution':resolution, 'coarsebdrs': coarseBdrs, 'numcoarsegroups': numCoarseGroups, 'materialopt': materialOpt, 'shownumbers': showNumbers, 'condensesubelements': condenseSubelements, 'plotopt': plotOpt, 'energypenalty': energyPenalty, 'dpi': dpi, 'listnumelements': listNumElements, 'listmaterials': materialsList} def do_all(inputDict): '''Driver function to read indicators, compute observations, perform clustering, write energy mesh''' @@ -114,6 +117,8 @@ def copy_inputDict_to_dataDict(inputDict, dataDict): dataDict['useSigt'] = inputDict['sigt'] dataDict['resolution'] = inputDict['resolution'] dataDict['materialOpt'] = inputDict['materialopt'] + dataDict['materialsList'] = inputDict['listmaterials'] + dataDict['importancesList'] = inputDict['listimportances'] dataDict['numElements'] = inputDict['numelements'] dataDict['numElementsIsTotal'] = inputDict['numelementsistotal'] dataDict['numElementsList'] = inputDict['listnumelements'] @@ -171,6 +176,8 @@ def read_energy_and_indicators(dataDict): # Inputs resolution = dataDict['resolution'] materialOpt = dataDict['materialOpt'] + materialsList = dataDict['materialsList'] + importancesList = dataDict['importancesList'] useSigt = dataDict['useSigt'] energyDatDirr = dataDict['energyDatDirr'] indicatorsDatDirr = dataDict['indicatorsDatDirr'] @@ -209,6 +216,11 @@ def read_energy_and_indicators(dataDict): importanceDict = {'tFUEL': 1} elif materialOpt == 'trigamore': importanceDict = {'tFUEL': 10, 'tCLAD': 2, 'tZIRC': 2, 'tIRRADIATIONTUBE': 1} + elif materialOpt == 'manual': + if not importancesList: + importancesList = [1]*len(materialsList) + importanceDict = {material:importance for material,importance in zip( + materialsList, importancesList)} # Appending to materialNames does not alias onto importanceDict materialNames = importanceDict.keys() @@ -526,10 +538,7 @@ def cluster_one_coarse_group(dataDict, timeDict, observations, globalLabels, off # Output 2: Plot observations colored by label / cluster if plotOpt not in ['none', 'sum']: - plot_clustering(dataDict, coarseGroup, uniqueLabels, labels, eGrid, obs, numClusters, numPoints) - # Hack to manually print interesting cases - #if coarseGroup == 1846: - # plot_clustering(dataDict, coarseGroup, uniqueLabels, labels, eGrid, obs, numClusters, numPoints) + plot_clustering(dataDict, coarseGroup, uniqueLabels, labels, eGrid, obs, numClusters, numPoints, offset) # Output3: return offset @@ -566,15 +575,16 @@ def plot_summary(dataDict, observations, globalLabels): gBdr = groupBdrs[strt:end+1] numGroups, numPoints = obs.shape labels = globalLabels[strt:end].copy() - labels -= np.min(labels) + offset = np.min(labels) + labels -= offset uniqueLabels = np.unique(labels) numClusters = numElements coarseGroup = 'sum' # Output - plot_clustering(dataDict, coarseGroup, uniqueLabels, labels, eGrid, obs, numClusters, numPoints) + plot_clustering(dataDict, coarseGroup, uniqueLabels, labels, eGrid, obs, numClusters, numPoints, offset) -def plot_clustering(dataDict, coarseGroup, uniqueLabels, labels, eGrid, obs, numClusters, numPoints): +def plot_clustering(dataDict, coarseGroup, uniqueLabels, labels, eGrid, obs, numClusters, numPoints, offset): '''Plot observations in coarse group''' # Inputs forceContiguity = dataDict['forceContiguity'] @@ -960,7 +970,9 @@ def define_input_parser(): parser.add_argument('-n', '--numcoarsegroups', help="The number of coarse groups to be used. If nonzero, overwrites the internal members of 'coarsebdrs'", type=int, default=defaults['numcoarsegroups']) parser.add_argument('-l', '--listnumelements', help='Number of elements to be put in each coarse boundary. Number of arguments should be one less than the number of coarse boundaries. Takes priority over "elements" if set', type=int, nargs='+', default=defaults['listnumelements']) parser.add_argument('-r', '--resolution', help='Resolution to use for the pointwise flux calculations', type=int, choices=range(11), default=defaults['resolution']) - parser.add_argument('-m', '--materialopt', help='Which materials to use. Specify in aggregate, not individually.', choices=['4','5','c5g7', 'graphite', 'iron', 'kpin', 'kenrichedpin', 'kcladpin', 'kpin2d', 'kenrichedpin2d', 'kmoxpin2d', 'kmoxenrichedpin2d', 'trigafuel', 'trigamore'], default=defaults['materialopt']) + parser.add_argument('-m', '--materialopt', help="Unless 'manual' is used, specifies a set of materials to use. If 'manual' is used, give a space-separated list of material names in 'listmaterials'.", choices=['4','5','c5g7', 'graphite', 'iron', 'kpin', 'kenrichedpin', 'kcladpin', 'kpin2d', 'kenrichedpin2d', 'kmoxpin2d', 'kmoxenrichedpin2d', 'trigafuel', 'trigamore', 'manual'], default=defaults['materialopt']) + parser.add_argument('-i', '--indicatormaterials', dest='listmaterials', help="When manual 'materialopt' is used, specify the materials to use.", nargs='+', default=defaults['listmaterials']) + parser.add_argument('-I', '--importances', dest='listimportances', help="When manual 'materialopt' is used, specify the weightings (importances) to use when clustering.", nargs='+', type=int, default=[]) parser.add_argument('-p', '--plotopt', help='Which observations to plot', choices=['none', 'first', 'last', 'firstlast', 'half', 'all', 'sum'], default=defaults['plotopt']) parser.add_argument('-s', '--shownumbers', help='If true, show element numbers on the plots', type=int, default=defaults['shownumbers']) parser.add_argument('-E', '--energypenalty', help='The energy variable is added to the observations to encourage contiguity for high numbers of elements. A value of 0 will not penalize in energy at all. A very large value will yield equal-lethargy-spaced MG', type=float, default=defaults['energypenalty']) diff --git a/src/materials.py b/src/materials.py index af01d37..526cf85 100755 --- a/src/materials.py +++ b/src/materials.py @@ -29,7 +29,7 @@ def do_all(inputDict): useCommonBXS = inputDict['commonbackgroundxs'] materials = [] mat2funcDict = mat.get_materials_name2function_dict() - for matl in inputDict['materialslist']: + for matl in sorted(inputDict['materialslist']): materials.append(mat2funcDict[matl]()) # util.print_newline(verbosity) diff --git a/src/materials_materials.py b/src/materials_materials.py index 8ffbaea..ad465e4 100644 --- a/src/materials_materials.py +++ b/src/materials_materials.py @@ -25,7 +25,74 @@ ############################################################################### def get_materials_name2function_dict(): - return {'hpu': get_hpu_slurry_material, 'hheu': get_hheu_slurry_material, 'hleu': get_hleu_slurry_material, 'puMetal': get_pu_metal_material, 'puMetalHot': get_hot_pu_metal_material, 'uMetal': get_u_metal_material, 'uo2ColdPin': get_cold_pin_uo2_material, 'uo2Cold': get_cold_uo2_material, 'uo2InnerHot': get_inner_hot_uo2_material, 'uo2MiddleHot': get_middle_hot_uo2_material, 'uo2OuterHot': get_outer_hot_uo2_material, 'moxCold': get_cold_mox_material, 'moxInnerHot': get_inner_hot_mox_material, 'moxMiddleHot': get_middle_hot_mox_material, 'moxOuterHot': get_outer_hot_mox_material, 'h2oCold': get_cold_h2o_material, 'h2oHot': get_hot_h2o_material, 'graphite': get_graphite_material, 'clowMOX': get_c5g7_low_mox_material, 'cmedMOX': get_c5g7_med_mox_material, 'chighMOX': get_c5g7_high_mox_material, 'cUO2': get_c5g7_uo2_material, 'cMOD': get_c5g7_moderator_material, 'cGUIDE': get_c5g7_guide_tube_material, 'cFCHAMBER': get_c5g7_fission_chamber_material, 'cCR': get_c5g7_control_rod_material, 'tFUEL': get_triga_fuel_material, 'tZIRC': get_triga_zirconium_material, 'tCLAD': get_triga_clad_material, 'tMOD': get_triga_moderator_material, 'tBORATEDGRAPHITE': get_triga_borated_graphite_material, 'tB4C': get_triga_b4c_material, 'tGRAPHITE': get_triga_graphite_material, 'tAIRTUBE': get_triga_air_tube_material, 'tIRRADIATIONTUBE': get_triga_irradiation_tube_material, 'tGRIDPLATE': get_triga_grid_plate_material, 'iron': get_iron_material, 'thickiron': get_thick_iron_material, 'kFUEL': get_kord_fuel_material, 'kRFUEL': get_kord_rod_fuel_material, 'kEFUEL': get_kord_enriched_fuel_material, 'kCLAD': get_kord_clad_material, 'kZR': get_kord_zirconium_material, 'kMOD': get_kord_moderator_material, 'kREFUEL': get_kord_enriched_rod_fuel_material, 'kRMFUEL': get_kord_mox_rod_fuel_material, 'debFUEL': get_bruss_enriched_rod_fuel_material} + return { + # Simple examples + 'hpu': get_hpu_slurry_material, + 'hheu': get_hheu_slurry_material, + 'hleu': get_hleu_slurry_material, + 'puMetal': get_pu_metal_material, + 'puMetalHot': get_hot_pu_metal_material, + 'uMetal': get_u_metal_material, + # Simple multi-temperature examples + 'uo2ColdPin': get_cold_pin_uo2_material, + 'uo2Cold': get_cold_uo2_material, + 'uo2InnerHot': get_inner_hot_uo2_material, + 'uo2MiddleHot': get_middle_hot_uo2_material, + 'uo2OuterHot': get_outer_hot_uo2_material, + 'moxCold': get_cold_mox_material, + 'moxInnerHot': get_inner_hot_mox_material, + 'moxMiddleHot': get_middle_hot_mox_material, + 'moxOuterHot': get_outer_hot_mox_material, + 'h2oCold': get_cold_h2o_material, + 'h2oHot': get_hot_h2o_material, + 'graphite': get_graphite_material, + # C5G7 + 'clowMOX': get_c5g7_low_mox_material, + 'cmedMOX': get_c5g7_med_mox_material, + 'chighMOX': get_c5g7_high_mox_material, + 'cUO2': get_c5g7_uo2_material, + 'cMOD': get_c5g7_moderator_material, + 'cGUIDE': get_c5g7_guide_tube_material, + 'cFCHAMBER': get_c5g7_fission_chamber_material, + 'cCR': get_c5g7_control_rod_material, + # TRIGA (BOL) + 'tFUEL': get_triga_fuel_material, + 'tZIRC': get_triga_zirconium_material, + 'tCLAD': get_triga_clad_material, + 'tMOD': get_triga_moderator_material, + 'tBORATEDGRAPHITE': get_triga_borated_graphite_material, + 'tB4C': get_triga_b4c_material, + 'tGRAPHITE': get_triga_graphite_material, + 'tAIRTUBE': get_triga_air_tube_material, + 'tIRRADIATIONTUBE': get_triga_irradiation_tube_material, + 'tGRIDPLATE': get_triga_grid_plate_material, + # Iron (for time-dependent dissertation problem) + 'iron': get_iron_material, + 'thickiron': get_thick_iron_material, + # Simplified PWR pincell (for Kord Smith) + 'kFUEL': get_kord_fuel_material, + 'kRFUEL': get_kord_rod_fuel_material, + 'kEFUEL': get_kord_enriched_fuel_material, + 'kCLAD': get_kord_clad_material, + 'kZR': get_kord_zirconium_material, + 'kMOD': get_kord_moderator_material, + 'kREFUEL': get_kord_enriched_rod_fuel_material, + 'kRMFUEL': get_kord_mox_rod_fuel_material, + # UO2 (for Don Bruss) + 'debFUEL': get_bruss_enriched_rod_fuel_material, + # Multi-temperature examples + 'mtH2O_0': get_multi_temperature_h2o_material_T0, + 'mtH2O_1': get_multi_temperature_h2o_material_T1, + 'mtH2O_2': get_multi_temperature_h2o_material_T2, + 'mtTFUEL_0': get_multi_temperature_triga_fuel_material_T0, + 'mtTFUEL_1': get_multi_temperature_triga_fuel_material_T1, + 'mtTFUEL_2': get_multi_temperature_triga_fuel_material_T2, + 'mtTFUEL_3': get_multi_temperature_triga_fuel_material_T3, + 'mtTFUEL_4': get_multi_temperature_triga_fuel_material_T4, + 'mtTFUEL_5': get_multi_temperature_triga_fuel_material_T5, + 'mtTFUEL_6': get_multi_temperature_triga_fuel_material_T6, + 'mtTFUEL_7': get_multi_temperature_triga_fuel_material_T7, + } ############################################################################### @@ -349,7 +416,7 @@ def get_h2o_material(): abundanceDict=abundanceDict, chordLength=chordLength, elemAtomFracDict=elemAtomFracDict, massDensity=massDensity) return material - + def get_cold_h2o_material(T=400.): material = get_h2o_material() material.update_temperature(T) @@ -1044,6 +1111,122 @@ def get_kord_moderator_material(): material.update_names('kMOD', 'cold light water') return material +############################################################################### +def get_multi_temperature_h2o_material_base(): + shortName = 'mtH2O' + longName = 'light water' + massDensity = 1.0 #g/cc + fuelRadius = 1.7920 #cm + temperature = 293.6 #K + # HACK TO ALIGN THERMAL GRIDS!!! + #thermalOpt = 'h2o' + thermalOpt = 'free' + elemAtomFracDict = {'H': 2, 'O': 1} + # + symDict, ZList, ZAList = get_all_isotopes(elemAtomFracDict) + abundanceDict = lookup_natl_abundances(ZAList) + chordLength = calc_chord_length(fuelRadius) + # + material = Material( + shortName=shortName, longName=longName, + temperature=temperature, thermalOpt=thermalOpt, + symDict=symDict, ZList=ZList, ZAList=ZAList, + abundanceDict=abundanceDict, chordLength=chordLength, + elemAtomFracDict=elemAtomFracDict, massDensity=massDensity) + return material + +def get_multi_temperature_h2o_material_Tgrid(): + return [293.6, 350, 400, 450, 500, 550, 600, 650, 800] #K + +def get_multi_temperature_h2o_material_Ti(iT): + P = 0.101325 #MPa + #P = 15.5 #MPa + material = get_multi_temperature_h2o_material_base() + Tgrid = get_multi_temperature_h2o_material_Tgrid() + T = Tgrid[iT] + rho = steam(P=P, T=T).rho / 1000 + shortName = 'mtH2O_{}'.format(iT) + longName = 'light water ({} K)'.format(T) + material.update_temperature(T) + material.update_temperature_index(iT) # X in .9Xc + material.update_mass_density(rho) + material.update_names(shortName, longName) + return material + +def get_multi_temperature_h2o_material_T0(): + return get_multi_temperature_h2o_material_Ti(0) + +def get_multi_temperature_h2o_material_T1(): + return get_multi_temperature_h2o_material_Ti(1) + +def get_multi_temperature_h2o_material_T2(): + return get_multi_temperature_h2o_material_Ti(2) + +def get_multi_temperature_h2o_material_T3(): + return get_multi_temperature_h2o_material_Ti(3) + +def get_multi_temperature_h2o_material_T4(): + return get_multi_temperature_h2o_material_Ti(4) + +def get_multi_temperature_h2o_material_T5(): + return get_multi_temperature_h2o_material_Ti(5) + +def get_multi_temperature_h2o_material_T6(): + return get_multi_temperature_h2o_material_Ti(6) + +def get_multi_temperature_h2o_material_T7(): + return get_multi_temperature_h2o_material_Ti(7) + +def get_multi_temperature_h2o_material_T8(): + return get_multi_temperature_h2o_material_Ti(8) + +############################################################################### +def get_multi_temperature_triga_fuel_material_base(): + return get_triga_fuel_material() + +def get_multi_temperature_triga_fuel_material_Tgrid(): + return [296, 400, 500, 600, 700, 800, 1000, 1200] #K + +def get_multi_temperature_triga_fuel_material_Ti(iT): + material = get_multi_temperature_triga_fuel_material_base() + Tgrid = get_multi_temperature_triga_fuel_material_Tgrid() + T = Tgrid[iT] + shortName = 'mtTFUEL_{}'.format(iT) + longName = '{} ({} K)'.format(material.longName, T) + material.update_temperature(T) + material.update_temperature_index(iT) # X in .9Xc + # MASS DENSITY SHOULD BE UPDATED TO ACCOUNT FOR THERMAL EXPANSION + #material.update_mass_density(rho) + material.update_names(shortName, longName) + return material + +def get_multi_temperature_triga_fuel_material_T0(): + return get_multi_temperature_triga_fuel_material_Ti(0) + +def get_multi_temperature_triga_fuel_material_T1(): + return get_multi_temperature_triga_fuel_material_Ti(1) + +def get_multi_temperature_triga_fuel_material_T2(): + return get_multi_temperature_triga_fuel_material_Ti(2) + +def get_multi_temperature_triga_fuel_material_T3(): + return get_multi_temperature_triga_fuel_material_Ti(3) + +def get_multi_temperature_triga_fuel_material_T4(): + return get_multi_temperature_triga_fuel_material_Ti(4) + +def get_multi_temperature_triga_fuel_material_T5(): + return get_multi_temperature_triga_fuel_material_Ti(5) + +def get_multi_temperature_triga_fuel_material_T6(): + return get_multi_temperature_triga_fuel_material_Ti(6) + +def get_multi_temperature_triga_fuel_material_T7(): + return get_multi_temperature_triga_fuel_material_Ti(7) + +def get_multi_temperature_triga_fuel_material_T8(): + return get_multi_temperature_triga_fuel_material_Ti(8) + ############################################################################### def get_all_isotopes(elemDict): symList = elemDict.keys()