text: # Copyright 2019 TerraPower, LLC
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  
  """Parameter definitions for Blocks."""
  
  import numpy
  
  import six
  
  from armi import runLog
  from armi.nucDirectory import nuclideBases
  from armi.physics.neutronics import crossSectionGroupManager
  from armi.reactor.flags import Flags  # non-standard import to avoid name conflict below
  from armi.utils import units
  from armi.utils.units import ASCII_LETTER_A
  
  from armi.reactor import parameters
  from armi.reactor.parameters import ParamLocation, Parameter, NoDefault
  
  
  def getBlockParameterDefinitions():
      pDefs = parameters.ParameterDefinitionCollection()
  
      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() as pb:
          pb.defParam(
              "partisnFlux",
              units="n/cm^2/s",
              description="flux generated by the PARTISN transport calculation when generating multi-group cross sections",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=0.0,
          )
  
          pb.defParam(
              "partisnMgFlux",
              units="n-cm/s",
              description="flux generated by the PARTISN transport calculation when generating multi-group cross sections",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              categories=[
                  parameters.Category.volumeIntegrated,
                  parameters.Category.fluxQuantities,
                  parameters.Category.multiGroupQuantities,
              ],
              default=None,
          )
  
          pb.defParam(
              "extSrc",
              units="g/cm^3/s",
              description="multigroup external source",
              location=ParamLocation.AVERAGE,
              saveToDB=False,
              categories=[parameters.Category.multiGroupQuantities],
              default=None,
          )
  
          pb.defParam(
              "mgGammaSrc",
              units="g/cm^3/s",
              description="multigroup gamma source",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              categories=[parameters.Category.multiGroupQuantities],
              default=None,
          )
  
          pb.defParam(
              "gammaSrc",
              units="g/cm^3/s",
              description="gamma source",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "mgFluxSK",
              units="",
              description="multigroup volume-integrated flux stored for multiple time steps in spatial kinetics (2-D array)",
              location=ParamLocation.VOLUME_INTEGRATED,
              saveToDB=False,
              categories=[
                  parameters.Category.fluxQuantities,
                  parameters.Category.multiGroupQuantities,
              ],
              default=None,
          )
  
          # Not anointing the pin fluxes as a MG quantity, since it has an extra dimension, which
          # could lead to issues, depending on how the multiGroupQuantities category gets used
          pb.defParam(
              "pinMgFluxes",
              units="n/s/cm$^2$",
              description="""
                  The block-level pin multigroup fluxes. pinMgFluxes[g][i] represents the flux in group g for pin i.  Flux
                  units are the standard n/cm^2/s.  The "ARMI pin ordering" is used, which is counter-clockwise from 3
                  o'clock.  See TP1-1.9.31-RPT-0010 for more details.
              """,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "pinMgFluxesAdj",
              units="",
              description="should be a blank 3-D array, but re-defined later (ng x nPins x nAxialSegments)",
              saveToDB=False,
              default=None,
          )
  
          pb.defParam(
              "pinMgFluxesGamma",
              units="g/s/cm$^2$",
              description="should be a blank 3-D array, but re-defined later (ng x nPins x nAxialSegments)",
              saveToDB=False,
              default=None,
          )
  
          pb.defParam(
              "pinPowers",
              units="W/cm",
              description="""
                  The block-level pin linear power densities. pinPowers[i] represents the average linear power density of
                  pin i.  Power units are Watts/cm (Watts produced per cm of pin length).  The "ARMI pin ordering" is
                  used, which is counter-clockwise from 3 o'clock.  See TP1-1.9.31-RPT-0010 for more details.
              """,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "pinPowersNeutron",
              units="W/cm",
              description="should be a blank 2-D array, but re-defined later (nPins x nAxialSegments)",
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "pinPowersGamma",
              units="W/cm",
              description="should be a blank 2-D array, but re-defined later (nPins x nAxialSegments)",
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "axialPowerProfile",
              units="",
              description="""
                  For each reconstructed axial location, a tuple (z,power density) where with axial origin at the bottom
                  of assembly in which the blocks are located.
              """,
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "axialPowerProfileNeutron",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "axialPowerProfileGamma",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "pinLocation",
              description="Location of fuel pins",
              units=None,
              saveToDB=False,
              default=None,
          )
  
          pb.defParam(
              "axialMgFluxReconCoeff",
              units="",
              description="""
                  The coefficients in the axial multigroup flux profile polynomial for this block.  The flux profile is
                  usually A*z^4 + B*z^3 + C*z^2 + D*z + E, and so this variable will be the 5 x ng list, so
                  axialMgFluxReconCoeff[g][i] is the ith coefficient for flux group g.  Also, this flux profile is
                  normalized (for each group) so that its average is always 1.0 in each block.  One must multiply the
                  coefficients of each group by the block-average group flux to obtain the axial group flux profile.
              """,
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "axialMgFluxProfileAdj",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=False,
              default=None,
          )
  
          pb.defParam(
              "axialMgFluxProfileNeutron",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=False,
              default=None,
          )
  
          pb.defParam(
              "axialMgFluxProfileNeutronAdj",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=False,
              default=None,
          )
  
          pb.defParam(
              "axialMgFluxProfileGamma",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=False,
              default=None,
          )
  
          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 move to external physic plugin
              ),
              location=ParamLocation.AVERAGE,
              saveToDB=False,
              default=None,
          )
  
          pb.defParam(
              "radialMgFluxProfile",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "radialMgFluxProfileAdj",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "radialMgFluxProfileNeutron",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "radialMgFluxProfileNeutronAdj",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "radialMgFluxProfileGamma",
              units="",
              description="",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "betad",
              units="",
              description="Delayed neutron beta",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "chi",
              units="",
              description="Energy distribution of fission neutrons",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "chid",
              units="",
              description="Energy distribution of delayed fission neutrons",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
              default=None,
          )
  
          pb.defParam(
              "linPow",
              units="W/m",
              description="Linear heat generation rate",
              location=ParamLocation.AVERAGE,
              default=0.0,
          )
  
          pb.defParam(
              "linPowByPin",
              units="W/cm",
              description="Pin linear power",
              location=ParamLocation.CHILDREN,
              default=None,
          )
  
          pb.defParam(
              "linPowByPinNeutron",
              units="W/cm",
              description="Pin linear neutron power",
              location=ParamLocation.CHILDREN,
              default=None,
          )
  
          pb.defParam(
              "linPowByPinGamma",
              units="W/cm",
              description="Pin linear gamma power",
              location=ParamLocation.CHILDREN,
              default=None,
          )
  
          pb.defParam(
              "reactionRates",
              units="Reactions/sec",
              description='List of reaction rates in specified by setting "reactionsToDB"',
              location=ParamLocation.VOLUME_INTEGRATED,
              default=None,
          )
  
      with pDefs.createBuilder(
          default=0.0, location=ParamLocation.AVERAGE, categories=["depletion"]
      ) as pb:
  
          pb.defParam(
              "burnupMWdPerKg",
              units="MWd/kg",
              description="Burnup in MWd/kg of initial heavy metal",
              categories=["cumulative"],
          )
  
          pb.defParam(
              "fissileFraction",
              units=None,
              description="Ratio of fissile mass to heavy metal mass at block-level",
          )
  
          pb.defParam(
              "molesHmBOL",
              units="mole",
              description="Total number of atoms of heavy metal at BOL assuming a full assembly",
              default=None,
          )
  
          pb.defParam(
              "massHmBOL",
              units="grams",
              description="Mass of heavy metal at BOL",
              default=None,
          )
  
          pb.defParam(
              "molesHmBOLByPin",
              units="mole",
              description="Total number of atoms of heavy metal at BOL",
              default=None,
              saveToDB=False,
          )
  
          pb.defParam(
              "molesHmNow",
              units="mole",
              description="Total number of atoms of heavy metal",
          )
  
          pb.defParam(
              "newDPA",
              units="dpa",
              description="Dose in DPA accrued during the current time step",
          )
  
          pb.defParam(
              "percentBu",
              units="%FIMA",
              description="Percentage of the initial heavy metal atoms that have been fissioned",
              categories=["cumulative"],
          )
  
          pb.defParam(
              "percentBuByPin",
              units="%FIMA",
              description="Percent burnup of the initial heavy metal atoms that have been fissioned for each pin",
              default=None,
              saveToDB=False,
          )
  
          pb.defParam(
              "percentBuMax",
              units="%FIMA",
              description="Maximum percentage in a single pin of the initial heavy metal "
              "atoms that have been fissioned",
          )
  
          pb.defParam(
              "percentBuMaxPinLocation",
              units="int",
              description="Peak burnup pin location",
          )
  
          pb.defParam(
              "percentBuMin",
              units="%FIMA",
              description="Minimum percentage of the initial heavy metal atoms that have been fissioned",
          )
  
          pb.defParam(
              "residence",
              units="EFP days",
              description="Duration that a block has been in the core at full power.",
              categories=["cumulative"],
          )
  
      pDefs.add(
          Parameter(
              name="depletionMatrix",
              units="N/A",
              description="Full BurnMatrix objects containing transmutation and decay info about this block.",
              location=ParamLocation.AVERAGE,
              saveToDB=False,
              default=None,
              setter=NoDefault,
              categories=set(),
          )
      )
  
      pDefs.add(
          Parameter(
              name="cycleAverageBurnMatrix",
              units="N/A",
              description="Integrated burn matrix mapping this block from its BOC to EOC number densities.",
              location=ParamLocation.AVERAGE,
              saveToDB=False,
              default=None,
              setter=NoDefault,
              categories=set(),
          )
      )
  
      with pDefs.createBuilder(
          default=0.0,
          location=ParamLocation.AVERAGE,
          saveToDB=False,
          categories=["thermal hydraulics"],
      ) as pb:
  
          pb.defParam(
              "pressureLossCoeffs",
              units="",
              description="Pressure loss coefficients from form losses outside of bundle region of "
              "assembly, e.g. losses through pin attachment hardware, expansion in inlet "
              "nozzle.",
              default=None,
              categories=[parameters.Category.assignInBlueprints],
          )
  
          pb.defParam(
              "inletLossCoeff",
              units="",
              description="Pressure loss coefficients from form losses to be applied at the block "
              "inlet",
              default=None,
              categories=[parameters.Category.assignInBlueprints],
          )
  
      with pDefs.createBuilder(
          default=0.0, location=ParamLocation.AVERAGE, categories=["thermal hydraulics"]
      ) as pb:
          pb.defParam(
              "THaveInletVel",
              units="m/s",
              saveToDB=True,
              description="Average fluid velocity taken at the inlet of the block.",
          )
  
          pb.defParam(
              "THaveOutletVel",
              units="m/s",
              saveToDB=True,
              description="Average fluid velocity taken at the outlet of the block.",
          )
  
          pb.defParam(
              "THdeltaPAccel",
              units="Pa",
              saveToDB=False,
              description="Acceleration component to the pressure drop.",
          )
  
          pb.defParam(
              "THdeltaPFric",
              units="Pa",
              saveToDB=False,
              description="Friction component to the pressure drop.",
          )
  
          pb.defParam(
              "THdeltaPInlet",
              units="Pa",
              saveToDB=False,
              description="Pressure drop at the inlet of the block.",
          )
  
          pb.defParam(
              "THdeltaPOutlet",
              units="Pa",
              saveToDB=False,
              description="Pressure drop at the outlet of the block.",
          )
  
          pb.defParam(
              "THhotChannelCladMidwallT",
              units=units.DEGC,
              saveToDB=False,
              description="Midwall (average) clad temperature for the hot channel or hot pin.",
          )
  
          pb.defParam(
              "THhotChannelHeatTransferCoeff",
              units="W/m^2/K",
              saveToDB=True,
              description="Film heat transfer coefficient for hot channel in the assembly.",
          )
  
          pb.defParam(
              "THinletDynamicPressure",
              units="Pa",
              saveToDB=False,
              description="Dynamic pressure drop component taken at the inlet of the block.",
          )
  
          pb.defParam(
              "THmixingLength",
              units=units.UNITLESS,
              saveToDB=False,
              description="Approximation of length for subchannel mixing in subchan model.",
          )
  
          pb.defParam(
              "THpeakingStdDev",
              units=units.UNITLESS,
              saveToDB=False,
              description="Standard deviation of pin peaking for modeling pin-level power in subchan.",
          )
  
          pb.defParam(
              "THradialPeakingFactor",
              units=units.UNITLESS,
              saveToDB=False,
              description="Approximation of radial peaking for modeling pin-level power in subchan.",
          )
  
      with pDefs.createBuilder(
          default=None, saveToDB=True, categories=["thermal hydraulics"]
      ) as pb:
  
          pb.defParam(
              "THhotChannelCladODT",
              units=units.DEGC,
              description="Nominal clad outer diameter temperature of the hot pin",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "THhotChannelCladIDT",
              units=units.DEGC,
              description="Nominal clad inner diameter temperature of the hot pin",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "THhotChannelFuelODT",
              units=units.DEGC,
              description="Temperature of the fuel outer diameter",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "THhotChannelFuelCenterlineT",
              units=units.DEGC,
              description="Nominal hot channel fuel centerline temperature",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "THdeltaPBundle",
              units="Pa",
              description="Pressure difference in a bundle, including contributions from friction, acceleration, and gravity",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH0SigmaCladODT",
              units=units.DEGC,
              description="0-sigma clad outer diameter temperature of the hot pin",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH2SigmaCladODT",
              units=units.DEGC,
              description="2-sigma clad outer diameter temperature of the hot pin",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH3SigmaCladODT",
              units=units.DEGC,
              description="3-sigma clad outer diameter temperature of the hot pin",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH0SigmaCladIDT",
              units=units.DEGC,
              description="0-sigma clad inner diameter temperature of the hot pin",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH2SigmaCladIDT",
              units=units.DEGC,
              description="2-sigma clad inner diameter temperature of the hot pin",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH3SigmaCladIDT",
              units=units.DEGC,
              description="3-sigma clad inner diameter temperature of the hot pin",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH0SigmaFuelCenterlineT",
              units=units.DEGC,
              description="0-sigma fuel centerline temperature",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH2SigmaFuelCenterlineT",
              units=units.DEGC,
              description="2-sigma fuel centerline temperature",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "TH3SigmaFuelCenterlineT",
              units=units.DEGC,
              description="3-sigma fuel centerline temperature",
              categories=["thInterface"],
          )
  
          pb.defParam(
              "THdilationPressure",
              units="Pa",
              description="Dilation pressure",
              categories=["thInterface"],
              default=0.0,
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THmaxLifeTimePower",
              units="W",
              description="Maximum power over the lifetime of this block.",
              default=0.0,
              location=ParamLocation.MAX,
          )
  
      with pDefs.createBuilder(
          default=0.0, categories=["thInterface"], saveToDB=True
      ) as pb:
  
          pb.defParam(
              "TH0SigmaOutletT",
              units=units.DEGC,
              description="0-sigma clad outer diameter temperature of the hot pin",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "TH2SigmaOutletT",
              units=units.DEGC,
              description="2-sigma clad outer diameter temperature of the hot pin",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "TH3SigmaOutletT",
              units=units.DEGC,
              description="3-sigma clad outer diameter temperature of the hot pin",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THTfuelCL",
              units=units.DEGC,
              description="Average temperature of the fuel centerline used for neutronic coupling",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THTfuelOD",
              units=units.DEGC,
              description="Average temperature of the fuel outer diameter used for neutronic coupling",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THaverageCladODT",
              units=units.DEGC,
              description="Block average of the outer clad temperature.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THaverageCladIDT",
              units=units.DEGC,
              description="Block average of the inner clad temperature",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THassemPressDrop",
              units="Pa",
              description="The pressure drop across this block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THaveCoolantVel",
              units="m/s",
              description="Average of the inlet and outlet coolant velocities",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THaverageCladTemp",
              units=units.DEGC,
              description="The nominal average clad temperature in the block, which should be used for neutronic and TH feedback.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THaverageGapTemp",
              units=units.DEGC,
              description="The nominal average gap temperature in the block, which should be used for neutronic and TH feedback.",
              location=ParamLocation.AVERAGE,
              saveToDB=True,
          )
  
          pb.defParam(
              "THaverageDuctTemp",
              units=units.DEGC,
              description="The nominal average duct temperature in the block, which should be used for neutronic and TH feedback.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THcoolantAverageT",
              units=units.DEGC,
              description="Flow-based average of the inlet and outlet coolant temperatures.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THcoolantInletT",
              units=units.DEGC,
              description="The nominal average bulk coolant inlet temperature into the block.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THcoolantOutletT",
              units=units.DEGC,
              description="Coolant temperature at the outlet of this block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THcoolantStaticT",
              units=units.DEGC,
              description="Volume-based average coolant temperature, recommended for neutronics",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THdPfrict",
              units="Pa",
              description="Frictional pressure drop",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THdeltaPFormLoss",
              units="Pa",
              description="Pressure differences due to user input loss coefficeints",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THdeltaPGrav",
              units="Pa",
              description="hydrostatic pressure difference in a block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THdeltaPNoGrav",
              units="Pa",
              description="Sum of the loss pressure drops due to friction, acceleration, and inlet + outlet",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THdeltaPTotal",
              units="Pa",
              description="Total pressure difference in a block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THinletCoolantVel",
              units="m/s",
              description="Flow velocity",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THhotChannelOutletT",
              units=units.DEGC,
              description="Nominal hot channel outlet temperature",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THlocalDTout",
              units=units.DEGC,
              description="Maximum delta-Ts for outlet temperatures of all assemblies",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THlocalDToutFuel",
              units=units.DEGC,
              description="Maximum delta-Ts for outlet temperatures of fuel assemblies",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THmassFlowRate",
              units="kg/s",
              description="Mass flow rate",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THmaxCoolantVel",
              units="m/s",
              description="The maximum outlet coolant velocity",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THorificeSetting",
              units="Pa/(kg/s)**2",
              description="A list of orifice settings corresponding to the assembly list",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THorificeZone",
              units=units.UNITLESS,
              description="A list of orificing zones corresponding to the assembly list",
              location=ParamLocation.AVERAGE,
          )
  
      with pDefs.createBuilder(
          default=0.0, categories=["thermal hydraulics", "mongoose"], saveToDB=True
      ) as pb:
  
          pb.defParam(
              "THcornTemp",
              units=units.DEGC,
              description="Best estimate duct temperature [degC] for assembly corners",
              location=ParamLocation.TOP | ParamLocation.CORNERS,
          )
  
          pb.defParam(
              "THedgeTemp",
              units=units.DEGC,
              description="Best estimate duct temperature for assembly edges",
              location=ParamLocation.TOP | ParamLocation.EDGES,
          )
  
          pb.defParam(
              "THbundleAveTemp",
              units=units.DEGC,
              description="Bundle averaged temperature",
              location=ParamLocation.TOP,
          )
  
          pb.defParam(
              "THcoldChanTemp",
              units=units.DEGC,
              description="Best estimate cold channel temperature",
              location=ParamLocation.TOP,
          )
  
          pb.defParam(
              "THcoldChannel",
              units=units.UNITLESS,
              description="Cold channel (lowest coolant dT) identifier",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THcoldPin",
              units=units.UNITLESS,
              description="Cold pin (lowest PCT) pin identifier",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THhotChannel",
              units=units.UNITLESS,
              description="Hot channel (highest coolant dT) identifier",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "THhotPin",
              units=units.UNITLESS,
              description="Hot pin (highest PCT) pin identifier",
              location=ParamLocation.AVERAGE,
          )
  
      with pDefs.createBuilder(default=0.0, location=ParamLocation.AVERAGE) as pb:
  
          pb.defParam("bu", units="", description="?")
  
          pb.defParam(
              "gasReleaseFraction",
              units="",
              description="Fraction of fission gas to remove",
              categories=["eq cumulative shift"],
          )
  
          pb.defParam(
              "bondRemoved",
              units="fraction",
              description="Fraction of thermal bond between fuel and clad that has been pushed out.",
              categories=["eq cumulative shift"],
          )
  
          def buGroup(self, buGroupChar):  # pylint: disable=method-hidden
              if isinstance(buGroupChar, (int, float)):
                  intValue = int(buGroupChar)
                  runLog.warning(
                      "Attempting to set `b.p.buGroup` to int value ({}). Possibly loading from old database".format(
                          buGroupChar
                      ),
                      single=True,
                      label="bu group as int " + str(intValue),
                  )
                  self.buGroupNum = intValue
                  return
              elif not isinstance(buGroupChar, six.string_types):
                  raise Exception(
                      "Wrong type for buGroupChar {}: {}".format(
                          buGroupChar, type(buGroupChar)
                      )
                  )
  
              buGroupNum = ord(buGroupChar) - ASCII_LETTER_A
              self._p_buGroup = (
                  buGroupChar  # pylint: disable=attribute-defined-outside-init
              )
              self._p_buGroupNum = (
                  buGroupNum  # pylint: disable=attribute-defined-outside-init
              )
              buGroupNumDef = parameters.ALL_DEFINITIONS["buGroupNum"]
              buGroupNumDef.assigned = parameters.SINCE_ANYTHING
  
          pb.defParam(
              "buGroup",
              units=units.NOT_APPLICABLE,
              description="The burnup group letter of this block",
              default="A",
              setter=buGroup,
          )
  
          def buGroupNum(self, buGroupNum):  # pylint: disable=method-hidden
              if buGroupNum > 26:
                  raise RuntimeError(
                      "Invalid bu group number ({}): too many groups. 26 is the max.".format(
                          buGroupNum
                      )
                  )
              self._p_buGroupNum = (
                  buGroupNum  # pylint: disable=attribute-defined-outside-init
              )
              self._p_buGroup = chr(
                  buGroupNum + ASCII_LETTER_A
              )  # pylint: disable=attribute-defined-outside-init
              buGroupDef = parameters.ALL_DEFINITIONS["buGroup"]
              buGroupDef.assigned = parameters.SINCE_ANYTHING
  
          pb.defParam(
              "buGroupNum",
              units=units.NOT_APPLICABLE,
              description="An integer representation of the burnup group, linked to buGroup.",
              default=0,
              setter=buGroupNum,
          )
  
          pb.defParam("buRate", units="", description="?")
  
          pb.defParam(
              "detailedDpa",
              units="dpa",
              description="displacements per atom",
              categories=["cumulative", "detailedAxialExpansion", "depletion"],
          )
  
          pb.defParam(
              "detailedDpaPeak",
              units="dpa",
              description="displacements per atom with peaking factor",
              categories=["cumulative", "detailedAxialExpansion", "depletion"],
          )
  
          pb.defParam(
              "detailedDpaRate",
              units="dpa/s",
              description="Current time derivative of average detailed DPA",
              categories=["detailedAxialExpansion", "depletion"],
          )
  
          pb.defParam(
              "displacementX",
              units="m",
              description="Assembly displacement in the x direction",
          )
  
          pb.defParam(
              "displacementY",
              units="m",
              description="Assembly displacement in the y direction",
          )
  
          pb.defParam(
              "fastFluence",
              units="#/cm^2",
              description="Fast spectrum fluence",
              categories=["cumulative"],
          )
  
          pb.defParam(
              "fastFluencePeak",
              units="#/cm^2",
              description="Fast spectrum fluence with a peaking factor",
              categories=["detailedAxialExpansion"],
          )
  
          pb.defParam(
              "fluence", units="#/cm^2", description="Fluence", categories=["cumulative"]
          )
  
          pb.defParam(
              "flux",
              units="n/cm^2/s",
              description="neutron flux",
              categories=[
                  "detailedAxialExpansion",
                  parameters.Category.retainOnReplacement,
                  parameters.Category.fluxQuantities,
              ],
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fluxAdj", units="", description="Adjoint flux"  # adjoint flux is unitless
          )
  
          pb.defParam(
              "pdens",
              units="W/cm$^3$",
              description="Average volumetric power density",
              categories=["detailedAxialExpansion"],
          )
  
          pb.defParam(
              "pdensDecay",
              units="W/cm$^3$",
              description="Decay power density from decaying radionuclides",
              categories=["detailedAxialExpansion"],
          )
  
          pb.defParam(
              "power",
              units="W",
              description="Total power",
              location=ParamLocation.VOLUME_INTEGRATED,
              categories=["detailedAxialExpansion"],
          )
  
          pb.defParam(
              "powerDecay",
              units="W",
              description="Total decay power",
              location=ParamLocation.VOLUME_INTEGRATED,
              categories=["detailedAxialExpansion"],
          )
  
          pb.defParam(
              "powerRx", units="W/cm$^3$", description="?", location=ParamLocation.AVERAGE
          )
  
          pb.defParam(
              "dpaRx", units="dpa/s", description="?", location=ParamLocation.AVERAGE
          )
  
          pb.defParam(
              "heliumInB4C",
              units="He/s/cm$^3$",
              description="?",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateAbs",
              units="1/cm^3/s",
              description="Total absorption rate in this block (fisson + capture).",
          )
  
          pb.defParam(
              "rateCap",
              units="1/cm^3/s",
              description="Parasitic capture rate in this block.",
          )
  
          pb.defParam(
              "rateFis", units="1/cm^3/s", description="Fission rate in this block."
          )
  
          pb.defParam(
              "rateProdFis",
              units="1/cm^3/s",
              description="Production rate of neutrons from fission reactions (nu * fission source / k-eff)",
          )
  
          pb.defParam(
              "rateProdN2n",
              units="1/cm^3/s",
              description="Production rate of neutrons from n2n reactions.",
          )
  
          pb.defParam(
              "timeToLimit",
              units="days",
              description="Time unit block violates its burnup limit.",
          )
  
          pb.defParam(
              "zbottom",
              units="cm",
              description="Axial position of the bottom of this block",
              categories=[parameters.Category.retainOnReplacement],
          )
  
          pb.defParam(
              "ztop",
              units="cm",
              description="Axial position of the top of this block",
              categories=[parameters.Category.retainOnReplacement],
          )
  
          pb.defParam("baseBu", units="?", description="?", saveToDB=False)
  
          pb.defParam("basePBu", units="?", description="?", saveToDB=False)
  
          pb.defParam("hydDiam", units="?", description="?", saveToDB=False)
  
          pb.defParam(
              "nHMAtBOL",
              units="atoms/bn-cm.",
              description="Ndens of heavy metal at BOL",
              saveToDB=False,
          )
  
          pb.defParam(
              "z",
              units="cm",
              description="Center axial dimension of this block",
              categories=[parameters.Category.retainOnReplacement],
          )
  
          pb.defParam(
              "pinPeakingStdDev",
              units="None",
              description="Standard deviation of the pin peaking factors for the block",
          )
  
      with pDefs.createBuilder() as pb:
  
          pb.defParam(
              "topIndex",
              units="",
              description="the axial block index within its parent assembly (0 is bottom block)",
              default=0,
              saveToDB=True,
              categories=[parameters.Category.retainOnReplacement],
          )
  
          pb.defParam(
              "eqRegion",
              units="",
              description="Equilibrium shuffling region. Corresponds to how many full cycles fuel here has gone through.",
              default=-1,
          )
  
          pb.defParam(
              "eqCascade",
              units="",
              description="Cascade number in repetitive equilibrium shuffling fuel management.",
              default=-1,
          )
  
          pb.defParam("id", units="?", description="?", default=None)
  
          pb.defParam(
              "height",
              units="cm",
              description="the block height",
              default=None,
              categories=[parameters.Category.retainOnReplacement],
          )
  
          def xsType(self, value):  # pylint: disable=method-hidden
              self._p_xsType = value  # pylint: disable=attribute-defined-outside-init
              self._p_xsTypeNum = crossSectionGroupManager.getXSTypeNumberFromLabel(
                  value
              )  # pylint: disable=attribute-defined-outside-init
              xsTypeNumDef = parameters.ALL_DEFINITIONS["xsTypeNum"]
              xsTypeNumDef.assigned = parameters.SINCE_ANYTHING
  
          pb.defParam(
              "xsType",
              units=units.NOT_APPLICABLE,
              description="The xs group letter of this block",
              default="A",
              setter=xsType,
          )
  
          def xsTypeNum(self, value):  # pylint: disable=method-hidden
              self._p_xsTypeNum = value  # pylint: disable=attribute-defined-outside-init
              self._p_xsType = crossSectionGroupManager.getXSTypeLabelFromNumber(
                  value
              )  # pylint: disable=attribute-defined-outside-init
              xsTypeDef = parameters.ALL_DEFINITIONS["xsType"]
              xsTypeDef.assigned = parameters.SINCE_ANYTHING
  
          pb.defParam(
              "xsTypeNum",
              units=units.NOT_APPLICABLE,
              description="An integer representation of the cross section type, linked to xsType.",
              default=65,  # NOTE: buGroupNum actually starts at 0
              setter=xsTypeNum,
          )
  
          pb.defParam(
              "type",
              units="N/A",
              description="string name of the input block",
              default="defaultType",
              saveToDB=True,
          )
  
          pb.defParam(
              "regName",
              units="?",
              description="Set by Assembly in writeNIP30 once the region has been placed",
              default=False,
              saveToDB=False,
          )
  
      with pDefs.createBuilder(
          default=0.0,
          location=ParamLocation.AVERAGE,
          categories=["reactivity coefficients"],
      ) as pb:
  
          pb.defParam(
              "VoideddopplerWorth",
              units="dk/kk' K**(n-1)",
              description="Distributed Voided Doppler constant.",
          )
  
          pb.defParam(
              "dopplerWorth",
              units="dk/kk' * K^(n-1)",
              description="Distributed Doppler constant.",
          )
  
          pb.defParam(
              "distortWorth",
              units="pcm/cm^3",
              description="Distortion reactivity distribution",
              default=None,
          )
  
          pb.defParam(
              "fuelWorth",
              units="dk/kk'-kg",
              description="Reactivity worth of fuel material per unit mass",
          )
  
          pb.defParam(
              "fuelWorthDollarsPerKg",
              units="$/kg",
              description="Reactivity worth of fuel material per unit mass",
          )
  
          pb.defParam("fuelWorthPT", units="pcm/%/cm^3", description="Fuel reactivity")
  
          pb.defParam(
              "structWorthPT", units="pcm/%/cm^3", description="Structure reactivity"
          )
  
          pb.defParam(
              "radExpWorthPT",
              units="pcm/%/cm^3",
              description="Radial swelling reactivity",
          )
  
          pb.defParam("coolWorthPT", units="pcm/%/cm^3", description="Coolant reactivity")
  
          pb.defParam(
              "coolFlowingWorthPT",
              units="pcm/%/cm^3",
              description="Flowing coolant reactivity",
          )
  
          pb.defParam(
              "axExpWorthPT", units="pcm/%/cm^3", description="Axial swelling reactivity"
          )
  
          pb.defParam(
              "coolantWorth",
              units="dk/kk'-kg",
              description="Reactivity worth of coolant material per unit mass",
          )
  
          pb.defParam(
              "coolantWorthDollarsPerKg",
              units="$/kg",
              description="Reactivity worth of coolant material per unit mass",
          )
  
          pb.defParam(
              "cladWorth",
              units="dk/kk'-kg",
              description="Reactivity worth of clad material per unit mass",
          )
  
          pb.defParam(
              "cladWorthDollarsPerKg",
              units="$/kg",
              description="Reactivity worth of clad material per unit mass",
          )
  
          pb.defParam(
              "structureWorth",
              units="dk/kk'-kg",
              description="Reactivity worth of structure material per unit mass",
          )
  
          pb.defParam(
              "structureWorthDollarsPerKg",
              units="$/kg",
              description="Reactivity worth of structure material (non-clad and non-wire wrap material) per unit mass",
          )
  
          pb.defParam(
              "rxAxialCentsPerK",
              units="cents/K",
              description="Axial temperature reactivity coefficient",
          )
  
          pb.defParam(
              "rxAxialCentsPerPow",
              units="cents/K",
              description="Axial power reactivity coefficient",
          )
  
          pb.defParam(
              "rxCoolantCentsPerK",
              units="cents/K",
              description="Coolant temperature reactivity coefficient",
          )
  
          pb.defParam(
              "rxCoolantCentsPerPow",
              units="cents/K",
              description="Coolant power reactivity coefficient",
          )
  
          pb.defParam(
              "rxDopplerCentsPerK",
              units="cents/K",
              description="Doppler temperature reactivity coefficient",
          )
  
          pb.defParam(
              "rxDopplerCentsPerPow",
              units="cents/K",
              description="Doppler power reactivity coefficient",
          )
  
          pb.defParam(
              "rxFuelCentsPerK",
              units="cents/K",
              description="Fuel temperature reactivity coefficient",
          )
  
          pb.defParam(
              "rxFuelCentsPerPow",
              units="cents/K",
              description="Fuel power reactivity coefficient",
          )
  
          pb.defParam(
              "rxNetCentsPerK",
              units="cents/K",
              description="Net temperature reactivity coefficient",
          )
  
          pb.defParam(
              "rxNetCentsPerPow",
              units="cents/K",
              description="Net power reactivity coefficient",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rxNetPosNeg",
              units="cents/K",
              description="Net temperature reactivity coefficient: positive or negative",
          )
  
          pb.defParam(
              "rxNetPosNegPow",
              units="cents/K",
              description="Net power reactivity coefficient: positive or negative",
          )
  
          pb.defParam(
              "rxRadialCentsPerK",
              units="cents/K",
              description="Radial temperature reactivity coefficient",
          )
  
          pb.defParam(
              "rxRadialCentsPerPow",
              units="cents/K",
              description="Radial power reactivity coefficient",
          )
  
          pb.defParam(
              "rxStructCentsPerK",
              units="cents/K",
              description="Structure temperature reactivity coefficient",
          )
  
          pb.defParam(
              "rxStructCentsPerPow",
              units="cents/K",
              description="Structure power reactivity coefficient",
          )
  
          pb.defParam(
              "rxVoidedDopplerCentsPerK",
              units="cents/K",
              description="Voided Doppler temperature reactivity coefficient",
          )
  
          pb.defParam(
              "rxVoidedDopplerCentsPerPow",
              units="cents/K",
              description="Voided Doppler power reactivity coefficient",
          )
  
          pb.defParam(
              "virdentGr",
              units="pcm/%/cm^3",
              description="Radial surface leakage reactivity",
          )
  
          pb.defParam(
              "virdentGz",
              units="pcm/%/cm^3",
              description="Axial surface leakage reactivity",
          )
  
          pb.defParam(
              "virdentLr",
              units="pcm/%/cm^3",
              description="Radial volume leakage reactivity",
          )
  
          pb.defParam(
              "virdentLz",
              units="pcm/%/cm^3",
              description="Axial volume leakage reactivity",
          )
  
          pb.defParam(
              "assemPeakStd", units="pcm/%/cm^3", description="Spectral reactivity"
          )
  
          pb.defParam("virdentS", units="pcm/%/cm^3", description="Spectral reactivity")
  
      with pDefs.createBuilder(
          default=0.0,
          location=ParamLocation.AVERAGE,
          categories=[
              "reactivity coefficients",
              "spatially dependent",
              "mass normalized",
          ],
      ) as pb:
  
          # FUEL COEFFICIENTS
          pb.defParam(
              "rxFuelDensityCoeffPerMass",
              units="dk/kk'-kg",
              description="Fuel Density Coefficient",
          )
  
          pb.defParam(
              "rxFuelDopplerConstant",
              units="dk/kk' K**(n-1)",
              description="Fuel Doppler Constant",
          )
  
          pb.defParam(
              "rxFuelVoidedDopplerConstant",
              units="dk/kk' K**(n-1)",
              description="Fuel Voided-Coolant Constant",
          )
  
          pb.defParam(
              "rxFuelTemperatureCoeffPerMass",
              units="dk/kk'-kg",
              description="Fuel Temperature Coefficient",
          )
  
          pb.defParam(
              "rxFuelVoidedTemperatureCoeffPerMass",
              units="dk/kk'-kg",
              description="Fuel Voided-Coolant Temperature Coefficient",
          )
  
          # CLAD COEFFICIENTS
          pb.defParam(
              "rxCladDensityCoeffPerMass",
              units="dk/kk'-kg",
              description="Clad Density Coefficient",
          )
  
          pb.defParam(
              "rxCladDopplerConstant",
              units="dk/kk' K**(n-1)",
              description="Clad Doppler Constant",
          )
  
          pb.defParam(
              "rxCladTemperatureCoeffPerMass",
              units="dk/kk'-kg",
              description="Clad Temperature Coefficient",
          )
  
          # STRUCTURE COEFFICIENTS
          pb.defParam(
              "rxStructureDensityCoeffPerMass",
              units="dk/kk'-kg",
              description="Structure Density Coefficient",
          )
  
          pb.defParam(
              "rxStructureDopplerConstant",
              units="dk/kk' K**(n-1)",
              description="Structure Doppler Constant",
          )
  
          pb.defParam(
              "rxStructureTemperatureCoeffPerMass",
              units="dk/kk'-kg",
              description="Structure Temperature Coefficient",
          )
  
          # COOLANT COEFFICIENTS
          pb.defParam(
              "rxCoolantDensityCoeffPerMass",
              units="dk/kk'-kg",
              description="Coolant Density Coefficient",
          )
  
          pb.defParam(
              "rxCoolantTemperatureCoeffPerMass",
              units="dk/kk'-kg",
              description="Coolant Temperature Coefficient",
          )
  
      with pDefs.createBuilder(
          default=0.0,
          location=ParamLocation.AVERAGE,
          categories=[
              "reactivity coefficients",
              "spatially dependent",
              "temperature normalized",
          ],
      ) as pb:
  
          # FUEL COEFFICIENTS
          pb.defParam(
              "rxFuelDensityCoeffPerTemp",
              units="dk/kk'-K",
              description="Fuel Density Coefficient",
          )
  
          pb.defParam(
              "rxFuelDopplerCoeffPerTemp",
              units="dk/kk'-K",
              description="Fuel Doppler Coefficient",
          )
  
          pb.defParam(
              "rxFuelVoidedDopplerCoeffPerTemp",
              units="dk/kk'-K",
              description="Fuel Voided-Coolant Doppler Coefficient",
          )
  
          pb.defParam(
              "rxFuelTemperatureCoeffPerTemp",
              units="dk/kk'-K",
              description="Fuel Temperature Coefficient",
          )
  
          pb.defParam(
              "rxFuelVoidedTemperatureCoeffPerTemp",
              units="dk/kk'-K",
              description="Fuel Voided-Coolant Temperature Coefficient",
          )
  
          # CLAD COEFFICIENTS
          pb.defParam(
              "rxCladDensityCoeffPerTemp",
              units="dk/kk'-K",
              description="Clad Density Coefficient",
          )
  
          pb.defParam(
              "rxCladDopplerCoeffPerTemp",
              units="dk/kk'-K",
              description="Clad Doppler Coefficient",
          )
  
          pb.defParam(
              "rxCladTemperatureCoeffPerTemp",
              units="dk/kk'-K",
              description="Clad Temperature Coefficient",
          )
  
          # STRUCTURE COEFFICIENTS
          pb.defParam(
              "rxStructureDensityCoeffPerTemp",
              units="dk/kk'-K",
              description="Structure Density Coefficient",
          )
  
          pb.defParam(
              "rxStructureDopplerCoeffPerTemp",
              units="dk/kk'-K",
              description="Structure Doppler Coefficient",
          )
  
          pb.defParam(
              "rxStructureTemperatureCoeffPerTemp",
              units="dk/kk'-K",
              description="Structure Temperature Coefficient",
          )
  
          # COOLANT COEFFICIENTS
          pb.defParam(
              "rxCoolantDensityCoeffPerTemp",
              units="dk/kk'-K",
              description="Coolant Density Coefficient",
          )
  
          pb.defParam(
              "rxCoolantTemperatureCoeffPerTemp",
              units="dk/kk'-K",
              description="Coolant Temperature Coefficient",
          )
  
      with pDefs.createBuilder(default=0.0) as pb:
  
          pb.defParam(
              "VirDenTerr",
              units="%",
              description="VirDenT error",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "arealPd",
              units="MW/m^2",
              description="Power divided by XY area",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "arealPdGamma",
              units="MW/m^2",
              description="Areal gamma power density",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "assemNum",
              units="None",
              description="Index that refers, nominally, to the assemNum parameter of "
              "the containing Assembly object. This is stored on the Block to aid in "
              "visualizing shuffle patterns and the like, and should not be used within "
              "the code. These are not guaranteed to be consistent with the containing "
              "Assembly, so they should not be used as a reliable means to reconstruct "
              "the model.",
              categories=[parameters.Category.retainOnReplacement],
          )
  
          pb.defParam(
              "avgFuelTemp", units="?", description="?", location=ParamLocation.AVERAGE
          )
  
          pb.defParam(
              "avgTempRef", units="?", description="?", location=ParamLocation.AVERAGE
          )
  
          pb.defParam(
              "axExtenNodeHeight",
              units="meter",
              description="Axial extension node height",
              location=ParamLocation.AVERAGE,
              default=0.0,
          )
  
          pb.defParam(
              "blockBeta",
              units="unitless",
              description="Beta in each block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "blockF",
              units="1/cm^5/s^2",
              description="Adjoint-weighted fission source in each block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam("bondBOL", units="?", description="?", saveToDB=False)
  
          pb.defParam(
              "breedRatio",
              units="None",
              description="Breeding ratio",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fissileDestroyed",
              units="atoms/bn-cm",
              description="Fissile atoms destroyed in last depletion step (not net!)",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fissileBefore",
              units="atoms/bn-cm",
              description="Fissile atoms at beginning of last depletion step (could be substep!)",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fissileAfter",
              units="atoms/bn-cm",
              description="Fissile atoms at end of last depletion step (could be substep!)",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam("buLimit", units="%FIMA", description="Burnup limit")
  
          pb.defParam(
              "cladACCI",
              units=units.MICRONS,
              description="The amount of cladding wastage due to absorber chemical clad interaction",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "convRatio",
              units="None",
              description="Conversion ratio",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "coolRemFrac",
              units="?",
              description="Fractional sodium density change for each block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "crWastage",
              units=units.MICRONS,
              description="Combines ACCI and clad corrosion for control blocks",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "cyclicNErr",
              units="None",
              description="Relative error of the block number density",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "deltaTclad",
              units="1/cm^5/s^2",
              description="Change in fuel temperature due to 1% rise in power.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "deltaTduct",
              units="1/cm^5/s^2",
              description="Change in fuel temperature due to 1% rise in power.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "deltaTfuel",
              units="1/cm^5/s^2",
              description="Change in fuel temperature due to 1% rise in power.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "detailedDpaNewCycle",
              units="dpa",
              description="The total DPA accumulated in all burn steps of one cycle",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "detailedDpaPeakNewCycle",
              units="dpa",
              description="The total peak DPA accumulated in all burn steps of one cycle",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "detailedDpaThisCycle",
              units="dpa",
              location=ParamLocation.AVERAGE,
              description="Displacement per atom accumulated during this cycle. This accumulates over a cycle and resets to zero at BOC.",
              categories=["cumulative over cycle", "detailedAxialExpansion"],
          )
  
          pb.defParam(
              "detailedDpaPeakRate",
              units="DPA/s",
              description="Peak DPA rate based on detailedDpaPeak",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "dilationElasticPM",
              units="mm",
              description="Combined elastic membrane and bending components of duct dilation",
              location=ParamLocation.AVERAGE,
              categories=["distortion"],
          )
  
          pb.defParam(
              "dilationElasticT",
              units="mm",
              description="Thermal expansion component of duct dilation",
              location=ParamLocation.AVERAGE,
              categories=["distortion"],
          )
  
          pb.defParam(
              "dilationElasticTRefueling",
              units="mm",
              description="Thermal expansion component of duct dilation at refueling temperature (180C)",
              location=ParamLocation.AVERAGE,
              categories=["distortion"],
          )
  
          pb.defParam(
              "dilationCreepIrrad",
              units="mm",
              description="Irradiation creep component of duct dilation",
              location=ParamLocation.AVERAGE,
              categories=["cumulative", "distortion"],
          )
  
          pb.defParam(
              "dilationSwellingSF",
              units="mm",
              description="Stress-free void swelling component of duct dilation",
              location=ParamLocation.AVERAGE,
              categories=["cumulative", "distortion"],
          )
  
          pb.defParam(
              "blockAxialSwellingSF",
              units="mm",
              description="Axial stress-free void swelling of block",
              location=ParamLocation.AVERAGE,
              categories=["cumulative", "distortion"],
          )
  
          pb.defParam(
              "dilationSwellingSE",
              units="mm",
              description="Stress-enhanced swelling component of duct dilation",
              location=ParamLocation.AVERAGE,
              categories=["cumulative", "distortion"],
          )
  
          pb.defParam(
              "dilationCreepTh1",
              units="mm",
              description="Primary thermal creep component of duct dilation",
              location=ParamLocation.AVERAGE,
              categories=["cumulative", "distortion"],
          )
  
          pb.defParam(
              "dilationCreepTh2",
              units="mm",
              description="Secondary thermal creep component of duct dilation",
              location=ParamLocation.AVERAGE,
              categories=["cumulative", "distortion"],
          )
  
          pb.defParam(
              "dilationTotal",
              units="mm",
              description="Total duct dilation",
              location=ParamLocation.AVERAGE,
              categories=["distortion"],
          )
  
          pb.defParam(
              "dilationRefueling",
              units="mm",
              description="Amount of duct dilation at refueling temperature (180C)",
              location=ParamLocation.AVERAGE,
              categories=["distortion"],
          )
  
          pb.defParam("displacementMAG", units="?", description="?")
  
          pb.defParam(
              "dpaPeakFromFluence",
              units="dpa",
              description="DPA approximation based on a fluence conversion factor set in the dpaPerFluence setting",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam("enrichmentBOL", units="?", description="?")
  
          pb.defParam(
              "fastFlux",
              units="1/cm^2/s",
              description="Neutron flux above 100keV",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fastFluxFr",
              units="",
              description="Fraction of flux above 100keV",
              location=ParamLocation.AVERAGE,
              categories=["detailedAxialExpansion"],
          )
  
          # This quantity should eventually be part of category 'detailedAxialExpansion'
          # to be "remapped" (converter currently do not support arrays)
          pb.defParam(
              "cornerFastFlux",
              units="n/cm^2/s",
              description="Neutron flux above 100keV at hexagon block corners",
              location=ParamLocation.CORNERS,
              saveToDB=False,
          )
  
          # This quantity should eventually be part of category 'detailedAxialExpansion'
          # to be "remapped" (converter currently do not support arrays)
          pb.defParam(
              "pointsFastFluxFr",
              units=None,
              description="Fraction of flux above 100keV at points within the block",
              location=ParamLocation.CHILDREN,
              saveToDB=False,
          )
  
          # This quantity should eventually be part of category 'detailedAxialExpansion'
          # to be "remapped" (converter currently do not support arrays)
          pb.defParam(
              "pointsDpa",
              units="dpa",
              description="displacements per atom at points within the block",
              location=ParamLocation.CHILDREN,
              categories=["cumulative"],
              saveToDB=False,
              default=0.0,
          )
  
          # This quantity should eventually be part of category 'detailedAxialExpansion'
          # to be "remapped" (converter currently do not support arrays)
          pb.defParam(
              "pointsDpaRate",
              units="dpa/s",
              description="Current time derivative of the displacement per atoms at points within the block",
              location=ParamLocation.CHILDREN,
              saveToDB=False,
          )
  
          pb.defParam("fertileBonus", units=None, description="The fertile bonus")
  
          pb.defParam(
              "fisDens",
              units="fissions/cm^3/s",
              description="Fission density in a pin (scaled up from homogeneous)",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fisDensHom", units="1/cm^3/s", description="Homogenized fissile density"
          )
  
          pb.defParam(
              "fluxDeltaFromRef",
              units="None",
              description="Relative difference between the current flux and the directly-computed perturbed flux.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fluxDif3d",
              units="1/cm^2/s",
              description="Average scalar neutron flux before gamma step",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fluxDirect",
              units="n/cm^2/s",
              description="Flux is computed with a direct method",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fluxGamma",
              units="g/cm^2/s",
              description="Gamma scalar flux",
              categories=[
                  "detailedAxialExpansion",
                  parameters.Category.retainOnReplacement,
                  parameters.Category.fluxQuantities,
              ],
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fluxPeak",
              units="n/cm^2/s",
              description="Peak neutron flux calculated within the mesh",
              location=ParamLocation.AVERAGE,
              categories=["detailedAxialExpansion"],
          )
  
          pb.defParam(
              "fluxPertDeltaFromDirect",
              units="None",
              description="Relative difference between the perturbed flux and the directly-computed perturbed flux",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fluxPertDeltaFromDirectfluxRefWeighted",
              units="None",
              description="",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fluxPerturbed",
              units="1/cm^2/s",
              description="Flux is computed by MEPT",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "fluxRef",
              units="1/cm^2/s",
              description="Reference flux",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "heightBOL",
              units="cm",
              description="As-fabricated height of this block (as input). Used in fuel performance. Should be constant.",
              location=ParamLocation.AVERAGE,
              categories=[parameters.Category.retainOnReplacement],
          )
  
          pb.defParam(
              "intrinsicSource",
              units="?",
              description="Intrinsic neutron source from spontaneous fissions before a decay period",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "intrinsicSourceDecayed",
              units="?",
              description="Intrinsic source from spontaneous fissions after a decay period",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "kInf",
              units="None",
              description="Neutron production rate in this block/neutron absorption rate in this block. Not truly kinf but a reasonable approximation of reactivity.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "kgFis",
              units="kg",
              description="Mass of fissile material in block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "kgHM",
              units="kg",
              description="Mass of heavy metal in block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "mchan",
              units="None",
              description="SASSYS/DIF3D-K (external) channel index assignment",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "medAbsE", units="eV", description="Median neutron absorption energy"
          )
  
          pb.defParam(
              "medFisE",
              units="eV",
              description="Median energy of neutron causing fission",
          )
  
          pb.defParam("medFlxE", units="eV", description="Median neutron flux energy")
  
          pb.defParam(
              "mreg",
              units="None",
              description="SASSYS/DIF3D-K radial region index assignment",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam("nPins", units=None, description="Number of pins")
  
          pb.defParam(
              "newDPAPeak",
              units="dpa",
              description="The peak DPA accumulated in the last burn step",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "pdensGenerated",
              units="W/cm^3",
              description="Volume-averaged generated power density. Different than b.p.pdens only when gamma transport is activated.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "pdensGamma",
              units="W/cm^3",
              description="Average volumetric gamma power density",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "pdensNeutron",
              units="W/cm^3",
              description="Average volumetric neutron power density",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "percentBuPeak",
              units="%FIMA",
              description="Peak percentage of the initial heavy metal atoms that have been fissioned",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "powerGenerated",
              units=" W",
              description="Generated power. Different than b.p.power only when gamma transport is activated.",
              location=ParamLocation.VOLUME_INTEGRATED,
          )
  
          pb.defParam(
              "powerGamma",
              units="W",
              description="Total gamma power",
              location=ParamLocation.VOLUME_INTEGRATED,
          )
  
          pb.defParam(
              "powerNeutron",
              units="W",
              description="Total neutron power",
              location=ParamLocation.VOLUME_INTEGRATED,
          )
  
          pb.defParam(
              "powerShapeDelta",
              units="W",
              description="Change in power shape when core temperature rises.",
              location=ParamLocation.VOLUME_INTEGRATED,
          )
  
          pb.defParam(
              "powerShapePercent",
              units="%",
              description="Percent change in power shape when core temperature rises.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "ppdens",
              units="W/cm^3",
              description="Peak power density",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "ppdensGamma",
              units="W/cm^3",
              description="Peak gamma density",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "puFrac",
              units="None",
              description="Current Pu number density relative to HM at BOL",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateBalance",
              units="1/cm^3/s",
              description="Numerical balance between particle production and destruction (should be small)",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateExtSrc",
              units="1/cm^3/s",
              description="Rate of production of neutrons from an external source.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateFisAbs",
              units="1/cm^3/s",
              description="Neutron abs. rate in fissile material",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "capturePowerFrac",
              units=None,
              description="Fraction of the power produced through capture in a block.",
              location=ParamLocation.AVERAGE,
              saveToDB="True",
          )
  
          pb.defParam(
              "rateFisSrc",
              units="1/cm^3/s",
              description="Fission source rate. This is related to production rate in fissile by a factor of keff",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateLeak",
              units="1/cm^3/s",
              description="Rate that neutrons leak out of this block.",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateParasAbs",
              units="1/cm^3/s",
              description="Rate of parasitic absorption (absorption in non-fertile/fissionable material)",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateProdNet",
              units="1/cm^3/s",
              description="Net production rate of neutrons",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateScatIn",
              units="1/cm^3/s",
              description="Rate neutrons in-scatter in this block",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "rateScatOut",
              units="1/cm^3/s",
              description="Rate that neutrons out-scatter in this block (removal - absorption)",
              location=ParamLocation.AVERAGE,
          )
  
          pb.defParam(
              "smearDensity",
              units="?",
              description="Smear density of fuel pins in this block. Defined as the ratio of fuel area to total space inside cladding.",
              location=ParamLocation.AVERAGE,
          )
  
      # TODO: this should be replaced with a number density vector (array) and a list of
      # nuclides on the Reactor
      with pDefs.createBuilder(
          location=ParamLocation.AVERAGE, default=0.0, categories=["number densities"]
      ) as pb:
          assert nuclideBases.instances, (
              "Nuclide Bases have not been instantiated yet; cannot produce parameters "
              "for them."
          )
          for nuc in nuclideBases.instances:
              pb.defParam(
                  nuc.getDatabaseName(),
                  units="#/barn-cm",
                  description="{} number density".format(nuc.name),
              )
  
      with pDefs.createBuilder(location=ParamLocation.AVERAGE) as pb:
  
          pb.defParam("distortionReactivity", units="?", description="?")
  
          pb.defParam("harmonic", units="?", description="?")
  
          pb.defParam("harmonicAdj", units="?", description="?")
  
      return pDefs
  