Loading SubKit/build/InpBuild.py +4 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,10 @@ class InpBuilder(object): for key in vuq_param.keys(): me.model.addVUQParam(key, vuq_param[key]) friction = me.inp.getFrictionModel() if friction['model'] is not None: me.model.setFrictionModel(friction) me.model.setAveragePower(qprime=me.inp.getInitialQprime()) me.model.generateModel(me.getOutputFilename()) Loading SubKit/build/InpParse.py +27 −0 Original line number Diff line number Diff line Loading @@ -820,3 +820,30 @@ class InpParse(object): raw = vuq.get('param') if raw: return me._processDict(raw) def getFrictionModel(me): """ Returns the name of the friction model to use Returns a dictionary: {model: name, options: {}} Options will be another dictionary that gives an option name and option value. Returns None if no model was specified by user. """ frict = {'model': None, 'options': {}} models = me.inpDict.get('models') if models: modelDict = models.get('friction') if modelDict is not None: keys = modelDict.keys() assert len(keys)==1 frict['model'] = keys[0] else: frict['model'] = None if frict['model']=='custom': frict['options']['A'] = me.inpDict['models']['friction']['custom']['A']['value'] frict['options']['B'] = me.inpDict['models']['friction']['custom']['B']['value'] frict['options']['C'] = me.inpDict['models']['friction']['custom']['C']['value'] return frict SubKit/build/Model.py +21 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,9 @@ class Model: # Takes a VUQ parameter name and returns its value me.vuq_param = {} # Dictionary stores the friction model to use me.frictionModel = {'model': 'modified', 'options': {}} # Single-phase turbulent mixing coefficient me.beta = 0.037 Loading Loading @@ -187,6 +190,24 @@ class Model: if beta is not None: me.beta = beta def setFrictionModel(me, model): """ Sets the friction model option Args: model (dict): Shall be of the form {'model': name, 'options': {}}. Valid names are "original", "modified", "zigrang", "churchill", and "custom". If "custom" is provided, then 'options' must be present in the dict to specify the A/B/C coefficients in the model. """ validNames = ['original', 'modified', 'zigrang', 'churchill', 'custom'] assert 'model' in model assert model['model'] in validNames if model['model']=='custom': assert 'options' in model assert 'A' in model['options'] assert 'B' in model['options'] assert 'C' in model['options'] me.frictionModel = model def setFluidProperties(me, fluidprops): """Set the fluid property table to use. Loading SubKit/build/genDeck.py +23 −8 Original line number Diff line number Diff line Loading @@ -106,8 +106,19 @@ def writeDeck(model, filename): hasmaps = 1 else: hasmaps = 0 group1Data.append(" 1 2 0 3{:5d}{:15.5e}{:6d} 1{:5d}{:5d}{:5d} 0 7 0\n".format( model.solver, mdotInit, notrans, hasmaps, fluidprops, mflx)) modelName = model.frictionModel['model'] if modelName=='original': irfc = 1 elif modelName=='modified': irfc = 2 elif modelName=='zigrang': irfc = 3 elif modelName=='churchill': irfc=4 else: irfc=5 group1Data.append(" 1{:5d} 0 3{:5d}{:15.5e}{:6d} 1{:5d}{:5d}{:5d} 0 7 0\n".format( irfc, model.solver, mdotInit, notrans, hasmaps, fluidprops, mflx)) group1Data.append("*Card 1.2\n") if mflx == 1: group1Data.append( Loading @@ -130,6 +141,10 @@ def writeDeck(model, filename): if model.editOptions['hdf5'] == True and model.is_nodal: group1Data.append("*Card 1.5\n") group1Data.append(" {nodal_model} .true.\n") if irfc==5: group1Data.append("*Card 1.5\n") group1Data.append("** A B C\n") group1Data.append("{:12.4e}{:12.4e}{:12.4e}\n".format(model.frictionModel['options']['A'], model.frictionModel['options']['B'], model.frictionModel['options']['C'])) # The Card Group 2 data to be written to the deck group2Data = [] Loading Loading @@ -481,7 +496,7 @@ def writeDeck(model, filename): group9Data.append("*Card 9.2\n") group9Data.append( "** I FTYP DROD DFUL NFUL IMTF IMTC IMOX DCRE TCLD FTDS IGPC IGFC IRDP EPSO\n") group9Data.append("{0:5d}{1:>5s}{2:11.7f}{3:11.7f}{4:5d} 0 0 0 0{5:15.5e}{6:15.5e} 0 0 0 0.0\n".format(i, charID( group9Data.append("{0:5d}{1:>5s}{2:11.7f}{3:11.7f}{4:6d} 0 0 0 0{5:12.5e}{6:12.5e} 0 0 0 0.0\n".format(i, charID( typeobj), typeobj.d_outer, typeobj.d_pellet, typeobj.num_rings, 0.5 * (typeobj.d_outer - typeobj.d_inner), typeobj.percentTheoreticalDensity)) else: group9Data.append( Loading SubKit/build/workbench/input.sch +82 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,88 @@ solution{ } } models{ Description="Select models to use for simulation." MinOccurs=0 MaxOccurs=1 InputTmpl="flag" friction{ Description="Selects the model to use for calculation of the friction factor." MinOccurs=0 MaxOccurs=1 InputTmpl="flag" ChildExactlyOne=[original, modified, zigrang, churchill, custom] original{ Description="Selects the original friction factor model." ### Appearance=":math:`$\lambda = \max(1.691{Re}^{-0.43}, 0.117{Re}^{-0.14})$`" MinOccurs=0 MaxOccurs=1 InputTmpl="flag" } modified{ Description="Selects the modified friction factor model." ### Appearance=":math:`$\lambda = 0.204 {Re}^{-0.2}$`" MinOccurs=0 MaxOccurs=1 InputTmpl="flag" } zigrang{ Description="Selects the Zigrang-Sylvester friction factor model." MinOccurs=0 MaxOccurs=1 InputTmpl="flag" } churchill{ Description="Selects the Churchill friction factor model." MinOccurs=0 MaxOccurs=1 InputTmpl="flag" } custom{ Description="Select user-defined friction factor model. Must enter model coefficients." ### Appearance=":math:`$\lambda = A {Re}^{B}+C$`" MinOccurs=0 MaxOccurs=1 InputTmpl="flag" A{ Description="The A coefficient in custom friction model." MinOccurs=1 MaxOccurs=1 InputTmpl="value.flag" value{ MinOccurs=1 MaxOccurs=1 ValType=Real MinValInc=0.0 } } B{ Description="The B coefficient in custom friction model." MinOccurs=1 MaxOccurs=1 InputTmpl="value.flag" value{ MinOccurs=1 MaxOccurs=1 ValType=Real } } C{ Description="The C coefficient in custom friction model." MinOccurs=1 MaxOccurs=1 InputTmpl="value.flag" value{ MinOccurs=1 MaxOccurs=1 ValType=Real } } } } } initial{ Description="Declares the initial condition block." Loading Loading
SubKit/build/InpBuild.py +4 −0 Original line number Diff line number Diff line Loading @@ -153,6 +153,10 @@ class InpBuilder(object): for key in vuq_param.keys(): me.model.addVUQParam(key, vuq_param[key]) friction = me.inp.getFrictionModel() if friction['model'] is not None: me.model.setFrictionModel(friction) me.model.setAveragePower(qprime=me.inp.getInitialQprime()) me.model.generateModel(me.getOutputFilename()) Loading
SubKit/build/InpParse.py +27 −0 Original line number Diff line number Diff line Loading @@ -820,3 +820,30 @@ class InpParse(object): raw = vuq.get('param') if raw: return me._processDict(raw) def getFrictionModel(me): """ Returns the name of the friction model to use Returns a dictionary: {model: name, options: {}} Options will be another dictionary that gives an option name and option value. Returns None if no model was specified by user. """ frict = {'model': None, 'options': {}} models = me.inpDict.get('models') if models: modelDict = models.get('friction') if modelDict is not None: keys = modelDict.keys() assert len(keys)==1 frict['model'] = keys[0] else: frict['model'] = None if frict['model']=='custom': frict['options']['A'] = me.inpDict['models']['friction']['custom']['A']['value'] frict['options']['B'] = me.inpDict['models']['friction']['custom']['B']['value'] frict['options']['C'] = me.inpDict['models']['friction']['custom']['C']['value'] return frict
SubKit/build/Model.py +21 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,9 @@ class Model: # Takes a VUQ parameter name and returns its value me.vuq_param = {} # Dictionary stores the friction model to use me.frictionModel = {'model': 'modified', 'options': {}} # Single-phase turbulent mixing coefficient me.beta = 0.037 Loading Loading @@ -187,6 +190,24 @@ class Model: if beta is not None: me.beta = beta def setFrictionModel(me, model): """ Sets the friction model option Args: model (dict): Shall be of the form {'model': name, 'options': {}}. Valid names are "original", "modified", "zigrang", "churchill", and "custom". If "custom" is provided, then 'options' must be present in the dict to specify the A/B/C coefficients in the model. """ validNames = ['original', 'modified', 'zigrang', 'churchill', 'custom'] assert 'model' in model assert model['model'] in validNames if model['model']=='custom': assert 'options' in model assert 'A' in model['options'] assert 'B' in model['options'] assert 'C' in model['options'] me.frictionModel = model def setFluidProperties(me, fluidprops): """Set the fluid property table to use. Loading
SubKit/build/genDeck.py +23 −8 Original line number Diff line number Diff line Loading @@ -106,8 +106,19 @@ def writeDeck(model, filename): hasmaps = 1 else: hasmaps = 0 group1Data.append(" 1 2 0 3{:5d}{:15.5e}{:6d} 1{:5d}{:5d}{:5d} 0 7 0\n".format( model.solver, mdotInit, notrans, hasmaps, fluidprops, mflx)) modelName = model.frictionModel['model'] if modelName=='original': irfc = 1 elif modelName=='modified': irfc = 2 elif modelName=='zigrang': irfc = 3 elif modelName=='churchill': irfc=4 else: irfc=5 group1Data.append(" 1{:5d} 0 3{:5d}{:15.5e}{:6d} 1{:5d}{:5d}{:5d} 0 7 0\n".format( irfc, model.solver, mdotInit, notrans, hasmaps, fluidprops, mflx)) group1Data.append("*Card 1.2\n") if mflx == 1: group1Data.append( Loading @@ -130,6 +141,10 @@ def writeDeck(model, filename): if model.editOptions['hdf5'] == True and model.is_nodal: group1Data.append("*Card 1.5\n") group1Data.append(" {nodal_model} .true.\n") if irfc==5: group1Data.append("*Card 1.5\n") group1Data.append("** A B C\n") group1Data.append("{:12.4e}{:12.4e}{:12.4e}\n".format(model.frictionModel['options']['A'], model.frictionModel['options']['B'], model.frictionModel['options']['C'])) # The Card Group 2 data to be written to the deck group2Data = [] Loading Loading @@ -481,7 +496,7 @@ def writeDeck(model, filename): group9Data.append("*Card 9.2\n") group9Data.append( "** I FTYP DROD DFUL NFUL IMTF IMTC IMOX DCRE TCLD FTDS IGPC IGFC IRDP EPSO\n") group9Data.append("{0:5d}{1:>5s}{2:11.7f}{3:11.7f}{4:5d} 0 0 0 0{5:15.5e}{6:15.5e} 0 0 0 0.0\n".format(i, charID( group9Data.append("{0:5d}{1:>5s}{2:11.7f}{3:11.7f}{4:6d} 0 0 0 0{5:12.5e}{6:12.5e} 0 0 0 0.0\n".format(i, charID( typeobj), typeobj.d_outer, typeobj.d_pellet, typeobj.num_rings, 0.5 * (typeobj.d_outer - typeobj.d_inner), typeobj.percentTheoreticalDensity)) else: group9Data.append( Loading
SubKit/build/workbench/input.sch +82 −0 Original line number Diff line number Diff line Loading @@ -244,6 +244,88 @@ solution{ } } models{ Description="Select models to use for simulation." MinOccurs=0 MaxOccurs=1 InputTmpl="flag" friction{ Description="Selects the model to use for calculation of the friction factor." MinOccurs=0 MaxOccurs=1 InputTmpl="flag" ChildExactlyOne=[original, modified, zigrang, churchill, custom] original{ Description="Selects the original friction factor model." ### Appearance=":math:`$\lambda = \max(1.691{Re}^{-0.43}, 0.117{Re}^{-0.14})$`" MinOccurs=0 MaxOccurs=1 InputTmpl="flag" } modified{ Description="Selects the modified friction factor model." ### Appearance=":math:`$\lambda = 0.204 {Re}^{-0.2}$`" MinOccurs=0 MaxOccurs=1 InputTmpl="flag" } zigrang{ Description="Selects the Zigrang-Sylvester friction factor model." MinOccurs=0 MaxOccurs=1 InputTmpl="flag" } churchill{ Description="Selects the Churchill friction factor model." MinOccurs=0 MaxOccurs=1 InputTmpl="flag" } custom{ Description="Select user-defined friction factor model. Must enter model coefficients." ### Appearance=":math:`$\lambda = A {Re}^{B}+C$`" MinOccurs=0 MaxOccurs=1 InputTmpl="flag" A{ Description="The A coefficient in custom friction model." MinOccurs=1 MaxOccurs=1 InputTmpl="value.flag" value{ MinOccurs=1 MaxOccurs=1 ValType=Real MinValInc=0.0 } } B{ Description="The B coefficient in custom friction model." MinOccurs=1 MaxOccurs=1 InputTmpl="value.flag" value{ MinOccurs=1 MaxOccurs=1 ValType=Real } } C{ Description="The C coefficient in custom friction model." MinOccurs=1 MaxOccurs=1 InputTmpl="value.flag" value{ MinOccurs=1 MaxOccurs=1 ValType=Real } } } } } initial{ Description="Declares the initial condition block." Loading