class MockPC(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder( location=parameters.ParamLocation.AVERAGE) as pb: pb.defParam("p1", "units", "p1 description") pb.defParam("p2", "units", "p2 description", parameters.ParamLocation.TOP)
class MockSyncPC(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(default=0.0, location=parameters.ParamLocation.AVERAGE) as pb: pb.defParam("param1", "units", "p1 description", categories=["cat1"]) pb.defParam("param2", "units", "p2 description", categories=["cat2"]) pb.defParam("param3", "units", "p3 description", categories=["cat3"])
class MockBaseParamCollection(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam("base1", "units", "a param on the base collection", "avg") pb.defParam("base2", "units", "another param on the base collection", "avg")
def getRadialSegmentParameterDefinitions(): """Return parameters for RadialSegment.""" pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb: pb.defParam("inner_theta", units="?", description="?") pb.defParam("outer_theta", units="?", description="?") pb.defParam("inner_radius", units="?", description="?") pb.defParam("outer_radius", units="?", description="?") pb.defParam("height", units="?", description="?") pb.defParam("azimuthal_differential", units="?", description="?") pb.defParam("radius_differential", units="?", description="?") pb.defParam("inner_axial", units="?", description="?") pb.defParam("outer_axial", units="?", description="?") return pDefs
def getHelixParameterDefinitions(): """Return parameters for Helix.""" pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb: pb.defParam("od", units="cm", description="Outer diameter") pb.defParam("id", units="cm", description="Inner diameter", default=0.0) pb.defParam("op", units="cm", description="Outer pitch") pb.defParam( "axialPitch", units="cm", description="Axial pitch of helix in helical shapes.", ) pb.defParam("helixDiameter", units="cm", description="Diameter of helix") return pDefs
def getFuelMaterialParameterDefinitions(): """ Define the state parameters available on a FuelMaterial object. .. note:: These are not stored in the database. """ pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(location=ParamLocation.AVERAGE, default=0.0, saveToDB=False) as pb: # not strictly fissile when the class 1/class 2 custom isotopic input option is used pb.defParam("class1_wt_frac", units=None, description="~Fissile/HM mass fraction") pb.defParam( "class1_custom_isotopics", units=None, description="Name of high-reactivity custom isotopics", ) pb.defParam( "class2_custom_isotopics", units=None, description="Name of low-reactivity custom isotopicsn", ) return pDefs
def _getFuelPerformanceBlockParams(): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(default=0.0, location=ParamLocation.AVERAGE) as pb: pb.defParam( "gasReleaseFraction", units="fraction", description= "Fraction of generated fission gas that no longer exists in the block." " Should be between 0 and 1, inclusive.", categories=["eq cumulative shift"], ) pb.defParam( "bondRemoved", units="fraction", description= "Fraction of thermal bond between fuel and clad that has been pushed out. " "Should be between 0 and 1, inclusive.", categories=["eq cumulative shift"], ) pb.defParam( "cladWastage", units=units.MICRONS, description="Total cladding wastage from inner and outer surfaces.", location=ParamLocation.AVERAGE, categories=["eq cumulative shift"], ) pb.defParam( "totalCladStrain", units="%", description="Total diametral clad strain.", categories=["eq cumulative shift"], ) pb.defParam( "axialGrowthPct", units="%", description="Axial growth percentage", categories=["eq cumulative shift"], ) pb.defParam( "fpPeakFuelTemp", units="C", description="Fuel performance calculated peak fuel temperature.", location=ParamLocation.AVERAGE, ) pb.defParam( "fpAveFuelTemp", units="C", description="Fuel performance calculated average fuel temperature.", location=ParamLocation.AVERAGE, ) return pDefs
class MockParamCollection(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam("sameName", "units", "description 1", "location") pb.defParam("sameName", "units", "description 2", "location")
def getHoledRectangleParameterDefinitions(): """Return parameters for HoledRectangle.""" pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb: pb.defParam("holeOD", units="?", description="?") return pDefs
class Mock(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam("noneDefault", "units", "description", "location", default=None)
def getMaterialParameterDefinitions(): """ Define the state parameters available on a Material object. .. note:: These are not stored in the database. """ pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder( location=ParamLocation.AVERAGE, default=0.0, saveToDB=False ) as pb: pb.defParam( "density", units="g/$cm^3$", description="density used for custom material" ) pb.defParam("refDens", units="g/$cm^3$", description="reference density") pb.defParam( "zrFrac", units=None, description="The zirconium weight fraction of a material", ) pb.defParam( "uFrac", units=None, description="The uranium weight fraction of a material" ) pb.defParam( "puFrac", units=None, description="The Pu weight fraction of a material" ) pb.defParam("thFrac", units=None, description="?") pb.defParam("refTempK", units="K", description="?") pb.defParam("shapeFactor", units="?", description="?") pb.defParam("theoreticalDensityFrac", units="?", description="?") pb.defParam( "thermalConductivity", units="W-m/K", description="Thermal conductivity" ) with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=False) as pb: pb.defParam("massFrac", units=None, description="mass fractions") pb.defParam("massFracNorm", units=None, description="mass fractions") pb.defParam( "atomFracDenom", units=None, description="so it does not have to be summed each time ( O(1) vs. O(N))", ) return pDefs
def getDummyParamDefs(): dummyDefs = parameters.ParameterDefinitionCollection() with dummyDefs.createBuilder() as pb: def type(self, value): self._p_type = value self._p_flags = Flags.fromStringIgnoreErrors(value) pb.defParam("type", units="none", description="Fake type", setter=type) return dummyDefs
def getHexagonParameterDefinitions(): """Return parameters for Hexagon.""" pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb: pb.defParam("ip", units="cm", description="Inner pitch", default=0.0) pb.defParam("op", units="cm", description="Outer pitch") return pDefs
class Mock(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam( "noSetter", "noSetter", "units", "description", "location", default="encapsulated", setter=None, )
def getUnshapedParameterDefinitions(): """Return parameters for UnshapedComponent.""" pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb: pb.defParam("op", units="cm", description="Outer pitch") pb.defParam( "userDefinedVolume", units="cm^3", description="Volume of this object." ) return pDefs
class Mock(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: with self.assertRaises(AssertionError): pb.defParam("units", "description", "location", default=[]) with self.assertRaises(AssertionError): pb.defParam("units", "description", "location", default={}) with self.assertRaises(AssertionError): fail = pDefs.createBuilder(default=[]) with self.assertRaises(AssertionError): fail = pDefs.createBuilder(default={})
def getRectangleParameterDefinitions(): """Return parameters for Rectangle.""" pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb: pb.defParam("lengthInner", units="cm", description="Inner length") pb.defParam("lengthOuter", units="cm", description="Outer length") pb.defParam("widthInner", units="cm", description="Inner width") pb.defParam("widthOuter", units="cm", description="Outer width") return pDefs
def getBatchParameterDefinitions(): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam( "targetDensity", units="g/cm$^3$", description='target density for the "mass addition components" of this batch', location="?", saveToDB=True, default=1.0, ) return pDefs
class MockPC(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(categories=["awesome", "stuff"]) as pb: pb.defParam("p1", "units", "p1 description", "location") pb.defParam("p2", "units", "p2 description", "location", categories=["bacon"]) with pDefs.createBuilder() as pb: pb.defParam("p3", "units", "p3 description", "location", categories=["bacon"])
class Mock(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: def n(self, value): self._p_n = value self._p_nPlus1 = value + 1 pb.defParam("n", "units", "description", "location", setter=n) def nPlus1(self, value): self._p_nPlus1 = value self._p_n = value - 1 pb.defParam("nPlus1", "units", "description", "location", setter=nPlus1)
def _getNeutronicsCoreParams(): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder( categories=[parameters.Category.neutronics]) as pb: pb.defParam( "eigenvalues", units=None, description="All available lambda-eigenvalues of reactor.", default= None, # will be a list though, can't set default to mutable type. location=ParamLocation.AVERAGE, ) pb.defParam( "axialMesh", units="cm", description= "Global axial mesh from bottom to top used in structured-mesh neutronics simulations.", default=None, location=ParamLocation.TOP, ) pb.defParam( "kInf", units=None, description="k-infinity", default=0.0, location=ParamLocation.AVERAGE, ) pb.defParam( "refKeff", units=None, description="Reference unperturbed keff", default=0.0, location=ParamLocation.AVERAGE, ) return pDefs
class Mock(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam("doodle", "units", "description", "location", default=42) with pDefs.createBuilder(MockComposite, default=0.0) as pb: pb.defParam("cheese", "kg", "pressed curds of milk", "avg") pb.defParam("fudge", "kg", "saturated chocolate", "avg", default=19) pb.defParam( "noodles", "kg", "strip, ring, or tube of pasta", "avg", default=None, )
def getTorusParameterDefinitions(): """Return parameters for Torus.""" pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder(location=ParamLocation.AVERAGE, saveToDB=True) as pb: pb.defParam("inner_theta", units="?", description="?") pb.defParam("outer_theta", units="?", description="?") pb.defParam("inner_radius", units="?", description="?") pb.defParam("outer_radius", units="?", description="?") pb.defParam("height", units="?", description="?") pb.defParam("azimuthal_differential", units="?", description="?") pb.defParam("radius_differential", units="?", description="?") pb.defParam("inner_axial", units="?", description="?") pb.defParam("outer_axial", units="?", description="?") pb.defParam("inner_minor_radius", units="?", description="?") pb.defParam("outer_minor_radius", units="?", description="?") pb.defParam("major_radius", units="?", description="?") pb.defParam("inner_phi", units="?", description="?") pb.defParam("outer_phi", units="?", description="?") pb.defParam("reference_volume", units="?", description="?") return pDefs
def getAssemblyParameterDefinitions(): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: def powerDecay(self, value): if value is None or isinstance(value, numpy.ndarray): self._p_powerDecay = value else: self._p_powerDecay = numpy.array(value) pb.defParam( "powerDecay", setter=powerDecay, units="W", description="List of decay heats at each time step specified in " "decayHeatCalcTimesInSeconds setting.", saveToDB=True, location=ParamLocation.AVERAGE, # really total default=None, ) with pDefs.createBuilder(location=ParamLocation.CENTROID) as pb: pb.defParam( "orientation", units="degrees", description=( "Triple representing rotations counterclockwise around each spatial axis. " "For example, a hex assembly rotated by 1/6th has orientation (0,0,60.0)" ), default=None, ) with pDefs.createBuilder(location=ParamLocation.AVERAGE, default=0.0) as pb: pb.defParam( "arealPd", units="MW/m^2", description="Power in assembly divided by its XY cross-sectional area. Related to PCT.", ) pb.defParam( "buLimit", units="", description="buLimit", default=parameters.NoDefault ) pb.defParam( "chargeBu", units="%FIMA", description="Max block-average burnup in this assembly when it entered the core.", ) pb.defParam( "chargeCycle", units="", description="Cycle number that this assembly entered the core.", ) pb.defParam( "chargeFis", units="kg", description="Fissile mass in assembly when it entered the core.", ) pb.defParam( "chargeTime", units="years", description="Time at which this assembly entered the core.", default=parameters.NoDefault, ) pb.defParam("daysSinceLastMove", units="", description="daysSinceLastMove") pb.defParam("kInf", units="", description="kInf") pb.defParam("maxDpaPeak", units="", description="maxDpaPeak") pb.defParam("maxPercentBu", units="", description="maxPercentBu") pb.defParam("numMoves", units="", description="numMoves") pb.defParam("timeToLimit", units="", description="timeToLimit", default=1e6) with pDefs.createBuilder(location=ParamLocation.AVERAGE) as pb: def detailedNDens(self, value): """Ensures that data is stored in an numpy array to save memory/space.""" if value is None or isinstance(value, numpy.ndarray): self._p_detailedNDens = value else: self._p_detailedNDens = numpy.array(value) pb.defParam( "detailedNDens", setter=detailedNDens, units="atoms/bn-cm", description=( "High-fidelity number density vector with up to thousands of nuclides. " "Used in high-fi depletion runs where low-fi depletion may also be occurring. " "This param keeps the hi-fi and low-fi depletion values from interfering. " "See core.p.detailedNucKeys for keys. " # Could be moved to external physics plugin ), saveToDB=True, default=None, ) pb.defParam( "assyAxialSwellingSF", units="mm", description="Assembly axial swelling due to stress-free swelling", default=0.0, ) pb.defParam( "fuelVent", units=None, description="Boolean option to turn on/off vented fuel pins in TWR design", saveToDB=False, default=False, categories=[parameters.Category.assignInBlueprints], ) with pDefs.createBuilder( location=ParamLocation.AVERAGE, default=0.0, categories=["thermal hydraulics"] ) as pb: pb.defParam("THdeltaPNoGrav", units="Pa", description="?") pb.defParam( "THdeltaPPump", units="Pa", description="Pumping pressure rise required to pump the given mass flow rate through the rod bundle", categories=["broadcast"], ) pb.defParam( "THdeltaPTotal", units="Pa", description="Total pressure difference across the assembly", categories=["broadcast"], ) pb.defParam( "THcoolantOutletT", units=units.DEGC, description="The nominal average bulk coolant outlet temperature out of the block.", categories=["broadcast"], ) pb.defParam( "THmassFlowRate", units="kg/s", description="The nominal assembly flow rate", categories=["broadcast"], ) pb.defParam( "THlocalDTout", units=units.DEGC, description="Maximum delta-Ts for outlet temperatures of all assemblies", categories=["broadcast"], ) pb.defParam( "THlocalDToutFuel", units=units.DEGC, description="Maximum delta-Ts for outlet temperatures of fuel assemblies", categories=["broadcast"], ) pb.defParam( "THorificeSetting", units="Pa/$(kg/s)^2$", description="The ratio of pressure drop over mass flow rate squared, through an orifice", default=None, ) pb.defParam( "THorificeZone", units=None, description="orifice zone for assembly; should be location specific", default=0, # integer default ) with pDefs.createBuilder( location="N/A", default=0.0, categories=["control rods"] ) as pb: pb.defParam( "crCurrentHeight", units="cm", description="The current height of the bottom of the control material from the 0 point in the reactor model", ) pb.defParam( "crEndingHeight", units="cm", description="The final position of the bottom of the control material when " "starting control operations as measured from the 0 point in the reactor model", ) pb.defParam( "crRodLength", units="cm", description="length of the control material within the control rod", saveToDB=False, ) pb.defParam( "crStartingHeight", units="cm", description="The initial starting position of the bottom of the control " "material when starting control operations as measured from the 0 point in the " "reactor model", ) with pDefs.createBuilder() as pb: pb.defParam( "type", units="?", description="The name of the assembly input on the blueprints input", location="?", default="defaultAssemType", saveToDB=True, ) with pDefs.createBuilder(default=0.0) as pb: pb.defParam("Pos", units="?", description="?", location="?") pb.defParam("Ring", units="?", description="?", location="?") pb.defParam("THcoolantInletT", units="?", description="?", location="?") pb.defParam("assemNum", units="?", description="?", location="?") pb.defParam( "axExpWorthPT", units="pcm/%/cm^3", description="Axial swelling reactivity", location=ParamLocation.AVERAGE, ) pb.defParam( "coolFlowingWorthPT", units="pcm/%/cm^3", description="Flowing coolant reactivity", location=ParamLocation.AVERAGE, ) pb.defParam( "coolWorthPT", units="pcm/%/cm^3", description="Coolant reactivity", location=ParamLocation.AVERAGE, ) pb.defParam("dischargeTime", units="?", description="?", location="?") pb.defParam( "fuelWorthPT", units="pcm/%/cm^3", description="Fuel reactivity", location=ParamLocation.AVERAGE, ) pb.defParam( "hotChannelFactors", units="None", description="Definition of set of HCFs to be applied to assembly.", location="?", default="Default", saveToDB=False, categories=[parameters.Category.assignInBlueprints], ) pb.defParam( "radExpWorthPT", units="pcm/%/cm^3", description="Radial swelling reactivity", location=ParamLocation.AVERAGE, ) pb.defParam( "structWorthPT", units="pcm/%/cm^3", description="Structure reactivity", location=ParamLocation.AVERAGE, ) with pDefs.createBuilder(categories=["radialGeometry"]) as pb: pb.defParam( "AziMesh", units="?", description="?", location="?", saveToDB=False, default=1, ) pb.defParam( "RadMesh", units="?", description="?", location="?", saveToDB=False, default=1, ) return pDefs
def getDummyParamDefs(): dummyDefs = parameters.ParameterDefinitionCollection() with dummyDefs.createBuilder() as pb: pb.defParam("type", units="none", description="Fake type") return dummyDefs
class MockPCChild(MockPC): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam("p2", "foo", "bar")
class MockPC(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() # use of the ParameterBuilder creates an empty __slots__ with pDefs.createBuilder() as pb: pb.defParam("p0", "units", "p0 description", "location")
class MockDerivedBCollection(MockDerivedACollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam("derBp", "units", "derived b param", "centroid")
class MockPC0(parameters.ParameterCollection): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam("p0", "units", "p0 description", "location")
class MockPCChild(MockPCParent): pDefs = parameters.ParameterDefinitionCollection() with pDefs.createBuilder() as pb: pb.defParam("sameName", "units", "description 4", "location")