Beispiel #1
0
    def _rw2DRecord(self):
        """
        Read/write the multigroup fluxes (n/cm^2-s) into a NxG matrix.

        Notes
        -----
        Zones are blocked into multiple records so we have to block or unblock
        them.

        rwMatrix reverses the indices into FORTRAN data order so be
        very careful with the indices.
        """
        nz = self._metadata["NZONE"]
        ng = self._metadata["NGROUP"]
        nb = self._metadata["NBLOK"]
        if self._data.groupFluxes is None:
            # initialize all-zeros here before reading now that we
            # have the matrix dimension metadata available.
            self._data.groupFluxes = numpy.zeros(
                (ng, nz),
                dtype=numpy.float32,
            )
        for bi in range(nb):
            jLow, jUp = cccc.getBlockBandwidth(bi + 1, nz, nb)
            numZonesInBlock = jUp - jLow + 1
            with self.createRecord() as record:
                # pass in shape in fortran (read) order
                self._data.groupFluxes[:, jLow : jUp + 1] = record.rwMatrix(
                    self._data.groupFluxes[:, jLow : jUp + 1],
                    numZonesInBlock,
                    ng,
                )
Beispiel #2
0
    def _rw3DRecord(self):
        """
        Read/write multi-dimensional regular total flux.

        The records contain blocks of values in the i-j planes.
        """

        ng = self._metadata["NGROUP"]
        imax = self._metadata["NINTI"]
        jmax = self._metadata["NINTJ"]
        kmax = self._metadata["NINTK"]
        nblck = self._metadata["NBLOK"]

        if self._flux.groupFluxes.size == 0:
            self._flux.groupFluxes = numpy.zeros((imax, jmax, kmax, ng))

        for gi in range(ng):
            gEff = self.getEnergyGroupIndex(gi)
            for k in range(kmax):
                # data in i-j plane may be blocked
                for bi in range(nblck):
                    # compute blocking parameters
                    jLow, jUp = cccc.getBlockBandwidth(bi + 1, jmax, nblck)
                    numZonesInBlock = jUp - jLow + 1
                    with self.createRecord() as record:
                        # pass in shape in fortran (read) order
                        # pylint: disable=protected-access
                        self._flux.groupFluxes[
                            :, jLow : jUp + 1, k, gEff
                        ] = record._rwMatrix(
                            self._flux.groupFluxes[:, jLow : jUp + 1, k, gEff],
                            record.rwDouble,
                            numZonesInBlock,
                            imax,
                        )
Beispiel #3
0
    def _rw3DRecord(self):
        """
        Read/write blocks of data from 3D with peaking info.

        By inspection we see these values are double precision.
        """
        imax = self._metadata["IM"]
        jmax = self._metadata["JM"]
        kmax = self._metadata["KM"]
        nblck = self._metadata["NJBLOK"]
        if self._data.peakPowerDensity.size == 0:
            # initialize all-zeros here before reading now that we
            # have the matrix dimension metadata available.
            self._data.peakPowerDensity = np.zeros(
                (imax, jmax, kmax),
                dtype=np.float64,
            )
        for ki in range(kmax):
            for bi in range(nblck):
                jL, jU = cccc.getBlockBandwidth(bi + 1, jmax, nblck)
                with self.createRecord() as record:
                    self._data.peakPowerDensity[
                        :, jL : jU + 1, ki
                    ] = record.rwDoubleMatrix(
                        self._data.peakPowerDensity[:, jL : jU + 1, ki],
                        jU - jL + 1,
                        imax,
                    )
Beispiel #4
0
 def _rw2DRecord(self):
     """Read/write power density by mesh point."""
     imax = self._metadata["NINTI"]
     jmax = self._metadata["NINTJ"]
     kmax = self._metadata["NINTK"]
     nblck = self._metadata["NBLOK"]
     if self._data.powerDensity.size == 0:
         # initialize all-zeros here before reading now that we
         # have the matrix dimension metadata available.
         self._data.powerDensity = numpy.zeros(
             (imax, jmax, kmax),
             dtype=numpy.float32,
         )
     for ki in range(kmax):
         for bi in range(nblck):
             jL, jU = cccc.getBlockBandwidth(bi + 1, jmax, nblck)
             with self.createRecord() as record:
                 self._data.powerDensity[:, jL:jU + 1,
                                         ki] = record.rwMatrix(
                                             self._data.powerDensity[:,
                                                                     jL:jU +
                                                                     1, ki],
                                             jU - jL + 1,
                                             imax,
                                         )