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

openmc-dev / openmc / 21296761587

23 Jan 2026 06:25PM UTC coverage: 81.971% (-0.006%) from 81.977%
21296761587

Pull #3702

github

web-flow
Merge 7459ffdfc into 3e2f1f521
Pull Request #3702: Random Ray Kinetic Simulation Mode

17714 of 24657 branches covered (71.84%)

Branch coverage included in aggregate %.

903 of 1044 new or added lines in 20 files covered. (86.49%)

79 existing lines in 9 files now uncovered.

56504 of 65885 relevant lines covered (85.76%)

52136903.61 hits per line

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

82.0
/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)
54,764,893✔
14
  : negroups_(sr.scalar_flux_old_.size()), material_(&sr.material_),
54,764,893✔
15
    density_mult_(&sr.density_mult_), is_small_(&sr.is_small_),
54,764,893✔
16
    n_hits_(&sr.n_hits_), is_linear_(sr.source_gradients_.size() > 0),
109,529,786✔
17
    lock_(&sr.lock_), volume_(&sr.volume_), volume_t_(&sr.volume_t_),
54,764,893✔
18
    volume_sq_(&sr.volume_sq_), volume_sq_t_(&sr.volume_sq_t_),
54,764,893✔
19
    volume_naive_(&sr.volume_naive_),
54,764,893✔
20
    position_recorded_(&sr.position_recorded_),
54,764,893✔
21
    external_source_present_(&sr.external_source_present_),
54,764,893✔
22
    position_(&sr.position_), centroid_(&sr.centroid_),
54,764,893✔
23
    centroid_iteration_(&sr.centroid_iteration_), centroid_t_(&sr.centroid_t_),
54,764,893✔
24
    mom_matrix_(&sr.mom_matrix_), mom_matrix_t_(&sr.mom_matrix_t_),
54,764,893✔
25
    volume_task_(&sr.volume_task_), mesh_(&sr.mesh_),
54,764,893✔
26
    parent_sr_(&sr.parent_sr_), scalar_flux_old_(sr.scalar_flux_old_.data()),
54,764,893✔
27
    scalar_flux_new_(sr.scalar_flux_new_.data()), source_(sr.source_.data()),
54,764,893✔
28
    source_final_(sr.source_.data()),
54,764,893✔
29
    external_source_(sr.external_source_.data()),
54,764,893✔
30
    scalar_flux_final_(sr.scalar_flux_final_.data()),
54,764,893✔
31
    source_gradients_(sr.source_gradients_.data()),
54,764,893✔
32
    flux_moments_old_(sr.flux_moments_old_.data()),
54,764,893✔
33
    flux_moments_new_(sr.flux_moments_new_.data()),
54,764,893✔
34
    flux_moments_t_(sr.flux_moments_t_.data()),
54,764,893✔
35
    tally_task_(sr.tally_task_.data()), phi_prime_(sr.phi_prime_.data()),
54,764,893✔
36
    T1_(sr.T1_.data()),
54,764,893✔
37
    delayed_fission_source_(sr.delayed_fission_source_.data()),
54,764,893✔
38
    precursors_old_(sr.precursors_old_.data()),
54,764,893✔
39
    precursors_new_(sr.precursors_new_.data()),
54,764,893✔
40
    precursors_final_(sr.precursors_final_.data()),
54,764,893✔
41
    scalar_flux_bd_(sr.scalar_flux_bd_.data()),
54,764,893✔
42
    source_bd_(sr.source_bd_.data()), precursors_bd_(sr.precursors_bd_.data()),
54,764,893✔
43
    scalar_flux_rhs_bd_(sr.scalar_flux_rhs_bd_.data()),
54,764,893✔
44
    source_rhs_bd_(sr.source_rhs_bd_.data()),
54,764,893✔
45
    scalar_flux_rhs_bd_2_(sr.scalar_flux_rhs_bd_2_.data()),
54,764,893✔
46
    precursors_rhs_bd_(sr.precursors_rhs_bd_.data()),
54,764,893✔
47
    tally_delay_task_(sr.tally_delay_task_.data())
109,529,786✔
48
{}
54,764,893✔
49

50
//==============================================================================
51
// SourceRegion implementation
52
//==============================================================================
53
SourceRegion::SourceRegion(int negroups, int ndgroups, bool is_linear)
2,210,767✔
54
{
55
  if (settings::run_mode == RunMode::EIGENVALUE) {
2,210,767✔
56
    // If in eigenvalue mode, set starting flux to guess of 1
57
    scalar_flux_old_.assign(negroups, 1.0);
110,070✔
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,697✔
62
    external_source_.assign(negroups, 0.0);
2,100,697✔
63
  }
64

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

69
  tally_task_.resize(negroups);
2,210,767✔
70
  if (is_linear) {
2,210,767✔
71
    source_gradients_.resize(negroups);
746,780✔
72
    flux_moments_old_.resize(negroups);
746,780✔
73
    flux_moments_new_.resize(negroups);
746,780✔
74
    flux_moments_t_.resize(negroups);
746,780✔
75
  }
76
  if (settings::kinetic_simulation) {
2,210,767✔
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,210,767✔
107

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

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

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

134
  // Only store these fields if is_linear_ is true
135
  if (is_linear_) {
2,118,527✔
136
    centroid_.push_back(sr.centroid_);
716,640✔
137
    centroid_iteration_.push_back(sr.centroid_iteration_);
716,640✔
138
    centroid_t_.push_back(sr.centroid_t_);
716,640✔
139
    mom_matrix_.push_back(sr.mom_matrix_);
716,640✔
140
    mom_matrix_t_.push_back(sr.mom_matrix_t_);
716,640✔
141
  }
142

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

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

161
    // Tally tasks
162
    tally_task_.emplace_back(sr.tally_task_[g]);
2,894,174✔
163

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

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

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

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

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

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

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

229
  scalar_flux_old_.clear();
×
230
  scalar_flux_new_.clear();
×
231
  scalar_flux_final_.clear();
×
232
  source_.clear();
×
233
  external_source_.clear();
×
234

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

242
  tally_task_.clear();
×
243
  volume_task_.clear();
×
244

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

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

NEW
255
      T1_.clear();
×
256

NEW
257
      source_bd_.clear();
×
NEW
258
      source_rhs_bd_.clear();
×
NEW
259
      scalar_flux_rhs_bd_2_.clear();
×
260
    }
261

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

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

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

280
void SourceRegionContainer::flux_swap()
130,512✔
281
{
282
  scalar_flux_old_.swap(scalar_flux_new_);
130,512✔
283
  if (is_linear_) {
130,512✔
284
    flux_moments_old_.swap(flux_moments_new_);
6,550✔
285
  }
286
}
130,512✔
287

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

320
  if (handle.is_linear_) {
2,147,483,647✔
321
    handle.centroid_ = &centroid(sr);
606,610,120✔
322
    handle.centroid_iteration_ = &centroid_iteration(sr);
606,610,120✔
323
    handle.centroid_t_ = &centroid_t(sr);
606,610,120✔
324
    handle.mom_matrix_ = &mom_matrix(sr);
606,610,120✔
325
    handle.mom_matrix_t_ = &mom_matrix_t(sr);
606,610,120✔
326
    handle.source_gradients_ = &source_gradients(sr, 0);
606,610,120✔
327
    handle.flux_moments_old_ = &flux_moments_old(sr, 0);
606,610,120✔
328
    handle.flux_moments_new_ = &flux_moments_new(sr, 0);
606,610,120✔
329
    handle.flux_moments_t_ = &flux_moments_t(sr, 0);
606,610,120✔
330
  }
331

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

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

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

343
      handle.source_bd_ = &source_bd(sr, 0);
500,353,510✔
344
      handle.source_rhs_bd_ = &source_rhs_bd(sr, 0);
500,353,510✔
345
      handle.scalar_flux_rhs_bd_2_ = &scalar_flux_rhs_bd_2(sr, 0);
500,353,510✔
346
    }
347

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

354
      handle.precursors_bd_ = &precursors_bd(sr, 0);
2,147,483,647✔
355
      handle.precursors_rhs_bd_ = &precursors_rhs_bd(sr, 0);
2,147,483,647✔
356

357
      handle.tally_delay_task_ = &tally_delay_task(sr, 0);
2,147,483,647✔
358
    }
359
  }
360

361
  return handle;
2,147,483,647✔
362
}
363

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

409
    // BD Vectors
410
    std::fill(scalar_flux_rhs_bd_.begin(), scalar_flux_rhs_bd_.end(), 0.0);
840✔
411

412
    if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
840✔
413
      std::fill(phi_prime_.begin(), phi_prime_.end(), 0.0);
560✔
414
    } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
280!
415
      std::fill(T1_.begin(), T1_.end(), 0.0);
280✔
416

417
      std::fill(source_rhs_bd_.begin(), source_rhs_bd_.end(), 0.0);
280✔
418
      std::fill(
280✔
419
        scalar_flux_rhs_bd_2_.begin(), scalar_flux_rhs_bd_2_.end(), 0.0);
560✔
420
    }
421
  }
422
}
1,079✔
423

424
//-----------------------------------------------------------------------------
425
// Methods for kinetic simulations
426

427
void SourceRegionContainer::precursors_swap()
119,000✔
428
{
429
  precursors_old_.swap(precursors_new_);
119,000✔
430
}
119,000✔
431

432
void SourceRegionContainer::time_step_reset()
1,008✔
433
{
434
  std::fill(scalar_flux_final_.begin(), scalar_flux_final_.end(), 0.0);
1,008✔
435
  std::fill(precursors_final_.begin(), precursors_final_.end(), 0.0);
1,008✔
436
  if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION)
1,008✔
437
    std::fill(source_final_.begin(), source_final_.end(), 0.0);
336✔
438
}
1,008✔
439

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