Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions framework/materials/multi_group_xs/multi_group_xs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ MultiGroupXS::Combine(
std::vector<std::shared_ptr<MultiGroupXS>> xsecs;
xsecs.reserve(combinations.size());

size_t n_grps = 0;
unsigned int n_grps = 0;
unsigned int n_precs = 0;
double Nf_total = 0.0; // Total density of fissile materials

Expand Down Expand Up @@ -138,7 +138,7 @@ MultiGroupXS::Combine(

// Here, raw cross sections are scaled by densities and spectra by
// fractional densities. The latter is done to preserve a unit spectra.
for (size_t g = 0; g < n_grps; ++g)
for (unsigned int g = 0; g < n_grps; ++g)
{
mgxs.sigma_t_[g] += sig_t[g];
mgxs.sigma_a_[g] += sig_a[g];
Expand All @@ -148,7 +148,7 @@ MultiGroupXS::Combine(
mgxs.sigma_f_[g] += sig_f[g];
mgxs.chi_[g] += ff_i * chi[g];
mgxs.nu_sigma_f_[g] += sig_f[g];
for (size_t gp = 0; gp < mgxs.num_groups_; ++gp)
for (unsigned int gp = 0; gp < mgxs.num_groups_; ++gp)
mgxs.production_matrix_[g][gp] += F[g][gp];

if (n_precs > 0)
Expand Down Expand Up @@ -202,7 +202,7 @@ MultiGroupXS::Combine(
{
auto& Sm = mgxs.transfer_matrices_[m];
const auto& Sm_other = xsecs[x]->GetTransferMatrix(m);
for (size_t g = 0; g < mgxs.num_groups_; ++g)
for (unsigned int g = 0; g < mgxs.num_groups_; ++g)
{
const auto& cols = Sm_other.rowI_indices[g];
const auto& vals = Sm_other.rowI_values[g];
Expand Down Expand Up @@ -256,7 +256,7 @@ MultiGroupXS::ComputeAbsorption()
// Compute for a pure absorber
if (transfer_matrices_.empty())
{
for (size_t g = 0; g < num_groups_; ++g)
for (unsigned int g = 0; g < num_groups_; ++g)
sigma_a_[g] = sigma_t_[g];
}

Expand All @@ -266,7 +266,7 @@ MultiGroupXS::ComputeAbsorption()
log.Log0Warning() << "Estimating absorption from the transfer matrices.";

const auto& S0 = transfer_matrices_.front();
for (size_t g = 0; g < num_groups_; ++g)
for (unsigned int g = 0; g < num_groups_; ++g)
{
// Estimate the scattering cross section
double sigma_s = 0.0;
Expand Down Expand Up @@ -307,13 +307,13 @@ MultiGroupXS::ComputeDiffusionParameters()

// Perform computations group-wise
const auto& S = transfer_matrices_;
for (size_t g = 0; g < num_groups_; ++g)
for (unsigned int g = 0; g < num_groups_; ++g)
{
// Determine transport correction
double sigma_1 = 0.0;
if (S.size() > 1)
{
for (size_t gp = 0; gp < num_groups_; ++gp)
for (unsigned int gp = 0; gp < num_groups_; ++gp)
{
const auto& cols = S[1].rowI_indices[gp];
const auto& vals = S[1].rowI_values[gp];
Expand Down Expand Up @@ -373,7 +373,7 @@ MultiGroupXS::SetScalingFactor(const double factor)
scaling_factor_ = factor;

// Apply to STL vector-based data
for (size_t g = 0; g < num_groups_; ++g)
for (unsigned int g = 0; g < num_groups_; ++g)
{
sigma_t_[g] *= m;
sigma_a_[g] *= m;
Expand All @@ -395,7 +395,7 @@ MultiGroupXS::SetScalingFactor(const double factor)

// Apply to transfer matrices
for (auto& S_ell : transfer_matrices_)
for (size_t g = 0; g < num_groups_; ++g)
for (unsigned int g = 0; g < num_groups_; ++g)
for (const auto& [_, gp, sig_ell] : S_ell.Row(g))
sig_ell *= m;

Expand All @@ -412,7 +412,7 @@ MultiGroupXS::TransposeTransferAndProduction()
{
const auto& S_ell = transfer_matrices_[ell];
SparseMatrix S_ell_transpose(num_groups_, num_groups_);
for (size_t g = 0; g < num_groups_; ++g)
for (unsigned int g = 0; g < num_groups_; ++g)
{
const size_t row_len = S_ell.rowI_indices[g].size();
const size_t* col_ptr = S_ell.rowI_indices[g].data();
Expand All @@ -430,8 +430,8 @@ MultiGroupXS::TransposeTransferAndProduction()
transposed_production_matrix_.clear();
transposed_production_matrix_.resize(num_groups_);
const auto& F = production_matrix_;
for (size_t g = 0; g < num_groups_; ++g)
for (size_t gp = 0; gp < num_groups_; ++gp)
for (unsigned int g = 0; g < num_groups_; ++g)
for (unsigned int gp = 0; gp < num_groups_; ++gp)
transposed_production_matrix_[g].push_back(F[gp][g]);
}
}
Expand Down
4 changes: 2 additions & 2 deletions framework/materials/multi_group_xs/multi_group_xs.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class MultiGroupXS
*/
void ExportToOpenSnXSFile(const std::string& file_name, double fission_scaling = 1.0) const;

size_t GetNumGroups() const { return num_groups_; }
unsigned int GetNumGroups() const { return num_groups_; }

unsigned int GetScatteringOrder() const { return scattering_order_; }

Expand Down Expand Up @@ -112,7 +112,7 @@ class MultiGroupXS

private:
/// Total number of groups
size_t num_groups_;
unsigned int num_groups_;
/// Legendre scattering order
unsigned int scattering_order_;
/// Number of precursors
Expand Down
10 changes: 5 additions & 5 deletions framework/materials/multi_group_xs/openmc_import.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ MultiGroupXS::LoadFromOpenMC(const std::string& file_name,
log.Log() << "Reading OpenMC cross-section file \"" << file_name << "\"\n";

// Number of groups
if (not H5ReadAttribute<size_t>(file, "energy_groups", mgxs.num_groups_))
if (not H5ReadAttribute<unsigned int>(file, "energy_groups", mgxs.num_groups_))
throw std::runtime_error("Failure reading \"energy_groups\" from " + file_name);

// Group structure
Expand Down Expand Up @@ -101,7 +101,7 @@ MultiGroupXS::LoadFromOpenMC(const std::string& file_name,
H5ReadDataset1D<int>(file, path + "scatter_data/g_min", g_min);
H5ReadDataset1D<int>(file, path + "scatter_data/g_max", g_max);
int fidx = 0;
for (size_t gp = 0; gp < mgxs.num_groups_; ++gp)
for (unsigned int gp = 0; gp < mgxs.num_groups_; ++gp)
for (int g = g_min[gp]; g <= g_max[gp]; ++g)
for (unsigned int n = 0; n < mgxs.scattering_order_ + 1; ++n, ++fidx)
mgxs.transfer_matrices_.at(n).Insert(g - 1, gp, flat_scatter_matrix[fidx]);
Expand Down Expand Up @@ -156,16 +156,16 @@ MultiGroupXS::LoadFromOpenMC(const std::string& file_name,

// Nu (computed)
auto nu = mgxs.nu_sigma_f_;
for (size_t g = 0; g < mgxs.num_groups_; ++g)
for (unsigned int g = 0; g < mgxs.num_groups_; ++g)
if (mgxs.sigma_f_[g] > 0.0)
nu[g] /= mgxs.sigma_f_[g];

// Production matrix (computed)
if (mgxs.production_matrix_.empty())
{
mgxs.production_matrix_.resize(mgxs.num_groups_, std::vector<double>(mgxs.num_groups_));
for (size_t gp = 0; gp < mgxs.num_groups_; ++gp)
for (size_t g = 0; g < mgxs.num_groups_; ++g)
for (unsigned int gp = 0; gp < mgxs.num_groups_; ++gp)
for (unsigned int g = 0; g < mgxs.num_groups_; ++g)
mgxs.production_matrix_[g][gp] = mgxs.chi_[g] * mgxs.nu_sigma_f_[gp];

OpenSnLogicalErrorIf(
Expand Down
10 changes: 5 additions & 5 deletions framework/materials/multi_group_xs/opensn_export.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ MultiGroupXS::ExportToOpenSnXSFile(const std::string& file_name, const double fi
const auto& nu_delayed_sigma_f = GetNuDelayedSigmaF();

std::vector<double> nu_prompt, nu_delayed;
for (size_t g = 0; g < GetNumGroups(); ++g)
for (unsigned int g = 0; g < GetNumGroups(); ++g)
{
nu_prompt.emplace_back(sigma_f[g] > 0.0 ? nu_prompt_sigma_f[g] / sigma_f[g] : 0.0);
nu_delayed.emplace_back(sigma_f[g] > 0.0 ? nu_delayed_sigma_f[g] / sigma_f[g] : 0.0);
Expand All @@ -100,7 +100,7 @@ MultiGroupXS::ExportToOpenSnXSFile(const std::string& file_name, const double fi
ofile << "\nCHI_DELAYED_BEGIN\n";
const auto& precursors = GetPrecursors();
for (size_t j = 0; j < GetNumPrecursors(); ++j)
for (size_t g = 0; g < GetNumGroups(); ++g)
for (unsigned int g = 0; g < GetNumGroups(); ++g)
ofile << "G_PRECURSOR_VAL"
<< " " << g << " " << j << " " << precursors[j].emission_spectrum[g] << "\n";
ofile << "CHI_DELAYED_END\n";
Expand All @@ -116,7 +116,7 @@ MultiGroupXS::ExportToOpenSnXSFile(const std::string& file_name, const double fi

std::vector<double> nu;
nu.reserve(GetNumGroups());
for (size_t g = 0; g < GetNumGroups(); ++g)
for (unsigned int g = 0; g < GetNumGroups(); ++g)
nu.emplace_back(sigma_f[g] > 0.0 ? nu_sigma_f[g] / sigma_f[g] : 0.0);

Print1DXS(ofile, "NU", nu, 1.0e-20);
Expand Down Expand Up @@ -160,8 +160,8 @@ MultiGroupXS::ExportToOpenSnXSFile(const std::string& file_name, const double fi
{
ofile << "\n";
ofile << "PRODUCTION_MATRIX_BEGIN\n";
for (size_t g = 0; g < GetNumGroups(); ++g)
for (size_t gp = 0; gp < GetNumGroups(); ++gp)
for (unsigned int g = 0; g < GetNumGroups(); ++g)
for (unsigned int gp = 0; gp < GetNumGroups(); ++gp)
ofile << "G_GPRIME_VAL " << g << " " << gp << " "
<< fission_scaling * GetProductionMatrix()[g][gp] << "\n";
}
Expand Down
20 changes: 10 additions & 10 deletions framework/materials/multi_group_xs/opensn_import.cc
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ MultiGroupXS::LoadFromOpenSn(const std::string& filename)
"must be specified when precursors are specified.");

// Add delayed fission neutron yield to total
for (size_t g = 0; g < xsf.num_groups_; ++g)
for (unsigned int g = 0; g < xsf.num_groups_; ++g)
xsf.nu_[g] += xsf.nu_delayed_[g];

// Add data to precursor structs
Expand All @@ -111,31 +111,31 @@ MultiGroupXS::LoadFromOpenSn(const std::string& filename)
if (xsf.sigma_f_.empty() and not xsf.nu_sigma_f_.empty())
{
xsf.sigma_f_ = xsf.nu_sigma_f_;
for (size_t g = 0; g < xsf.num_groups_; ++g)
for (unsigned int g = 0; g < xsf.num_groups_; ++g)
if (xsf.nu_sigma_f_[g] > 0.0)
xsf.sigma_f_[g] /= xsf.nu_[g];
}
mgxs.sigma_f_ = xsf.sigma_f_;

// Compute total production cross section
xsf.nu_sigma_f_ = xsf.sigma_f_;
for (size_t g = 0; g < xsf.num_groups_; ++g)
for (unsigned int g = 0; g < xsf.num_groups_; ++g)
xsf.nu_sigma_f_[g] *= xsf.nu_[g];
mgxs.nu_sigma_f_ = xsf.nu_sigma_f_;

// Compute prompt production cross section
if (not xsf.nu_prompt_.empty())
{
mgxs.nu_prompt_sigma_f_ = xsf.sigma_f_;
for (size_t g = 0; g < xsf.num_groups_; ++g)
for (unsigned int g = 0; g < xsf.num_groups_; ++g)
mgxs.nu_prompt_sigma_f_[g] *= xsf.nu_prompt_[g];
}

// Compute delayed production cross section
if (not xsf.nu_delayed_.empty())
{
mgxs.nu_delayed_sigma_f_ = xsf.sigma_f_;
for (size_t g = 0; g < xsf.num_groups_; ++g)
for (unsigned int g = 0; g < xsf.num_groups_; ++g)
mgxs.nu_delayed_sigma_f_[g] *= xsf.nu_delayed_[g];
}

Expand All @@ -145,8 +145,8 @@ MultiGroupXS::LoadFromOpenSn(const std::string& filename)
not xsf.nu_prompt_.empty() ? mgxs.nu_prompt_sigma_f_ : xsf.nu_sigma_f_;

mgxs.production_matrix_.resize(xsf.num_groups_);
for (size_t g = 0; g < xsf.num_groups_; ++g)
for (size_t gp = 0.0; gp < xsf.num_groups_; ++gp)
for (unsigned int g = 0; g < xsf.num_groups_; ++g)
for (unsigned int gp = 0.0; gp < xsf.num_groups_; ++gp)
mgxs.production_matrix_[g].push_back(fis_spec[g] * nu_sigma_f[gp]);
} // if production_matrix empty

Expand All @@ -167,13 +167,13 @@ MultiGroupXS::LoadFromOpenSn(const std::string& filename)

// Compute production cross section
mgxs.nu_sigma_f_.assign(xsf.num_groups_, 0.0);
for (size_t g = 0; g < xsf.num_groups_; ++g)
for (size_t gp = 0; gp < xsf.num_groups_; ++gp)
for (unsigned int g = 0; g < xsf.num_groups_; ++g)
for (unsigned int gp = 0; gp < xsf.num_groups_; ++gp)
mgxs.nu_sigma_f_[gp] += xsf.production_matrix_[g][gp];

// Check for reasonable fission neutron yield
auto nu = xsf.nu_sigma_f_;
for (size_t g = 0; g < xsf.num_groups_; ++g)
for (unsigned int g = 0; g < xsf.num_groups_; ++g)
if (xsf.sigma_f_[g] > 0.0)
nu[g] /= xsf.sigma_f_[g];

Expand Down
8 changes: 4 additions & 4 deletions framework/materials/multi_group_xs/xsfile.cc
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ XSFile::Read()
"Only positive velocity values are permitted.");

// Compute inverse velocity
for (size_t g = 0; g < num_groups_; ++g)
for (unsigned int g = 0; g < num_groups_; ++g)
inv_velocity_[g] = 1.0 / inv_velocity_[g];
}

Expand Down Expand Up @@ -159,7 +159,7 @@ XSFile::Read()
{
nu_prompt_.assign(num_groups_, 0.0);
nu_delayed_.assign(num_groups_, 0.0);
for (size_t g = 0; g < num_groups_; ++g)
for (unsigned int g = 0; g < num_groups_; ++g)
{
nu_prompt_[g] = (1.0 - beta_[g]) * nu_[g];
nu_delayed_[g] = beta_[g] * nu_[g];
Expand Down Expand Up @@ -374,7 +374,7 @@ XSFile::Read()
void
XSFile::ReadGroupStructure(const std::string& keyword,
std::vector<double>& destination,
const size_t n_grps,
const unsigned int n_grps,
std::ifstream& file,
std::istringstream& line_stream,
size_t& line_number)
Expand Down Expand Up @@ -409,7 +409,7 @@ XSFile::ReadGroupStructure(const std::string& keyword,
void
XSFile::Read1DData(const std::string& keyword,
std::vector<double>& destination,
const size_t n_entries,
const std::size_t n_entries,
std::ifstream& file,
std::istringstream& line_stream,
size_t& line_number)
Expand Down
4 changes: 2 additions & 2 deletions framework/materials/multi_group_xs/xsfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class XSFile

std::string file_name_;
std::ifstream file_;
size_t num_groups_;
unsigned int num_groups_;
unsigned int scattering_order_;
size_t num_precursors_;
std::vector<MultiGroupXS::Precursor> precursors_;
Expand All @@ -53,7 +53,7 @@ class XSFile
/// Reading group structure data.
void ReadGroupStructure(const std::string& keyword,
std::vector<double>& destination,
size_t n_grps,
unsigned int n_grps,
std::ifstream& file,
std::istringstream& line_stream,
size_t& line_number);
Expand Down
Loading