6 material.
total_xs = j.at(
"total_xs").get<
double>();
7 material.
fission_xs = j.at(
"fission_xs").get<
double>();
8 material.
nu = j.at(
"nu").get<
double>();
12 Build(input_file_json);
18 for (
const auto& [name, material_json] :
19 input_file_json.at(
"materials").items()) {
29 std::vector<Material> materials;
32 materials.push_back(material);
34 for (
const auto& material : materials) {
35 if (material.total_xs < (material.scattering_xs + material.fission_xs))
36 throw std::runtime_error(
37 "Sum of scattering and fission cross sections is greater than the "
38 "total cross section. Please check over material data in input "
40 if (material.total_xs < 0)
41 throw std::runtime_error(
42 "Negative total cross section passed in material. Please check over "
43 "material data in input file.");
44 if (material.scattering_xs < 0)
45 throw std::runtime_error(
46 "Negative scattering cross section passed in material. Please check "
47 "over material data in input file.");
48 if (material.fission_xs < 0)
49 throw std::runtime_error(
50 "Negative fission cross section passed in material. Please check "
51 "over material data in input file.");
53 throw std::runtime_error(
54 "Negative fission multiplication (nu) passed in material. Please "
55 "check over material data in input file.");
std::unordered_map< std::string, int > name_id_map_
std::unordered_map< int, Material > id_object_map_
void CheckMaterials()
Check that all materials in id_object_map_ have physically valid cross sections.
MaterialBank(const json &json_input)
Construct a new Material Bank object. Material structs are built using the json input.
void Build(const json &json_input)
Builds the material structs and assigns them to the id_material_map_ and name_id_map_ members.
void from_json(const json &j, Material &material)
Get the Material information from the json input.
Defines a monoenergetic, constant-properties material.
double scattering_xs
Isotropic scattering macroscopic cross section in 1/cm.
double nu
Average number of neutrons produced per fission event.
double total_xs
Total macroscopic cross section in 1/cm.
double fission_xs
Fission macroscopic cross section in 1/cm.