Exemple #1
0
/**
 * @brief Set the Material's array of absorption scattering cross-sections.
 * @details This method is a helper function to allow OpenMOC users to assign
 *          the Material's nuclear data in Python. A user must initialize a
 *          NumPy array of the correct size (i.e., a float64 array the length
 *          of the number of energy groups) as input to this function. This
 *          function then fills the NumPy array with the data values for the
 *          Material's absorption cross-sections. An example of how this
 *          function might be called in Python is as follows:
 *
 * @code
 *          sigma_a = numpy.array([0.05, 0.1, 0.15, ... ])
 *          material = openmoc.Material(openmoc.material_id())
 *          material.setSigmaA(sigma_a)
 * @endcode
 *
 * @param xs the array of absorption scattering cross-sections
 * @param num_groups the number of energy groups
 */
void Material::setSigmaA(double* xs, int num_groups) {

  if (_num_groups != num_groups)
    log_printf(ERROR, "Unable to set sigma_a with %d groups for Material "
               "%d which contains %d energy groups", num_groups, _id, _num_groups);

  for (int i=0; i < _num_groups; i++){
    _sigma_a[i] = FP_PRECISION(xs[i]);

    if (_buckling != NULL & _dif_coef != NULL)
      _sigma_a[i] += FP_PRECISION(_buckling[i] * _dif_coef[i]);
  }
}
Exemple #2
0
/**
 * @brief Set the Material's total cross-section for some energy group.
 * @param xs the total cross-section
 * @param group the energy group
 */
void Material::setSigmaTByGroup(double xs, int group) {

  if (group <= 0 || group > _num_groups)
    log_printf(ERROR, "Unable to set sigma_t for group %d for Material "
               "%d which contains %d energy groups", group, _id, _num_groups);

    /* If the cross-section is near zero (e.g., within (-1E-10, 1E-10)) */
    if (fabs(xs) < ZERO_SIGMA_T) {
      log_printf(INFO, "Overriding zero cross-section in "
                 "group %d for Material %d with 1E-10", group, _id);
      _sigma_t[group-1] = FP_PRECISION(ZERO_SIGMA_T);
    }
    else
      _sigma_t[group-1] = FP_PRECISION(xs);
}
Exemple #3
0
/**
 * @brief Set the Material's array of total cross-sections.
 * @details This method is a helper function to allow OpenMOC users to assign
 *          the Material's nuclear data in Python. A user must initialize a
 *          NumPy array of the correct size (i.e., a float64 array the length
 *          of the number of energy groups) as input to this function. This
 *          function then fills the NumPy array with the data values for the
 *          Material's total cross-sections. An example of how this function
 *          might be called in Python is as follows:
 *
 * @code
 *          sigma_t = numpy.array([0.05, 0.1, 0.15, ... ])
 *          material = openmoc.Material(openmoc.material_id())
 *          material.setSigmaT(sigma_t)
 * @endcode
 *
 * @param xs the array of total cross-sections
 * @param num_groups the number of energy groups
 */
void Material::setSigmaT(double* xs, int num_groups) {

  if (_num_groups != num_groups)
    log_printf(ERROR, "Unable to set sigma_t with %d groups for Material "
               "%d which contains %d energy groups", num_groups, _id, _num_groups);

  for (int i=0; i < _num_groups; i++)
    _sigma_t[i] = FP_PRECISION(xs[i]);
}
Exemple #4
0
/**
 * @brief Set the Material's array of total cross-sections.
 * @details This method is a helper function to allow OpenMOC users to assign
 *          the Material's nuclear data in Python. A user must initialize a
 *          NumPy array of the correct size (e.g., a float64 array the length
 *          of the number of energy groups) as input to this function. This
 *          function then fills the NumPy array with the data values for the
 *          Material's total cross-sections. An example of how this function
 *          might be called in Python is as follows:
 *
 * @code
 *          sigma_t = numpy.array([0.05, 0.1, 0.15, ... ])
 *          material = openmoc.Material(openmoc.material_id())
 *          material.setSigmaT(sigma_t)
 * @endcode
 *
 *          NOTE: This routine will override an zero-valued cross-sections
 *          (e.g., in void or gap regions) with a minimum value of 1E-10 to
 *          void numerical issues in the MOC solver.
 *
 * @param xs the array of total cross-sections
 * @param num_groups the number of energy groups
 */
void Material::setSigmaT(double* xs, int num_groups) {

  if (_num_groups != num_groups)
    log_printf(ERROR, "Unable to set sigma_t with %d groups for Material "
               "%d which contains %d energy groups", num_groups,
               _id, _num_groups);

  for (int i=0; i < _num_groups; i++) {

    /* If the cross-section is near zero (e.g., within (-1E-10, 1E-10)) */
    if (fabs(xs[i]) < ZERO_SIGMA_T) {
      log_printf(INFO, "Overriding zero cross-section in "
                 "group %d for Material %d with 1E-10", i, _id);
      _sigma_t[i] = FP_PRECISION(ZERO_SIGMA_T);
    }
    else
      _sigma_t[i] = FP_PRECISION(xs[i]);
  }
}