示例#1
0
    def loadFromString(self, string, handleInvalids=True):
        """Read in settings from a string.

        Supports two xml formats, the newer (tags are the key, etc.) and the former
        (tags are the type, etc.)

        Passes the reader back out in case you want to know something about how the
        reading went like for knowing if a file contained deprecated settings, etc.
        """
        if self._failOnLoad:
            raise exceptions.StateError(
                "Cannot load settings after processing of command "
                "line options begins.\nYou may be able to fix this by "
                "reordering the command line arguments.")

        reader = settingsIO.SettingsReader(self)
        reader.readFromStream(io.StringIO(string),
                              handleInvalids=handleInvalids)

        if armi.MPI_RANK == 0:
            runLog.setVerbosity(self["verbosity"])
        else:
            runLog.setVerbosity(self["branchVerbosity"])

        return reader
示例#2
0
 def _prepToRead(self, fName):
     if self._failOnLoad:
         raise exceptions.StateError(
             "Cannot load settings file after processing of command "
             "line options begins.\nYou may be able to fix this by "
             "reordering the command line arguments, and making sure "
             "the settings file `{}` comes before any modified settings.".
             format(fName))
     path = pathTools.armiAbsPath(fName)
     return settingsIO.SettingsReader(self), path
示例#3
0
    def _performGeometryTransformations(self, makePlots=False):
        """
        Apply geometry conversions to make reactor work in neutronics

        There are two conditions where things must happen:

        1. If you are doing finite-difference, you need to add the edge assemblies (fast).
           For this, we just modify the reactor in place

        2. If you are doing detailed axial expansion, you need to average out the axial mesh (slow!)
           For this we need to create a whole copy of the reactor and use that.

        In both cases, we need to undo the modifications between reading the output
        and applying the result to the data model.

        See Also
        --------
        _undoGeometryTransformations
        """
        if any(self.geomConverters):
            raise exceptions.StateError(
                "The reactor has been transformed, but not restored to the original.\n"
                + "Geometry converter is set to {} \n.".format(
                    self.geomConverters) +
                "This is a programming error and requires further investigation."
            )
        neutronicsReactor = self.r
        if self.options.detailedAxialExpansion:
            converter = self.geomConverters.get("axial")
            if not converter:
                converter = uniformMesh.NeutronicsUniformMeshConverter(
                    None,
                    calcReactionRates=self.options.
                    calcReactionRatesOnMeshConversion,
                )
                neutronicsReactor = converter.convert(self.r)
                if makePlots:
                    converter.plotConvertedReactor()
                self.geomConverters["axial"] = converter

        if self.edgeAssembliesAreNeeded():
            converter = self.geomConverters.get(
                "edgeAssems", geometryConverters.EdgeAssemblyChanger())
            converter.addEdgeAssemblies(neutronicsReactor.core)
            self.geomConverters["edgeAssems"] = converter

        self.r = neutronicsReactor