mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 21:55:41 -04:00
Random ray consistency changes (#3298)
This commit is contained in:
parent
11587786e0
commit
a5b26de041
3 changed files with 17 additions and 32 deletions
|
|
@ -1110,27 +1110,27 @@ class Settings:
|
|||
if not isinstance(random_ray, Mapping):
|
||||
raise ValueError(f'Unable to set random_ray from "{random_ray}" '
|
||||
'which is not a dict.')
|
||||
for key in random_ray:
|
||||
for key, value in random_ray.items():
|
||||
if key == 'distance_active':
|
||||
cv.check_type('active ray length', random_ray[key], Real)
|
||||
cv.check_greater_than('active ray length', random_ray[key], 0.0)
|
||||
cv.check_type('active ray length', value, Real)
|
||||
cv.check_greater_than('active ray length', value, 0.0)
|
||||
elif key == 'distance_inactive':
|
||||
cv.check_type('inactive ray length', random_ray[key], Real)
|
||||
cv.check_type('inactive ray length', value, Real)
|
||||
cv.check_greater_than('inactive ray length',
|
||||
random_ray[key], 0.0, True)
|
||||
value, 0.0, True)
|
||||
elif key == 'ray_source':
|
||||
cv.check_type('random ray source', random_ray[key], SourceBase)
|
||||
cv.check_type('random ray source', value, SourceBase)
|
||||
elif key == 'volume_estimator':
|
||||
cv.check_value('volume estimator', random_ray[key],
|
||||
cv.check_value('volume estimator', value,
|
||||
('naive', 'simulation_averaged',
|
||||
'hybrid'))
|
||||
elif key == 'source_shape':
|
||||
cv.check_value('source shape', random_ray[key],
|
||||
cv.check_value('source shape', value,
|
||||
('flat', 'linear', 'linear_xy'))
|
||||
elif key == 'volume_normalized_flux_tallies':
|
||||
cv.check_type('volume normalized flux tallies', random_ray[key], bool)
|
||||
cv.check_type('volume normalized flux tallies', value, bool)
|
||||
elif key == 'adjoint':
|
||||
cv.check_type('adjoint', random_ray[key], bool)
|
||||
cv.check_type('adjoint', value, bool)
|
||||
else:
|
||||
raise ValueError(f'Unable to set random ray to "{key}" which is '
|
||||
'unsupported by OpenMC')
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ void FlatSourceDomain::update_neutron_source(double k_eff)
|
|||
|
||||
double inverse_k_eff = 1.0 / k_eff;
|
||||
|
||||
// Add scattering source
|
||||
// Add scattering + fission source
|
||||
#pragma omp parallel for
|
||||
for (int64_t sr = 0; sr < n_source_regions_; sr++) {
|
||||
int material = source_regions_.material(sr);
|
||||
|
|
@ -126,35 +126,20 @@ void FlatSourceDomain::update_neutron_source(double k_eff)
|
|||
for (int g_out = 0; g_out < negroups_; g_out++) {
|
||||
double sigma_t = sigma_t_[material * negroups_ + g_out];
|
||||
double scatter_source = 0.0;
|
||||
double fission_source = 0.0;
|
||||
|
||||
for (int g_in = 0; g_in < negroups_; g_in++) {
|
||||
double scalar_flux = source_regions_.scalar_flux_old(sr, g_in);
|
||||
double sigma_s =
|
||||
sigma_s_[material * negroups_ * negroups_ + g_out * negroups_ + g_in];
|
||||
scatter_source += sigma_s * scalar_flux;
|
||||
}
|
||||
|
||||
source_regions_.source(sr, g_out) = scatter_source / sigma_t;
|
||||
}
|
||||
}
|
||||
|
||||
// Add fission source
|
||||
#pragma omp parallel for
|
||||
for (int64_t sr = 0; sr < n_source_regions_; sr++) {
|
||||
int material = source_regions_.material(sr);
|
||||
|
||||
for (int g_out = 0; g_out < negroups_; g_out++) {
|
||||
double sigma_t = sigma_t_[material * negroups_ + g_out];
|
||||
double fission_source = 0.0;
|
||||
|
||||
for (int g_in = 0; g_in < negroups_; g_in++) {
|
||||
double scalar_flux = source_regions_.scalar_flux_old(sr, g_in);
|
||||
double nu_sigma_f = nu_sigma_f_[material * negroups_ + g_in];
|
||||
double chi = chi_[material * negroups_ + g_out];
|
||||
|
||||
scatter_source += sigma_s * scalar_flux;
|
||||
fission_source += nu_sigma_f * scalar_flux * chi;
|
||||
}
|
||||
source_regions_.source(sr, g_out) +=
|
||||
fission_source * inverse_k_eff / sigma_t;
|
||||
source_regions_.source(sr, g_out) =
|
||||
(scatter_source + fission_source * inverse_k_eff) / sigma_t;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
k-combined:
|
||||
1.006640E+00 1.812967E-03
|
||||
1.006640E+00 1.812969E-03
|
||||
tally 1:
|
||||
6.684129E+00
|
||||
8.939821E+00
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue