• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openmc-dev / openmc / 26248631044

21 May 2026 07:35PM UTC coverage: 81.174% (-0.2%) from 81.374%
26248631044

Pull #3653

github

web-flow
Merge 5828c2742 into 7d09a1260
Pull Request #3653: Modernize CMake packaging

17987 of 26078 branches covered (68.97%)

Branch coverage included in aggregate %.

59151 of 68950 relevant lines covered (85.79%)

48415572.71 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.75
/src/simulation.cpp
1
#include "openmc/simulation.h"
2

3
#include "openmc/bank.h"
4
#include "openmc/capi.h"
5
#include "openmc/collision_track.h"
6
#include "openmc/container_util.h"
7
#include "openmc/eigenvalue.h"
8
#include "openmc/error.h"
9
#include "openmc/event.h"
10
#include "openmc/geometry_aux.h"
11
#include "openmc/ifp.h"
12
#include "openmc/material.h"
13
#include "openmc/message_passing.h"
14
#include "openmc/nuclide.h"
15
#include "openmc/output.h"
16
#include "openmc/particle.h"
17
#include "openmc/photon.h"
18
#include "openmc/random_lcg.h"
19
#include "openmc/settings.h"
20
#include "openmc/source.h"
21
#include "openmc/state_point.h"
22
#include "openmc/tallies/derivative.h"
23
#include "openmc/tallies/filter.h"
24
#include "openmc/tallies/tally.h"
25
#include "openmc/tallies/trigger.h"
26
#include "openmc/timer.h"
27
#include "openmc/track_output.h"
28
#include "openmc/weight_windows.h"
29

30
#ifdef _OPENMP
31
#include <omp.h>
32
#endif
33
#include "openmc/tensor.h"
34

35
#ifdef OPENMC_MPI
36
#include <mpi.h>
37
#endif
38

39
#include <fmt/format.h>
40

41
#include <algorithm>
42
#include <cmath>
43
#include <string>
44

45
//==============================================================================
46
// C API functions
47
//==============================================================================
48

49
// OPENMC_RUN encompasses all the main logic where iterations are performed
50
// over the batches, generations, and histories in a fixed source or
51
// k-eigenvalue calculation.
52

53
int openmc_run()
6,493✔
54
{
55
  openmc::simulation::time_total.start();
6,493✔
56
  openmc_simulation_init();
6,493✔
57

58
  // Ensure that a batch isn't executed in the case that the maximum number of
59
  // batches has already been run in a restart statepoint file
60
  int status = 0;
6,493✔
61
  if (openmc::simulation::current_batch >= openmc::settings::n_max_batches) {
6,493✔
62
    status = openmc::STATUS_EXIT_MAX_BATCH;
11✔
63
  }
64

65
  int err = 0;
66
  while (status == 0 && err == 0) {
146,853✔
67
    err = openmc_next_batch(&status);
140,373✔
68
  }
69

70
  openmc_simulation_finalize();
6,480✔
71
  openmc::simulation::time_total.stop();
6,480✔
72
  return err;
6,480✔
73
}
74

75
int openmc_simulation_init()
7,665✔
76
{
77
  using namespace openmc;
7,665✔
78

79
  // Skip if simulation has already been initialized
80
  if (simulation::initialized)
7,665✔
81
    return 0;
82

83
  // Initialize nuclear data (energy limits, log grid)
84
  if (settings::run_CE) {
7,643✔
85
    initialize_data();
6,247✔
86
  }
87

88
  // Determine how much work each process should do
89
  calculate_work(settings::n_particles);
7,643✔
90

91
  // Allocate source, fission and surface source banks.
92
  allocate_banks();
7,643✔
93

94
  // Create track file if needed
95
  if (!settings::track_identifiers.empty() || settings::write_all_tracks) {
7,643✔
96
    open_track_file();
90✔
97
  }
98

99
  // If doing an event-based simulation, intialize the particle buffer
100
  // and event queues
101
  if (settings::event_based) {
7,643✔
102
    int64_t event_buffer_length =
219!
103
      std::min(simulation::work_per_rank, settings::max_particles_in_flight);
219✔
104
    init_event_queues(event_buffer_length);
219✔
105
  }
106

107
  // Allocate tally results arrays if they're not allocated yet
108
  for (auto& t : model::tallies) {
34,687✔
109
    t->set_strides();
27,044✔
110
    t->init_results();
27,044✔
111
  }
112

113
  // Set up material nuclide index mapping
114
  for (auto& mat : model::materials) {
27,157✔
115
    mat->init_nuclide_index();
19,514✔
116
  }
117

118
  // Reset global variables -- this is done before loading state point (as that
119
  // will potentially populate k_generation and entropy)
120
  simulation::current_batch = 0;
7,643✔
121
  simulation::ct_current_file = 1;
7,643✔
122
  simulation::ssw_current_file = 1;
7,643✔
123
  simulation::k_generation.clear();
7,643✔
124
  simulation::entropy.clear();
7,643✔
125
  reset_source_rejection_counters();
7,643✔
126
  openmc_reset();
7,643✔
127

128
  // If this is a restart run, load the state point data and binary source
129
  // file
130
  if (settings::restart_run) {
7,643✔
131
    load_state_point();
63✔
132
    write_message("Resuming simulation...", 6);
126✔
133
  } else {
134
    // Only initialize primary source bank for eigenvalue simulations
135
    if (settings::run_mode == RunMode::EIGENVALUE &&
7,580✔
136
        settings::solver_type == SolverType::MONTE_CARLO) {
4,398✔
137
      initialize_source();
4,027✔
138
    }
139
  }
140

141
  // Display header
142
  if (mpi::master) {
7,643✔
143
    if (settings::run_mode == RunMode::FIXED_SOURCE) {
6,651✔
144
      if (settings::solver_type == SolverType::MONTE_CARLO) {
2,876✔
145
        header("FIXED SOURCE TRANSPORT SIMULATION", 3);
2,500✔
146
      } else if (settings::solver_type == SolverType::RANDOM_RAY) {
376!
147
        header("FIXED SOURCE TRANSPORT SIMULATION (RANDOM RAY SOLVER)", 3);
376✔
148
      }
149
    } else if (settings::run_mode == RunMode::EIGENVALUE) {
3,775!
150
      if (settings::solver_type == SolverType::MONTE_CARLO) {
3,775✔
151
        header("K EIGENVALUE SIMULATION", 3);
3,500✔
152
      } else if (settings::solver_type == SolverType::RANDOM_RAY) {
275!
153
        header("K EIGENVALUE SIMULATION (RANDOM RAY SOLVER)", 3);
275✔
154
      }
155
      if (settings::verbosity >= 7)
3,775✔
156
        print_columns();
3,395✔
157
    }
158
  }
159

160
  // load weight windows from file
161
  if (!settings::weight_windows_file.empty()) {
7,643!
162
    openmc_weight_windows_import(settings::weight_windows_file.c_str());
×
163
  }
164

165
  // Set flag indicating initialization is done
166
  simulation::initialized = true;
7,643✔
167
  return 0;
7,643✔
168
}
169

170
int openmc_simulation_finalize()
7,630✔
171
{
172
  using namespace openmc;
7,630✔
173

174
  // Skip if simulation was never run
175
  if (!simulation::initialized)
7,630!
176
    return 0;
177

178
  // Stop active batch timer and start finalization timer
179
  simulation::time_active.stop();
7,630✔
180
  simulation::time_finalize.start();
7,630✔
181

182
  // Clear material nuclide mapping
183
  for (auto& mat : model::materials) {
27,131✔
184
    mat->mat_nuclide_index_.clear();
39,002!
185
  }
186

187
  // Close track file if open
188
  if (!settings::track_identifiers.empty() || settings::write_all_tracks) {
7,630✔
189
    close_track_file();
90✔
190
  }
191

192
  // Increment total number of generations
193
  simulation::total_gen += simulation::current_batch * settings::gen_per_batch;
7,630✔
194

195
#ifdef OPENMC_MPI
196
  broadcast_results();
3,426✔
197
#endif
198

199
  // Write tally results to tallies.out
200
  if (settings::output_tallies && mpi::master)
7,630!
201
    write_tallies();
6,292✔
202

203
  // If weight window generators are present in this simulation,
204
  // write a weight windows file
205
  if (variance_reduction::weight_windows_generators.size() > 0) {
7,630✔
206
    openmc_weight_windows_export();
166✔
207
  }
208

209
  // Deactivate all tallies
210
  for (auto& t : model::tallies) {
34,674✔
211
    t->active_ = false;
27,044✔
212
  }
213

214
  // Stop timers and show timing statistics
215
  simulation::time_finalize.stop();
7,630✔
216
  simulation::time_total.stop();
7,630✔
217

218
#ifdef OPENMC_MPI
219
  // Reduce track count across ranks for correct reporting. In shared secondary
220
  // bank mode, all ranks already have the global count; in non-shared mode,
221
  // each rank only has its own count.
222
  if (settings::weight_windows_on && !settings::use_shared_secondary_bank) {
3,426✔
223
    int64_t total_tracks;
80✔
224
    MPI_Reduce(&simulation::simulation_tracks_completed, &total_tracks, 1,
80✔
225
      MPI_INT64_T, MPI_SUM, 0, mpi::intracomm);
226
    if (mpi::master)
80✔
227
      simulation::simulation_tracks_completed = total_tracks;
64✔
228
  }
229
#endif
230

231
  if (mpi::master) {
7,630✔
232
    if (settings::solver_type != SolverType::RANDOM_RAY) {
6,638✔
233
      if (settings::verbosity >= 6)
5,987✔
234
        print_runtime();
5,607✔
235
      if (settings::verbosity >= 4)
5,987✔
236
        print_results();
5,607✔
237
    }
238
  }
239
  if (settings::check_overlaps)
7,630!
240
    print_overlap_check();
×
241

242
  // Reset flags
243
  simulation::initialized = false;
7,630✔
244
  return 0;
7,630✔
245
}
246

247
int openmc_next_batch(int* status)
144,498✔
248
{
249
  using namespace openmc;
144,498✔
250
  using openmc::simulation::current_gen;
144,498✔
251

252
  // Make sure simulation has been initialized
253
  if (!simulation::initialized) {
144,498✔
254
    set_errmsg("Simulation has not been initialized yet.");
11✔
255
    return OPENMC_E_ALLOCATE;
11✔
256
  }
257

258
  initialize_batch();
144,487✔
259

260
  // =======================================================================
261
  // LOOP OVER GENERATIONS
262
  for (current_gen = 1; current_gen <= settings::gen_per_batch; ++current_gen) {
289,171✔
263

264
    initialize_generation();
144,697✔
265

266
    // Start timer for transport
267
    simulation::time_transport.start();
144,697✔
268

269
    // Transport loop
270
    if (settings::event_based) {
144,697✔
271
      if (settings::use_shared_secondary_bank) {
3,211✔
272
        transport_event_based_shared_secondary();
11✔
273
      } else {
274
        transport_event_based();
3,200✔
275
      }
276
    } else {
277
      if (settings::use_shared_secondary_bank) {
141,486✔
278
        transport_history_based_shared_secondary();
667✔
279
      } else {
280
        transport_history_based();
140,819✔
281
      }
282
    }
283

284
    // Accumulate time for transport
285
    simulation::time_transport.stop();
144,684✔
286

287
    finalize_generation();
144,684✔
288
  }
289

290
  finalize_batch();
144,474✔
291

292
  // Check simulation ending criteria
293
  if (status) {
144,474!
294
    if (simulation::current_batch >= settings::n_max_batches) {
144,474✔
295
      *status = STATUS_EXIT_MAX_BATCH;
6,673✔
296
    } else if (simulation::satisfy_triggers) {
137,801✔
297
      *status = STATUS_EXIT_ON_TRIGGER;
93✔
298
    } else {
299
      *status = STATUS_EXIT_NORMAL;
137,708✔
300
    }
301
  }
302
  return 0;
303
}
304

305
bool openmc_is_statepoint_batch()
3,135✔
306
{
307
  using namespace openmc;
3,135✔
308
  using openmc::simulation::current_gen;
3,135✔
309

310
  if (!simulation::initialized)
3,135!
311
    return false;
312
  else
313
    return contains(settings::statepoint_batch, simulation::current_batch);
6,270✔
314
}
315

316
namespace openmc {
317

318
//==============================================================================
319
// Global variables
320
//==============================================================================
321

322
namespace simulation {
323

324
int ct_current_file;
325
int current_batch;
326
int current_gen;
327
bool initialized {false};
328
double keff {1.0};
329
double keff_std;
330
double k_col_abs {0.0};
331
double k_col_tra {0.0};
332
double k_abs_tra {0.0};
333
double log_spacing;
334
int n_lost_particles {0};
335
bool need_depletion_rx {false};
336
int restart_batch;
337
bool satisfy_triggers {false};
338
int ssw_current_file;
339
int total_gen {0};
340
double total_weight;
341
int64_t work_per_rank;
342

343
const RegularMesh* entropy_mesh {nullptr};
344
const RegularMesh* ufs_mesh {nullptr};
345

346
vector<double> k_generation;
347
vector<int64_t> work_index;
348

349
int64_t simulation_tracks_completed {0};
350

351
} // namespace simulation
352

353
//==============================================================================
354
// Non-member functions
355
//==============================================================================
356

357
void allocate_banks()
7,643✔
358
{
359
  if (settings::run_mode == RunMode::EIGENVALUE &&
7,643✔
360
      settings::solver_type == SolverType::MONTE_CARLO) {
4,461✔
361
    // Allocate source bank
362
    simulation::source_bank.resize(simulation::work_per_rank);
4,090✔
363

364
    // Allocate fission bank
365
    init_fission_bank(3 * simulation::work_per_rank);
4,090✔
366

367
    // Allocate IFP bank
368
    if (settings::ifp_on) {
4,090✔
369
      resize_simulation_ifp_banks();
74✔
370
    }
371
  }
372

373
  if (settings::surf_source_write) {
7,643✔
374
    // Allocate surface source bank
375
    simulation::surf_source_bank.reserve(settings::ssw_max_particles);
1,154✔
376
  }
377

378
  if (settings::collision_track) {
7,643✔
379
    // Allocate collision track bank
380
    collision_track_reserve_bank();
148✔
381
  }
382
}
7,643✔
383

384
void initialize_batch()
165,449✔
385
{
386
  // Increment current batch
387
  ++simulation::current_batch;
165,449✔
388
  if (settings::run_mode == RunMode::FIXED_SOURCE) {
165,449✔
389
    if (settings::solver_type == SolverType::RANDOM_RAY &&
64,756✔
390
        simulation::current_batch < settings::n_inactive + 1) {
14,112✔
391
      write_message(
16,812✔
392
        6, "Simulating batch {:<4} (inactive)", simulation::current_batch);
393
    } else {
394
      write_message(6, "Simulating batch {}", simulation::current_batch);
112,700✔
395
    }
396
  }
397

398
  // Reset total starting particle weight used for normalizing tallies
399
  simulation::total_weight = 0.0;
165,449✔
400

401
  // Determine if this batch is the first inactive or active batch.
402
  bool first_inactive = false;
165,449✔
403
  bool first_active = false;
165,449✔
404
  if (!settings::restart_run) {
165,449✔
405
    first_inactive = settings::n_inactive > 0 && simulation::current_batch == 1;
165,286✔
406
    first_active = simulation::current_batch == settings::n_inactive + 1;
165,286✔
407
  } else if (simulation::current_batch == simulation::restart_batch + 1) {
163✔
408
    first_inactive = simulation::restart_batch < settings::n_inactive;
52✔
409
    first_active = !first_inactive;
52✔
410
  }
411

412
  // Manage active/inactive timers and activate tallies if necessary.
413
  if (first_inactive) {
165,338✔
414
    simulation::time_inactive.start();
3,845✔
415
  } else if (first_active) {
161,604✔
416
    simulation::time_inactive.stop();
7,596✔
417
    simulation::time_active.start();
7,596✔
418
    for (auto& t : model::tallies) {
34,618✔
419
      t->active_ = true;
27,022✔
420
    }
421
  }
422

423
  // Add user tallies to active tallies list
424
  setup_active_tallies();
165,449✔
425
}
165,449✔
426

427
void finalize_batch()
165,436✔
428
{
429
  // Reduce tallies onto master process and accumulate
430
  simulation::time_tallies.start();
165,436✔
431
  accumulate_tallies();
165,436✔
432
  simulation::time_tallies.stop();
165,436✔
433

434
  // update weight windows if needed
435
  for (const auto& wwg : variance_reduction::weight_windows_generators) {
168,068✔
436
    wwg->update();
2,632✔
437
  }
438

439
  // Reset global tally results
440
  if (simulation::current_batch <= settings::n_inactive) {
165,436✔
441
    simulation::global_tallies.fill(0.0);
32,148✔
442
    simulation::n_realizations = 0;
32,148✔
443
  }
444

445
  // Check_triggers
446
  if (mpi::master)
165,436✔
447
    check_triggers();
146,637✔
448
#ifdef OPENMC_MPI
449
  MPI_Bcast(&simulation::satisfy_triggers, 1, MPI_C_BOOL, 0, mpi::intracomm);
72,448✔
450
#endif
451
  if (simulation::satisfy_triggers ||
165,436✔
452
      (settings::trigger_on &&
2,567✔
453
        simulation::current_batch == settings::n_max_batches)) {
2,567✔
454
    settings::statepoint_batch.insert(simulation::current_batch);
141✔
455
  }
456

457
  // Write out state point if it's been specified for this batch and is not
458
  // a CMFD run instance
459
  if (contains(settings::statepoint_batch, simulation::current_batch) &&
330,872✔
460
      !settings::cmfd_run) {
7,898✔
461
    if (contains(settings::sourcepoint_batch, simulation::current_batch) &&
15,166✔
462
        settings::source_write && !settings::source_separate) {
14,283✔
463
      bool b = (settings::run_mode == RunMode::EIGENVALUE);
6,490✔
464
      openmc_statepoint_write(nullptr, &b);
6,490✔
465
    } else {
466
      bool b = false;
1,232✔
467
      openmc_statepoint_write(nullptr, &b);
1,232✔
468
    }
469
  }
470

471
  if (settings::run_mode == RunMode::EIGENVALUE) {
165,436✔
472
    // Write out a separate source point if it's been specified for this batch
473
    if (contains(settings::sourcepoint_batch, simulation::current_batch) &&
105,180✔
474
        settings::source_write && settings::source_separate) {
104,809✔
475

476
      // Determine width for zero padding
477
      int w = std::to_string(settings::n_max_batches).size();
71✔
478
      std::string source_point_filename = fmt::format("{0}source.{1:0{2}}",
71✔
479
        settings::path_output, simulation::current_batch, w);
71✔
480
      span<SourceSite> bankspan(simulation::source_bank);
71✔
481
      write_source_point(source_point_filename, bankspan,
142✔
482
        simulation::work_index, settings::source_mcpl_write);
483
    }
71✔
484

485
    // Write a continously-overwritten source point if requested.
486
    if (settings::source_latest) {
100,693✔
487
      auto filename = settings::path_output + "source";
150✔
488
      span<SourceSite> bankspan(simulation::source_bank);
150✔
489
      write_source_point(filename, bankspan, simulation::work_index,
300✔
490
        settings::source_mcpl_write);
491
    }
150✔
492
  }
493

494
  // Write out surface source if requested.
495
  if (settings::surf_source_write &&
165,436✔
496
      simulation::ssw_current_file <= settings::ssw_max_files) {
17,669✔
497
    bool last_batch = (simulation::current_batch == settings::n_batches);
1,976✔
498
    if (simulation::surf_source_bank.full() || last_batch) {
1,976✔
499
      // Determine appropriate filename
500
      auto filename = fmt::format("{}surface_source.{}", settings::path_output,
1,187✔
501
        simulation::current_batch);
1,187✔
502
      if (settings::ssw_max_files == 1 ||
1,187✔
503
          (simulation::ssw_current_file == 1 && last_batch)) {
55!
504
        filename = settings::path_output + "surface_source";
1,132✔
505
      }
506

507
      // Get span of source bank and calculate parallel index vector
508
      auto surf_work_index = mpi::calculate_parallel_index_vector(
1,187✔
509
        simulation::surf_source_bank.size());
1,187✔
510
      span<SourceSite> surfbankspan(simulation::surf_source_bank.begin(),
1,187✔
511
        simulation::surf_source_bank.size());
1,187✔
512

513
      // Write surface source file
514
      write_source_point(
1,187✔
515
        filename, surfbankspan, surf_work_index, settings::surf_mcpl_write);
516

517
      // Reset surface source bank and increment counter
518
      simulation::surf_source_bank.clear();
1,187✔
519
      if (!last_batch && settings::ssw_max_files >= 1) {
1,187!
520
        simulation::surf_source_bank.reserve(settings::ssw_max_particles);
1,005✔
521
      }
522
      ++simulation::ssw_current_file;
1,187✔
523
    }
1,187✔
524
  }
525
  // Write collision track file if requested
526
  if (settings::collision_track) {
165,436✔
527
    collision_track_flush_bank();
608✔
528
  }
529
}
165,436✔
530

531
void initialize_generation()
165,659✔
532
{
533
  if (settings::run_mode == RunMode::EIGENVALUE) {
165,659✔
534
    // Clear out the fission bank
535
    simulation::fission_bank.resize(0);
100,903✔
536

537
    // Count source sites if using uniform fission source weighting
538
    if (settings::ufs_on)
100,903✔
539
      ufs_count_sites();
150✔
540

541
    // Store current value of tracklength k
542
    simulation::keff_generation = simulation::global_tallies(
100,903✔
543
      GlobalTally::K_TRACKLENGTH, TallyResult::VALUE);
544
  }
545
}
165,659✔
546

547
void finalize_generation()
165,646✔
548
{
549
  auto& gt = simulation::global_tallies;
165,646✔
550

551
  // Update global tallies with the accumulation variables
552
  if (settings::run_mode == RunMode::EIGENVALUE) {
165,646✔
553
    gt(GlobalTally::K_COLLISION, TallyResult::VALUE) += global_tally_collision;
100,903✔
554
    gt(GlobalTally::K_ABSORPTION, TallyResult::VALUE) +=
100,903✔
555
      global_tally_absorption;
556
    gt(GlobalTally::K_TRACKLENGTH, TallyResult::VALUE) +=
100,903✔
557
      global_tally_tracklength;
558
  }
559
  gt(GlobalTally::LEAKAGE, TallyResult::VALUE) += global_tally_leakage;
165,646✔
560

561
  // reset tallies
562
  if (settings::run_mode == RunMode::EIGENVALUE) {
165,646✔
563
    global_tally_collision = 0.0;
100,903✔
564
    global_tally_absorption = 0.0;
100,903✔
565
    global_tally_tracklength = 0.0;
100,903✔
566
  }
567
  global_tally_leakage = 0.0;
165,646✔
568

569
  if (settings::run_mode == RunMode::EIGENVALUE &&
165,646✔
570
      settings::solver_type == SolverType::MONTE_CARLO) {
100,903✔
571
    // If using shared memory, stable sort the fission bank (by parent IDs)
572
    // so as to allow for reproducibility regardless of which order particles
573
    // are run in.
574
    sort_bank(simulation::fission_bank, true);
94,053✔
575

576
    // Distribute fission bank across processors evenly
577
    synchronize_bank();
94,053✔
578
  }
579

580
  if (settings::run_mode == RunMode::EIGENVALUE) {
165,646✔
581

582
    // Calculate shannon entropy
583
    if (settings::entropy_on &&
100,903✔
584
        settings::solver_type == SolverType::MONTE_CARLO)
14,535✔
585
      shannon_entropy();
7,685✔
586

587
    // Collect results and statistics
588
    calculate_generation_keff();
100,903✔
589
    calculate_average_keff();
100,903✔
590

591
    // Write generation output
592
    if (mpi::master && settings::verbosity >= 7) {
100,903✔
593
      print_generation();
75,918✔
594
    }
595
  }
596
}
165,646✔
597

598
void sample_source_particle(Particle& p, int64_t index_source)
177,810,781✔
599
{
600
  // Sample a particle from the source bank
601
  if (settings::run_mode == RunMode::EIGENVALUE) {
177,810,781✔
602
    p.from_source(&simulation::source_bank[index_source - 1]);
149,894,700✔
603
  } else if (settings::run_mode == RunMode::FIXED_SOURCE) {
27,916,081!
604
    // initialize random number seed
605
    int64_t id = compute_transport_seed(compute_particle_id(index_source));
27,916,081✔
606
    uint64_t seed = init_seed(id, STREAM_SOURCE);
27,916,081✔
607
    // sample from external source distribution or custom library then set
608
    auto site = sample_external_source(&seed);
27,916,081✔
609
    p.from_source(&site);
27,916,077✔
610
  }
611
}
177,810,777✔
612

613
void initialize_particle_track(
199,099,472✔
614
  Particle& p, int64_t index_source, bool is_secondary)
615
{
616
  // Note: index_source is 1-based (first particle = 1), but current_work() is
617
  // stored as 0-based for direct use as an array index into
618
  // progeny_per_particle, source_bank, ifp banks, etc.
619
  if (!is_secondary) {
199,099,472✔
620
    sample_source_particle(p, index_source);
177,810,781✔
621
  }
622

623
  p.current_work() = index_source - 1;
199,099,468✔
624

625
  // set identifier for particle
626
  p.id() = compute_particle_id(index_source);
199,099,468✔
627

628
  // set progeny count to zero
629
  p.n_progeny() = 0;
199,099,468✔
630

631
  // Reset particle event counter
632
  p.n_event() = 0;
199,099,468✔
633

634
  // Initialize track counter (1 for this primary/secondary track)
635
  p.n_tracks() = 1;
199,099,468✔
636

637
  // Reset split counter
638
  p.n_split() = 0;
199,099,468✔
639

640
  // Reset weight window ratio
641
  p.ww_factor() = 0.0;
199,099,468✔
642

643
  // set particle history start weight
644
  p.wgt_born() = p.wgt();
199,099,468✔
645

646
  // Reset pulse_height_storage
647
  std::fill(p.pht_storage().begin(), p.pht_storage().end(), 0);
199,099,468✔
648

649
  // set random number seed
650
  int64_t particle_seed = compute_transport_seed(p.id());
199,099,468✔
651
  init_particle_seeds(particle_seed, p.seeds());
199,099,468✔
652

653
  // set particle trace
654
  p.trace() = false;
199,099,468✔
655
  if (simulation::current_batch == settings::trace_batch &&
199,110,468✔
656
      simulation::current_gen == settings::trace_gen &&
199,099,468!
657
      p.id() == settings::trace_particle)
11,000✔
658
    p.trace() = true;
11✔
659

660
  // Set particle track.
661
  p.write_track() = check_track_criteria(p);
199,099,468✔
662

663
  // Set the particle's initial weight window value.
664
  if (!is_secondary) {
199,099,468✔
665
    p.wgt_ww_born() = -1.0;
177,810,777✔
666
    apply_weight_windows(p);
177,810,777✔
667
  }
668

669
  // Display message if high verbosity or trace is on
670
  if (settings::verbosity >= 9 || p.trace()) {
199,099,468!
671
    write_message("Simulating Particle {}", p.id());
22✔
672
  }
673

674
  // Add particle's starting weight to count for normalizing tallies later
675
  if (!is_secondary) {
199,099,468✔
676
#pragma omp atomic
97,867,681✔
677
    simulation::total_weight += p.wgt();
177,810,777✔
678
  }
679

680
  // Force calculation of cross-sections by setting last energy to zero
681
  if (settings::run_CE) {
199,099,468✔
682
    p.invalidate_neutron_xs();
84,561,924✔
683
  }
684

685
  // Prepare to write out particle track.
686
  if (p.write_track())
199,099,468✔
687
    add_particle_track(p);
999✔
688
}
199,099,468✔
689

690
int overall_generation()
204,429,015✔
691
{
692
  using namespace simulation;
204,429,015✔
693
  return settings::gen_per_batch * (current_batch - 1) + current_gen;
204,429,015✔
694
}
695

696
int64_t compute_particle_id(int64_t index_source)
227,015,824✔
697
{
698
  if (settings::use_shared_secondary_bank) {
227,015,824✔
699
    return simulation::work_index[mpi::rank] + index_source +
22,857,716✔
700
           simulation::simulation_tracks_completed;
22,857,716✔
701
  } else {
702
    return simulation::work_index[mpi::rank] + index_source;
204,158,108✔
703
  }
704
}
705

706
int64_t compute_transport_seed(int64_t particle_id)
227,015,868✔
707
{
708
  if (settings::use_shared_secondary_bank) {
227,015,868✔
709
    return particle_id;
710
  } else {
711
    return (simulation::total_gen + overall_generation() - 1) *
204,158,141✔
712
             settings::n_particles +
713
           particle_id;
204,158,141✔
714
  }
715
}
716

717
void calculate_work(int64_t n_particles)
16,976✔
718
{
719
  // Determine minimum amount of particles to simulate on each processor
720
  int64_t min_work = n_particles / mpi::n_procs;
16,976✔
721

722
  // Determine number of processors that have one extra particle
723
  int64_t remainder = n_particles % mpi::n_procs;
16,976✔
724

725
  int64_t i_bank = 0;
16,976✔
726
  simulation::work_index.resize(mpi::n_procs + 1);
16,976✔
727
  simulation::work_index[0] = 0;
16,976✔
728
  for (int i = 0; i < mpi::n_procs; ++i) {
39,463✔
729
    // Number of particles for rank i
730
    int64_t work_i = i < remainder ? min_work + 1 : min_work;
22,487✔
731

732
    // Set number of particles
733
    if (mpi::rank == i)
22,487✔
734
      simulation::work_per_rank = work_i;
16,976✔
735

736
    // Set index into source bank for rank i
737
    i_bank += work_i;
22,487✔
738
    simulation::work_index[i + 1] = i_bank;
22,487✔
739
  }
740
}
16,976✔
741

742
void initialize_data()
6,291✔
743
{
744
  // Determine minimum/maximum energy for incident neutron/photon data
745
  data::energy_max = {INFTY, INFTY, INFTY, INFTY};
6,291✔
746
  data::energy_min = {0.0, 0.0, 0.0, 0.0};
6,291✔
747

748
  for (const auto& nuc : data::nuclides) {
38,848✔
749
    if (nuc->grid_.size() >= 1) {
32,557!
750
      int neutron = ParticleType::neutron().transport_index();
32,557✔
751
      data::energy_min[neutron] =
32,557✔
752
        std::max(data::energy_min[neutron], nuc->grid_[0].energy.front());
38,327✔
753
      data::energy_max[neutron] =
32,557✔
754
        std::min(data::energy_max[neutron], nuc->grid_[0].energy.back());
39,886✔
755
    }
756
  }
757

758
  if (settings::photon_transport) {
6,291✔
759
    for (const auto& elem : data::elements) {
1,491✔
760
      if (elem->energy_.size() >= 1) {
1,064!
761
        int photon = ParticleType::photon().transport_index();
1,064✔
762
        int n = elem->energy_.size();
1,064✔
763
        data::energy_min[photon] =
2,128✔
764
          std::max(data::energy_min[photon], std::exp(elem->energy_(1)));
1,761✔
765
        data::energy_max[photon] =
1,064✔
766
          std::min(data::energy_max[photon], std::exp(elem->energy_(n - 1)));
1,491✔
767
      }
768
    }
769

770
    if (settings::electron_treatment == ElectronTreatment::TTB) {
427✔
771
      // Determine if minimum/maximum energy for bremsstrahlung is greater/less
772
      // than the current minimum/maximum
773
      if (data::ttb_e_grid.size() >= 1) {
368!
774
        int photon = ParticleType::photon().transport_index();
368✔
775
        int electron = ParticleType::electron().transport_index();
368✔
776
        int positron = ParticleType::positron().transport_index();
368✔
777
        int n_e = data::ttb_e_grid.size();
368✔
778

779
        const std::vector<int> charged = {electron, positron};
368✔
780
        for (auto t : charged) {
1,104✔
781
          data::energy_min[t] = std::exp(data::ttb_e_grid(1));
736✔
782
          data::energy_max[t] = std::exp(data::ttb_e_grid(n_e - 1));
736✔
783
        }
784

785
        data::energy_min[photon] =
736✔
786
          std::max(data::energy_min[photon], data::energy_min[electron]);
736!
787

788
        data::energy_max[photon] =
736✔
789
          std::min(data::energy_max[photon], data::energy_max[electron]);
736!
790
      }
368✔
791
    }
792
  }
793

794
  // Show which nuclide results in lowest energy for neutron transport
795
  for (const auto& nuc : data::nuclides) {
7,910✔
796
    // If a nuclide is present in a material that's not used in the model, its
797
    // grid has not been allocated
798
    if (nuc->grid_.size() > 0) {
7,389!
799
      double max_E = nuc->grid_[0].energy.back();
7,389✔
800
      int neutron = ParticleType::neutron().transport_index();
7,389✔
801
      if (max_E == data::energy_max[neutron]) {
7,389✔
802
        write_message(7, "Maximum neutron transport energy: {} eV for {}",
5,770✔
803
          data::energy_max[neutron], nuc->name_);
5,770✔
804
        if (mpi::master && data::energy_max[neutron] < 20.0e6) {
5,770!
805
          warning("Maximum neutron energy is below 20 MeV. This may bias "
×
806
                  "the results.");
807
        }
808
        break;
809
      }
810
    }
811
  }
812

813
  // Set up logarithmic grid for nuclides
814
  for (auto& nuc : data::nuclides) {
38,848✔
815
    nuc->init_grid();
32,557✔
816
  }
817
  int neutron = ParticleType::neutron().transport_index();
6,291✔
818
  simulation::log_spacing =
12,582✔
819
    std::log(data::energy_max[neutron] / data::energy_min[neutron]) /
6,291✔
820
    settings::n_log_bins;
821
}
6,291✔
822

823
#ifdef OPENMC_MPI
824
void broadcast_results()
3,426✔
825
{
826
  // Broadcast tally results so that each process has access to results
827
  for (auto& t : model::tallies) {
16,851✔
828
    // Create a new datatype that consists of all values for a given filter
829
    // bin and then use that to broadcast. This is done to minimize the
830
    // chance of the 'count' argument of MPI_BCAST exceeding 2**31
831
    auto& results = t->results_;
13,425✔
832

833
    auto shape = results.shape();
13,425✔
834
    int count_per_filter = shape[1] * shape[2];
13,425✔
835
    MPI_Datatype result_block;
13,425✔
836
    MPI_Type_contiguous(count_per_filter, MPI_DOUBLE, &result_block);
13,425✔
837
    MPI_Type_commit(&result_block);
13,425✔
838
    MPI_Bcast(results.data(), shape[0], result_block, 0, mpi::intracomm);
13,425✔
839
    MPI_Type_free(&result_block);
13,425✔
840
  }
13,425✔
841

842
  // Also broadcast global tally results
843
  auto& gt = simulation::global_tallies;
3,426✔
844
  MPI_Bcast(gt.data(), gt.size(), MPI_DOUBLE, 0, mpi::intracomm);
3,426✔
845

846
  // These guys are needed so that non-master processes can calculate the
847
  // combined estimate of k-effective
848
  double temp[] {
3,426✔
849
    simulation::k_col_abs, simulation::k_col_tra, simulation::k_abs_tra};
3,426✔
850
  MPI_Bcast(temp, 3, MPI_DOUBLE, 0, mpi::intracomm);
3,426✔
851
  simulation::k_col_abs = temp[0];
3,426✔
852
  simulation::k_col_tra = temp[1];
3,426✔
853
  simulation::k_abs_tra = temp[2];
3,426✔
854
}
3,426✔
855

856
#endif
857

858
void free_memory_simulation()
8,650✔
859
{
860
  simulation::k_generation.clear();
8,650✔
861
  simulation::entropy.clear();
8,650✔
862
}
8,650✔
863

864
void transport_history_based_single_particle(Particle& p)
186,764,002✔
865
{
866
  while (p.alive()) {
2,147,483,647✔
867
    p.event_calculate_xs();
2,147,483,647✔
868
    if (p.alive()) {
2,147,483,647!
869
      p.event_advance();
2,147,483,647✔
870
    }
871
    if (p.alive()) {
2,147,483,647✔
872
      if (p.collision_distance() > p.boundary().distance()) {
2,147,483,647✔
873
        p.event_cross_surface();
2,147,483,647✔
874
      } else if (p.alive()) {
2,147,483,647✔
875
        p.event_collide();
2,147,483,647✔
876
      }
877
    }
878
    p.event_check_limit_and_revive();
2,147,483,647✔
879
  }
880
  p.event_death();
186,763,993✔
881
}
186,763,993✔
882

883
void transport_history_based()
140,819✔
884
{
885
#pragma omp parallel for schedule(runtime)
78,444✔
886
  for (int64_t i_work = 1; i_work <= simulation::work_per_rank; ++i_work) {
80,448,520✔
887
    Particle p;
80,386,154✔
888
    initialize_particle_track(p, i_work, false);
80,386,154✔
889
    transport_history_based_single_particle(p);
80,386,150✔
890
  }
80,386,145✔
891
}
140,810✔
892

893
// The shared secondary bank transport algorithm works in two phases. In the
894
// first phase, all primary particles are sampled then transported, and their
895
// secondary particles are deposited into a shared secondary bank. The second
896
// phase occurs in a loop, where all secondary tracks in the shared secondary
897
// bank are transported. Any secondary particles generated during this phase are
898
// deposited back into the shared secondary bank. The shared secondary bank is
899
// sorted for consistent ordering and load balanced across MPI ranks. This loop
900
// continues until there are no more secondary tracks left to transport.
901
void transport_history_based_shared_secondary()
667✔
902
{
903
  // Clear shared secondary banks from any prior use
904
  simulation::shared_secondary_bank_read.clear();
667✔
905
  simulation::shared_secondary_bank_write.clear();
667✔
906

907
  if (mpi::master) {
667✔
908
    write_message(fmt::format(" Primary source          particles: {}",
1,150✔
909
                    settings::n_particles),
910
      6);
911
  }
912

913
  simulation::progeny_per_particle.resize(simulation::work_per_rank);
667✔
914
  std::fill(simulation::progeny_per_particle.begin(),
1,334✔
915
    simulation::progeny_per_particle.end(), 0);
667✔
916

917
  // Phase 1: Transport primary particles and deposit first generation of
918
  // secondaries in the shared secondary bank
919
#pragma omp parallel
384✔
920
  {
283✔
921
    vector<SourceSite> thread_bank;
283✔
922

923
#pragma omp for schedule(runtime)
924
    for (int64_t i = 1; i <= simulation::work_per_rank; i++) {
356,058✔
925
      Particle p;
355,775✔
926
      initialize_particle_track(p, i, false);
355,775✔
927
      transport_history_based_single_particle(p);
355,775✔
928
      for (auto& site : p.local_secondary_bank()) {
1,087,225✔
929
        thread_bank.push_back(site);
731,450✔
930
      }
931
    }
355,775✔
932

933
    // Drain thread-local bank into the shared secondary bank (once per thread)
934
#pragma omp critical(SharedSecondaryBank)
935
    {
283✔
936
      for (auto& site : thread_bank) {
731,733✔
937
        simulation::shared_secondary_bank_write.thread_unsafe_append(site);
731,450✔
938
      }
939
    }
940
  }
941

942
  simulation::simulation_tracks_completed += settings::n_particles;
667✔
943

944
  // Phase 2: Now that the secondary bank has been populated, enter loop over
945
  // all secondary generations
946
  int n_generation_depth = 1;
667✔
947
  int64_t alive_secondary = 1;
667✔
948
  while (alive_secondary) {
8,916✔
949

950
    // Sort the shared secondary bank by parent ID then progeny ID to
951
    // ensure reproducibility.
952
    sort_bank(simulation::shared_secondary_bank_write, false);
8,249✔
953

954
    // Synchronize the shared secondary bank amongst all MPI ranks, such
955
    // that each MPI rank has an approximately equal number of secondary
956
    // tracks. Also reports the total number of secondaries alive across
957
    // all MPI ranks.
958
    alive_secondary = synchronize_global_secondary_bank(
8,249✔
959
      simulation::shared_secondary_bank_write);
960

961
    // Recalculate work for each MPI rank based on number of alive secondary
962
    // tracks
963
    calculate_work(alive_secondary);
8,249✔
964

965
    // Display the number of secondary tracks in this generation. This
966
    // is useful for user monitoring so as to see if the secondary population is
967
    // exploding and to determine how many generations of secondaries are being
968
    // transported.
969
    if (mpi::master) {
8,249✔
970
      write_message(fmt::format(" Secondary generation {:<2}    tracks: {}",
13,154✔
971
                      n_generation_depth, alive_secondary),
972
        6);
973
    }
974

975
    simulation::shared_secondary_bank_read =
8,249✔
976
      std::move(simulation::shared_secondary_bank_write);
8,249✔
977
    simulation::shared_secondary_bank_write = SharedArray<SourceSite>();
8,249!
978
    simulation::progeny_per_particle.resize(
8,249✔
979
      simulation::shared_secondary_bank_read.size());
8,249✔
980
    std::fill(simulation::progeny_per_particle.begin(),
16,498✔
981
      simulation::progeny_per_particle.end(), 0);
8,249✔
982

983
    // Transport all secondary tracks from the shared secondary bank
984
#pragma omp parallel
4,656✔
985
    {
3,593✔
986
      vector<SourceSite> thread_bank;
3,593✔
987

988
#pragma omp for schedule(runtime)
989
      for (int64_t i = 1; i <= simulation::shared_secondary_bank_read.size();
9,727,253✔
990
           i++) {
991
        Particle p;
9,723,660✔
992
        initialize_particle_track(p, i, true);
9,723,660✔
993
        SourceSite& site = simulation::shared_secondary_bank_read[i - 1];
9,723,660✔
994
        p.event_revive_from_secondary(site);
9,723,660✔
995
        transport_history_based_single_particle(p);
9,723,660✔
996
        for (auto& secondary_site : p.local_secondary_bank()) {
18,715,870✔
997
          thread_bank.push_back(secondary_site);
8,992,210✔
998
        }
999
      }
9,723,660✔
1000

1001
      // Drain thread-local bank into the shared secondary bank (once per
1002
      // thread)
1003
#pragma omp critical(SharedSecondaryBank)
1004
      {
3,593✔
1005
        for (auto& secondary_site : thread_bank) {
8,995,803✔
1006
          simulation::shared_secondary_bank_write.thread_unsafe_append(
8,992,210✔
1007
            secondary_site);
1008
        }
1009
      }
1010
    } // End of transport loop over tracks in shared secondary bank
3,593✔
1011
    n_generation_depth++;
8,249✔
1012
    simulation::simulation_tracks_completed += alive_secondary;
8,249✔
1013
  } // End of loop over secondary generations
1014

1015
  // Reset work so that fission bank etc works correctly
1016
  calculate_work(settings::n_particles);
667✔
1017
}
667✔
1018

1019
void transport_event_based()
3,200✔
1020
{
1021
  int64_t remaining_work = simulation::work_per_rank;
3,200✔
1022
  int64_t source_offset = 0;
3,200✔
1023

1024
  // To cap the total amount of memory used to store particle object data, the
1025
  // number of particles in flight at any point in time can bet set. In the case
1026
  // that the maximum in flight particle count is lower than the total number
1027
  // of particles that need to be run this iteration, the event-based transport
1028
  // loop is executed multiple times until all particles have been completed.
1029
  while (remaining_work > 0) {
6,400✔
1030
    // Figure out # of particles to run for this subiteration
1031
    int64_t n_particles =
3,200!
1032
      std::min(remaining_work, settings::max_particles_in_flight);
3,200✔
1033

1034
    // Initialize all particle histories for this subiteration
1035
    process_init_events(n_particles, source_offset);
3,200✔
1036
    process_transport_events();
3,200✔
1037
    process_death_events(n_particles);
3,200✔
1038

1039
    // Adjust remaining work and source offset variables
1040
    remaining_work -= n_particles;
3,200✔
1041
    source_offset += n_particles;
3,200✔
1042
  }
1043
}
3,200✔
1044

1045
void transport_event_based_shared_secondary()
11✔
1046
{
1047
  // Clear shared secondary banks from any prior use
1048
  simulation::shared_secondary_bank_read.clear();
11✔
1049
  simulation::shared_secondary_bank_write.clear();
11✔
1050

1051
  if (mpi::master) {
11!
1052
    write_message(fmt::format(" Primary source          particles: {}",
22!
1053
                    settings::n_particles),
1054
      6);
1055
  }
1056

1057
  simulation::progeny_per_particle.resize(simulation::work_per_rank);
11✔
1058
  std::fill(simulation::progeny_per_particle.begin(),
22✔
1059
    simulation::progeny_per_particle.end(), 0);
11✔
1060

1061
  // Phase 1: Transport primary particles using event-based processing and
1062
  // deposit first generation of secondaries in the shared secondary bank
1063
  int64_t remaining_work = simulation::work_per_rank;
11✔
1064
  int64_t source_offset = 0;
11✔
1065

1066
  while (remaining_work > 0) {
22✔
1067
    int64_t n_particles =
11!
1068
      std::min(remaining_work, settings::max_particles_in_flight);
11✔
1069

1070
    process_init_events(n_particles, source_offset);
11✔
1071
    process_transport_events();
11✔
1072
    process_death_events(n_particles);
11✔
1073

1074
    // Collect secondaries from all particle buffers into shared bank
1075
    for (int64_t i = 0; i < n_particles; i++) {
1,661✔
1076
      for (auto& site : simulation::particles[i].local_secondary_bank()) {
6,132✔
1077
        simulation::shared_secondary_bank_write.thread_unsafe_append(site);
4,482✔
1078
      }
1079
      simulation::particles[i].local_secondary_bank().clear();
3,017✔
1080
    }
1081

1082
    remaining_work -= n_particles;
11✔
1083
    source_offset += n_particles;
11✔
1084
  }
1085

1086
  simulation::simulation_tracks_completed += settings::n_particles;
11✔
1087

1088
  // Phase 2: Now that the secondary bank has been populated, enter loop over
1089
  // all secondary generations
1090
  int n_generation_depth = 1;
11✔
1091
  int64_t alive_secondary = 1;
11✔
1092
  while (alive_secondary) {
417✔
1093

1094
    // Sort the shared secondary bank by parent ID then progeny ID to
1095
    // ensure reproducibility.
1096
    sort_bank(simulation::shared_secondary_bank_write, false);
406✔
1097

1098
    // Synchronize the shared secondary bank amongst all MPI ranks, such
1099
    // that each MPI rank has an approximately equal number of secondary
1100
    // tracks.
1101
    alive_secondary = synchronize_global_secondary_bank(
406✔
1102
      simulation::shared_secondary_bank_write);
1103

1104
    // Recalculate work for each MPI rank based on number of alive secondary
1105
    // tracks
1106
    calculate_work(alive_secondary);
406✔
1107

1108
    if (mpi::master) {
406!
1109
      write_message(fmt::format(" Secondary generation {:<2}    tracks: {}",
812!
1110
                      n_generation_depth, alive_secondary),
1111
        6);
1112
    }
1113

1114
    simulation::shared_secondary_bank_read =
406✔
1115
      std::move(simulation::shared_secondary_bank_write);
406✔
1116
    simulation::shared_secondary_bank_write = SharedArray<SourceSite>();
406!
1117
    simulation::progeny_per_particle.resize(
406✔
1118
      simulation::shared_secondary_bank_read.size());
406✔
1119
    std::fill(simulation::progeny_per_particle.begin(),
812✔
1120
      simulation::progeny_per_particle.end(), 0);
406✔
1121

1122
    // Ensure particle buffer is large enough for this secondary generation
1123
    int64_t sec_buffer_length = std::min(
406!
1124
      static_cast<int64_t>(simulation::shared_secondary_bank_read.size()),
406!
1125
      settings::max_particles_in_flight);
406✔
1126
    if (sec_buffer_length >
406✔
1127
        static_cast<int64_t>(simulation::particles.size())) {
406✔
1128
      init_event_queues(sec_buffer_length);
34✔
1129
    }
1130

1131
    // Transport secondary tracks using event-based processing
1132
    int64_t sec_remaining = simulation::shared_secondary_bank_read.size();
406✔
1133
    int64_t sec_offset = 0;
406✔
1134

1135
    while (sec_remaining > 0) {
801✔
1136
      int64_t n_particles =
395!
1137
        std::min(sec_remaining, settings::max_particles_in_flight);
395✔
1138

1139
      process_init_secondary_events(
395✔
1140
        n_particles, sec_offset, simulation::shared_secondary_bank_read);
1141
      process_transport_events();
395✔
1142
      process_death_events(n_particles);
395✔
1143

1144
      // Collect secondaries from all particle buffers into shared bank
1145
      for (int64_t i = 0; i < n_particles; i++) {
180,005✔
1146
        for (auto& site : simulation::particles[i].local_secondary_bank()) {
354,738✔
1147
          simulation::shared_secondary_bank_write.thread_unsafe_append(site);
175,128✔
1148
        }
1149
        simulation::particles[i].local_secondary_bank().clear();
226,133✔
1150
      }
1151

1152
      sec_remaining -= n_particles;
395✔
1153
      sec_offset += n_particles;
395✔
1154
    } // End of subiteration loop over secondary tracks
1155
    n_generation_depth++;
406✔
1156
    simulation::simulation_tracks_completed += alive_secondary;
406✔
1157
  } // End of loop over secondary generations
1158

1159
  // Reset work so that fission bank etc works correctly
1160
  calculate_work(settings::n_particles);
11✔
1161
}
11✔
1162

1163
} // namespace openmc
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc