mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
initial stab at making mgxs externally usable
This commit is contained in:
parent
b60ee3b67c
commit
9c06a128d9
17 changed files with 135 additions and 134 deletions
|
|
@ -110,7 +110,10 @@ class Mgxs {
|
|||
//!
|
||||
//! @param xs_id HDF5 group id for the cross section data.
|
||||
//! @param temperature Temperatures to read.
|
||||
Mgxs(hid_t xs_id, const std::vector<double>& temperature);
|
||||
//! @param num_group number of energy groups
|
||||
//! @param num_delay number of delayed groups
|
||||
Mgxs(hid_t xs_id, const std::vector<double>& temperature,
|
||||
int num_group, int num_delay);
|
||||
|
||||
//! \brief Constructor that initializes and populates all data to build a
|
||||
//! macroscopic cross section from microscopic cross section.
|
||||
|
|
@ -119,8 +122,11 @@ class Mgxs {
|
|||
//! @param mat_kTs temperatures (in units of eV) that data is needed.
|
||||
//! @param micros Microscopic objects to combine.
|
||||
//! @param atom_densities Atom densities of those microscopic quantities.
|
||||
//! @param num_group number of energy groups
|
||||
//! @param num_delay number of delayed groups
|
||||
Mgxs(const std::string& in_name, const std::vector<double>& mat_kTs,
|
||||
const std::vector<Mgxs*>& micros, const std::vector<double>& atom_densities);
|
||||
const std::vector<Mgxs*>& micros, const std::vector<double>& atom_densities,
|
||||
int num_group, int num_delay);
|
||||
|
||||
//! \brief Provides a cross section value given certain parameters
|
||||
//!
|
||||
|
|
|
|||
|
|
@ -12,36 +12,41 @@
|
|||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
// Global variables
|
||||
// Global MGXS data container structure
|
||||
//==============================================================================
|
||||
|
||||
struct MgxsInterface
|
||||
{
|
||||
int num_energy_groups;
|
||||
int num_delayed_groups;
|
||||
|
||||
std::vector<Mgxs> nuclides_MG;
|
||||
std::vector<Mgxs> macro_xs;
|
||||
|
||||
std::vector<double> energy_bins;
|
||||
std::vector<double> energy_bin_avg;
|
||||
std::vector<double> rev_energy_bins;
|
||||
|
||||
MgxsInterface() = default;
|
||||
|
||||
// Construct from path to cross sections file
|
||||
MgxsInterface(const std::string& path_cross_sections);
|
||||
|
||||
void init(const std::string& path_cross_sections);
|
||||
|
||||
void add_mgxs(hid_t file_id, const std::string& name,
|
||||
const std::vector<double>& temperature);
|
||||
|
||||
void create_macro_xs();
|
||||
|
||||
std::vector<std::vector<double>> get_mat_kTs();
|
||||
|
||||
void read_mg_cross_sections_header();
|
||||
};
|
||||
|
||||
namespace data {
|
||||
|
||||
extern std::vector<Mgxs> nuclides_MG;
|
||||
extern std::vector<Mgxs> macro_xs;
|
||||
extern int num_energy_groups;
|
||||
extern int num_delayed_groups;
|
||||
extern std::vector<double> energy_bins;
|
||||
extern std::vector<double> energy_bin_avg;
|
||||
extern std::vector<double> rev_energy_bins;
|
||||
|
||||
} // namespace data
|
||||
|
||||
//==============================================================================
|
||||
// Mgxs data loading interface methods
|
||||
//==============================================================================
|
||||
|
||||
void read_mgxs();
|
||||
|
||||
void
|
||||
add_mgxs(hid_t file_id, const std::string& name,
|
||||
const std::vector<double>& temperature);
|
||||
|
||||
void create_macro_xs();
|
||||
|
||||
std::vector<std::vector<double>> get_mat_kTs();
|
||||
|
||||
void read_mg_cross_sections_header();
|
||||
extern MgxsInterface mgInterface;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
// Mgxs tracking/transport/tallying interface methods
|
||||
|
|
|
|||
|
|
@ -155,7 +155,7 @@ void read_cross_sections_xml()
|
|||
if (settings::run_CE) {
|
||||
read_ce_cross_sections_xml();
|
||||
} else {
|
||||
read_mg_cross_sections_header();
|
||||
data::mgInterface.read_mg_cross_sections_header();
|
||||
}
|
||||
|
||||
// Establish mapping between (type, material) and index in libraries
|
||||
|
|
|
|||
|
|
@ -260,8 +260,8 @@ void read_input_xml()
|
|||
read_ce_cross_sections(nuc_temps, thermal_temps);
|
||||
} else {
|
||||
// Create material macroscopic data for MGXS
|
||||
read_mgxs();
|
||||
create_macro_xs();
|
||||
data::mgInterface.init(settings::path_cross_sections);
|
||||
data::mgInterface.create_macro_xs();
|
||||
}
|
||||
simulation::time_read_xs.stop();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,7 +368,7 @@ void Material::normalize_density()
|
|||
// determine atomic weight ratio
|
||||
int i_nuc = nuclide_[i];
|
||||
double awr = settings::run_CE ?
|
||||
data::nuclides[i_nuc]->awr_ : data::nuclides_MG[i_nuc].awr;
|
||||
data::nuclides[i_nuc]->awr_ : data::mgInterface.nuclides_MG[i_nuc].awr;
|
||||
|
||||
// if given weight percent, convert all values so that they are divided
|
||||
// by awr. thus, when a sum is done over the values, it's actually
|
||||
|
|
@ -388,7 +388,7 @@ void Material::normalize_density()
|
|||
for (int i = 0; i < nuclide_.size(); ++i) {
|
||||
int i_nuc = nuclide_[i];
|
||||
double awr = settings::run_CE ?
|
||||
data::nuclides[i_nuc]->awr_ : data::nuclides_MG[i_nuc].awr;
|
||||
data::nuclides[i_nuc]->awr_ : data::mgInterface.nuclides_MG[i_nuc].awr;
|
||||
sum_percent += atom_density_(i)*awr;
|
||||
}
|
||||
sum_percent = 1.0 / sum_percent;
|
||||
|
|
@ -726,7 +726,7 @@ void Material::init_bremsstrahlung()
|
|||
void Material::init_nuclide_index()
|
||||
{
|
||||
int n = settings::run_CE ?
|
||||
data::nuclides.size() : data::nuclides_MG.size();
|
||||
data::nuclides.size() : data::mgInterface.nuclides_MG.size();
|
||||
mat_nuclide_index_.resize(n);
|
||||
std::fill(mat_nuclide_index_.begin(), mat_nuclide_index_.end(), C_NONE);
|
||||
for (int i = 0; i < nuclide_.size(); ++i) {
|
||||
|
|
@ -994,11 +994,11 @@ void Material::to_hdf5(hid_t group) const
|
|||
} else {
|
||||
for (int i = 0; i < nuclide_.size(); ++i) {
|
||||
int i_nuc = nuclide_[i];
|
||||
if (data::nuclides_MG[i_nuc].awr != MACROSCOPIC_AWR) {
|
||||
nuc_names.push_back(data::nuclides_MG[i_nuc].name);
|
||||
if (data::mgInterface.nuclides_MG[i_nuc].awr != MACROSCOPIC_AWR) {
|
||||
nuc_names.push_back(data::mgInterface.nuclides_MG[i_nuc].name);
|
||||
nuc_densities.push_back(atom_density_(i));
|
||||
} else {
|
||||
macro_names.push_back(data::nuclides_MG[i_nuc].name);
|
||||
macro_names.push_back(data::mgInterface.nuclides_MG[i_nuc].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
24
src/mgxs.cpp
24
src/mgxs.cpp
|
|
@ -24,18 +24,6 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
// Global variables
|
||||
//==============================================================================
|
||||
|
||||
namespace data {
|
||||
|
||||
// Storage for the MGXS data
|
||||
std::vector<Mgxs> nuclides_MG;
|
||||
std::vector<Mgxs> macro_xs;
|
||||
|
||||
} // namespace data
|
||||
|
||||
//==============================================================================
|
||||
// Mgxs base-class methods
|
||||
//==============================================================================
|
||||
|
|
@ -53,8 +41,6 @@ Mgxs::init(const std::string& in_name, double in_awr,
|
|||
kTs = xt::adapt(in_kTs);
|
||||
fissionable = in_fissionable;
|
||||
scatter_format = in_scatter_format;
|
||||
num_groups = data::num_energy_groups;
|
||||
num_delayed_groups = data::num_delayed_groups;
|
||||
xs.resize(in_kTs.size());
|
||||
is_isotropic = in_is_isotropic;
|
||||
n_pol = in_polar.size();
|
||||
|
|
@ -284,7 +270,10 @@ Mgxs::metadata_from_hdf5(hid_t xs_id, const std::vector<double>& temperature,
|
|||
|
||||
//==============================================================================
|
||||
|
||||
Mgxs::Mgxs(hid_t xs_id, const std::vector<double>& temperature)
|
||||
Mgxs::Mgxs(hid_t xs_id, const std::vector<double>& temperature,
|
||||
int num_group, int num_delay) :
|
||||
num_groups(num_group),
|
||||
num_delayed_groups(num_delay)
|
||||
{
|
||||
// Call generic data gathering routine (will populate the metadata)
|
||||
int order_data;
|
||||
|
|
@ -317,7 +306,10 @@ Mgxs::Mgxs(hid_t xs_id, const std::vector<double>& temperature)
|
|||
//==============================================================================
|
||||
|
||||
Mgxs::Mgxs(const std::string& in_name, const std::vector<double>& mat_kTs,
|
||||
const std::vector<Mgxs*>& micros, const std::vector<double>& atom_densities)
|
||||
const std::vector<Mgxs*>& micros, const std::vector<double>& atom_densities,
|
||||
int num_group, int num_delay) :
|
||||
num_groups(num_group),
|
||||
num_delayed_groups(num_delay)
|
||||
{
|
||||
// Get the minimum data needed to initialize:
|
||||
// Dont need awr, but lets just initialize it anyways
|
||||
|
|
|
|||
|
|
@ -18,30 +18,25 @@
|
|||
|
||||
namespace openmc {
|
||||
|
||||
//==============================================================================
|
||||
// Global variable definitions
|
||||
//==============================================================================
|
||||
|
||||
namespace data {
|
||||
|
||||
int num_energy_groups;
|
||||
int num_delayed_groups;
|
||||
std::vector<double> energy_bins;
|
||||
std::vector<double> energy_bin_avg;
|
||||
std::vector<double> rev_energy_bins;
|
||||
|
||||
} // namesapce data
|
||||
|
||||
//==============================================================================
|
||||
// Mgxs data loading interface methods
|
||||
//==============================================================================
|
||||
|
||||
void read_mgxs()
|
||||
namespace data {
|
||||
MgxsInterface mgInterface;
|
||||
}
|
||||
|
||||
MgxsInterface::MgxsInterface(const std::string& path_cross_sections)
|
||||
{
|
||||
init(path_cross_sections);
|
||||
}
|
||||
|
||||
void MgxsInterface::init(const std::string& path_cross_sections)
|
||||
{
|
||||
// Check if MGXS Library exists
|
||||
if (!file_exists(settings::path_cross_sections)) {
|
||||
if (!file_exists(path_cross_sections)) {
|
||||
// Could not find MGXS Library file
|
||||
fatal_error("Cross sections HDF5 file '" + settings::path_cross_sections +
|
||||
fatal_error("Cross sections HDF5 file '" + path_cross_sections +
|
||||
"' does not exist.");
|
||||
}
|
||||
|
||||
|
|
@ -53,7 +48,7 @@ void read_mgxs()
|
|||
get_temperatures(nuc_temps, dummy);
|
||||
|
||||
// Open file for reading
|
||||
hid_t file_id = file_open(settings::path_cross_sections, 'r');
|
||||
hid_t file_id = file_open(path_cross_sections, 'r');
|
||||
|
||||
// Read filetype
|
||||
std::string type;
|
||||
|
|
@ -92,7 +87,7 @@ void read_mgxs()
|
|||
already_read.insert(name);
|
||||
}
|
||||
|
||||
if (data::nuclides_MG[i_nuc].fissionable) {
|
||||
if (nuclides_MG[i_nuc].fissionable) {
|
||||
mat->fissionable_ = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -104,7 +99,7 @@ void read_mgxs()
|
|||
//==============================================================================
|
||||
|
||||
void
|
||||
add_mgxs(hid_t file_id, const std::string& name,
|
||||
MgxsInterface::add_mgxs(hid_t file_id, const std::string& name,
|
||||
const std::vector<double>& temperature)
|
||||
{
|
||||
write_message("Loading " + std::string(name) + " data...", 6);
|
||||
|
|
@ -118,13 +113,14 @@ add_mgxs(hid_t file_id, const std::string& name,
|
|||
+ "provided MGXS Library");
|
||||
}
|
||||
|
||||
data::nuclides_MG.emplace_back(xs_grp, temperature);
|
||||
nuclides_MG.emplace_back(xs_grp, temperature, num_energy_groups,
|
||||
num_delayed_groups);
|
||||
close_group(xs_grp);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
||||
void create_macro_xs()
|
||||
void MgxsInterface::create_macro_xs()
|
||||
{
|
||||
// Get temperatures to read for each material
|
||||
auto kTs = get_mat_kTs();
|
||||
|
|
@ -144,20 +140,21 @@ void create_macro_xs()
|
|||
// material
|
||||
std::vector<Mgxs*> mgxs_ptr;
|
||||
for (int i_nuclide : mat->nuclide_) {
|
||||
mgxs_ptr.push_back(&data::nuclides_MG[i_nuclide]);
|
||||
mgxs_ptr.push_back(&nuclides_MG[i_nuclide]);
|
||||
}
|
||||
|
||||
data::macro_xs.emplace_back(mat->name_, kTs[i], mgxs_ptr, atom_densities);
|
||||
macro_xs.emplace_back(mat->name_, kTs[i], mgxs_ptr, atom_densities,
|
||||
num_energy_groups, num_delayed_groups);
|
||||
} else {
|
||||
// Preserve the ordering of materials by including a blank entry
|
||||
data::macro_xs.emplace_back();
|
||||
macro_xs.emplace_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
||||
std::vector<std::vector<double>> get_mat_kTs()
|
||||
std::vector<std::vector<double>> MgxsInterface::get_mat_kTs()
|
||||
{
|
||||
std::vector<std::vector<double>> kTs(model::materials.size());
|
||||
|
||||
|
|
@ -186,7 +183,7 @@ std::vector<std::vector<double>> get_mat_kTs()
|
|||
|
||||
//==============================================================================
|
||||
|
||||
void read_mg_cross_sections_header()
|
||||
void MgxsInterface::read_mg_cross_sections_header()
|
||||
{
|
||||
// Check if MGXS Library exists
|
||||
if (!file_exists(settings::path_cross_sections)) {
|
||||
|
|
@ -200,24 +197,25 @@ void read_mg_cross_sections_header()
|
|||
hid_t file_id = file_open(settings::path_cross_sections, 'r', true);
|
||||
|
||||
ensure_exists(file_id, "energy_groups", true);
|
||||
read_attribute(file_id, "energy_groups", data::num_energy_groups);
|
||||
read_attribute(file_id, "energy_groups", num_energy_groups);
|
||||
|
||||
if (attribute_exists(file_id, "delayed_groups")) {
|
||||
read_attribute(file_id, "delayed_groups", data::num_delayed_groups);
|
||||
read_attribute(file_id, "delayed_groups", num_delayed_groups);
|
||||
} else {
|
||||
data::num_delayed_groups = 0;
|
||||
num_delayed_groups = 0;
|
||||
}
|
||||
|
||||
ensure_exists(file_id, "group structure", true);
|
||||
read_attribute(file_id, "group structure", data::rev_energy_bins);
|
||||
read_attribute(file_id, "group structure", rev_energy_bins);
|
||||
|
||||
// Reverse energy bins
|
||||
std::copy(data::rev_energy_bins.crbegin(), data::rev_energy_bins.crend(),
|
||||
std::back_inserter(data::energy_bins));
|
||||
std::copy(rev_energy_bins.crbegin(), rev_energy_bins.crend(),
|
||||
std::back_inserter(data::mgInterface.energy_bins));
|
||||
|
||||
// Create average energies
|
||||
for (int i = 0; i < data::energy_bins.size() - 1; ++i) {
|
||||
data::energy_bin_avg.push_back(0.5*(data::energy_bins[i] + data::energy_bins[i+1]));
|
||||
for (int i = 0; i < data::mgInterface.energy_bins.size() - 1; ++i) {
|
||||
data::mgInterface.energy_bin_avg.push_back(0.5*
|
||||
(data::mgInterface.energy_bins[i] + data::mgInterface.energy_bins[i+1]));
|
||||
}
|
||||
|
||||
// Add entries into libraries for MG data
|
||||
|
|
@ -236,8 +234,8 @@ void read_mg_cross_sections_header()
|
|||
|
||||
// Get the minimum and maximum energies
|
||||
int neutron = static_cast<int>(Particle::Type::neutron);
|
||||
data::energy_min[neutron] = data::energy_bins.back();
|
||||
data::energy_max[neutron] = data::energy_bins.front();
|
||||
data::energy_min[neutron] = data::mgInterface.energy_bins.back();
|
||||
data::energy_max[neutron] = data::mgInterface.energy_bins.front();
|
||||
|
||||
// Close MGXS HDF5 file
|
||||
file_close(file_id);
|
||||
|
|
@ -251,7 +249,7 @@ void
|
|||
calculate_xs_c(int i_mat, int gin, double sqrtkT, Direction u,
|
||||
double& total_xs, double& abs_xs, double& nu_fiss_xs)
|
||||
{
|
||||
data::macro_xs[i_mat].calculate_xs(gin - 1, sqrtkT, u, total_xs, abs_xs,
|
||||
data::mgInterface.macro_xs[i_mat].calculate_xs(gin - 1, sqrtkT, u, total_xs, abs_xs,
|
||||
nu_fiss_xs);
|
||||
}
|
||||
|
||||
|
|
@ -269,7 +267,7 @@ get_nuclide_xs(int index, int xstype, int gin, const int* gout,
|
|||
} else {
|
||||
gout_c_p = gout;
|
||||
}
|
||||
return data::nuclides_MG[index].get_xs(xstype, gin - 1, gout_c_p, mu, dg);
|
||||
return data::mgInterface.nuclides_MG[index].get_xs(xstype, gin - 1, gout_c_p, mu, dg);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -286,7 +284,7 @@ get_macro_xs(int index, int xstype, int gin, const int* gout,
|
|||
} else {
|
||||
gout_c_p = gout;
|
||||
}
|
||||
return data::macro_xs[index].get_xs(xstype, gin - 1, gout_c_p, mu, dg);
|
||||
return data::mgInterface.macro_xs[index].get_xs(xstype, gin - 1, gout_c_p, mu, dg);
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -301,7 +299,7 @@ get_name_c(int index, int name_len, char* name)
|
|||
std::strcpy(name, str.c_str());
|
||||
|
||||
// Now get the data and copy to the C-string
|
||||
str = data::nuclides_MG[index - 1].name;
|
||||
str = data::mgInterface.nuclides_MG[index - 1].name;
|
||||
std::strcpy(name, str.c_str());
|
||||
|
||||
// Finally, remove the null terminator
|
||||
|
|
@ -313,7 +311,7 @@ get_name_c(int index, int name_len, char* name)
|
|||
double
|
||||
get_awr_c(int index)
|
||||
{
|
||||
return data::nuclides_MG[index - 1].awr;
|
||||
return data::mgInterface.nuclides_MG[index - 1].awr;
|
||||
}
|
||||
|
||||
} // namespace openmc
|
||||
|
|
|
|||
|
|
@ -710,7 +710,7 @@ write_tallies()
|
|||
<< data::nuclides[i_nuclide]->name_ << "\n";
|
||||
} else {
|
||||
tallies_out << std::string(indent+1, ' ')
|
||||
<< data::nuclides_MG[i_nuclide].name << "\n";
|
||||
<< data::mgInterface.nuclides_MG[i_nuclide].name << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ Particle::from_source(const Bank* src)
|
|||
} else {
|
||||
g_ = static_cast<int>(src->E);
|
||||
g_last_ = static_cast<int>(src->E);
|
||||
E_ = data::energy_bin_avg[g_ - 1];
|
||||
E_ = data::mgInterface.energy_bin_avg[g_ - 1];
|
||||
}
|
||||
E_last_ = E_;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ void read_particle_restart(Particle& p, int& previous_run_mode)
|
|||
// Set energy group and average energy in multi-group mode
|
||||
if (!settings::run_CE) {
|
||||
p.g_ = p.E_;
|
||||
p.E_ = data::energy_bin_avg[p.g_ - 1];
|
||||
p.E_ = data::mgInterface.energy_bin_avg[p.g_ - 1];
|
||||
}
|
||||
|
||||
// Set particle last attributes
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ scatter(Particle* p)
|
|||
int gin = p->g_last_ - 1;
|
||||
int gout = p->g_ - 1;
|
||||
int i_mat = p->material_;
|
||||
data::macro_xs[i_mat].sample_scatter(gin, gout, p->mu_, p->wgt_);
|
||||
data::mgInterface.macro_xs[i_mat].sample_scatter(gin, gout, p->mu_, p->wgt_);
|
||||
|
||||
// Adjust return value for fortran indexing
|
||||
// TODO: Remove when no longer needed
|
||||
|
|
@ -92,7 +92,7 @@ scatter(Particle* p)
|
|||
p->u() = rotate_angle(p->u(), p->mu_, nullptr);
|
||||
|
||||
// Update energy value for downstream compatability (in tallying)
|
||||
p->E_ = data::energy_bin_avg[gout];
|
||||
p->E_ = data::mgInterface.energy_bin_avg[gout];
|
||||
|
||||
// Set event component
|
||||
p->event_ = EVENT_SCATTER;
|
||||
|
|
@ -148,7 +148,7 @@ create_fission_sites(Particle* p, std::vector<Particle::Bank>& bank)
|
|||
// the energy in the fission bank
|
||||
int dg;
|
||||
int gout;
|
||||
data::macro_xs[p->material_].sample_fission_energy(p->g_ - 1, dg, gout);
|
||||
data::mgInterface.macro_xs[p->material_].sample_fission_energy(p->g_ - 1, dg, gout);
|
||||
site.E = gout + 1;
|
||||
site.delayed_group = dg + 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -311,9 +311,9 @@ Particle::Bank sample_external_source()
|
|||
|
||||
// If running in MG, convert site % E to group
|
||||
if (!settings::run_CE) {
|
||||
site.E = lower_bound_index(data::rev_energy_bins.begin(),
|
||||
data::rev_energy_bins.end(), site.E);
|
||||
site.E = data::num_energy_groups - site.E;
|
||||
site.E = lower_bound_index(data::mgInterface.rev_energy_bins.begin(),
|
||||
data::mgInterface.rev_energy_bins.end(), site.E);
|
||||
site.E = data::mgInterface.num_energy_groups - site.E;
|
||||
}
|
||||
|
||||
// Set the random number generator back to the tracking stream.
|
||||
|
|
|
|||
|
|
@ -208,7 +208,7 @@ openmc_statepoint_write(const char* filename, bool* write_source)
|
|||
if (settings::run_CE) {
|
||||
nuclides.push_back(data::nuclides[i_nuclide]->name_);
|
||||
} else {
|
||||
nuclides.push_back(data::nuclides_MG[i_nuclide].name);
|
||||
nuclides.push_back(data::mgInterface.nuclides_MG[i_nuclide].name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ void write_nuclides(hid_t file)
|
|||
nuc_names.push_back(nuc->name_);
|
||||
awrs.push_back(nuc->awr_);
|
||||
} else {
|
||||
const auto& nuc {data::nuclides_MG[i]};
|
||||
const auto& nuc {data::mgInterface.nuclides_MG[i]};
|
||||
if (nuc.awr != MACROSCOPIC_AWR) {
|
||||
nuc_names.push_back(nuc.name);
|
||||
awrs.push_back(nuc.awr);
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ EnergyFilter::set_bins(gsl::span<const double> bins)
|
|||
// (after flipping for the different ordering of the library and tallying
|
||||
// systems).
|
||||
if (!settings::run_CE) {
|
||||
if (n_bins_ == data::num_energy_groups) {
|
||||
if (n_bins_ == data::mgInterface.num_energy_groups) {
|
||||
matches_transport_groups_ = true;
|
||||
for (gsl::index i = 0; i < n_bins_ + 1; ++i) {
|
||||
if (data::rev_energy_bins[i] != bins_[i]) {
|
||||
if (data::mgInterface.rev_energy_bins[i] != bins_[i]) {
|
||||
matches_transport_groups_ = false;
|
||||
break;
|
||||
}
|
||||
|
|
@ -61,9 +61,9 @@ const
|
|||
{
|
||||
if (p->g_ != F90_NONE && matches_transport_groups_) {
|
||||
if (estimator == ESTIMATOR_TRACKLENGTH) {
|
||||
match.bins_.push_back(data::num_energy_groups - p->g_);
|
||||
match.bins_.push_back(data::mgInterface.num_energy_groups - p->g_);
|
||||
} else {
|
||||
match.bins_.push_back(data::num_energy_groups - p->g_last_);
|
||||
match.bins_.push_back(data::mgInterface.num_energy_groups - p->g_last_);
|
||||
}
|
||||
match.weights_.push_back(1.0);
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ EnergyoutFilter::get_all_bins(const Particle* p, int estimator,
|
|||
FilterMatch& match) const
|
||||
{
|
||||
if (p->g_ != F90_NONE && matches_transport_groups_) {
|
||||
match.bins_.push_back(data::num_energy_groups - p->g_);
|
||||
match.bins_.push_back(data::mgInterface.num_energy_groups - p->g_);
|
||||
match.weights_.push_back(1.0);
|
||||
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -361,7 +361,7 @@ score_fission_eout(const Particle* p, int i_tally, int i_score, int score_bin)
|
|||
if (settings::run_CE) {
|
||||
E_out = bank.E;
|
||||
} else {
|
||||
E_out = data::energy_bin_avg[static_cast<int>(bank.E)];
|
||||
E_out = data::mgInterface.energy_bin_avg[static_cast<int>(bank.E)];
|
||||
}
|
||||
|
||||
// Set EnergyoutFilter bin index
|
||||
|
|
@ -1376,13 +1376,13 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
|
|||
|
||||
// To significantly reduce de-referencing, point matxs to the macroscopic
|
||||
// Mgxs for the material of interest
|
||||
data::macro_xs[p->material_].set_angle_index(p_u);
|
||||
data::mgInterface.macro_xs[p->material_].set_angle_index(p_u);
|
||||
|
||||
// Do same for nucxs, point it to the microscopic nuclide data of interest
|
||||
if (i_nuclide >= 0) {
|
||||
// And since we haven't calculated this temperature index yet, do so now
|
||||
data::nuclides_MG[i_nuclide].set_temperature_index(p->sqrtkT_);
|
||||
data::nuclides_MG[i_nuclide].set_angle_index(p_u);
|
||||
data::mgInterface.nuclides_MG[i_nuclide].set_temperature_index(p->sqrtkT_);
|
||||
data::mgInterface.nuclides_MG[i_nuclide].set_angle_index(p_u);
|
||||
}
|
||||
|
||||
for (auto i = 0; i < tally.scores_.size(); ++i) {
|
||||
|
|
@ -1869,7 +1869,7 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
|
|||
// delayed-nu-fission xs to the absorption xs for all delayed
|
||||
// groups
|
||||
score = 0.;
|
||||
for (auto d = 0; d < data::num_delayed_groups; ++d) {
|
||||
for (auto d = 0; d < data::mgInterface.num_delayed_groups; ++d) {
|
||||
if (i_nuclide >= 0) {
|
||||
score += p->wgt_absorb_ * flux
|
||||
* get_nuclide_xs(i_nuclide, MG_GET_XS_DECAY_RATE,
|
||||
|
|
@ -1960,7 +1960,7 @@ score_general_mg(const Particle* p, int i_tally, int start_index,
|
|||
continue;
|
||||
} else {
|
||||
score = 0.;
|
||||
for (auto d = 0; d < data::num_delayed_groups; ++d) {
|
||||
for (auto d = 0; d < data::mgInterface.num_delayed_groups; ++d) {
|
||||
if (i_nuclide >= 0) {
|
||||
score += atom_density * flux
|
||||
* get_nuclide_xs(i_nuclide, MG_GET_XS_DECAY_RATE,
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@ namespace openmc {
|
|||
XsData::XsData(bool fissionable, int scatter_format, int n_pol, int n_azi)
|
||||
{
|
||||
size_t n_ang = n_pol * n_azi;
|
||||
size_t n_dg = data::num_delayed_groups;
|
||||
size_t n_g = data::num_energy_groups;
|
||||
size_t n_dg = data::mgInterface.num_delayed_groups;
|
||||
size_t n_g = data::mgInterface.num_energy_groups;
|
||||
|
||||
// check to make sure scatter format is OK before we allocate
|
||||
if (scatter_format != ANGLE_HISTOGRAM && scatter_format != ANGLE_TABULAR &&
|
||||
|
|
@ -127,8 +127,8 @@ XsData::fission_vector_beta_from_hdf5(hid_t xsdata_grp, size_t n_ang,
|
|||
{
|
||||
// Data is provided as nu-fission and chi with a beta for delayed info
|
||||
|
||||
size_t n_g = data::num_energy_groups;
|
||||
size_t n_dg = data::num_delayed_groups;
|
||||
size_t n_g = data::mgInterface.num_energy_groups;
|
||||
size_t n_dg = data::mgInterface.num_delayed_groups;
|
||||
|
||||
// Get chi
|
||||
xt::xtensor<double, 2> temp_chi({n_ang, n_g}, 0.);
|
||||
|
|
@ -182,8 +182,8 @@ XsData::fission_vector_no_beta_from_hdf5(hid_t xsdata_grp, size_t n_ang)
|
|||
{
|
||||
// Data is provided separately as prompt + delayed nu-fission and chi
|
||||
|
||||
size_t n_g = data::num_energy_groups;
|
||||
size_t n_dg = data::num_delayed_groups;
|
||||
size_t n_g = data::mgInterface.num_energy_groups;
|
||||
size_t n_dg = data::mgInterface.num_delayed_groups;
|
||||
|
||||
// Get chi-prompt
|
||||
xt::xtensor<double, 2> temp_chi_p({n_ang, n_g}, 0.);
|
||||
|
|
@ -218,7 +218,7 @@ XsData::fission_vector_no_delayed_from_hdf5(hid_t xsdata_grp, size_t n_ang)
|
|||
// No beta is provided and there is no prompt/delay distinction.
|
||||
// Therefore, the code only considers the data as prompt.
|
||||
|
||||
size_t n_g = data::num_energy_groups;
|
||||
size_t n_g = data::mgInterface.num_energy_groups;
|
||||
|
||||
// Get chi
|
||||
xt::xtensor<double, 2> temp_chi({n_ang, n_g}, 0.);
|
||||
|
|
@ -241,8 +241,8 @@ XsData::fission_matrix_beta_from_hdf5(hid_t xsdata_grp, size_t n_ang, bool is_is
|
|||
{
|
||||
// Data is provided as nu-fission and chi with a beta for delayed info
|
||||
|
||||
size_t n_g = data::num_energy_groups;
|
||||
size_t n_dg = data::num_delayed_groups;
|
||||
size_t n_g = data::mgInterface.num_energy_groups;
|
||||
size_t n_dg = data::mgInterface.num_delayed_groups;
|
||||
|
||||
// Get nu-fission matrix
|
||||
xt::xtensor<double, 3> temp_matrix({n_ang, n_g, n_g}, 0.);
|
||||
|
|
@ -319,8 +319,8 @@ XsData::fission_matrix_no_beta_from_hdf5(hid_t xsdata_grp, size_t n_ang)
|
|||
{
|
||||
// Data is provided separately as prompt + delayed nu-fission and chi
|
||||
|
||||
size_t n_g = data::num_energy_groups;
|
||||
size_t n_dg = data::num_delayed_groups;
|
||||
size_t n_g = data::mgInterface.num_energy_groups;
|
||||
size_t n_dg = data::mgInterface.num_delayed_groups;
|
||||
|
||||
// Get the prompt nu-fission matrix
|
||||
xt::xtensor<double, 3> temp_matrix_p({n_ang, n_g, n_g}, 0.);
|
||||
|
|
@ -353,7 +353,7 @@ XsData::fission_matrix_no_delayed_from_hdf5(hid_t xsdata_grp, size_t n_ang)
|
|||
// No beta is provided and there is no prompt/delay distinction.
|
||||
// Therefore, the code only considers the data as prompt.
|
||||
|
||||
size_t n_g = data::num_energy_groups;
|
||||
size_t n_g = data::mgInterface.num_energy_groups;
|
||||
|
||||
// Get nu-fission matrix
|
||||
xt::xtensor<double, 3> temp_matrix({n_ang, n_g, n_g}, 0.);
|
||||
|
|
@ -381,7 +381,7 @@ XsData::fission_from_hdf5(hid_t xsdata_grp, size_t n_ang, bool is_isotropic)
|
|||
// as a nu-fission matrix or a set of chi and nu-fission vectors
|
||||
if (object_exists(xsdata_grp, "chi") ||
|
||||
object_exists(xsdata_grp, "chi-prompt")) {
|
||||
if (data::num_delayed_groups == 0) {
|
||||
if (data::mgInterface.num_delayed_groups == 0) {
|
||||
fission_vector_no_delayed_from_hdf5(xsdata_grp, n_ang);
|
||||
} else {
|
||||
if (object_exists(xsdata_grp, "beta")) {
|
||||
|
|
@ -391,7 +391,7 @@ XsData::fission_from_hdf5(hid_t xsdata_grp, size_t n_ang, bool is_isotropic)
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (data::num_delayed_groups == 0) {
|
||||
if (data::mgInterface.num_delayed_groups == 0) {
|
||||
fission_matrix_no_delayed_from_hdf5(xsdata_grp, n_ang);
|
||||
} else {
|
||||
if (object_exists(xsdata_grp, "beta")) {
|
||||
|
|
@ -403,7 +403,7 @@ XsData::fission_from_hdf5(hid_t xsdata_grp, size_t n_ang, bool is_isotropic)
|
|||
}
|
||||
|
||||
// Combine prompt_nu_fission and delayed_nu_fission into nu_fission
|
||||
if (data::num_delayed_groups == 0) {
|
||||
if (data::mgInterface.num_delayed_groups == 0) {
|
||||
nu_fission = prompt_nu_fission;
|
||||
} else {
|
||||
nu_fission = prompt_nu_fission + xt::sum(delayed_nu_fission, {1});
|
||||
|
|
@ -422,7 +422,7 @@ XsData::scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang,
|
|||
hid_t scatt_grp = open_group(xsdata_grp, "scatter_data");
|
||||
|
||||
// Get the outgoing group boundary indices
|
||||
size_t n_g = data::num_energy_groups;
|
||||
size_t n_g = data::mgInterface.num_energy_groups;
|
||||
xt::xtensor<int, 2> gmin({n_ang, n_g}, 0.);
|
||||
read_nd_vector(scatt_grp, "g_min", gmin, true);
|
||||
xt::xtensor<int, 2> gmax({n_ang, n_g}, 0.);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue