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

openmc-dev / openmc / 27444237628

12 Jun 2026 09:31PM UTC coverage: 81.304% (+0.02%) from 81.281%
27444237628

Pull #3971

github

web-flow
Merge 9487507b3 into 02eb999af
Pull Request #3971: Delta tracking

18480 of 26797 branches covered (68.96%)

Branch coverage included in aggregate %.

592 of 644 new or added lines in 20 files covered. (91.93%)

31 existing lines in 3 files now uncovered.

59819 of 69507 relevant lines covered (86.06%)

49514105.74 hits per line

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

86.4
/src/particle.cpp
1
#include "openmc/particle.h"
2

3
#include <algorithm> // copy, min
4
#include <cmath>     // log, abs
5

6
#include <fmt/core.h>
7

8
#include "openmc/bank.h"
9
#include "openmc/capi.h"
10
#include "openmc/cell.h"
11
#include "openmc/collision_track.h"
12
#include "openmc/constants.h"
13
#include "openmc/dagmc.h"
14
#include "openmc/error.h"
15
#include "openmc/geometry.h"
16
#include "openmc/hdf5_interface.h"
17
#include "openmc/lattice.h"
18
#include "openmc/majorant.h"
19
#include "openmc/material.h"
20
#include "openmc/message_passing.h"
21
#include "openmc/mgxs_interface.h"
22
#include "openmc/nuclide.h"
23
#include "openmc/particle_data.h"
24
#include "openmc/photon.h"
25
#include "openmc/physics.h"
26
#include "openmc/physics_mg.h"
27
#include "openmc/random_lcg.h"
28
#include "openmc/settings.h"
29
#include "openmc/simulation.h"
30
#include "openmc/source.h"
31
#include "openmc/surface.h"
32
#include "openmc/tallies/derivative.h"
33
#include "openmc/tallies/tally.h"
34
#include "openmc/tallies/tally_scoring.h"
35
#include "openmc/track_output.h"
36
#include "openmc/weight_windows.h"
37

38
#ifdef OPENMC_DAGMC_ENABLED
39
#include "DagMC.hpp"
40
#endif
41

42
namespace openmc {
43

44
//==============================================================================
45
// Particle implementation
46
//==============================================================================
47

48
double Particle::speed() const
2,147,483,647✔
49
{
50
  if (settings::run_CE) {
2,147,483,647✔
51
    // Determine mass in eV/c^2
52
    double mass = this->mass();
2,147,483,647✔
53

54
    // Equivalent to C * sqrt(1-(m/(m+E))^2) without problem at E<<m:
55
    return C_LIGHT * std::sqrt(this->E() * (this->E() + 2 * mass)) /
2,147,483,647✔
56
           (this->E() + mass);
2,147,483,647✔
57
  } else {
58
    auto mat = this->material();
2,082,832,565✔
59
    if (mat == MATERIAL_VOID)
2,082,832,565!
60
      return 1.0 / data::mg.default_inverse_velocity_[this->g()];
×
61
    auto& macro_xs = data::mg.macro_xs_[mat];
2,082,832,565✔
62
    int macro_t = this->mg_xs_cache().t;
2,082,832,565✔
63
    int macro_a = macro_xs.get_angle_index(this->u());
2,082,832,565✔
64
    return 1.0 / macro_xs.get_xs(
2,147,483,647✔
65
                   MgxsType::INVERSE_VELOCITY, this->g(), macro_t, macro_a);
2,082,832,565✔
66
  }
67
}
68

69
double Particle::mass() const
2,147,483,647✔
70
{
71
  switch (type().pdg_number()) {
2,147,483,647✔
72
  case PDG_NEUTRON:
73
    return MASS_NEUTRON_EV;
74
  case PDG_ELECTRON:
88,228,255✔
75
  case PDG_POSITRON:
88,228,255✔
76
    return MASS_ELECTRON_EV;
88,228,255✔
77
  default:
40,563,669✔
78
    return this->type().mass() * AMU_EV;
40,563,669✔
79
  }
80
}
81

82
bool Particle::create_secondary(
503,988,740✔
83
  double wgt, Direction u, double E, ParticleType type)
84
{
85
  // If energy is below cutoff for this particle, don't create secondary
86
  // particle
87
  int idx = type.transport_index();
503,988,740✔
88
  if (idx == C_NONE) {
503,988,740!
89
    return false;
90
  }
91
  if (E < settings::energy_cutoff[idx]) {
503,988,740✔
92
    return false;
93
  }
94

95
  // Increment number of secondaries created (for ParticleProductionFilter)
96
  n_secondaries()++;
263,642,959✔
97

98
  SourceSite bank;
263,642,959✔
99
  bank.particle = type;
263,642,959✔
100
  bank.wgt = wgt;
263,642,959✔
101
  bank.r = r();
263,642,959!
102
  bank.u = u;
263,642,959✔
103
  bank.E = settings::run_CE ? E : g();
263,642,959!
104
  bank.time = time();
263,642,959✔
105
  bank_second_E() += bank.E;
263,642,959✔
106
  bank.parent_id = current_work();
263,642,959✔
107
  if (settings::use_shared_secondary_bank) {
263,642,959✔
108
    bank.progeny_id = n_progeny()++;
15,366,794✔
109
  }
110
  bank.wgt_born = wgt_born();
263,642,959✔
111
  bank.wgt_ww_born = wgt_ww_born();
263,642,959✔
112
  bank.n_split = n_split();
263,642,959✔
113

114
  local_secondary_bank().emplace_back(bank);
263,642,959✔
115
  return true;
116
}
117

118
void Particle::split(double wgt)
10,328,543✔
119
{
120
  SourceSite bank;
10,328,543✔
121
  bank.particle = type();
10,328,543✔
122
  bank.wgt = wgt;
10,328,543✔
123
  bank.r = r();
10,328,543✔
124
  bank.u = u();
10,328,543✔
125
  bank.E = settings::run_CE ? E() : g();
10,328,543✔
126
  bank.time = time();
10,328,543✔
127

128
  // Convert signed index to a signed surface ID
129
  if (surface() == SURFACE_NONE) {
10,328,543✔
130
    bank.surf_id = SURFACE_NONE;
10,324,671✔
131
  } else {
132
    int surf_id = model::surfaces[surface_index()]->id_;
3,872✔
133
    bank.surf_id = (surface() > 0) ? surf_id : -surf_id;
3,872✔
134
  }
135

136
  bank.wgt_born = wgt_born();
10,328,543✔
137
  bank.wgt_ww_born = wgt_ww_born();
10,328,543✔
138
  bank.n_split = n_split();
10,328,543✔
139
  bank.parent_id = current_work();
10,328,543✔
140
  if (settings::use_shared_secondary_bank) {
10,328,543✔
141
    bank.progeny_id = n_progeny()++;
5,160,128✔
142
  }
143

144
  local_secondary_bank().emplace_back(bank);
10,328,543✔
145
}
10,328,543✔
146

147
void Particle::from_source(const SourceSite* src)
462,978,966✔
148
{
149
  // Reset some attributes
150
  clear();
462,978,966✔
151
  surface() = SURFACE_NONE;
462,978,966✔
152
  cell_born() = C_NONE;
462,978,966✔
153
  material() = C_NONE;
462,978,966✔
154
  n_collision() = 0;
462,978,966✔
155
  fission() = false;
462,978,966✔
156
  majorant() = 0.0;
462,978,966✔
157
  zero_flux_derivs();
462,978,966✔
158
  lifetime() = 0.0;
462,978,966✔
159
#ifdef OPENMC_DAGMC_ENABLED
160
  history().reset();
42,261,667✔
161
#endif
162

163
  // Copy attributes from source bank site
164
  type() = src->particle;
462,978,966✔
165
  wgt() = src->wgt;
462,978,966✔
166
  wgt_last() = src->wgt;
462,978,966✔
167
  r() = src->r;
462,978,966✔
168
  u() = src->u;
462,978,966✔
169
  r_born() = src->r;
462,978,966✔
170
  r_last_current() = src->r;
462,978,966✔
171
  r_last() = src->r;
462,978,966✔
172
  u_last() = src->u;
462,978,966✔
173
  if (settings::run_CE) {
462,978,966✔
174
    E() = src->E;
346,113,102✔
175
    g() = 0;
346,113,102✔
176
  } else {
177
    g() = static_cast<int>(src->E);
116,865,864✔
178
    g_last() = static_cast<int>(src->E);
116,865,864✔
179
    E() = data::mg.energy_bin_avg_[g()];
116,865,864✔
180
  }
181
  E_last() = E();
462,978,966✔
182
  time() = src->time;
462,978,966✔
183
  time_last() = src->time;
462,978,966✔
184
  parent_nuclide() = src->parent_nuclide;
462,978,966✔
185
  delayed_group() = src->delayed_group;
462,978,966✔
186

187
  // Convert signed surface ID to signed index
188
  if (src->surf_id != SURFACE_NONE) {
462,978,966✔
189
    int index_plus_one = model::surface_map[std::abs(src->surf_id)] + 1;
113,872✔
190
    surface() = (src->surf_id > 0) ? index_plus_one : -index_plus_one;
113,872✔
191
  }
192

193
  wgt_born() = src->wgt_born;
462,978,966✔
194
  wgt_ww_born() = src->wgt_ww_born;
462,978,966✔
195
  n_split() = src->n_split;
462,978,966✔
196

197
  if (delta_tracking()) {
462,978,966✔
198
    update_majorant();
168,458,969✔
199
  }
200
}
462,978,966✔
201

202
void Particle::event_calculate_xs()
2,147,483,647✔
203
{
204
  // Set the random number stream
205
  stream() = STREAM_TRACKING;
2,147,483,647✔
206

207
  // Store pre-collision particle properties
208
  wgt_last() = wgt();
2,147,483,647✔
209
  E_last() = E();
2,147,483,647✔
210
  u_last() = u();
2,147,483,647✔
211
  r_last() = r();
2,147,483,647✔
212
  time_last() = time();
2,147,483,647✔
213

214
  // Reset event variables
215
  event() = TallyEvent::KILL;
2,147,483,647✔
216
  event_nuclide() = NUCLIDE_NONE;
2,147,483,647✔
217
  event_mt() = REACTION_NONE;
2,147,483,647✔
218

219
  // If the cell hasn't been determined based on the particle's location,
220
  // initiate a search for the current cell. This generally happens at the
221
  // beginning of the history and again for any secondary particles
222
  if (lowest_coord().cell() == C_NONE) {
2,147,483,647✔
223
    if (!exhaustive_find_cell(*this)) {
284,661,294!
224
      mark_as_lost(
×
225
        "Could not find the cell containing particle " + std::to_string(id()));
×
226
      return;
×
227
    }
228

229
    // Set birth cell attribute
230
    if (cell_born() == C_NONE)
284,661,294!
231
      cell_born() = lowest_coord().cell();
284,661,294✔
232

233
    // Initialize last cells from current cell
234
    for (int j = 0; j < n_coord(); ++j) {
586,705,307✔
235
      cell_last(j) = coord(j).cell();
302,044,013✔
236
    }
237
    n_coord_last() = n_coord();
284,661,294✔
238
  }
239

240
  // Write particle track.
241
  if (write_track())
2,147,483,647✔
242
    write_particle_track(*this);
10,313✔
243

244
  if (settings::check_overlaps)
2,147,483,647!
245
    check_cell_overlap(*this);
×
246

247
  // Calculate microscopic and macroscopic cross sections
248
  if (material() != MATERIAL_VOID) {
2,147,483,647✔
249
    if (settings::run_CE) {
2,147,483,647✔
250
      if (material() != material_last() || sqrtkT() != sqrtkT_last() ||
2,147,483,647✔
251
          density_mult() != density_mult_last()) {
902,839,009✔
252
        // If the material is the same as the last material and the
253
        // temperature hasn't changed, we don't need to lookup cross
254
        // sections again.
255
        model::materials[material()]->calculate_xs(*this);
2,147,483,647✔
256
      }
257
    } else {
258
      // Get the MG data; unlike the CE case above, we have to re-calculate
259
      // cross sections for every collision since the cross sections may
260
      // be angle-dependent
261
      data::mg.macro_xs_[material()].calculate_xs(*this);
2,082,832,565✔
262

263
      // Update the particle's group while we know we are multi-group
264
      g_last() = g();
2,082,832,565✔
265
    }
266
  } else {
267
    macro_xs().total = 0.0;
111,961,442✔
268
    macro_xs().absorption = 0.0;
111,961,442✔
269
    macro_xs().fission = 0.0;
111,961,442✔
270
    macro_xs().nu_fission = 0.0;
111,961,442✔
271
  }
272
}
273

274
void Particle::event_advance()
2,147,483,647✔
275
{
276
  // Find the distance to the nearest boundary
277
  boundary() = distance_to_boundary(*this);
2,147,483,647✔
278

279
  // Sample a distance to collision
280
  if (type() == ParticleType::electron() ||
2,147,483,647✔
281
      type() == ParticleType::positron()) {
2,147,483,647✔
282
    collision_distance() = material() == MATERIAL_VOID ? INFINITY : 0.0;
176,456,510!
283
  } else if (macro_xs().total == 0.0) {
2,147,483,647✔
284
    collision_distance() = INFINITY;
111,961,442✔
285
  } else {
286
    collision_distance() = -std::log(prn(current_seed())) / macro_xs().total;
2,147,483,647✔
287
  }
288

289
  double speed = this->speed();
2,147,483,647✔
290
  double time_cutoff = settings::time_cutoff[type().transport_index()];
2,147,483,647✔
291
  double distance_cutoff =
2,147,483,647✔
292
    (time_cutoff < INFTY) ? (time_cutoff - time()) * speed : INFTY;
2,147,483,647✔
293

294
  // Select smaller of the three distances
295
  double distance =
2,147,483,647✔
296
    std::min({boundary().distance(), collision_distance(), distance_cutoff});
2,147,483,647✔
297

298
  // Advance particle in space and time
299
  this->move_distance(distance);
2,147,483,647✔
300
  double dt = distance / speed;
2,147,483,647✔
301
  this->time() += dt;
2,147,483,647✔
302
  this->lifetime() += dt;
2,147,483,647✔
303

304
  // Score timed track-length tallies
305
  if (!model::active_timed_tracklength_tallies.empty()) {
2,147,483,647✔
306
    score_timed_tracklength_tally(*this, distance);
3,628,317✔
307
  }
308

309
  // Score track-length tallies
310
  if (!model::active_tracklength_tallies.empty()) {
2,147,483,647✔
311
    score_tracklength_tally(*this, distance);
2,147,483,647✔
312
  }
313

314
  // Score track-length estimate of k-eff
315
  if (settings::run_mode == RunMode::EIGENVALUE && type().is_neutron() &&
2,147,483,647✔
316
      !delta_tracking()) {
2,147,483,647!
317
    keff_tally_tracklength() += wgt() * distance * macro_xs().nu_fission;
2,147,483,647✔
318
  }
319

320
  // Score flux derivative accumulators for differential tallies.
321
  if (!model::active_tallies.empty()) {
2,147,483,647✔
322
    score_track_derivative(*this, distance);
2,147,483,647✔
323
  }
324

325
  // Set particle weight to zero if it hit the time boundary
326
  if (distance == distance_cutoff) {
2,147,483,647✔
327
    wgt() = 0.0;
224,928✔
328
  }
329
}
2,147,483,647✔
330

331
void Particle::event_delta_advance()
264,540,122✔
332
{
333
  if (E() != E_last()) {
264,540,122✔
334
    update_majorant();
23,503,689✔
335
  }
336

337
  // Sample distance to next position
338
  if (type() == ParticleType::electron() ||
264,540,122✔
339
      type() == ParticleType::positron()) {
111,897,830✔
340
    // Electrons/positrons don't move
341
    collision_distance() = 0.0;
152,779,429✔
342
  } else {
343
    // Sample collision distance based on the majorant for this energy.
344
    collision_distance() = -std::log(prn(current_seed())) / majorant();
111,760,693✔
345
  }
346

347
  // Update distance to problem boundary
348
  boundary() = distance_to_external_boundary(*this);
264,540,122✔
349

350
  // Move to the external boundary or delta tracking collision site. Particles
351
  // with large majorant cross sections will tunnel out of the domain if a
352
  // floating point tolerance is not specified on the boundary distance
353
  // calculation.
354
  double distance =
264,540,122✔
355
    std::min(collision_distance(), boundary().distance() - FP_REL_PRECISION);
264,540,122✔
356
  r() += distance * u();
264,540,122✔
357

358
  // Need to locate the particle at the collision site or boundary.
359
  for (int j = 0; j < n_coord(); ++j) {
624,361,397✔
360
    coord(j).reset();
359,821,275✔
361
  }
362
  if (!exhaustive_find_cell(*this)) {
264,540,122!
363
    // We've lost this particle.
NEW
364
    mark_as_lost(fmt::format(
×
NEW
365
      "Particle {} could not be located while running delta tracking!", id()));
×
NEW
366
    return;
×
367
  }
368

369
  // Force re-calculation of material properties at the collision site.
370
  material_last() = C_NONE;
264,540,122✔
371
}
372

373
void Particle::event_cross_surface()
2,147,483,647✔
374
{
375
  // Saving previous cell data
376
  for (int j = 0; j < n_coord(); ++j) {
2,147,483,647✔
377
    cell_last(j) = coord(j).cell();
2,147,483,647✔
378
  }
379
  n_coord_last() = n_coord();
2,147,483,647✔
380

381
  // Set surface that particle is on and adjust coordinate levels
382
  surface() = boundary().surface();
2,147,483,647✔
383
  n_coord() = boundary().coord_level();
2,147,483,647✔
384

385
  if (boundary().lattice_translation()[0] != 0 ||
2,147,483,647✔
386
      boundary().lattice_translation()[1] != 0 ||
2,147,483,647✔
387
      boundary().lattice_translation()[2] != 0) {
2,147,483,647✔
388
    // Particle crosses lattice boundary
389

390
    bool verbose = settings::verbosity >= 10 || trace();
801,265,664!
391
    cross_lattice(*this, boundary(), verbose);
801,265,664✔
392
    event() = TallyEvent::LATTICE;
801,265,664✔
393

394
    // Score cell to cell partial currents
395
    if (!model::active_surface_tallies.empty()) {
801,265,664!
UNCOV
396
      auto& lat {*model::lattices[lowest_coord().lattice()]};
×
UNCOV
397
      bool is_valid;
×
UNCOV
398
      Direction normal =
×
UNCOV
399
        lat.get_normal(boundary().lattice_translation(), is_valid);
×
400
      if (is_valid) {
×
401
        normal /= normal.norm();
×
402
        score_surface_tally(*this, model::active_surface_tallies, normal);
×
403
      }
404
    }
405

406
  } else {
407

408
    const auto& surf {*model::surfaces[surface_index()].get()};
2,147,483,647✔
409

410
    // Particle crosses surface
411
    // If BC, add particle to surface source before crossing surface
412
    if (surf.surf_source_ && surf.bc_) {
2,147,483,647✔
413
      add_surf_source_to_bank(*this, surf);
1,023,077,777✔
414
    }
415
    this->cross_surface(surf);
2,147,483,647✔
416
    // If no BC, add particle to surface source after crossing surface
417
    if (surf.surf_source_ && !surf.bc_) {
2,147,483,647✔
418
      add_surf_source_to_bank(*this, surf);
1,851,932,611✔
419
    }
420
    if (settings::weight_window_checkpoint_surface) {
2,147,483,647✔
421
      apply_weight_windows(*this);
173,985✔
422
    }
423
    event() = TallyEvent::SURFACE;
2,147,483,647✔
424

425
    // Score cell to cell partial currents
426
    if (!model::active_surface_tallies.empty()) {
2,147,483,647✔
427
      Direction normal = surf.normal(r());
34,931,567✔
428
      normal /= normal.norm();
34,931,567✔
429
      score_surface_tally(*this, model::active_surface_tallies, normal);
34,931,567✔
430
    }
431
  }
432
}
2,147,483,647✔
433

434
void Particle::event_collide()
2,147,483,647✔
435
{
436
  // Score collision estimate of keff
437
  if (settings::run_mode == RunMode::EIGENVALUE && type().is_neutron()) {
2,147,483,647✔
438
    keff_tally_collision() += wgt() * macro_xs().nu_fission / macro_xs().total;
2,147,483,647✔
439
  }
440

441
  // Score surface current tallies -- this has to be done before the collision
442
  // since the direction of the particle will change and we need to use the
443
  // pre-collision direction to figure out what mesh surfaces were crossed
444

445
  if (!model::active_meshsurf_tallies.empty())
2,147,483,647✔
446
    score_meshsurface_tally(*this, model::active_meshsurf_tallies);
63,098,926✔
447

448
  // Clear surface component
449
  surface() = SURFACE_NONE;
2,147,483,647✔
450

451
  if (settings::run_CE) {
2,147,483,647✔
452
    collision(*this);
1,647,408,748✔
453
  } else {
454
    collision_mg(*this);
1,801,144,774✔
455
  }
456

457
  // Collision track feature to recording particle interaction
458
  if (settings::collision_track) {
2,147,483,647✔
459
    collision_track_record(*this);
728,673✔
460
  }
461

462
  // Score collision estimator tallies -- this is done after a collision
463
  // has occurred rather than before because we need information on the
464
  // outgoing energy for any tallies with an outgoing energy filter
465
  if (!model::active_collision_tallies.empty())
2,147,483,647✔
466
    score_collision_tally(*this);
202,484,744✔
467
  if (!model::active_analog_tallies.empty()) {
2,147,483,647✔
468
    if (settings::run_CE) {
406,229,898✔
469
      score_analog_tally_ce(*this);
405,021,636✔
470
    } else {
471
      score_analog_tally_mg(*this);
1,208,262✔
472
    }
473
  }
474

475
  if (!model::active_pulse_height_tallies.empty() && type().is_photon()) {
2,147,483,647✔
476
    pht_collision_energy();
8,668✔
477
  }
478

479
  // Reset banked weight during collision
480
  n_bank() = 0;
2,147,483,647✔
481
  bank_second_E() = 0.0;
2,147,483,647✔
482
  wgt_bank() = 0.0;
2,147,483,647✔
483

484
  // Clear number of secondaries in this collision. This is
485
  // distinct from the number of created neutrons n_bank() above!
486
  n_secondaries() = 0;
2,147,483,647✔
487

488
  zero_delayed_bank();
2,147,483,647✔
489

490
  // Reset fission logical
491
  fission() = false;
2,147,483,647✔
492

493
  // Save coordinates for tallying purposes
494
  r_last_current() = r();
2,147,483,647✔
495

496
  // Set last material to none since cross sections will need to be
497
  // re-evaluated
498
  material_last() = C_NONE;
2,147,483,647✔
499

500
  // Set all directions to base level -- right now, after a collision, only
501
  // the base level directions are changed
502
  for (int j = 0; j < n_coord() - 1; ++j) {
2,147,483,647✔
503
    if (coord(j + 1).rotated()) {
473,816,681✔
504
      // If next level is rotated, apply rotation matrix
505
      const auto& m {model::cells[coord(j).cell()]->rotation_};
11,724,229✔
506
      const auto& u {coord(j).u()};
11,724,229✔
507
      coord(j + 1).u() = u.rotate(m);
11,724,229✔
508
    } else {
509
      // Otherwise, copy this level's direction
510
      coord(j + 1).u() = coord(j).u();
462,092,452✔
511
    }
512
  }
513

514
  // Score flux derivative accumulators for differential tallies.
515
  if (!model::active_tallies.empty())
2,147,483,647✔
516
    score_collision_derivative(*this);
1,393,028,924✔
517

518
#ifdef OPENMC_DAGMC_ENABLED
519
  history().reset();
315,525,710✔
520
#endif
521
}
2,147,483,647✔
522

523
void Particle::event_revive_from_secondary(const SourceSite& site)
274,985,699✔
524
{
525
  // Write final position for the previous track (skip if this is a freshly
526
  // constructed particle with no prior track, e.g., Phase 2 of shared
527
  // secondary transport)
528
  if (write_track() && n_event() > 0) {
274,985,699!
529
    write_particle_track(*this);
5,234✔
530
  }
531

532
  from_source(&site);
274,985,699✔
533

534
  n_event() = 0;
274,985,699✔
535
  if (!settings::use_shared_secondary_bank) {
274,985,699✔
536
    n_tracks()++;
253,653,115✔
537
  }
538
  bank_second_E() = 0.0;
274,985,699✔
539

540
  // Subtract secondary particle energy from interim pulse-height results.
541
  // In shared secondary mode, this subtraction was already done on the parent
542
  // particle during create_secondary(), so skip it here.
543
  if (!settings::use_shared_secondary_bank &&
528,638,814✔
544
      !model::active_pulse_height_tallies.empty() && this->type().is_photon()) {
274,985,699✔
545
    // Since the birth cell of the particle has not been set we
546
    // have to determine it before the energy of the secondary particle can be
547
    // removed from the pulse-height of this cell.
548
    if (lowest_coord().cell() == C_NONE) {
3,168!
549
      bool verbose = settings::verbosity >= 10 || trace();
3,168!
550
      if (!exhaustive_find_cell(*this, verbose)) {
3,168!
UNCOV
551
        mark_as_lost("Could not find the cell containing particle " +
×
UNCOV
552
                     std::to_string(id()));
×
UNCOV
553
        return;
×
554
      }
555
      // Set birth cell attribute
556
      if (cell_born() == C_NONE)
3,168!
557
        cell_born() = lowest_coord().cell();
3,168✔
558

559
      // Initialize last cells from current cell
560
      for (int j = 0; j < n_coord(); ++j) {
6,336✔
561
        cell_last(j) = coord(j).cell();
3,168✔
562
      }
563
      n_coord_last() = n_coord();
3,168✔
564
    }
565
    pht_secondary_particles();
3,168✔
566
  }
567

568
  // Enter new particle in particle track file
569
  if (write_track())
274,985,699✔
570
    add_particle_track(*this);
5,234✔
571
}
572

573
void Particle::event_check_limit_and_revive()
2,147,483,647✔
574
{
575
  // If particle has too many events, display warning and kill it
576
  n_event()++;
2,147,483,647✔
577
  if (n_event() == settings::max_particle_events) {
2,147,483,647!
UNCOV
578
    warning("Particle " + std::to_string(id()) +
×
579
            " underwent maximum number of events.");
UNCOV
580
    wgt() = 0.0;
×
581
  }
582

583
  // In non-shared-secondary mode, revive from local secondary bank
584
  if (!alive() && !settings::use_shared_secondary_bank &&
2,147,483,647✔
585
      !local_secondary_bank().empty()) {
431,805,342✔
586
    SourceSite& site = local_secondary_bank().back();
253,653,115✔
587
    event_revive_from_secondary(site);
253,653,115✔
588
    local_secondary_bank().pop_back();
253,653,115✔
589
  }
590
}
2,147,483,647✔
591

592
void Particle::event_death()
200,270,307✔
593
{
594
#ifdef OPENMC_DAGMC_ENABLED
595
  history().reset();
18,298,138✔
596
#endif
597

598
  // Finish particle track output.
599
  if (write_track()) {
200,270,307✔
600
    write_particle_track(*this);
1,010✔
601
    finalize_particle_track(*this);
1,010✔
602
  }
603

604
// Contribute tally reduction variables to global accumulator
605
#pragma omp atomic
109,673,153✔
606
  global_tally_absorption += keff_tally_absorption();
200,270,307✔
607
#pragma omp atomic
109,435,214✔
608
  global_tally_collision += keff_tally_collision();
200,270,307✔
609
  if (!delta_tracking()) {
200,270,307✔
610
#pragma omp atomic
108,959,333✔
611
    global_tally_tracklength += keff_tally_tracklength();
199,170,307✔
612
  }
613
#pragma omp atomic
109,396,938✔
614
  global_tally_leakage += keff_tally_leakage();
200,270,307✔
615

616
  // Reset particle tallies once accumulated
617
  keff_tally_absorption() = 0.0;
200,270,307✔
618
  keff_tally_collision() = 0.0;
200,270,307✔
619
  keff_tally_tracklength() = 0.0;
200,270,307✔
620
  keff_tally_leakage() = 0.0;
200,270,307✔
621

622
  if (!model::active_pulse_height_tallies.empty()) {
200,270,307✔
623
    score_pulse_height_tally(*this, model::active_pulse_height_tallies);
33,000✔
624
  }
625

626
  // Accumulate track count for this particle history
627
  if (!settings::use_shared_secondary_bank) {
200,270,307✔
628
#pragma omp atomic
97,255,062✔
629
    simulation::simulation_tracks_completed += n_tracks();
178,153,227✔
630
  }
631

632
  // Record the number of progeny created by this particle.
633
  // This data will be used to efficiently sort the fission bank.
634
  if (settings::run_mode == RunMode::EIGENVALUE ||
200,270,307✔
635
      settings::use_shared_secondary_bank) {
636
    simulation::progeny_per_particle[current_work()] = n_progeny();
173,121,080✔
637
  }
638
}
200,270,307✔
639

640
void Particle::pht_collision_energy()
8,668✔
641
{
642
  // Adds the energy particles lose in a collision to the pulse-height
643

644
  // determine index of cell in pulse_height_cells
645
  auto it = std::find(model::pulse_height_cells.begin(),
8,668✔
646
    model::pulse_height_cells.end(), lowest_coord().cell());
8,668!
647

648
  if (it != model::pulse_height_cells.end()) {
8,668!
649
    int index = std::distance(model::pulse_height_cells.begin(), it);
8,668✔
650
    pht_storage()[index] += E_last() - E();
8,668✔
651

652
    // If the energy of the particle is below the cutoff, it will not be sampled
653
    // so its energy is added to the pulse-height in the cell
654
    int photon = ParticleType::photon().transport_index();
8,668✔
655
    if (E() < settings::energy_cutoff[photon]) {
8,668✔
656
      pht_storage()[index] += E();
3,740✔
657
    }
658
  }
659
}
8,668✔
660

661
void Particle::pht_secondary_particles()
3,168✔
662
{
663
  // Removes the energy of secondary produced particles from the pulse-height
664

665
  // determine index of cell in pulse_height_cells
666
  auto it = std::find(model::pulse_height_cells.begin(),
3,168✔
667
    model::pulse_height_cells.end(), cell_born());
3,168!
668

669
  if (it != model::pulse_height_cells.end()) {
3,168!
670
    int index = std::distance(model::pulse_height_cells.begin(), it);
3,168✔
671
    pht_storage()[index] -= E();
3,168✔
672
  }
673
}
3,168✔
674

675
void Particle::cross_surface(const Surface& surf)
2,147,483,647✔
676
{
677

678
  if (settings::verbosity >= 10 || trace()) {
2,147,483,647✔
679
    write_message(1, "    Crossing surface {}", surf.id_);
88✔
680
  }
681

682
// if we're crossing a CSG surface, make sure the DAG history is reset
683
#ifdef OPENMC_DAGMC_ENABLED
684
  if (surf.geom_type() == GeometryType::CSG)
262,347,093✔
685
    history().reset();
262,289,411✔
686
#endif
687

688
  // Handle any applicable boundary conditions.
689
  if (surf.bc_ && settings::run_mode != RunMode::PLOTTING &&
2,147,483,647!
690
      settings::run_mode != RunMode::VOLUME) {
691
    surf.bc_->handle_particle(*this, surf);
1,023,429,885✔
692
    return;
1,023,429,885✔
693
  }
694

695
  // ==========================================================================
696
  // SEARCH NEIGHBOR LISTS FOR NEXT CELL
697

698
#ifdef OPENMC_DAGMC_ENABLED
699
  // in DAGMC, we know what the next cell should be
700
  if (surf.geom_type() == GeometryType::DAG) {
168,874,721✔
701
    int32_t i_cell = next_cell(surface_index(), cell_last(n_coord() - 1),
46,742✔
702
                       lowest_coord().universe()) -
46,742✔
703
                     1;
46,742✔
704
    // save material, temperature, and density multiplier
705
    material_last() = material();
46,742✔
706
    sqrtkT_last() = sqrtkT();
46,742✔
707
    density_mult_last() = density_mult();
46,742✔
708
    // set new cell value
709
    lowest_coord().cell() = i_cell;
46,742✔
710
    auto& cell = model::cells[i_cell];
46,742✔
711

712
    cell_instance() = 0;
46,742✔
713
    if (cell->distribcell_index_ >= 0)
46,742✔
714
      cell_instance() = cell_instance_at_level(*this, n_coord() - 1);
45,718✔
715

716
    material() = cell->material(cell_instance());
46,742!
717
    sqrtkT() = cell->sqrtkT(cell_instance());
46,742!
718
    density_mult() = cell->density_mult(cell_instance());
46,742✔
719
    return;
46,742✔
720
  }
721
#endif
722

723
  bool verbose = settings::verbosity >= 10 || trace();
1,854,729,165!
724
  if (neighbor_list_find_cell(*this, verbose)) {
1,854,729,165✔
725
    return;
726
  }
727

728
  // ==========================================================================
729
  // COULDN'T FIND PARTICLE IN NEIGHBORING CELLS, SEARCH ALL CELLS
730

731
  // Remove lower coordinate levels
732
  n_coord() = 1;
29,977✔
733
  bool found = exhaustive_find_cell(*this, verbose);
29,977✔
734

735
  if (settings::run_mode != RunMode::PLOTTING && (!found)) {
29,977!
736
    // If a cell is still not found, there are two possible causes: 1) there is
737
    // a void in the model, and 2) the particle hit a surface at a tangent. If
738
    // the particle is really traveling tangent to a surface, if we move it
739
    // forward a tiny bit it should fix the problem.
740

741
    surface() = SURFACE_NONE;
5,865✔
742
    n_coord() = 1;
5,865✔
743
    r() += TINY_BIT * u();
5,865✔
744

745
    // Couldn't find next cell anywhere! This probably means there is an actual
746
    // undefined region in the geometry.
747

748
    if (!exhaustive_find_cell(*this, verbose)) {
5,865!
749
      mark_as_lost("After particle " + std::to_string(id()) +
17,586✔
750
                   " crossed surface " + std::to_string(surf.id_) +
17,586✔
751
                   " it could not be located in any cell and it did not leak.");
752
      return;
5,856✔
753
    }
754
  }
755
}
756

757
void Particle::cross_vacuum_bc(const Surface& surf)
37,356,987✔
758
{
759
  // Score any surface current tallies -- note that the particle is moved
760
  // forward slightly so that if the mesh boundary is on the surface, it is
761
  // still processed
762

763
  if (!model::active_meshsurf_tallies.empty()) {
37,356,987✔
764
    // TODO: Find a better solution to score surface currents than
765
    // physically moving the particle forward slightly
766

767
    r() += TINY_BIT * u();
937,222✔
768
    score_meshsurface_tally(*this, model::active_meshsurf_tallies);
937,222✔
769
  }
770

771
  // Score to global leakage tally
772
  keff_tally_leakage() += wgt();
37,356,987✔
773

774
  // Kill the particle
775
  wgt() = 0.0;
37,356,987✔
776

777
  // Display message
778
  if (settings::verbosity >= 10 || trace()) {
37,356,987!
779
    write_message(1, "    Leaked out of surface {}", surf.id_);
22✔
780
  }
781
}
37,356,987✔
782

783
void Particle::cross_reflective_bc(const Surface& surf, Direction new_u)
983,924,956✔
784
{
785
  // Do not handle reflective boundary conditions on lower universes
786
  if (n_coord() != 1) {
983,924,956!
UNCOV
787
    mark_as_lost("Cannot reflect particle " + std::to_string(id()) +
×
788
                 " off surface in a lower universe.");
UNCOV
789
    return;
×
790
  }
791

792
  // Score surface currents since reflection causes the direction of the
793
  // particle to change. For surface filters, we need to score the tallies
794
  // twice, once before the particle's surface attribute has changed and
795
  // once after. For mesh surface filters, we need to artificially move
796
  // the particle slightly back in case the surface crossing is coincident
797
  // with a mesh boundary
798

799
  if (!model::active_surface_tallies.empty()) {
983,924,956✔
800
    Direction normal = surf.normal(r());
285,021✔
801
    normal /= normal.norm();
285,021✔
802
    score_surface_tally(*this, model::active_surface_tallies, normal);
285,021✔
803
  }
804

805
  if (!model::active_meshsurf_tallies.empty()) {
983,924,956✔
806
    Position r {this->r()};
46,885,487✔
807
    this->r() -= TINY_BIT * u();
46,885,487✔
808
    score_meshsurface_tally(*this, model::active_meshsurf_tallies);
46,885,487✔
809
    this->r() = r;
46,885,487✔
810
  }
811

812
  // Set the new particle direction
813
  u() = new_u;
983,924,956✔
814

815
  // Reassign particle's cell and surface
816
  coord(0).cell() = cell_last(0);
983,924,956✔
817
  surface() = -surface();
983,924,956✔
818

819
  // If a reflective surface is coincident with a lattice or universe
820
  // boundary, it is necessary to redetermine the particle's coordinates in
821
  // the lower universes.
822
  // (unless we're using a dagmc model, which has exactly one universe)
823
  n_coord() = 1;
983,924,956✔
824
  if (surf.geom_type() != GeometryType::DAG &&
1,967,847,154!
825
      !neighbor_list_find_cell(*this)) {
983,922,198✔
UNCOV
826
    mark_as_lost("Couldn't find particle after reflecting from surface " +
×
UNCOV
827
                 std::to_string(surf.id_) + ".");
×
UNCOV
828
    return;
×
829
  }
830

831
  // Set previous coordinate going slightly past surface crossing
832
  r_last_current() = r() + TINY_BIT * u();
983,924,956✔
833

834
  // Diagnostic message
835
  if (settings::verbosity >= 10 || trace()) {
983,924,956!
UNCOV
836
    write_message(1, "    Reflected from surface {}", surf.id_);
×
837
  }
838
}
839

840
void Particle::cross_periodic_bc(
3,153,408✔
841
  const Surface& surf, Position new_r, Direction new_u, int new_surface)
842
{
843
  // Do not handle periodic boundary conditions on lower universes
844
  if (n_coord() != 1) {
3,153,408!
UNCOV
845
    mark_as_lost(
×
UNCOV
846
      "Cannot transfer particle " + std::to_string(id()) +
×
847
      " across surface in a lower universe. Boundary conditions must be "
848
      "applied to root universe.");
849
    return;
×
850
  }
851

852
  // Score surface currents since reflection causes the direction of the
853
  // particle to change -- artificially move the particle slightly back in
854
  // case the surface crossing is coincident with a mesh boundary
855
  if (!model::active_meshsurf_tallies.empty()) {
3,153,408!
UNCOV
856
    Position r {this->r()};
×
UNCOV
857
    this->r() -= TINY_BIT * u();
×
UNCOV
858
    score_meshsurface_tally(*this, model::active_meshsurf_tallies);
×
UNCOV
859
    this->r() = r;
×
860
  }
861

862
  // Adjust the particle's location and direction.
863
  r() = new_r;
3,153,408✔
864
  u() = new_u;
3,153,408✔
865

866
  // Reassign particle's surface
867
  surface() = new_surface;
3,153,408✔
868

869
  // Figure out what cell particle is in now
870
  n_coord() = 1;
3,153,408✔
871

872
  if (!neighbor_list_find_cell(*this)) {
3,153,408!
UNCOV
873
    mark_as_lost("Couldn't find particle after hitting periodic "
×
UNCOV
874
                 "boundary on surface " +
×
UNCOV
875
                 std::to_string(surf.id_) + ".");
×
UNCOV
876
    return;
×
877
  }
878

879
  // Set previous coordinate going slightly past surface crossing
880
  r_last_current() = r() + TINY_BIT * u();
3,153,408✔
881

882
  // Diagnostic message
883
  if (settings::verbosity >= 10 || trace()) {
3,153,408!
UNCOV
884
    write_message(1, "    Hit periodic boundary on surface {}", surf.id_);
×
885
  }
886
}
887

888
void Particle::update_majorant()
193,062,658✔
889
{
890
  if (type().is_neutron()) {
193,062,658✔
891
    majorant() = NeutronMajorant::safety_factor_ *
20,620,806✔
892
                 data::n_majorant->calculate_neutron_xs(E());
20,620,806✔
893
  } else if (type().is_photon()) {
172,441,852✔
894
    majorant() = PhotonMajorant::safety_factor_ *
19,662,423✔
895
                 data::p_majorant->calculate_photon_xs(E());
19,662,423✔
896
  }
897
}
193,062,658✔
898

899
void Particle::mark_as_lost(const char* message)
5,865✔
900
{
901
  // Print warning and write lost particle file
902
  warning(message);
5,865✔
903
  if (settings::max_write_lost_particles < 0 ||
5,865✔
904
      simulation::n_lost_particles < settings::max_write_lost_particles) {
5,500✔
905
    write_restart();
440✔
906
  }
907
  // Increment number of lost particles
908
  wgt() = 0.0;
5,865✔
909
#pragma omp atomic
3,190✔
910
  simulation::n_lost_particles += 1;
2,675✔
911

912
  // Count the total number of simulated particles (on this processor)
913
  auto n = simulation::current_batch * settings::gen_per_batch *
5,865✔
914
           simulation::work_per_rank;
915

916
  // Abort the simulation if the maximum number of lost particles has been
917
  // reached
918
  if (simulation::n_lost_particles >= settings::max_lost_particles &&
5,865✔
919
      simulation::n_lost_particles >= settings::rel_max_lost_particles * n) {
9!
920
    fatal_error("Maximum number of lost particles has been reached.");
9✔
921
  }
922
}
5,856✔
923

924
void Particle::write_restart() const
440✔
925
{
926
  // Dont write another restart file if in particle restart mode
927
  if (settings::run_mode == RunMode::PARTICLE)
440✔
928
    return;
33✔
929

930
  // Set up file name
931
  auto filename = fmt::format("{}particle_{}_{}.h5", settings::path_output,
407✔
932
    simulation::current_batch, id());
407✔
933

934
#pragma omp critical(WriteParticleRestart)
217✔
935
  {
407✔
936
    // Create file
937
    hid_t file_id = file_open(filename, 'w');
407✔
938

939
    // Write filetype and version info
940
    write_attribute(file_id, "filetype", "particle restart");
407✔
941
    write_attribute(file_id, "version", VERSION_PARTICLE_RESTART);
407✔
942
    write_attribute(file_id, "openmc_version", VERSION);
407✔
943
#ifdef GIT_SHA1
944
    write_attr_string(file_id, "git_sha1", GIT_SHA1);
945
#endif
946

947
    // Write data to file
948
    write_dataset(file_id, "current_batch", simulation::current_batch);
407✔
949
    write_dataset(file_id, "generations_per_batch", settings::gen_per_batch);
407✔
950
    write_dataset(file_id, "current_generation", simulation::current_gen);
407✔
951
    write_dataset(file_id, "n_particles", settings::n_particles);
407✔
952
    switch (settings::run_mode) {
407!
953
    case RunMode::FIXED_SOURCE:
275✔
954
      write_dataset(file_id, "run_mode", "fixed source");
275✔
955
      break;
145✔
956
    case RunMode::EIGENVALUE:
132✔
957
      write_dataset(file_id, "run_mode", "eigenvalue");
132✔
958
      break;
72✔
UNCOV
959
    case RunMode::PARTICLE:
×
UNCOV
960
      write_dataset(file_id, "run_mode", "particle restart");
×
961
      break;
962
    default:
963
      break;
964
    }
965
    write_dataset(file_id, "id", id());
407✔
966
    write_dataset(file_id, "type", type().pdg_number());
407✔
967

968
    // Get source site data for the particle that got lost
969
    int64_t i = current_work();
407✔
970
    SourceSite site;
407✔
971
    if (settings::run_mode == RunMode::EIGENVALUE) {
407✔
972
      site = simulation::source_bank[i];
132✔
973
    } else if (settings::run_mode == RunMode::FIXED_SOURCE &&
275✔
974
               settings::use_shared_secondary_bank &&
275!
975
               i < simulation::shared_secondary_bank_read.size()) {
55!
976
      site = simulation::shared_secondary_bank_read[i];
×
977
    } else if (settings::run_mode == RunMode::FIXED_SOURCE) {
275!
978
      // Re-sample using the same seed used to generate the source particle.
979
      // current_work() is 0-indexed, compute_particle_id expects 1-indexed.
980
      int64_t id = compute_transport_seed(compute_particle_id(i + 1));
275✔
981
      uint64_t seed = init_seed(id, STREAM_SOURCE);
275✔
982
      site = sample_external_source(&seed);
275✔
983
    }
984
    write_dataset(file_id, "weight", site.wgt);
407✔
985
    write_dataset(file_id, "energy", site.E);
407✔
986
    write_dataset(file_id, "xyz", site.r);
407✔
987
    write_dataset(file_id, "uvw", site.u);
407✔
988
    write_dataset(file_id, "time", site.time);
407✔
989

990
    // Close file
991
    file_close(file_id);
407✔
992
  } // #pragma omp critical
993
}
407✔
994

995
void Particle::update_neutron_xs(
2,147,483,647✔
996
  int i_nuclide, int i_grid, int i_sab, double sab_frac, double ncrystal_xs)
997
{
998
  // Get microscopic cross section cache
999
  auto& micro = this->neutron_xs(i_nuclide);
2,147,483,647✔
1000

1001
  // If the cache doesn't match, recalculate micro xs
1002
  if (this->E() != micro.last_E || this->sqrtkT() != micro.last_sqrtkT ||
2,147,483,647✔
1003
      i_sab != micro.index_sab || sab_frac != micro.sab_frac ||
2,147,483,647✔
1004
      ncrystal_xs != micro.ncrystal_xs) {
2,147,483,647!
1005
    data::nuclides[i_nuclide]->calculate_xs(i_sab, i_grid, sab_frac, *this);
2,147,483,647✔
1006

1007
    // If NCrystal is being used, update micro cross section cache
1008
    micro.ncrystal_xs = ncrystal_xs;
2,147,483,647✔
1009
    if (ncrystal_xs >= 0.0) {
2,147,483,647✔
1010
      data::nuclides[i_nuclide]->calculate_elastic_xs(*this);
11,018,953✔
1011
      ncrystal_update_micro(ncrystal_xs, micro);
11,018,953✔
1012
    }
1013
  }
1014
}
2,147,483,647✔
1015

1016
//==============================================================================
1017
// Non-method functions
1018
//==============================================================================
1019
void add_surf_source_to_bank(Particle& p, const Surface& surf)
2,147,483,647✔
1020
{
1021
  if (simulation::current_batch <= settings::n_inactive ||
2,147,483,647✔
1022
      simulation::surf_source_bank.full()) {
2,147,483,647✔
1023
    return;
2,147,483,647✔
1024
  }
1025

1026
  // If a cell/cellfrom/cellto parameter is defined
1027
  if (settings::ssw_cell_id != C_NONE) {
337,084✔
1028

1029
    // Retrieve cell index and storage type
1030
    int cell_idx = model::cell_map[settings::ssw_cell_id];
254,439✔
1031

1032
    if (surf.bc_) {
254,439✔
1033
      // Leave if cellto with vacuum boundary condition
1034
      if (surf.bc_->type() == "vacuum" &&
298,918✔
1035
          settings::ssw_cell_type == SSWCellType::To) {
33,099✔
1036
        return;
1037
      }
1038

1039
      // Leave if other boundary condition than vacuum
1040
      if (surf.bc_->type() != "vacuum") {
274,646✔
1041
        return;
1042
      }
1043
    }
1044

1045
    // Check if the cell of interest has been exited
1046
    bool exited = false;
1047
    for (int i = 0; i < p.n_coord_last(); ++i) {
333,675✔
1048
      if (p.cell_last(i) == cell_idx) {
207,732✔
1049
        exited = true;
73,766✔
1050
      }
1051
    }
1052

1053
    // Check if the cell of interest has been entered
1054
    bool entered = false;
1055
    for (int i = 0; i < p.n_coord(); ++i) {
297,977✔
1056
      if (p.coord(i).cell() == cell_idx) {
172,034✔
1057
        entered = true;
57,516✔
1058
      }
1059
    }
1060

1061
    // Vacuum boundary conditions: return if cell is not exited
1062
    if (surf.bc_) {
125,943✔
1063
      if (surf.bc_->type() == "vacuum" && !exited) {
41,926!
1064
        return;
1065
      }
1066
    } else {
1067

1068
      // If we both enter and exit the cell of interest
1069
      if (entered && exited) {
104,980✔
1070
        return;
1071
      }
1072

1073
      // If we did not enter nor exit the cell of interest
1074
      if (!entered && !exited) {
77,777✔
1075
        return;
1076
      }
1077

1078
      // If cellfrom and the cell before crossing is not the cell of
1079
      // interest
1080
      if (settings::ssw_cell_type == SSWCellType::From && !exited) {
64,276✔
1081
        return;
1082
      }
1083

1084
      // If cellto and the cell after crossing is not the cell of interest
1085
      if (settings::ssw_cell_type == SSWCellType::To && !entered) {
52,734✔
1086
        return;
1087
      }
1088
    }
1089
  }
1090

1091
  SourceSite site;
129,653✔
1092
  site.r = p.r();
129,653✔
1093
  site.u = p.u();
129,653✔
1094
  site.E = p.E();
129,653✔
1095
  site.time = p.time();
129,653✔
1096
  site.wgt = p.wgt();
129,653✔
1097
  site.delayed_group = p.delayed_group();
129,653✔
1098
  site.surf_id = surf.id_;
129,653✔
1099
  site.particle = p.type();
129,653✔
1100
  site.parent_id = p.id();
129,653✔
1101
  site.progeny_id = p.n_progeny();
129,653✔
1102
  int64_t idx = simulation::surf_source_bank.thread_safe_append(site);
129,653✔
1103
}
1104

1105
} // 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