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

openmc-dev / openmc / 13686601155

05 Mar 2025 10:14PM UTC coverage: 85.272% (+0.2%) from 85.042%
13686601155

Pull #3272

github

web-flow
Merge e2d0ad1f1 into ced892912
Pull Request #3272: add continue feature for depletion

24 of 25 new or added lines in 2 files covered. (96.0%)

332 existing lines in 10 files now uncovered.

51328 of 60193 relevant lines covered (85.27%)

31317470.42 hits per line

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

95.45
/src/ncrystal_interface.cpp
1
#include "openmc/ncrystal_interface.h"
2

3
#include "openmc/error.h"
4
#include "openmc/material.h"
5
#include "openmc/random_lcg.h"
6

7
namespace openmc {
8

9
//==============================================================================
10
// NCrystalMat implementation
11
//==============================================================================
12

13
NCrystalMat::NCrystalMat(const std::string& cfg) : cfg_(cfg), proc_(cfg.c_str())
16✔
14
{}
16✔
15

16
double NCrystalMat::xs(const Particle& p) const
11,158,829✔
17
{
18
  // Calculate scattering XS per atom with NCrystal, only once per material
19
  double neutron_state[4] = {p.E(), p.u().x, p.u().y, p.u().z};
11,158,829✔
20
  return proc_.cross_section(neutron_state);
22,317,658✔
21
}
22

23
void NCrystalMat::scatter(Particle& p) const
158,829✔
24
{
25
  // Scatter with NCrystal, using the OpenMC RNG stream:
26
  uint64_t* seed = p.current_seed();
158,829✔
27
  std::function<double()> rng = [&seed]() { return prn(seed); };
903,848✔
28
  double neutron_state[4] = {p.E(), p.u().x, p.u().y, p.u().z};
158,829✔
29
  proc_.scatter(rng, neutron_state);
158,829✔
30
  // Modify attributes of particle
31
  p.E() = neutron_state[0];
158,829✔
32
  Direction u_old {p.u()};
158,829✔
33
  p.u() = Direction(neutron_state[1], neutron_state[2], neutron_state[3]);
158,829✔
34
  p.mu() = u_old.dot(p.u());
158,829✔
35
  p.event_mt() = ELASTIC;
158,829✔
36
}
158,829✔
37

38
//==============================================================================
39
// Functions
40
//==============================================================================
41

42
void ncrystal_update_micro(double xs, NuclideMicroXS& micro)
11,018,953✔
43
{
44
  if (micro.thermal > 0 || micro.thermal_elastic > 0) {
11,018,953✔
UNCOV
45
    fatal_error("S(a,b) treatment and NCrystal are not compatible.");
×
46
  }
47
  // remove free atom cross section
48
  // and replace it by scattering cross section per atom from NCrystal
49
  micro.total = micro.total - micro.elastic + xs;
11,018,953✔
50
  micro.elastic = xs;
11,018,953✔
51
}
11,018,953✔
52

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

© 2025 Coveralls, Inc