Skip to content

Commit 67aa0de

Browse files
authored
Random Ray External Source Plotting Fix (#3430)
1 parent 4943fa3 commit 67aa0de

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/random_ray/flat_source_domain.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -919,10 +919,17 @@ void FlatSourceDomain::output_to_vtk() const
919919
std::fprintf(plot, "LOOKUP_TABLE default\n");
920920
for (int i = 0; i < Nx * Ny * Nz; i++) {
921921
int64_t fsr = voxel_indices[i];
922+
int mat = source_regions_.material(fsr);
922923
float total_external = 0.0f;
923924
if (fsr >= 0) {
924925
for (int g = 0; g < negroups_; g++) {
925-
total_external += source_regions_.external_source(fsr, g);
926+
// External sources are already divided by sigma_t, so we need to
927+
// multiply it back to get the true external source.
928+
double sigma_t = 1.0;
929+
if (mat != MATERIAL_VOID) {
930+
sigma_t = sigma_t_[mat * negroups_ + g];
931+
}
932+
total_external += source_regions_.external_source(fsr, g) * sigma_t;
926933
}
927934
}
928935
total_external = convert_to_big_endian<float>(total_external);

0 commit comments

Comments
 (0)