diff --git a/openmc/mgxs_library.py b/openmc/mgxs_library.py index a15aa51aec..a5968e299e 100644 --- a/openmc/mgxs_library.py +++ b/openmc/mgxs_library.py @@ -1263,6 +1263,10 @@ class XSdata(object): for g_out in range(g_out_bounds[p, a, g_in, 0], g_out_bounds[p, a, g_in, 1] + 1): flat_mult.append(matrix[g_in, g_out]) + # And write it. + scatt_grp.create_dataset("multiplicity matrix", + data=np.array(flat_mult), + compression=compression) # And finally, adjust g_out_bounds for 1-based group counting # and write it. g_out_bounds[:, :, :, :] += 1 diff --git a/src/mgxs_header.F90 b/src/mgxs_header.F90 index e3cc09bd7d..04fab444a7 100644 --- a/src/mgxs_header.F90 +++ b/src/mgxs_header.F90 @@ -726,7 +726,11 @@ module mgxs_header ! Get nu_fission (as a vector) if (check_dataset(xsdata_grp, "nu-fission")) then - call read_dataset(xs % nu_fission, xsdata_grp, "nu-fission") + allocate(temp_arr(groups * this % n_azi * this % n_pol)) + call read_dataset(temp_arr, xsdata_grp, "nu-fission") + xs % nu_fission = reshape(temp_arr, (/groups, this % n_azi, & + this % n_pol/)) + deallocate(temp_arr) else call fatal_error("If fissionable, must provide nu-fission!") end if @@ -774,8 +778,12 @@ module mgxs_header ! (*Need is defined as will be using it to tally) if (get_fiss) then if (check_dataset(xsdata_grp, "fission")) then + allocate(temp_arr(groups * this % n_azi * this % n_pol)) + call read_dataset(temp_arr, xsdata_grp, "fission") allocate(xs % fission(groups, this % n_azi, this % n_pol)) - call read_dataset(xs % fission, xsdata_grp, "fission") + xs % fission = reshape(temp_arr, (/groups, this % n_azi, & + this % n_pol/)) + deallocate(temp_arr) else call fatal_error("Fission data missing, required due to fission& & tallies in tallies.xml file!") @@ -783,8 +791,12 @@ module mgxs_header end if if (get_kfiss) then if (check_dataset(xsdata_grp, "kappa-fission")) then + allocate(temp_arr(groups * this % n_azi * this % n_pol)) + call read_dataset(temp_arr, xsdata_grp, "kappa-fission") allocate(xs % k_fission(groups, this % n_azi, this % n_pol)) - call read_dataset(xs % k_fission, xsdata_grp, "kappa-fission") + xs % k_fission = reshape(temp_arr, (/groups, this % n_azi, & + this % n_pol/)) + deallocate(temp_arr) else call fatal_error("kappa_fission data missing, required due to & &kappa-fission tallies in tallies.xml file!") @@ -793,8 +805,12 @@ module mgxs_header end if if (check_dataset(xsdata_grp, "absorption")) then + allocate(temp_arr(groups * this % n_azi * this % n_pol)) + call read_dataset(temp_arr, xsdata_grp, "absorption") allocate(xs % absorption(groups, this % n_azi, this % n_pol)) - call read_dataset(xs % absorption, xsdata_grp, "absorption") + xs % absorption = reshape(temp_arr, (/groups, this % n_azi, & + this % n_pol/)) + deallocate(temp_arr) else call fatal_error("Must provide absorption!") end if @@ -805,14 +821,20 @@ module mgxs_header scatt_grp = open_group(xsdata_grp, 'scatter data') ! First get the outgoing group boundary indices if (check_dataset(scatt_grp, "g_min")) then + allocate(temp_arr(groups * this % n_azi * this % n_pol)) + call read_dataset(temp_arr, scatt_grp, "g_min") allocate(gmin(groups, this % n_azi, this % n_pol)) - call read_dataset(gmin, scatt_grp, "g_min") + gmin = reshape(temp_arr, (/groups, this % n_azi, this % n_pol/)) + deallocate(temp_arr) else call fatal_error("'g_min' for the scatter matrix must be provided") end if if (check_dataset(scatt_grp, "g_max")) then + allocate(temp_arr(groups * this % n_azi * this % n_pol)) + call read_dataset(temp_arr, scatt_grp, "g_max") allocate(gmax(groups, this % n_azi, this % n_pol)) - call read_dataset(gmax, scatt_grp, "g_max") + gmax = reshape(temp_arr, (/groups, this % n_azi, this % n_pol/)) + deallocate(temp_arr) else call fatal_error("'g_max' for the scatter matrix must be provided") end if @@ -857,7 +879,7 @@ module mgxs_header ! Finally convert the legendre to tabular if needed ! Compare the number of orders given with the maximum order of the - ! problem. Strip off the supefluous orders if needed. + ! problem. Strip off the superfluous orders if needed. if (this % scatter_type == ANGLE_LEGENDRE) then order = min(order_dim - 1, max_order) order_dim = order + 1 @@ -904,7 +926,8 @@ module mgxs_header if (norm > ZERO) then scatt_coeffs(gin, iazi, ipol) % data(:, gout) = & scatt_coeffs(gin, iazi, ipol) % data(:, gout) * & - input_scatt(gin, iazi, ipol) % data(1, gout) + input_scatt(gin, iazi, ipol) % data(1, gout) / & + norm end if end do ! gout end do ! gin @@ -1006,7 +1029,11 @@ module mgxs_header allocate(xs % total(groups, this % n_azi, this % n_pol)) if (check_dataset(xsdata_grp, "total")) then - call read_dataset(xs % total, xsdata_grp, "total") + allocate(temp_arr(groups * this % n_azi * this % n_pol)) + call read_dataset(temp_arr, xsdata_grp, "total") + xs % total = reshape(temp_arr, (/groups, this % n_azi, & + this % n_pol/)) + deallocate(temp_arr) else do ipol = 1, this % n_pol do iazi = 1, this % n_azi diff --git a/tests/1d_mgxs.h5 b/tests/1d_mgxs.h5 index 38bb500677..d764cb69fb 100644 Binary files a/tests/1d_mgxs.h5 and b/tests/1d_mgxs.h5 differ diff --git a/tests/test_mg_basic/inputs_true.dat b/tests/test_mg_basic/inputs_true.dat index 916cd9205c..e44aa66a5b 100644 --- a/tests/test_mg_basic/inputs_true.dat +++ b/tests/test_mg_basic/inputs_true.dat @@ -1 +1 @@ -ed4d8a6c1a00d4dad10bc5522bf42d0c7a13ef5f86fc93a3f249e77681cda4424ce8879919015b05272c276ffea41e3aecef882592e8dbd97085273a356fb630 +002fff0d8ba33340c9039f7650ece41bd26324d2e5c2816acc232adb298ae9dbd0873c5e28520df33ebe5af4c58e2ad338547ca337b2b42f53d255bff1ae314b \ No newline at end of file diff --git a/tests/test_mg_tallies/inputs_true.dat b/tests/test_mg_tallies/inputs_true.dat index 59666aec61..ca92dcb099 100644 --- a/tests/test_mg_tallies/inputs_true.dat +++ b/tests/test_mg_tallies/inputs_true.dat @@ -1 +1 @@ -34af3b6ee8f65c6257d85a7c9594bc9bbabdabcb055e42bf6dd3ebfc0e41503367674223093363798950524e04f4377eae80f6d535301e55d268ff0c74e4261f +615fe0688980afc02bc11f41ac065b9479d2f6618acf6d20fcb91cd78209aed1d8fbaf73b06f153368a16aa90249d6d3ce06f840d9071a40b2118d36178fd84f \ No newline at end of file