mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
some small potential bug fixes and code cleanup
This commit is contained in:
parent
5566fc36b6
commit
3385c8b0a2
4 changed files with 9 additions and 24 deletions
|
|
@ -109,13 +109,7 @@ ScattData::base_combine(size_t max_order,
|
|||
|
||||
// Combine mult_numer and mult_denom into the combined multiplicity matrix
|
||||
xt::xtensor<double, 2> this_mult({groups, groups}, 1.);
|
||||
for (int gin = 0; gin < groups; gin++) {
|
||||
for (int gout = 0; gout < groups; gout++) {
|
||||
if (mult_denom(gin, gout) > 0.) {
|
||||
this_mult(gin, gout) = mult_numer(gin, gout) / mult_denom(gin, gout);
|
||||
}
|
||||
}
|
||||
}
|
||||
this_mult = xt::nan_to_num(mult_numer / mult_denom);
|
||||
|
||||
// We have the data, now we need to convert to a jagged array and then use
|
||||
// the initialize function to store it on the object.
|
||||
|
|
@ -531,7 +525,7 @@ ScattDataHistogram::calc_f(int gin, int gout, double mu)
|
|||
int imu;
|
||||
if (mu == 1.) {
|
||||
// use size -2 to have the index one before the end
|
||||
imu = this->mu.size() - 2;
|
||||
imu = this->mu.shape()[0] - 2;
|
||||
} else {
|
||||
imu = std::floor((mu + 1.) / dmu + 1.) - 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <iostream>
|
||||
|
||||
#include "xtensor/xview.hpp"
|
||||
#include "xtensor/xindex_view.hpp"
|
||||
|
|
@ -204,13 +205,7 @@ XsData::fission_vector_no_delayed_from_hdf5(hid_t xsdata_grp, size_t n_ang,
|
|||
temp_chi = temp_chi / xt::view(xt::sum(temp_chi, {1}), xt::all(), xt::newaxis());
|
||||
|
||||
// Now every incoming group in self.chi is the normalized chi we just made
|
||||
for (size_t a = 0; a < n_ang; a++) {
|
||||
for (size_t gin = 0; gin < energy_groups; gin++) {
|
||||
for (size_t gout = 0; gout < energy_groups; gout++) {
|
||||
chi_prompt(a, gin, gout) = temp_chi(a, gout);
|
||||
}
|
||||
}
|
||||
}
|
||||
chi_prompt = xt::view(temp_chi, xt::all(), xt::newaxis(), xt::all());
|
||||
|
||||
// Get nu-fission directly
|
||||
if (object_exists(xsdata_grp, "prompt-nu-fission")) {
|
||||
|
|
@ -317,7 +312,8 @@ XsData::fission_matrix_no_delayed_from_hdf5(hid_t xsdata_grp, size_t n_ang,
|
|||
|
||||
// chi_prompt is this matrix but normalized over outgoing groups, which we
|
||||
// have already stored in prompt_nu_fission
|
||||
chi_prompt = temp_matrix / prompt_nu_fission;
|
||||
chi_prompt = temp_matrix / xt::view(prompt_nu_fission, xt::all(), xt::all(),
|
||||
xt::newaxis());
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -391,12 +387,7 @@ XsData::scatter_from_hdf5(hid_t xsdata_grp, size_t n_ang, size_t energy_groups,
|
|||
|
||||
// Now use this info to find the length of a vector to hold the flattened
|
||||
// data.
|
||||
size_t length = 0;
|
||||
for (size_t a = 0; a < n_ang; a++) {
|
||||
for (size_t gin = 0; gin < energy_groups; gin++) {
|
||||
length += order_data * (gmax(a, gin) - gmin(a, gin) + 1);
|
||||
}
|
||||
}
|
||||
size_t length = order_data * xt::sum(gmax - gmin + 1)();
|
||||
|
||||
double_4dvec input_scatt(n_ang, double_3dvec(energy_groups));
|
||||
xt::xtensor<double, 1> temp_arr({length}, 0.);
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
os.remove(f)
|
||||
|
||||
|
||||
def test_mg_benchmark():
|
||||
def test_mg_basic():
|
||||
create_library()
|
||||
mat_names = ['base leg', 'base tab', 'base hist', 'base matrix',
|
||||
'base ang', 'micro']
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ class MGXSTestHarness(PyAPITestHarness):
|
|||
os.remove(f)
|
||||
|
||||
|
||||
def test_mg_benchmark():
|
||||
def test_mg_basic_delayed():
|
||||
create_library()
|
||||
model = slab_mg(num_regions=4, mat_names=['vec beta', 'vec no beta',
|
||||
'matrix beta', 'matrix no beta'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue