Made modifications to 1) fix min data temperature and max data temperature printing, and 2) to allow openmc.mgxs.Library to tally over Cells which contaon universes instead of only allowing for cells that contain materials.

This commit is contained in:
Adam Nelson 2020-05-07 07:15:19 -05:00
parent d3909eb81d
commit 1a4304c78a
3 changed files with 14 additions and 9 deletions

View file

@ -192,7 +192,9 @@ class Library:
if self._domains == 'all':
if self.domain_type == 'material':
return list(self.geometry.get_all_materials().values())
elif self.domain_type in ['cell', 'distribcell']:
elif self.domain_type == 'cell':
return list(self.geometry.get_all_cells().values())
elif self.domain_type in 'distribcell':
return list(self.geometry.get_all_material_cells().values())
elif self.domain_type == 'universe':
return list(self.geometry.get_all_universes().values())
@ -316,7 +318,10 @@ class Library:
if self.domain_type == 'material':
cv.check_type('domain', domains, Iterable, openmc.Material)
all_domains = self.geometry.get_all_materials().values()
elif self.domain_type in ['cell', 'distribcell']:
elif self.domain_type == 'cell':
cv.check_type('domain', domains, Iterable, openmc.Cell)
all_domains = self.geometry.get_all_cells().values()
elif self.domain_type == 'distribcell':
cv.check_type('domain', domains, Iterable, openmc.Cell)
all_domains = self.geometry.get_all_material_cells().values()
elif self.domain_type == 'universe':
@ -1382,7 +1387,7 @@ class Library:
materials = openmc.Materials()
# Get all Cells from the Geometry for differentiation
all_cells = geometry.get_all_material_cells().values()
all_cells = geometry.get_all_cells().values()
# Create the xsdata object and add it to the mgxs_file
for i, domain in enumerate(self.domains):

View file

@ -127,8 +127,8 @@ int openmc_finalize()
data::energy_max = {INFTY, INFTY};
data::energy_min = {0.0, 0.0};
data::temperature_min = 0.0;
data::temperature_max = INFTY;
data::temperature_min = INFTY;
data::temperature_max = 0.0;
model::root_universe = -1;
openmc::openmc_set_seed(DEFAULT_SEED);

View file

@ -30,8 +30,8 @@ namespace openmc {
namespace data {
std::array<double, 2> energy_min {0.0, 0.0};
std::array<double, 2> energy_max {INFTY, INFTY};
double temperature_min {0.0};
double temperature_max {INFTY};
double temperature_min {INFTY};
double temperature_max {0.0};
std::vector<std::unique_ptr<Nuclide>> nuclides;
std::unordered_map<std::string, int> nuclide_map;
} // namespace data
@ -159,8 +159,8 @@ Nuclide::Nuclide(hid_t group, const std::vector<double>& temperature, int i_nucl
double T_min_read = *std::min_element(temps_to_read.cbegin(), temps_to_read.cend());
double T_max_read = *std::max_element(temps_to_read.cbegin(), temps_to_read.cend());
data::temperature_min = std::max(data::temperature_min, T_min_read);
data::temperature_max = std::min(data::temperature_max, T_max_read);
data::temperature_min = std::min(data::temperature_min, T_min_read);
data::temperature_max = std::max(data::temperature_max, T_max_read);
hid_t energy_group = open_group(group, "energy");
for (const auto& T : temps_to_read) {