From 53066768deb4ca809be34c27f9cd9b7cf281a748 Mon Sep 17 00:00:00 2001 From: John Tramm Date: Mon, 24 Feb 2025 09:49:51 -0600 Subject: [PATCH] Random Ray Void Accuracy Fix (#3316) --- src/random_ray/flat_source_domain.cpp | 10 ++++------ src/random_ray/linear_source_domain.cpp | 3 +-- src/random_ray/random_ray.cpp | 1 + .../random_ray_void/flat/results_true.dat | 4 ++-- .../random_ray_void/linear/results_true.dat | 4 ++-- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/random_ray/flat_source_domain.cpp b/src/random_ray/flat_source_domain.cpp index cfe747eec5..cd4304b620 100644 --- a/src/random_ray/flat_source_domain.cpp +++ b/src/random_ray/flat_source_domain.cpp @@ -187,8 +187,7 @@ void FlatSourceDomain::normalize_scalar_flux_and_volumes( source_regions_.volume_naive(sr) = source_regions_.volume(sr) * normalization_factor; source_regions_.volume_sq(sr) = - (source_regions_.volume_sq_t(sr) / source_regions_.volume_t(sr)) * - volume_normalization_factor; + source_regions_.volume_sq_t(sr) / source_regions_.volume_t(sr); source_regions_.volume(sr) = source_regions_.volume_t(sr) * volume_normalization_factor; } @@ -463,12 +462,11 @@ void FlatSourceDomain::convert_source_regions_to_tallies() auto filter_weight = filter_iter.weight_; // Loop over scores - for (auto score_index = 0; score_index < tally.scores_.size(); - score_index++) { - auto score_bin = tally.scores_[score_index]; + for (int score = 0; score < tally.scores_.size(); score++) { + auto score_bin = tally.scores_[score]; // If a valid tally, filter, and score combination has been found, // then add it to the list of tally tasks for this source element. - TallyTask task(i_tally, filter_index, score_index, score_bin); + TallyTask task(i_tally, filter_index, score, score_bin); source_regions_.tally_task(sr, g).push_back(task); // Also add this task to the list of volume tasks for this source diff --git a/src/random_ray/linear_source_domain.cpp b/src/random_ray/linear_source_domain.cpp index 75d078d1b9..a8300ba3f8 100644 --- a/src/random_ray/linear_source_domain.cpp +++ b/src/random_ray/linear_source_domain.cpp @@ -127,8 +127,7 @@ void LinearSourceDomain::normalize_scalar_flux_and_volumes( source_regions_.volume(sr) = source_regions_.volume_t(sr) * volume_normalization_factor; source_regions_.volume_sq(sr) = - (source_regions_.volume_sq_t(sr) / source_regions_.volume_t(sr)) * - volume_normalization_factor; + source_regions_.volume_sq_t(sr) / source_regions_.volume_t(sr); if (source_regions_.volume_t(sr) > 0.0) { double inv_volume = 1.0 / source_regions_.volume_t(sr); source_regions_.centroid(sr) = source_regions_.centroid_t(sr); diff --git a/src/random_ray/random_ray.cpp b/src/random_ray/random_ray.cpp index 9917cf0c5b..f9ebb6f9d0 100644 --- a/src/random_ray/random_ray.cpp +++ b/src/random_ray/random_ray.cpp @@ -703,6 +703,7 @@ void RandomRay::attenuate_flux_linear_source_void( // source region. The centroid and spatial momements estimates are scaled by // the ray segment length as part of length averaging of the estimates. domain_->source_regions_.volume(sr) += distance; + domain_->source_regions_.volume_sq(sr) += distance_2; domain_->source_regions_.centroid_iteration(sr) += midpoint * distance; moment_matrix_estimate *= distance; domain_->source_regions_.mom_matrix(sr) += moment_matrix_estimate; diff --git a/tests/regression_tests/random_ray_void/flat/results_true.dat b/tests/regression_tests/random_ray_void/flat/results_true.dat index bf395f25f7..bd2f2d3b41 100644 --- a/tests/regression_tests/random_ray_void/flat/results_true.dat +++ b/tests/regression_tests/random_ray_void/flat/results_true.dat @@ -1,6 +1,6 @@ tally 1: -1.760401E+00 -1.554914E-01 +2.354630E+00 +2.777456E-01 tally 2: 1.056204E-01 5.741779E-04 diff --git a/tests/regression_tests/random_ray_void/linear/results_true.dat b/tests/regression_tests/random_ray_void/linear/results_true.dat index 77fade8295..e289b2f136 100644 --- a/tests/regression_tests/random_ray_void/linear/results_true.dat +++ b/tests/regression_tests/random_ray_void/linear/results_true.dat @@ -1,6 +1,6 @@ tally 1: -1.762592E+00 -1.558698E-01 +2.356821E+00 +2.782548E-01 tally 2: 1.082935E-01 6.029854E-04