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

openmc-dev / openmc / 23560024828

25 Mar 2026 07:28PM UTC coverage: 80.336% (-1.0%) from 81.326%
23560024828

Pull #3702

github

web-flow
Merge 0f768b2d1 into 6cd39073b
Pull Request #3702: Random Ray Kinetic Simulation Mode

17625 of 25263 branches covered (69.77%)

Branch coverage included in aggregate %.

926 of 1957 new or added lines in 21 files covered. (47.32%)

461 existing lines in 28 files now uncovered.

57995 of 68867 relevant lines covered (84.21%)

50654337.8 hits per line

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

70.17
/src/random_ray/source_region.cpp
1
#include "openmc/random_ray/source_region.h"
2
#include "openmc/random_ray/random_ray.h"
3

4
#include "openmc/error.h"
5
#include "openmc/message_passing.h"
6
#include "openmc/simulation.h"
7

8
namespace openmc {
9

10
//==============================================================================
11
// SourceRegionHandle implementation
12
//==============================================================================
13
SourceRegionHandle::SourceRegionHandle(SourceRegion& sr)
57,973,520✔
14
  : negroups_(sr.scalar_flux_old_.size()), material_(&sr.material_),
57,973,520✔
15
    temperature_idx_(&sr.temperature_idx_), density_mult_(&sr.density_mult_),
57,973,520✔
16
    is_small_(&sr.is_small_), n_hits_(&sr.n_hits_),
57,973,520✔
17
    is_linear_(sr.source_gradients_.size() > 0), lock_(&sr.lock_),
57,973,520✔
18
    volume_(&sr.volume_), volume_t_(&sr.volume_t_), volume_sq_(&sr.volume_sq_),
57,973,520✔
19
    volume_sq_t_(&sr.volume_sq_t_), volume_naive_(&sr.volume_naive_),
57,973,520✔
20
    position_recorded_(&sr.position_recorded_),
57,973,520✔
21
    external_source_present_(&sr.external_source_present_),
57,973,520✔
22
    position_(&sr.position_), centroid_(&sr.centroid_),
57,973,520✔
23
    centroid_iteration_(&sr.centroid_iteration_), centroid_t_(&sr.centroid_t_),
57,973,520✔
24
    mom_matrix_(&sr.mom_matrix_), mom_matrix_t_(&sr.mom_matrix_t_),
57,973,520✔
25
    volume_task_(&sr.volume_task_), mesh_(&sr.mesh_),
57,973,520✔
26
    parent_sr_(&sr.parent_sr_), scalar_flux_old_(sr.scalar_flux_old_.data()),
57,973,520✔
27
    scalar_flux_new_(sr.scalar_flux_new_.data()), source_(sr.source_.data()),
57,973,520✔
28
    source_final_(sr.source_.data()),
57,973,520✔
29
    external_source_(sr.external_source_.data()),
57,973,520✔
30
    scalar_flux_final_(sr.scalar_flux_final_.data()),
57,973,520✔
31
    source_gradients_(sr.source_gradients_.data()),
57,973,520✔
32
    flux_moments_old_(sr.flux_moments_old_.data()),
57,973,520✔
33
    flux_moments_new_(sr.flux_moments_new_.data()),
57,973,520✔
34
    flux_moments_t_(sr.flux_moments_t_.data()),
57,973,520✔
35
    tally_task_(sr.tally_task_.data()), phi_prime_(sr.phi_prime_.data()),
57,973,520✔
36
    T1_(sr.T1_.data()),
57,973,520✔
37
    delayed_fission_source_(sr.delayed_fission_source_.data()),
57,973,520✔
38
    precursors_old_(sr.precursors_old_.data()),
57,973,520✔
39
    precursors_new_(sr.precursors_new_.data()),
57,973,520✔
40
    precursors_final_(sr.precursors_final_.data()),
57,973,520✔
41
    scalar_flux_bd_(sr.scalar_flux_bd_.data()),
57,973,520✔
42
    source_bd_(sr.source_bd_.data()), precursors_bd_(sr.precursors_bd_.data()),
57,973,520✔
43
    scalar_flux_rhs_bd_(sr.scalar_flux_rhs_bd_.data()),
57,973,520✔
44
    source_rhs_bd_(sr.source_rhs_bd_.data()),
57,973,520✔
45
    scalar_flux_rhs_bd_2_(sr.scalar_flux_rhs_bd_2_.data()),
57,973,520✔
46
    precursors_rhs_bd_(sr.precursors_rhs_bd_.data()),
57,973,520✔
47
    tally_delay_task_(sr.tally_delay_task_.data())
57,973,520✔
48
{}
57,973,520✔
49

50
//==============================================================================
51
// SourceRegion implementation
52
//==============================================================================
53
SourceRegion::SourceRegion(int negroups, int ndgroups, bool is_linear)
2,214,060✔
54
{
55
  if (settings::run_mode == RunMode::EIGENVALUE) {
2,214,060✔
56
    // If in eigenvalue mode, set starting flux to guess of 1
57
    scalar_flux_old_.assign(negroups, 1.0);
113,350✔
58
  } else {
59
    // If in fixed source mode, set starting flux to guess of zero
60
    // and initialize external source arrays
61
    scalar_flux_old_.assign(negroups, 0.0);
2,100,710✔
62
    external_source_.assign(negroups, 0.0);
2,100,710✔
63
  }
64

65
  scalar_flux_new_.assign(negroups, 0.0);
2,214,060✔
66
  source_.assign(negroups, 0.0);
2,214,060✔
67
  scalar_flux_final_.assign(negroups, 0.0);
2,214,060✔
68

69
  tally_task_.resize(negroups);
2,214,060✔
70
  if (is_linear) {
2,214,060✔
71
    source_gradients_.resize(negroups);
747,140✔
72
    flux_moments_old_.resize(negroups);
747,140✔
73
    flux_moments_new_.resize(negroups);
747,140✔
74
    flux_moments_t_.resize(negroups);
747,140✔
75
  }
76
  if (settings::kinetic_simulation) {
2,214,060✔
77
    scalar_flux_bd_.resize(negroups);
62,420✔
78
    scalar_flux_rhs_bd_.resize(negroups);
62,420✔
79

80
    if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
62,420✔
81
      // Time Isotropic arrays
82
      phi_prime_.assign(negroups, 0.0);
58,260✔
83
    } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
4,160!
84
      // Source Derivative Propogation arrays
85
      source_final_.assign(negroups, 0.0);
4,160✔
86

87
      T1_.assign(negroups, 0.0);
4,160✔
88

89
      source_bd_.resize(negroups);
4,160✔
90
      source_rhs_bd_.resize(negroups);
4,160✔
91
      scalar_flux_rhs_bd_2_.resize(negroups);
4,160✔
92
    }
93

94
    if (settings::create_delayed_neutrons) {
62,420!
95
      delayed_fission_source_.assign(ndgroups, 0.0);
62,420✔
96
      precursors_old_.assign(ndgroups, 0.0);
62,420✔
97
      precursors_new_.assign(ndgroups, 0.0);
62,420✔
98
      precursors_final_.assign(ndgroups, 0.0);
62,420✔
99

100
      precursors_bd_.resize(ndgroups);
62,420✔
101
      precursors_rhs_bd_.resize(ndgroups);
62,420✔
102

103
      tally_delay_task_.resize(ndgroups);
62,420✔
104
    }
105
  }
106
}
2,214,060✔
107

108
//==============================================================================
109
// SourceRegionContainer implementation
110
//==============================================================================
111

112
void SourceRegionContainer::push_back(const SourceRegion& sr)
2,121,820✔
113
{
114
  n_source_regions_++;
2,121,820✔
115

116
  // Scalar fields
117
  material_.push_back(sr.material_);
2,121,820✔
118
  temperature_idx_.push_back(sr.temperature_idx_);
2,121,820✔
119
  density_mult_.push_back(sr.density_mult_);
2,121,820✔
120
  is_small_.push_back(sr.is_small_);
2,121,820✔
121
  n_hits_.push_back(sr.n_hits_);
2,121,820✔
122
  lock_.push_back(sr.lock_);
2,121,820✔
123
  volume_.push_back(sr.volume_);
2,121,820✔
124
  volume_t_.push_back(sr.volume_t_);
2,121,820✔
125
  volume_sq_.push_back(sr.volume_sq_);
2,121,820✔
126
  volume_sq_t_.push_back(sr.volume_sq_t_);
2,121,820✔
127
  volume_naive_.push_back(sr.volume_naive_);
2,121,820✔
128
  position_recorded_.push_back(sr.position_recorded_);
2,121,820✔
129
  external_source_present_.push_back(sr.external_source_present_);
2,121,820✔
130
  position_.push_back(sr.position_);
2,121,820✔
131
  volume_task_.push_back(sr.volume_task_);
2,121,820✔
132
  mesh_.push_back(sr.mesh_);
2,121,820✔
133
  parent_sr_.push_back(sr.parent_sr_);
2,121,820✔
134

135
  // Only store these fields if is_linear_ is true
136
  if (is_linear_) {
2,121,820✔
137
    centroid_.push_back(sr.centroid_);
717,000✔
138
    centroid_iteration_.push_back(sr.centroid_iteration_);
717,000✔
139
    centroid_t_.push_back(sr.centroid_t_);
717,000✔
140
    mom_matrix_.push_back(sr.mom_matrix_);
717,000✔
141
    mom_matrix_t_.push_back(sr.mom_matrix_t_);
717,000✔
142
  }
143

144
  // Energy-dependent fields
145
  for (int g = 0; g < negroups_; ++g) {
5,037,080✔
146
    scalar_flux_old_.push_back(sr.scalar_flux_old_[g]);
2,915,260✔
147
    scalar_flux_new_.push_back(sr.scalar_flux_new_[g]);
2,915,260✔
148
    scalar_flux_final_.push_back(sr.scalar_flux_final_[g]);
2,915,260✔
149
    source_.push_back(sr.source_[g]);
2,915,260✔
150
    if (settings::run_mode == RunMode::FIXED_SOURCE) {
2,915,260✔
151
      external_source_.push_back(sr.external_source_[g]);
2,050,260✔
152
    }
153

154
    // Only store these fields if is_linear_ is true
155
    if (is_linear_) {
2,915,260✔
156
      source_gradients_.push_back(sr.source_gradients_[g]);
779,880✔
157
      flux_moments_old_.push_back(sr.flux_moments_old_[g]);
779,880✔
158
      flux_moments_new_.push_back(sr.flux_moments_new_[g]);
779,880✔
159
      flux_moments_t_.push_back(sr.flux_moments_t_[g]);
779,880✔
160
    }
161

162
    // Tally tasks
163
    tally_task_.emplace_back(sr.tally_task_[g]);
2,915,260✔
164

165
    // Energy-dependent fields for kinetic simulations
166
    if (settings::kinetic_simulation) {
2,915,260✔
167
      scalar_flux_bd_.push_back(sr.scalar_flux_bd_[g]);
536,640✔
168
      scalar_flux_rhs_bd_.push_back(sr.scalar_flux_rhs_bd_[g]);
536,640✔
169

170
      if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
536,640✔
171
        // Time Isotropic arrays
172
        phi_prime_.push_back(sr.phi_prime_[g]);
457,600✔
173
      } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
79,040!
174
        // Source Derivative Propogation arrays
175
        source_final_.push_back(sr.source_final_[g]);
79,040✔
176

177
        T1_.push_back(sr.T1_[g]);
79,040✔
178

179
        source_bd_.push_back(sr.source_bd_[g]);
79,040✔
180
        source_rhs_bd_.push_back(sr.source_rhs_bd_[g]);
79,040✔
181
        scalar_flux_rhs_bd_2_.push_back(sr.scalar_flux_rhs_bd_2_[g]);
79,040✔
182
      }
183
    }
184
  }
185
  // Delay group-dependent fields for kinetic simulations
186
  if (settings::kinetic_simulation && settings::create_delayed_neutrons) {
2,121,820!
187
    for (int dg = 0; dg < ndgroups_; dg++) {
544,960✔
188
      delayed_fission_source_.push_back(sr.delayed_fission_source_[dg]);
482,560✔
189
      precursors_old_.push_back(sr.precursors_old_[dg]);
482,560✔
190
      precursors_new_.push_back(sr.precursors_new_[dg]);
482,560✔
191
      precursors_final_.push_back(sr.precursors_final_[dg]);
482,560✔
192
      tally_delay_task_.emplace_back(sr.tally_delay_task_[dg]);
482,560✔
193

194
      // Backward difference arrays
195
      precursors_bd_.push_back(sr.precursors_bd_[dg]);
482,560✔
196
      precursors_rhs_bd_.push_back(sr.precursors_rhs_bd_[dg]);
482,560✔
197
    }
198
  }
199
}
2,121,820✔
200

201
void SourceRegionContainer::assign(
×
202
  int n_source_regions, const SourceRegion& source_region)
203
{
204
  // Clear existing data
205
  n_source_regions_ = 0;
×
206
  material_.clear();
×
207
  temperature_idx_.clear();
×
208
  density_mult_.clear();
×
209
  is_small_.clear();
×
210
  n_hits_.clear();
×
211
  lock_.clear();
×
212
  volume_.clear();
×
213
  volume_t_.clear();
×
214
  volume_sq_.clear();
×
215
  volume_sq_t_.clear();
×
216
  volume_naive_.clear();
×
217
  position_recorded_.clear();
×
218
  external_source_present_.clear();
×
219
  position_.clear();
×
220
  mesh_.clear();
×
221
  parent_sr_.clear();
×
222

223
  if (is_linear_) {
×
224
    centroid_.clear();
×
225
    centroid_iteration_.clear();
×
226
    centroid_t_.clear();
×
227
    mom_matrix_.clear();
×
228
    mom_matrix_t_.clear();
×
229
  }
230

231
  scalar_flux_old_.clear();
×
232
  scalar_flux_new_.clear();
×
233
  scalar_flux_final_.clear();
×
234
  source_.clear();
×
235
  external_source_.clear();
×
236

237
  if (is_linear_) {
×
238
    source_gradients_.clear();
×
239
    flux_moments_old_.clear();
×
240
    flux_moments_new_.clear();
×
241
    flux_moments_t_.clear();
×
242
  }
243

244
  tally_task_.clear();
×
245
  volume_task_.clear();
×
246

247
  // Clear existing data for kinetic simulatons
NEW
248
  if (settings::kinetic_simulation) {
×
NEW
249
    scalar_flux_bd_.clear();
×
NEW
250
    scalar_flux_rhs_bd_.clear();
×
251

NEW
252
    if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
×
NEW
253
      phi_prime_.clear();
×
NEW
254
    } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
×
NEW
255
      source_final_.clear();
×
256

NEW
257
      T1_.clear();
×
258

NEW
259
      source_bd_.clear();
×
NEW
260
      source_rhs_bd_.clear();
×
NEW
261
      scalar_flux_rhs_bd_2_.clear();
×
262
    }
263

NEW
264
    if (settings::create_delayed_neutrons) {
×
NEW
265
      precursors_bd_.clear();
×
NEW
266
      precursors_rhs_bd_.clear();
×
267

NEW
268
      delayed_fission_source_.clear();
×
NEW
269
      precursors_old_.clear();
×
NEW
270
      precursors_new_.clear();
×
NEW
271
      precursors_final_.clear();
×
NEW
272
      tally_delay_task_.clear();
×
273
    }
274
  }
275

276
  // Fill with copies of source_region
277
  for (int i = 0; i < n_source_regions; ++i) {
×
278
    push_back(source_region);
×
279
  }
280
}
×
281

282
void SourceRegionContainer::flux_swap()
133,200✔
283
{
284
  scalar_flux_old_.swap(scalar_flux_new_);
133,200✔
285
  if (is_linear_) {
133,200✔
286
    flux_moments_old_.swap(flux_moments_new_);
6,850✔
287
  }
288
}
133,200✔
289

290
SourceRegionHandle SourceRegionContainer::get_source_region_handle(int64_t sr)
2,147,483,647✔
291
{
292
  SourceRegionHandle handle;
2,147,483,647✔
293
  handle.negroups_ = negroups();
2,147,483,647✔
294
  handle.material_ = &material(sr);
2,147,483,647✔
295
  handle.temperature_idx_ = &temperature_idx(sr);
2,147,483,647✔
296
  handle.density_mult_ = &density_mult(sr);
2,147,483,647✔
297
  handle.is_small_ = &is_small(sr);
2,147,483,647✔
298
  handle.n_hits_ = &n_hits(sr);
2,147,483,647✔
299
  handle.is_linear_ = is_linear();
2,147,483,647✔
300
  handle.lock_ = &lock(sr);
2,147,483,647✔
301
  handle.volume_ = &volume(sr);
2,147,483,647✔
302
  handle.volume_t_ = &volume_t(sr);
2,147,483,647✔
303
  handle.volume_sq_ = &volume_sq(sr);
2,147,483,647✔
304
  handle.volume_sq_t_ = &volume_sq_t(sr);
2,147,483,647✔
305
  handle.volume_naive_ = &volume_naive(sr);
2,147,483,647✔
306
  handle.position_recorded_ = &position_recorded(sr);
2,147,483,647✔
307
  handle.external_source_present_ = &external_source_present(sr);
2,147,483,647✔
308
  handle.position_ = &position(sr);
2,147,483,647✔
309
  handle.volume_task_ = &volume_task(sr);
2,147,483,647✔
310
  handle.mesh_ = &mesh(sr);
2,147,483,647✔
311
  handle.parent_sr_ = &parent_sr(sr);
2,147,483,647✔
312
  handle.scalar_flux_old_ = &scalar_flux_old(sr, 0);
2,147,483,647✔
313
  handle.scalar_flux_new_ = &scalar_flux_new(sr, 0);
2,147,483,647✔
314
  handle.source_ = &source(sr, 0);
2,147,483,647✔
315
  if (settings::run_mode == RunMode::FIXED_SOURCE) {
2,147,483,647✔
316
    handle.external_source_ = &external_source(sr, 0);
997,634,370✔
317
  } else {
318
    handle.external_source_ = nullptr;
2,147,483,647✔
319
  }
320
  handle.scalar_flux_final_ = &scalar_flux_final(sr, 0);
2,147,483,647✔
321
  handle.tally_task_ = &tally_task(sr, 0);
2,147,483,647✔
322

323
  if (handle.is_linear_) {
2,147,483,647✔
324
    handle.centroid_ = &centroid(sr);
622,550,230✔
325
    handle.centroid_iteration_ = &centroid_iteration(sr);
622,550,230✔
326
    handle.centroid_t_ = &centroid_t(sr);
622,550,230✔
327
    handle.mom_matrix_ = &mom_matrix(sr);
622,550,230✔
328
    handle.mom_matrix_t_ = &mom_matrix_t(sr);
622,550,230✔
329
    handle.source_gradients_ = &source_gradients(sr, 0);
622,550,230✔
330
    handle.flux_moments_old_ = &flux_moments_old(sr, 0);
622,550,230✔
331
    handle.flux_moments_new_ = &flux_moments_new(sr, 0);
622,550,230✔
332
    handle.flux_moments_t_ = &flux_moments_t(sr, 0);
622,550,230✔
333
  }
334

335
  if (settings::kinetic_simulation) {
2,147,483,647✔
336
    handle.scalar_flux_bd_ = &scalar_flux_bd(sr, 0);
2,147,483,647✔
337
    handle.scalar_flux_rhs_bd_ = &scalar_flux_rhs_bd(sr, 0);
2,147,483,647✔
338

339
    if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
2,147,483,647✔
340
      handle.phi_prime_ = &phi_prime(sr, 0);
2,147,483,647✔
341
    } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
500,353,510!
342
      handle.source_final_ = &source_final(sr, 0);
500,353,510✔
343

344
      handle.T1_ = &T1(sr, 0);
500,353,510✔
345

346
      handle.source_bd_ = &source_bd(sr, 0);
500,353,510✔
347
      handle.source_rhs_bd_ = &source_rhs_bd(sr, 0);
500,353,510✔
348
      handle.scalar_flux_rhs_bd_2_ = &scalar_flux_rhs_bd_2(sr, 0);
500,353,510✔
349
    }
350

351
    if (settings::create_delayed_neutrons) {
2,147,483,647!
352
      handle.delayed_fission_source_ = &delayed_fission_source(sr, 0);
2,147,483,647✔
353
      handle.precursors_old_ = &precursors_old(sr, 0);
2,147,483,647✔
354
      handle.precursors_new_ = &precursors_new(sr, 0);
2,147,483,647✔
355
      handle.precursors_final_ = &precursors_final(sr, 0);
2,147,483,647✔
356

357
      handle.precursors_bd_ = &precursors_bd(sr, 0);
2,147,483,647✔
358
      handle.precursors_rhs_bd_ = &precursors_rhs_bd(sr, 0);
2,147,483,647✔
359

360
      handle.tally_delay_task_ = &tally_delay_task(sr, 0);
2,147,483,647✔
361
    }
362
  }
363

364
  return handle;
2,147,483,647✔
365
}
366

367
void SourceRegionContainer::adjoint_reset()
1,001✔
368
{
369
  std::fill(n_hits_.begin(), n_hits_.end(), 0);
1,001✔
370
  std::fill(volume_.begin(), volume_.end(), 0.0);
1,001✔
371
  std::fill(volume_t_.begin(), volume_t_.end(), 0.0);
1,001✔
372
  std::fill(volume_sq_.begin(), volume_sq_.end(), 0.0);
1,001✔
373
  std::fill(volume_sq_t_.begin(), volume_sq_t_.end(), 0.0);
1,001✔
374
  std::fill(volume_naive_.begin(), volume_naive_.end(), 0.0);
1,001✔
375
  std::fill(
1,001✔
376
    external_source_present_.begin(), external_source_present_.end(), 0);
377
  std::fill(external_source_.begin(), external_source_.end(), 0.0);
1,001✔
378
  std::fill(centroid_.begin(), centroid_.end(), Position {0.0, 0.0, 0.0});
1,001✔
379
  std::fill(centroid_iteration_.begin(), centroid_iteration_.end(),
1,001✔
380
    Position {0.0, 0.0, 0.0});
1,001✔
381
  std::fill(centroid_t_.begin(), centroid_t_.end(), Position {0.0, 0.0, 0.0});
1,001✔
382
  std::fill(mom_matrix_.begin(), mom_matrix_.end(),
1,001✔
383
    MomentMatrix {0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
1,001✔
384
  std::fill(mom_matrix_t_.begin(), mom_matrix_t_.end(),
1,001✔
385
    MomentMatrix {0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
1,001✔
386
  if (settings::run_mode == RunMode::FIXED_SOURCE) {
1,001✔
387
    std::fill(scalar_flux_old_.begin(), scalar_flux_old_.end(), 0.0);
52✔
388
  } else {
389
    std::fill(scalar_flux_old_.begin(), scalar_flux_old_.end(), 1.0);
949✔
390
  }
391
  std::fill(scalar_flux_new_.begin(), scalar_flux_new_.end(), 0.0);
1,001✔
392
  std::fill(source_.begin(), source_.end(), 0.0f);
313,042✔
393
  std::fill(external_source_.begin(), external_source_.end(), 0.0f);
1,001✔
394
  std::fill(source_gradients_.begin(), source_gradients_.end(),
1,001✔
395
    MomentArray {0.0, 0.0, 0.0});
1,001✔
396
  std::fill(flux_moments_old_.begin(), flux_moments_old_.end(),
1,001✔
397
    MomentArray {0.0, 0.0, 0.0});
1,001✔
398
  std::fill(flux_moments_new_.begin(), flux_moments_new_.end(),
1,001✔
399
    MomentArray {0.0, 0.0, 0.0});
1,001✔
400
  std::fill(flux_moments_t_.begin(), flux_moments_t_.end(),
1,001✔
401
    MomentArray {0.0, 0.0, 0.0});
1,001✔
402
  // Reset arrays for kinetic adjoint simulations
403
  if (settings::kinetic_simulation && !simulation::is_initial_condition) {
1,001✔
404
    if (settings::create_delayed_neutrons) {
780!
405
      std::fill(
780✔
406
        delayed_fission_source_.begin(), delayed_fission_source_.end(), 0.0);
407
      std::fill(precursors_old_.begin(), precursors_old_.end(), 0.0);
780✔
408
      std::fill(precursors_new_.begin(), precursors_new_.end(), 0.0);
780✔
409
      std::fill(precursors_rhs_bd_.begin(), precursors_rhs_bd_.end(), 0.0);
780✔
410
    }
411

412
    // BD Vectors
413
    std::fill(scalar_flux_rhs_bd_.begin(), scalar_flux_rhs_bd_.end(), 0.0);
780✔
414

415
    if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
780✔
416
      std::fill(phi_prime_.begin(), phi_prime_.end(), 0.0);
520✔
417
    } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
260!
418
      std::fill(T1_.begin(), T1_.end(), 0.0);
260✔
419

420
      std::fill(source_rhs_bd_.begin(), source_rhs_bd_.end(), 0.0);
260✔
421
      std::fill(
260✔
422
        scalar_flux_rhs_bd_2_.begin(), scalar_flux_rhs_bd_2_.end(), 0.0);
423
    }
424
  }
425
}
1,001✔
426

427
//-----------------------------------------------------------------------------
428
// Methods for kinetic simulations
429

430
void SourceRegionContainer::precursors_swap()
119,000✔
431
{
432
  precursors_old_.swap(precursors_new_);
119,000✔
433
}
119,000✔
434

435
void SourceRegionContainer::time_step_reset()
936✔
436
{
437
  std::fill(scalar_flux_final_.begin(), scalar_flux_final_.end(), 0.0);
936✔
438
  std::fill(precursors_final_.begin(), precursors_final_.end(), 0.0);
936✔
439
  if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION)
936✔
440
    std::fill(source_final_.begin(), source_final_.end(), 0.0);
312✔
441
}
936✔
442

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