Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
ran git clang-format develop with llvm 15.0.0
  • Loading branch information
jtramm committed Jan 31, 2025
commit e9066cabfaec6f74e6d25cc7e5d30269f639dfd8
2 changes: 1 addition & 1 deletion src/random_ray/flat_source_domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ void FlatSourceDomain::convert_source_regions_to_tallies()

// Loop over scores
for (auto score_index = 0; score_index < tally.scores_.size();
score_index++) {
score_index++) {
auto score_bin = tally.scores_[score_index];
// If a valid tally, filter, and score combination has been found,
// then add it to the list of tally tasks for this source element.
Expand Down
8 changes: 4 additions & 4 deletions src/random_ray/linear_source_domain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ void LinearSourceDomain::set_flux_to_flux_plus_source(
int64_t sr, double volume, int g)
{
source_regions_.scalar_flux_new(sr, g) /= volume;
source_regions_.scalar_flux_new(sr,g) += source_regions_.source(sr,g);
source_regions_.flux_moments_new(sr,g) *= (1.0 / volume);
source_regions_.scalar_flux_new(sr, g) += source_regions_.source(sr, g);
source_regions_.flux_moments_new(sr, g) *= (1.0 / volume);
}

void LinearSourceDomain::set_flux_to_old_flux(int64_t sr, int g)
Expand All @@ -154,7 +154,7 @@ void LinearSourceDomain::accumulate_iteration_flux()
// Accumulate scalar flux moments
#pragma omp parallel for
for (int64_t se = 0; se < n_source_elements_; se++) {
source_regions_.flux_moments_t(se) += source_regions_.flux_moments_new(se);
source_regions_.flux_moments_t(se) += source_regions_.flux_moments_new(se);
}
}

Expand All @@ -164,7 +164,7 @@ double LinearSourceDomain::evaluate_flux_at_point(
double phi_flat = FlatSourceDomain::evaluate_flux_at_point(r, sr, g);

Position local_r = r - source_regions_.centroid(sr);
MomentArray phi_linear = source_regions_.flux_moments_t(sr,g);
MomentArray phi_linear = source_regions_.flux_moments_t(sr, g);
phi_linear *= 1.0 / (settings::n_batches - settings::n_inactive);

MomentMatrix invM = source_regions_.mom_matrix(sr).inverse();
Expand Down
17 changes: 10 additions & 7 deletions src/random_ray/random_ray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,8 @@ void RandomRay::attenuate_flux_flat_source(double distance, bool is_active)
float sigma_t = domain_->sigma_t_[material * negroups_ + g];
float tau = sigma_t * distance;
float exponential = cjosey_exponential(tau); // exponential = 1 - exp(-tau)
float new_delta_psi = (angular_flux_[g] - domain_->source_regions_.source(sr,g)) * exponential;
float new_delta_psi =
(angular_flux_[g] - domain_->source_regions_.source(sr, g)) * exponential;
delta_psi_[g] = new_delta_psi;
angular_flux_[g] -= new_delta_psi;
}
Expand All @@ -334,7 +335,7 @@ void RandomRay::attenuate_flux_flat_source(double distance, bool is_active)
// Accumulate delta psi into new estimate of source region flux for
// this iteration
for (int g = 0; g < negroups_; g++) {
domain_->source_regions_.scalar_flux_new(sr,g) += delta_psi_[g];
domain_->source_regions_.scalar_flux_new(sr, g) += delta_psi_[g];
}

// Accomulate volume (ray distance) into this iteration's estimate
Expand Down Expand Up @@ -415,8 +416,10 @@ void RandomRay::attenuate_flux_linear_source(double distance, bool is_active)
// calculated from the source gradients dot product with local centroid
// and direction, respectively.
float spatial_source =
domain_->source_regions_.source(sr,g) + rm_local.dot(domain_->source_regions_.source_gradients(sr,g));
float dir_source = u().dot(domain_->source_regions_.source_gradients(sr,g));
domain_->source_regions_.source(sr, g) +
rm_local.dot(domain_->source_regions_.source_gradients(sr, g));
float dir_source =
u().dot(domain_->source_regions_.source_gradients(sr, g));

float gn = exponentialG(tau);
float f1 = 1.0f - tau * gn;
Expand Down Expand Up @@ -464,8 +467,8 @@ void RandomRay::attenuate_flux_linear_source(double distance, bool is_active)
// Accumulate deltas into the new estimate of source region flux for this
// iteration
for (int g = 0; g < negroups_; g++) {
domain_->source_regions_.scalar_flux_new(sr,g) += delta_psi_[g];
domain_->source_regions_.flux_moments_new(sr,g) += delta_moments_[g];
domain_->source_regions_.scalar_flux_new(sr, g) += delta_psi_[g];
domain_->source_regions_.flux_moments_new(sr, g) += delta_moments_[g];
}

// Accumulate the volume (ray segment distance), centroid, and spatial
Expand Down Expand Up @@ -534,7 +537,7 @@ void RandomRay::initialize_ray(uint64_t ray_id, FlatSourceDomain* domain)
int64_t sr = domain_->source_region_offsets_[i_cell] + cell_instance();

for (int g = 0; g < negroups_; g++) {
angular_flux_[g] = domain_->source_regions_.source(sr,g);
angular_flux_[g] = domain_->source_regions_.source(sr, g);
}
}

Expand Down
16 changes: 8 additions & 8 deletions src/random_ray/source_region.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ void SourceRegionContainer::mpi_sync_ranks(bool reduce_position)

// Receive all data into gather vector
for (int i = 1; i < mpi::n_procs; i++) {
MPI_Recv(all_position[i].data(), n_source_regions_ * 3, MPI_DOUBLE, i, 0,
mpi::intracomm, MPI_STATUS_IGNORE);
MPI_Recv(all_position[i].data(), n_source_regions_ * 3, MPI_DOUBLE, i,
0, mpi::intracomm, MPI_STATUS_IGNORE);
}

// Scan through gathered data and pick first valid cell posiiton
Expand All @@ -195,19 +195,19 @@ void SourceRegionContainer::mpi_sync_ranks(bool reduce_position)
}
} else {
// Other ranks just send in their data
MPI_Send(
position_.data(), n_source_regions_ * 3, MPI_DOUBLE, 0, 0, mpi::intracomm);
MPI_Send(position_.data(), n_source_regions_ * 3, MPI_DOUBLE, 0, 0,
mpi::intracomm);
}
}

// For the rest of the source region data, we simply perform an all reduce,
// as these values will be needed on all ranks for transport during the
// next iteration.
MPI_Allreduce(MPI_IN_PLACE, volume_.data(), n_source_regions_, MPI_DOUBLE, MPI_SUM,
mpi::intracomm);
MPI_Allreduce(MPI_IN_PLACE, volume_.data(), n_source_regions_, MPI_DOUBLE,
MPI_SUM, mpi::intracomm);

MPI_Allreduce(MPI_IN_PLACE, scalar_flux_new_.data(), n_source_regions_ * negroups_,
MPI_DOUBLE, MPI_SUM, mpi::intracomm);
MPI_Allreduce(MPI_IN_PLACE, scalar_flux_new_.data(),
n_source_regions_ * negroups_, MPI_DOUBLE, MPI_SUM, mpi::intracomm);

if (is_linear_) {
// We are going to assume we can safely cast Position, MomentArray,
Expand Down