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

openmc-dev / openmc / 21380032196

27 Jan 2026 12:49AM UTC coverage: 81.963% (-0.01%) from 81.977%
21380032196

Pull #3702

github

web-flow
Merge d4b973c43 into 5c502ddb3
Pull Request #3702: Random Ray Kinetic Simulation Mode

17712 of 24657 branches covered (71.83%)

Branch coverage included in aggregate %.

902 of 1043 new or added lines in 20 files covered. (86.48%)

82 existing lines in 10 files now uncovered.

56474 of 65855 relevant lines covered (85.76%)

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

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

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

69
  tally_task_.resize(negroups);
2,431,835✔
70
  if (is_linear) {
2,431,835✔
71
    source_gradients_.resize(negroups);
821,458✔
72
    flux_moments_old_.resize(negroups);
821,458✔
73
    flux_moments_new_.resize(negroups);
821,458✔
74
    flux_moments_t_.resize(negroups);
821,458✔
75
  }
76
  if (settings::kinetic_simulation) {
2,431,835✔
77
    scalar_flux_bd_.resize(negroups);
68,662✔
78
    scalar_flux_rhs_bd_.resize(negroups);
68,662✔
79

80
    if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
68,662✔
81
      // Time Isotropic arrays
82
      phi_prime_.assign(negroups, 0.0);
64,086✔
83
    } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
4,576!
84
      // Source Derivative Propogation arrays
85
      source_final_.assign(negroups, 0.0);
4,576✔
86

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

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

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

100
      precursors_bd_.resize(ndgroups);
68,662✔
101
      precursors_rhs_bd_.resize(ndgroups);
68,662✔
102

103
      tally_delay_task_.resize(ndgroups);
68,662✔
104
    }
105
  }
106
}
2,431,835✔
107

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

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

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

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

143
  // Energy-dependent fields
144
  for (int g = 0; g < negroups_; ++g) {
5,513,945✔
145
    scalar_flux_old_.push_back(sr.scalar_flux_old_[g]);
3,183,574✔
146
    scalar_flux_new_.push_back(sr.scalar_flux_new_[g]);
3,183,574✔
147
    scalar_flux_final_.push_back(sr.scalar_flux_final_[g]);
3,183,574✔
148
    source_.push_back(sr.source_[g]);
3,183,574✔
149
    if (settings::run_mode == RunMode::FIXED_SOURCE) {
3,183,574✔
150
      external_source_.push_back(sr.external_source_[g]);
2,255,350✔
151
    }
152

153
    // Only store these fields if is_linear_ is true
154
    if (is_linear_) {
3,183,574✔
155
      source_gradients_.push_back(sr.source_gradients_[g]);
857,076✔
156
      flux_moments_old_.push_back(sr.flux_moments_old_[g]);
857,076✔
157
      flux_moments_new_.push_back(sr.flux_moments_new_[g]);
857,076✔
158
      flux_moments_t_.push_back(sr.flux_moments_t_[g]);
857,076✔
159
    }
160

161
    // Tally tasks
162
    tally_task_.emplace_back(sr.tally_task_[g]);
3,183,574✔
163

164
    // Energy-dependent fields for kinetic simulations
165
    if (settings::kinetic_simulation) {
3,183,574✔
166
      scalar_flux_bd_.push_back(sr.scalar_flux_bd_[g]);
590,304✔
167
      scalar_flux_rhs_bd_.push_back(sr.scalar_flux_rhs_bd_[g]);
590,304✔
168

169
      if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
590,304✔
170
        // Time Isotropic arrays
171
        phi_prime_.push_back(sr.phi_prime_[g]);
503,360✔
172
      } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
86,944!
173
        // Source Derivative Propogation arrays
174
        source_final_.push_back(sr.source_final_[g]);
86,944✔
175

176
        T1_.push_back(sr.T1_[g]);
86,944✔
177

178
        source_bd_.push_back(sr.source_bd_[g]);
86,944✔
179
        source_rhs_bd_.push_back(sr.source_rhs_bd_[g]);
86,944✔
180
        scalar_flux_rhs_bd_2_.push_back(sr.scalar_flux_rhs_bd_2_[g]);
86,944✔
181
      }
182
    }
183
  }
184
  // Delay group-dependent fields for kinetic simulations
185
  if (settings::kinetic_simulation && settings::create_delayed_neutrons) {
2,330,371!
186
    for (int dg = 0; dg < ndgroups_; dg++) {
599,456✔
187
      delayed_fission_source_.push_back(sr.delayed_fission_source_[dg]);
530,816✔
188
      precursors_old_.push_back(sr.precursors_old_[dg]);
530,816✔
189
      precursors_new_.push_back(sr.precursors_new_[dg]);
530,816✔
190
      precursors_final_.push_back(sr.precursors_final_[dg]);
530,816✔
191
      tally_delay_task_.emplace_back(sr.tally_delay_task_[dg]);
530,816✔
192

193
      // Backward difference arrays
194
      precursors_bd_.push_back(sr.precursors_bd_[dg]);
530,816✔
195
      precursors_rhs_bd_.push_back(sr.precursors_rhs_bd_[dg]);
530,816✔
196
    }
197
  }
198
}
2,330,371✔
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()
143,562✔
281
{
282
  scalar_flux_old_.swap(scalar_flux_new_);
143,562✔
283
  if (is_linear_) {
143,562✔
284
    flux_moments_old_.swap(flux_moments_new_);
7,205✔
285
  }
286
}
143,562✔
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);
1,093,381,231✔
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);
667,271,132✔
322
    handle.centroid_iteration_ = &centroid_iteration(sr);
667,271,132✔
323
    handle.centroid_t_ = &centroid_t(sr);
667,271,132✔
324
    handle.mom_matrix_ = &mom_matrix(sr);
667,271,132✔
325
    handle.mom_matrix_t_ = &mom_matrix_t(sr);
667,271,132✔
326
    handle.source_gradients_ = &source_gradients(sr, 0);
667,271,132✔
327
    handle.flux_moments_old_ = &flux_moments_old(sr, 0);
667,271,132✔
328
    handle.flux_moments_new_ = &flux_moments_new(sr, 0);
667,271,132✔
329
    handle.flux_moments_t_ = &flux_moments_t(sr, 0);
667,271,132✔
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) {
550,388,861!
339
      handle.source_final_ = &source_final(sr, 0);
550,388,861✔
340

341
      handle.T1_ = &T1(sr, 0);
550,388,861✔
342

343
      handle.source_bd_ = &source_bd(sr, 0);
550,388,861✔
344
      handle.source_rhs_bd_ = &source_rhs_bd(sr, 0);
550,388,861✔
345
      handle.scalar_flux_rhs_bd_2_ = &scalar_flux_rhs_bd_2(sr, 0);
550,388,861✔
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,233✔
365
{
366
  std::fill(n_hits_.begin(), n_hits_.end(), 0);
1,233✔
367
  std::fill(volume_.begin(), volume_.end(), 0.0);
1,233✔
368
  std::fill(volume_t_.begin(), volume_t_.end(), 0.0);
1,233✔
369
  std::fill(volume_sq_.begin(), volume_sq_.end(), 0.0);
1,233✔
370
  std::fill(volume_sq_t_.begin(), volume_sq_t_.end(), 0.0);
1,233✔
371
  std::fill(volume_naive_.begin(), volume_naive_.end(), 0.0);
1,233✔
372
  std::fill(
1,233✔
373
    external_source_present_.begin(), external_source_present_.end(), 0);
1,233✔
374
  std::fill(external_source_.begin(), external_source_.end(), 0.0);
1,233✔
375
  std::fill(centroid_.begin(), centroid_.end(), Position {0.0, 0.0, 0.0});
1,233✔
376
  std::fill(centroid_iteration_.begin(), centroid_iteration_.end(),
1,233✔
377
    Position {0.0, 0.0, 0.0});
1,233✔
378
  std::fill(centroid_t_.begin(), centroid_t_.end(), Position {0.0, 0.0, 0.0});
1,233✔
379
  std::fill(mom_matrix_.begin(), mom_matrix_.end(),
1,233✔
380
    MomentMatrix {0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
1,233✔
381
  std::fill(mom_matrix_t_.begin(), mom_matrix_t_.end(),
1,233✔
382
    MomentMatrix {0.0, 0.0, 0.0, 0.0, 0.0, 0.0});
1,233✔
383
  if (settings::run_mode == RunMode::FIXED_SOURCE) {
1,233✔
384
    std::fill(scalar_flux_old_.begin(), scalar_flux_old_.end(), 0.0);
65✔
385
  } else {
386
    std::fill(scalar_flux_old_.begin(), scalar_flux_old_.end(), 1.0);
1,168✔
387
  }
388
  std::fill(scalar_flux_new_.begin(), scalar_flux_new_.end(), 0.0);
1,233✔
389
  std::fill(source_.begin(), source_.end(), 0.0f);
1,233✔
390
  std::fill(external_source_.begin(), external_source_.end(), 0.0f);
1,233✔
391
  std::fill(source_gradients_.begin(), source_gradients_.end(),
1,233✔
392
    MomentArray {0.0, 0.0, 0.0});
1,233✔
393
  std::fill(flux_moments_old_.begin(), flux_moments_old_.end(),
1,233✔
394
    MomentArray {0.0, 0.0, 0.0});
1,233✔
395
  std::fill(flux_moments_new_.begin(), flux_moments_new_.end(),
1,233✔
396
    MomentArray {0.0, 0.0, 0.0});
1,233✔
397
  std::fill(flux_moments_t_.begin(), flux_moments_t_.end(),
1,233✔
398
    MomentArray {0.0, 0.0, 0.0});
1,233✔
399
  // Reset arrays for kinetic adjoint simulations
400
  if (settings::kinetic_simulation && !simulation::is_initial_condition) {
1,233✔
401
    if (settings::create_delayed_neutrons) {
960!
402
      std::fill(
960✔
403
        delayed_fission_source_.begin(), delayed_fission_source_.end(), 0.0);
960✔
404
      std::fill(precursors_old_.begin(), precursors_old_.end(), 0.0);
960✔
405
      std::fill(precursors_new_.begin(), precursors_new_.end(), 0.0);
960✔
406
      std::fill(precursors_rhs_bd_.begin(), precursors_rhs_bd_.end(), 0.0);
960✔
407
    }
408

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

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

417
      std::fill(source_rhs_bd_.begin(), source_rhs_bd_.end(), 0.0);
320✔
418
      std::fill(
320✔
419
        scalar_flux_rhs_bd_2_.begin(), scalar_flux_rhs_bd_2_.end(), 0.0);
640✔
420
    }
421
  }
422
}
1,233✔
423

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

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

432
void SourceRegionContainer::time_step_reset()
1,152✔
433
{
434
  std::fill(scalar_flux_final_.begin(), scalar_flux_final_.end(), 0.0);
1,152✔
435
  std::fill(precursors_final_.begin(), precursors_final_.end(), 0.0);
1,152✔
436
  if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION)
1,152✔
437
    std::fill(source_final_.begin(), source_final_.end(), 0.0);
384✔
438
}
1,152✔
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