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

openmc-dev / openmc / 24201667475

09 Apr 2026 04:34PM UTC coverage: 81.306% (-0.03%) from 81.337%
24201667475

Pull #3702

github

web-flow
Merge 85e3d3a8b into 1eb368bbd
Pull Request #3702: Random Ray Kinetic Simulation Mode

18160 of 26198 branches covered (69.32%)

Branch coverage included in aggregate %.

935 of 1075 new or added lines in 20 files covered. (86.98%)

74 existing lines in 8 files now uncovered.

58936 of 68624 relevant lines covered (85.88%)

52648244.8 hits per line

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

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

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

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

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

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

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

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

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

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

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

162
    // Tally tasks
163
    tally_task_.emplace_back(sr.tally_task_[g]);
3,206,960✔
164

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

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

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

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

194
      // Backward difference arrays
195
      precursors_bd_.push_back(sr.precursors_bd_[dg]);
530,816✔
196
      precursors_rhs_bd_.push_back(sr.precursors_rhs_bd_[dg]);
530,816✔
197
    }
198
  }
199
}
2,334,089✔
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()
146,532✔
283
{
284
  scalar_flux_old_.swap(scalar_flux_new_);
146,532✔
285
  if (is_linear_) {
146,532✔
286
    flux_moments_old_.swap(flux_moments_new_);
7,535✔
287
  }
288
}
146,532✔
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);
1,097,467,621✔
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);
684,805,253✔
325
    handle.centroid_iteration_ = &centroid_iteration(sr);
684,805,253✔
326
    handle.centroid_t_ = &centroid_t(sr);
684,805,253✔
327
    handle.mom_matrix_ = &mom_matrix(sr);
684,805,253✔
328
    handle.mom_matrix_t_ = &mom_matrix_t(sr);
684,805,253✔
329
    handle.source_gradients_ = &source_gradients(sr, 0);
684,805,253✔
330
    handle.flux_moments_old_ = &flux_moments_old(sr, 0);
684,805,253✔
331
    handle.flux_moments_new_ = &flux_moments_new(sr, 0);
684,805,253✔
332
    handle.flux_moments_t_ = &flux_moments_t(sr, 0);
684,805,253✔
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) {
550,388,861!
342
      handle.source_final_ = &source_final(sr, 0);
550,388,861✔
343

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

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

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

411
    if (RandomRay::time_method_ == RandomRayTimeMethod::ISOTROPIC) {
900✔
412
      std::fill(phi_prime_.begin(), phi_prime_.end(), 0.0);
600✔
413
    } else if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION) {
300!
414
      std::fill(T1_.begin(), T1_.end(), 0.0);
300✔
415

416
      std::fill(source_rhs_bd_.begin(), source_rhs_bd_.end(), 0.0);
300✔
417
      std::fill(
300✔
418
        scalar_flux_rhs_bd_2_.begin(), scalar_flux_rhs_bd_2_.end(), 0.0);
419
    }
420
  }
421
}
1,156✔
422

423
void SourceRegionContainer::adjoint_reset()
76✔
424
{
425
  std::fill(
76✔
426
    external_source_present_.begin(), external_source_present_.end(), 0);
427
  std::fill(external_source_.begin(), external_source_.end(), 0.0f);
76✔
428
}
76✔
429

430
//-----------------------------------------------------------------------------
431
// Methods for kinetic simulations
432

433
void SourceRegionContainer::precursors_swap()
130,900✔
434
{
435
  precursors_old_.swap(precursors_new_);
130,900✔
436
}
130,900✔
437

438
void SourceRegionContainer::time_step_reset()
1,080✔
439
{
440
  std::fill(scalar_flux_final_.begin(), scalar_flux_final_.end(), 0.0);
1,080✔
441
  std::fill(precursors_final_.begin(), precursors_final_.end(), 0.0);
1,080✔
442
  if (RandomRay::time_method_ == RandomRayTimeMethod::PROPAGATION)
1,080✔
443
    std::fill(source_final_.begin(), source_final_.end(), 0.0);
360✔
444
}
1,080✔
445

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