flux_modules/flux_module.py
def calculate_cell_reaction_rate(self, reaction_xs, rr_vect=None, return_xs_arrays=False):
    """
    Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation.

    Note that the array is ordered by the associated DG(0) dof, not by the cell index in the mesh.

    :param str reaction_xs: Reaction cross-section id.
    :param ndarray rr_vect: (optional) Output vector. If not given, reaction rate vector of the FluxModule class
      (:attr:`cell_RR`) will be updated. Must be pre-allocated to store :attr:`Discretization.local_ndof0`
      elements, but doesn't need to be pre-set to any value.
    :param bool return_xs_arrays: (optional) If True, a list that contains for each group the cell (dof) values array
      of the DG(0) representation of the specified reaction xs will be created and returned.
    :return: List with xs value arrays for each group if `return_xs_arrays == True`, None otherwise (see above)
    :rtype: list[ndarray] | None
    """
    if reaction_xs not in self.PD.used_xs:
      warning("Attempted to calculate cell-wise reaction rate for reaction without loaded cross-section (skipping).")
      return

    if self.verb > 1: print0(self.print_prefix + "Calculating cell-wise '{}' reaction rate.".format(reaction_xs))

    if not rr_vect:
      try:
        self.cell_RR
      except AttributeError:
        self.cell_RR = numpy.zeros(self.DD.local_ndof0)
      finally:
        rr_vect = self.cell_RR
    else:
      assert rr_vect.size == self.DD.local_ndof0

    if return_xs_arrays:
      xs_arrays = [None] * self.DD.G
    else:
      xs_arrays = None

    rr_vect.fill(0)

    if not self.up_to_date["cell_powers"]:
      self.update_phi()

    calc_timer = Timer("FM: Calculation of '{}' reaction rate".format(reaction_xs))
    ass_timer = Timer("FM: Assemble '{}' reaction rate".format(reaction_xs))

    for g in xrange(self.DD.G):
      self.PD.get_xs(reaction_xs, self.R, g)
      if xs_arrays:
        xs_arrays[g] = self.R.vector().get_local().copy()

      ass_timer.start()
      self.phig.assign(self.phi_mg[g])
      assemble(self.cell_RR_form, tensor=self._cell_RRg_vector)
      ass_timer.stop()

      rr_vect += self._cell_RRg_vector.get_local()

    return xs_arrays

    Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation.

    Note that the array is ordered by the associated DG(0) dof, not by the cell index in the mesh.

    :param str reaction_xs: Reaction cross-section id.
    :param ndarray rr_vect: (optional) Output vector. If not given, reaction rate vector of the FluxModule class
      (:attr:`cell_RR`) will be updated. Must be pre-allocated to store :attr:`Discretization.local_ndof0`
      elements, but doesn't need to be pre-set to any value.
    :param bool return_xs_arrays: (optional) If True, a list that contains for each group the cell (dof) values array
      of the DG(0) representation of the specified reaction xs will be created and returned.
    :return: List with xs value arrays for each group if `return_xs_arrays == True`, None otherwise (see above)
    :rtype: list[ndarray] | None
    
Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation.
Note that the array is ordered by the associated DG(0) dof, not by the cell index in the mesh.
Calculates cell - integrated reaction rate and optionally returns the xs ' s needed for the calculation . Note that the array is ordered by the associated DG ( 0 ) dof not by the cell index in the mesh .
def calculate_cell_reaction_rate(self, reaction_xs, rr_vect=None, return_xs_arrays=False):
    if reaction_xs not in self.PD.used_xs:
      warning("Attempted to calculate cell-wise reaction rate for reaction without loaded cross-section (skipping).")
      return
    if self.verb > 1: print0(self.print_prefix + "Calculating cell-wise '{}' reaction rate.".format(reaction_xs))
    if not rr_vect:
      try:
        self.cell_RR
      except AttributeError:
        self.cell_RR = numpy.zeros(self.DD.local_ndof0)
      finally:
        rr_vect = self.cell_RR
    else:
      assert rr_vect.size == self.DD.local_ndof0
    if return_xs_arrays:
      xs_arrays = [None] * self.DD.G
    else:
      xs_arrays = None
    rr_vect.fill(0)
    if not self.up_to_date["cell_powers"]:
      self.update_phi()
    calc_timer = Timer("FM: Calculation of '{}' reaction rate".format(reaction_xs))
    ass_timer = Timer("FM: Assemble '{}' reaction rate".format(reaction_xs))
    for g in xrange(self.DD.G):
      self.PD.get_xs(reaction_xs, self.R, g)
      if xs_arrays:
        xs_arrays[g] = self.R.vector().get_local().copy()
      ass_timer.start()
      self.phig.assign(self.phi_mg[g])
      assemble(self.cell_RR_form, tensor=self._cell_RRg_vector)
      ass_timer.stop()
      rr_vect += self._cell_RRg_vector.get_local()
    return xs_arrays
def calculate_cell_reaction_rate ( self , reaction_xs , rr_vect = None , return_xs_arrays = False ) : if reaction_xs not in self . PD . used_xs : warning ( "Attempted to calculate cell-wise reaction rate for reaction without loaded cross-section (skipping)." ) return if self . verb > 1 : print0 ( self . print_prefix + "Calculating cell-wise '{}' reaction rate." . format ( reaction_xs ) ) if not rr_vect : try : self . cell_RR except AttributeError : self . cell_RR = numpy . zeros ( self . DD . local_ndof0 ) finally : rr_vect = self . cell_RR else : assert rr_vect . size == self . DD . local_ndof0 if return_xs_arrays : xs_arrays = [ None ] * self . DD . G else : xs_arrays = None rr_vect . fill ( 0 ) if not self . up_to_date [ "cell_powers" ] : self . update_phi ( ) calc_timer = Timer ( "FM: Calculation of '{}' reaction rate" . format ( reaction_xs ) ) ass_timer = Timer ( "FM: Assemble '{}' reaction rate" . format ( reaction_xs ) ) for g in xrange ( self . DD . G ) : self . PD . get_xs ( reaction_xs , self . R , g ) if xs_arrays : xs_arrays [ g ] = self . R . vector ( ) . get_local ( ) . copy ( ) ass_timer . start ( ) self . phig . assign ( self . phi_mg [ g ] ) assemble ( self . cell_RR_form , tensor = self . _cell_RRg_vector ) ass_timer . stop ( ) rr_vect += self . _cell_RRg_vector . get_local ( ) return xs_arrays
Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation.
Calculates cell - integrated reaction rate and optionally returns the xs ' s needed for the calculation .
"""
    Calculates cell-integrated reaction rate and optionally returns the xs's needed for the calculation.

    Note that the array is ordered by the associated DG(0) dof, not by the cell index in the mesh.

    :param str reaction_xs: Reaction cross-section id.
    :param ndarray rr_vect: (optional) Output vector. If not given, reaction rate vector of the FluxModule class
      (:attr:`cell_RR`) will be updated. Must be pre-allocated to store :attr:`Discretization.local_ndof0`
      elements, but doesn't need to be pre-set to any value.
    :param bool return_xs_arrays: (optional) If True, a list that contains for each group the cell (dof) values array
      of the DG(0) representation of the specified reaction xs will be created and returned.
    :return: List with xs value arrays for each group if `return_xs_arrays == True`, None otherwise (see above)
    :rtype: list[ndarray] | None
    """
List with xs value arrays for each group if `return_xs_arrays == True`, None otherwise
List with xs value arrays for each group if ` return_xs_arrays == True ` None otherwise
list[ndarray] | None
self
reaction_xs
Reaction cross-section id.
Reaction cross - section id .
rr_vect
(optional) Output vector. If not given, reaction rate vector of the FluxModule class
(:attr:`cell_RR`) will be updated. Must be pre-allocated to store :attr:`Discretization.local_ndof0`
elements, but doesn't need to be pre-set to any value.
( optional ) Output vector . If not given reaction rate vector of the FluxModule class ( : attr : ` cell_RR ` ) will be updated . Must be pre - allocated to store : attr : ` Discretization . local_ndof0 ` elements but doesn ' t need to be pre - set to any value .
return_xs_arrays
(optional) If True, a list that contains for each group the cell (dof) values array
of the DG(0) representation of the specified reaction xs will be created and returned.
( optional ) If True a list that contains for each group the cell ( dof ) values array of the DG ( 0 ) representation of the specified reaction xs will be created and returned .