Chi-Tech
lbts_compute_beta.cc
Go to the documentation of this file.
2
3/**Computes the delayed neutron factor.*/
5{
6 if (num_precursors_ == 0 or not options_.use_precursors)
7 return 0.0;
8
9 //compute total fission neutron production
10 const double FPR = ComputeFissionProduction(phi_new_local_);
11
12 //compute delayed fission neutron production
13 double localDNPR = 0.0;
14 for (const auto& cell : grid_ptr_->local_cells)
15 {
16 const auto& transport_view = cell_transport_views_[cell.local_id_];
17 const double cell_volume = transport_view.Volume();
18 const size_t dof_map = cell.local_id_ + max_precursors_per_material_;
19
20 const auto& xs = transport_view.XS();
21 const auto& num_precursors = xs.NumPrecursors();
22 const auto& precursors = xs.Precursors();
23
24 //skip cell if not fissionable
25 if (not xs.IsFissionable())
26 continue;
27
28 //============================= Loop over groupsets
29 for (const auto& groupset : groupsets_)
30 {
31 auto gs_i = static_cast<size_t>(groupset.groups_.front().id_);
32 auto gs_f = static_cast<size_t>(groupset.groups_.back().id_);
33
34 //============================= Loop over groupset groups
35 for (size_t g = gs_i; g <= gs_f; ++g)
36 for (unsigned int j = 0; j < num_precursors; ++j)
37 {
38 const auto& precursor = precursors[j];
39
40 //TODO: Verify that this is correct.
41 localDNPR += precursor.emission_spectrum[g] *
42 precursor.decay_constant *
43 precursor_new_local_[dof_map + j] *
44 cell_volume;
45 }
46 }
47 }
48
49 //============================================= Allreduce global DNPR
50 double DNPR = 0.0;
51 MPI_Allreduce(&localDNPR, &DNPR, 1,
52 MPI_DOUBLE, MPI_SUM, Chi::mpi.comm);
53
54 return DNPR / (DNPR + FPR);
55}
static chi::MPI_Info & mpi
Definition: chi_runtime.h:78