Skip to content

Commit

Permalink
Update update_grid.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
jpollin98 committed May 4, 2024
1 parent ebbaaac commit 243965d
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions update_grid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,23 @@ void update_grid(FILE *estimators_file, const int nts, const int nts_prev, const
/// Do not use values which are saved in the cellcache within update_grid
use_cellcache = false;

if constexpr (DETAILED_BF_ESTIMATORS_ON) {
if (!(nts == globals::timestep_initial && titer == 0)) {
for (int mgi = 0; mgi < grid::get_npts_model(); mgi++) {
const auto nonemptymgi = grid::get_modelcell_nonemptymgi(mgi);
if (!(globals::lte_iteration || grid::modelgrid[mgi].thick == 1)) {
int assoc_cells = grid::get_numassociatedcells(mgi);
if (assoc_cells > 0) {
double deltaV =
grid::get_modelcell_assocvolume_tmin(mgi) * pow(globals::timesteps[nts_prev].mid / globals::tmin, 3);
double estimator_normfactor = 1 / deltaV / deltat / globals::nprocs;
radfield::normalise_bf_estimators(mgi, nonemptymgi, estimator_normfactor / H);
}
}
}
}
}

#ifdef _OPENMP
#pragma omp parallel
#endif
Expand All @@ -1147,23 +1164,6 @@ void update_grid(FILE *estimators_file, const int nts, const int nts_prev, const
#pragma omp for schedule(dynamic)
#endif

if (!(nts == globals::timestep_initial && titer == 0)) {
if constexpr (DETAILED_BF_ESTIMATORS_ON) {
for (int mgi = 0; mgi < grid::get_npts_model(); mgi++) {
const auto nonemptymgi = grid::get_modelcell_nonemptymgi(mgi);
if (!(globals::lte_iteration || grid::modelgrid[mgi].thick == 1)) {
int assoc_cells = grid::get_numassociatedcells(mgi);
if (assoc_cells > 0) {
double deltaV =
grid::get_modelcell_assocvolume_tmin(mgi) * pow(globals::timesteps[nts_prev].mid / globals::tmin, 3);
double estimator_normfactor = 1 / deltaV / deltat / globals::nprocs;
radfield::normalise_bf_estimators(mgi, nonemptymgi, estimator_normfactor / H);
}
}
}
}
}

for (int mgi = nstart; mgi < nstart + ndo; mgi++) {
/// Check if this task should work on the current model grid cell.
/// If yes, update the cell and write out the estimators
Expand Down

0 comments on commit 243965d

Please sign in to comment.