mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Enable fission heating tallies in the random ray solver (#3714)
This commit is contained in:
parent
73a98b2cc6
commit
3e2f1f521a
13 changed files with 315 additions and 6 deletions
|
|
@ -513,6 +513,7 @@ Supported scores:
|
|||
- total
|
||||
- fission
|
||||
- nu-fission
|
||||
- kappa-fission
|
||||
- events
|
||||
|
||||
Supported Estimators:
|
||||
|
|
|
|||
|
|
@ -107,6 +107,7 @@ public:
|
|||
vector<double> nu_sigma_f_;
|
||||
vector<double> sigma_f_;
|
||||
vector<double> chi_;
|
||||
vector<double> kappa_fission_;
|
||||
|
||||
// 3D arrays stored in 1D representing values for all materials x energy
|
||||
// groups x energy groups
|
||||
|
|
|
|||
|
|
@ -1729,12 +1729,14 @@ class Model:
|
|||
if correction == 'P0':
|
||||
mgxs_lib.mgxs_types = [
|
||||
'nu-transport', 'absorption', 'nu-fission', 'fission',
|
||||
'consistent nu-scatter matrix', 'multiplicity matrix', 'chi'
|
||||
'consistent nu-scatter matrix', 'multiplicity matrix', 'chi',
|
||||
'kappa-fission'
|
||||
]
|
||||
elif correction is None:
|
||||
mgxs_lib.mgxs_types = [
|
||||
'total', 'absorption', 'nu-fission', 'fission',
|
||||
'consistent nu-scatter matrix', 'multiplicity matrix', 'chi'
|
||||
'consistent nu-scatter matrix', 'multiplicity matrix', 'chi',
|
||||
'kappa-fission'
|
||||
]
|
||||
|
||||
# Specify a "material" domain type for the cross section tally filters
|
||||
|
|
|
|||
|
|
@ -665,10 +665,15 @@ void FlatSourceDomain::random_ray_tally()
|
|||
score = 1.0;
|
||||
break;
|
||||
|
||||
case SCORE_KAPPA_FISSION:
|
||||
score = flux * volume * kappa_fission_[material * negroups_ + g] *
|
||||
density_mult;
|
||||
break;
|
||||
|
||||
default:
|
||||
fatal_error("Invalid score specified in tallies.xml. Only flux, "
|
||||
"total, fission, nu-fission, and events are supported in "
|
||||
"random ray mode.");
|
||||
"total, fission, nu-fission, kappa-fission, and events "
|
||||
"are supported in random ray mode.");
|
||||
break;
|
||||
}
|
||||
// Apply score to the appropriate tally bin
|
||||
|
|
@ -1165,6 +1170,10 @@ void FlatSourceDomain::flatten_xs()
|
|||
}
|
||||
chi_.push_back(chi);
|
||||
|
||||
double kappa_fission =
|
||||
m.get_xs(MgxsType::KAPPA_FISSION, g_out, NULL, NULL, NULL, t, a);
|
||||
kappa_fission_.push_back(kappa_fission);
|
||||
|
||||
for (int g_in = 0; g_in < negroups_; g_in++) {
|
||||
double sigma_s =
|
||||
m.get_xs(MgxsType::NU_SCATTER, g_in, &g_out, NULL, NULL, t, a);
|
||||
|
|
@ -1180,6 +1189,7 @@ void FlatSourceDomain::flatten_xs()
|
|||
nu_sigma_f_.push_back(0);
|
||||
sigma_f_.push_back(0);
|
||||
chi_.push_back(0);
|
||||
kappa_fission_.push_back(0);
|
||||
for (int g_in = 0; g_in < negroups_; g_in++) {
|
||||
sigma_s_.push_back(0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,11 +83,12 @@ void validate_random_ray_inputs()
|
|||
case SCORE_FISSION:
|
||||
case SCORE_NU_FISSION:
|
||||
case SCORE_EVENTS:
|
||||
case SCORE_KAPPA_FISSION:
|
||||
break;
|
||||
default:
|
||||
fatal_error(
|
||||
"Invalid score specified. Only flux, total, fission, nu-fission, and "
|
||||
"event scores are supported in random ray mode.");
|
||||
"Invalid score specified. Only flux, total, fission, nu-fission, "
|
||||
"kappa-fission, and event scores are supported in random ray mode.");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<model>
|
||||
<materials>
|
||||
<cross_sections>mgxs.h5</cross_sections>
|
||||
<material id="1" name="UO2__2_4__" depletable="true">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="UO2__2_4__"/>
|
||||
</material>
|
||||
<material id="2" name="Zircaloy">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="Zircaloy"/>
|
||||
</material>
|
||||
<material id="3" name="Hot_borated_water">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="Hot_borated_water"/>
|
||||
</material>
|
||||
</materials>
|
||||
<geometry>
|
||||
<cell id="1" name="Fuel" material="1" region="-1" universe="0"/>
|
||||
<cell id="2" name="Cladding" material="2" region="1 -2" universe="0"/>
|
||||
<cell id="3" name="Water" material="3" region="2 3 -4 5 -6" universe="0"/>
|
||||
<surface id="1" name="Fuel OR" type="z-cylinder" coeffs="0 0 0.39218"/>
|
||||
<surface id="2" name="Clad OR" type="z-cylinder" coeffs="0 0 0.4572"/>
|
||||
<surface id="3" name="left" type="x-plane" boundary="reflective" coeffs="-0.63"/>
|
||||
<surface id="4" name="right" type="x-plane" boundary="reflective" coeffs="0.63"/>
|
||||
<surface id="5" name="bottom" type="y-plane" boundary="reflective" coeffs="-0.63"/>
|
||||
<surface id="6" name="top" type="y-plane" boundary="reflective" coeffs="0.63"/>
|
||||
</geometry>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source type="independent" strength="1.0" particle="neutron">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1 0.63 0.63 1</parameters>
|
||||
</space>
|
||||
<constraints>
|
||||
<fissionable>true</fissionable>
|
||||
</constraints>
|
||||
</source>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<random_ray>
|
||||
<source type="independent" strength="1.0" particle="neutron">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1.0 0.63 0.63 1.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<distance_inactive>30.0</distance_inactive>
|
||||
<distance_active>150.0</distance_active>
|
||||
<source_region_meshes>
|
||||
<mesh id="1">
|
||||
<domain id="0" type="universe"/>
|
||||
</mesh>
|
||||
</source_region_meshes>
|
||||
<source_shape>linear</source_shape>
|
||||
</random_ray>
|
||||
<mesh id="1">
|
||||
<dimension>2 2</dimension>
|
||||
<lower_left>-0.63 -0.63</lower_left>
|
||||
<upper_right>0.63 0.63</upper_right>
|
||||
</mesh>
|
||||
</settings>
|
||||
<tallies>
|
||||
<filter id="61" type="material">
|
||||
<bins>1</bins>
|
||||
</filter>
|
||||
<tally id="193" name="KF Tally">
|
||||
<filters>61</filters>
|
||||
<scores>kappa-fission</scores>
|
||||
</tally>
|
||||
</tallies>
|
||||
</model>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
k-combined:
|
||||
7.479770E-01 1.624548E-02
|
||||
tally 1:
|
||||
2.965503E+08
|
||||
1.762157E+16
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<model>
|
||||
<materials>
|
||||
<cross_sections>mgxs.h5</cross_sections>
|
||||
<material id="1" name="UO2__2_4__" depletable="true">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="UO2__2_4__"/>
|
||||
</material>
|
||||
<material id="2" name="Zircaloy">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="Zircaloy"/>
|
||||
</material>
|
||||
<material id="3" name="Hot_borated_water">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="Hot_borated_water"/>
|
||||
</material>
|
||||
</materials>
|
||||
<geometry>
|
||||
<cell id="1" name="Fuel" material="1" region="-1" universe="0"/>
|
||||
<cell id="2" name="Cladding" material="2" region="1 -2" universe="0"/>
|
||||
<cell id="3" name="Water" material="3" region="2 3 -4 5 -6" universe="0"/>
|
||||
<surface id="1" name="Fuel OR" type="z-cylinder" coeffs="0 0 0.39218"/>
|
||||
<surface id="2" name="Clad OR" type="z-cylinder" coeffs="0 0 0.4572"/>
|
||||
<surface id="3" name="left" type="x-plane" boundary="reflective" coeffs="-0.63"/>
|
||||
<surface id="4" name="right" type="x-plane" boundary="reflective" coeffs="0.63"/>
|
||||
<surface id="5" name="bottom" type="y-plane" boundary="reflective" coeffs="-0.63"/>
|
||||
<surface id="6" name="top" type="y-plane" boundary="reflective" coeffs="0.63"/>
|
||||
</geometry>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source type="independent" strength="1.0" particle="neutron">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1 0.63 0.63 1</parameters>
|
||||
</space>
|
||||
<constraints>
|
||||
<fissionable>true</fissionable>
|
||||
</constraints>
|
||||
</source>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<random_ray>
|
||||
<source type="independent" strength="1.0" particle="neutron">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1.0 0.63 0.63 1.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<distance_inactive>30.0</distance_inactive>
|
||||
<distance_active>150.0</distance_active>
|
||||
<source_region_meshes>
|
||||
<mesh id="1">
|
||||
<domain id="0" type="universe"/>
|
||||
</mesh>
|
||||
</source_region_meshes>
|
||||
<source_shape>linear</source_shape>
|
||||
</random_ray>
|
||||
<mesh id="1">
|
||||
<dimension>2 2</dimension>
|
||||
<lower_left>-0.63 -0.63</lower_left>
|
||||
<upper_right>0.63 0.63</upper_right>
|
||||
</mesh>
|
||||
</settings>
|
||||
<tallies>
|
||||
<filter id="97" type="material">
|
||||
<bins>1</bins>
|
||||
</filter>
|
||||
<tally id="203" name="KF Tally">
|
||||
<filters>97</filters>
|
||||
<scores>kappa-fission</scores>
|
||||
</tally>
|
||||
</tallies>
|
||||
</model>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
k-combined:
|
||||
7.372542E-01 6.967831E-03
|
||||
tally 1:
|
||||
2.909255E+08
|
||||
1.693395E+16
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<model>
|
||||
<materials>
|
||||
<cross_sections>mgxs.h5</cross_sections>
|
||||
<material id="1" name="UO2__2_4__" depletable="true">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="UO2__2_4__"/>
|
||||
</material>
|
||||
<material id="2" name="Zircaloy">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="Zircaloy"/>
|
||||
</material>
|
||||
<material id="3" name="Hot_borated_water">
|
||||
<density value="1.0" units="macro"/>
|
||||
<macroscopic name="Hot_borated_water"/>
|
||||
</material>
|
||||
</materials>
|
||||
<geometry>
|
||||
<cell id="1" name="Fuel" material="1" region="-1" universe="0"/>
|
||||
<cell id="2" name="Cladding" material="2" region="1 -2" universe="0"/>
|
||||
<cell id="3" name="Water" material="3" region="2 3 -4 5 -6" universe="0"/>
|
||||
<surface id="1" name="Fuel OR" type="z-cylinder" coeffs="0 0 0.39218"/>
|
||||
<surface id="2" name="Clad OR" type="z-cylinder" coeffs="0 0 0.4572"/>
|
||||
<surface id="3" name="left" type="x-plane" boundary="reflective" coeffs="-0.63"/>
|
||||
<surface id="4" name="right" type="x-plane" boundary="reflective" coeffs="0.63"/>
|
||||
<surface id="5" name="bottom" type="y-plane" boundary="reflective" coeffs="-0.63"/>
|
||||
<surface id="6" name="top" type="y-plane" boundary="reflective" coeffs="0.63"/>
|
||||
</geometry>
|
||||
<settings>
|
||||
<run_mode>eigenvalue</run_mode>
|
||||
<particles>100</particles>
|
||||
<batches>10</batches>
|
||||
<inactive>5</inactive>
|
||||
<source type="independent" strength="1.0" particle="neutron">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1 0.63 0.63 1</parameters>
|
||||
</space>
|
||||
<constraints>
|
||||
<fissionable>true</fissionable>
|
||||
</constraints>
|
||||
</source>
|
||||
<energy_mode>multi-group</energy_mode>
|
||||
<random_ray>
|
||||
<source type="independent" strength="1.0" particle="neutron">
|
||||
<space type="box">
|
||||
<parameters>-0.63 -0.63 -1.0 0.63 0.63 1.0</parameters>
|
||||
</space>
|
||||
</source>
|
||||
<distance_inactive>30.0</distance_inactive>
|
||||
<distance_active>150.0</distance_active>
|
||||
<source_region_meshes>
|
||||
<mesh id="1">
|
||||
<domain id="0" type="universe"/>
|
||||
</mesh>
|
||||
</source_region_meshes>
|
||||
<source_shape>linear</source_shape>
|
||||
</random_ray>
|
||||
<mesh id="1">
|
||||
<dimension>2 2</dimension>
|
||||
<lower_left>-0.63 -0.63</lower_left>
|
||||
<upper_right>0.63 0.63</upper_right>
|
||||
</mesh>
|
||||
</settings>
|
||||
<tallies>
|
||||
<filter id="97" type="material">
|
||||
<bins>1</bins>
|
||||
</filter>
|
||||
<tally id="203" name="KF Tally">
|
||||
<filters>97</filters>
|
||||
<scores>kappa-fission</scores>
|
||||
</tally>
|
||||
</tallies>
|
||||
</model>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
k-combined:
|
||||
6.413334E-01 2.083132E-02
|
||||
tally 1:
|
||||
2.541463E+08
|
||||
1.297259E+16
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
import os
|
||||
|
||||
import openmc
|
||||
from openmc.examples import pwr_pin_cell
|
||||
from openmc import RegularMesh
|
||||
from openmc.utility_funcs import change_directory
|
||||
import pytest
|
||||
|
||||
from tests.testing_harness import TolerantPyAPITestHarness
|
||||
|
||||
|
||||
class MGXSTestHarness(TolerantPyAPITestHarness):
|
||||
def _cleanup(self):
|
||||
super()._cleanup()
|
||||
f = 'mgxs.h5'
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("method", ["material_wise", "stochastic_slab", "infinite_medium"])
|
||||
def test_random_ray_auto_convert(method):
|
||||
with change_directory(method):
|
||||
openmc.reset_auto_ids()
|
||||
|
||||
# Start with a normal continuous energy model
|
||||
model = pwr_pin_cell()
|
||||
|
||||
# Convert to a multi-group model
|
||||
model.convert_to_multigroup(
|
||||
method=method, groups='CASMO-2', nparticles=100,
|
||||
overwrite_mgxs_library=False, mgxs_path="mgxs.h5"
|
||||
)
|
||||
|
||||
# Convert to a random ray model
|
||||
model.convert_to_random_ray()
|
||||
|
||||
# Set the number of particles
|
||||
model.settings.particles = 100
|
||||
|
||||
# Overlay a basic 2x2 mesh
|
||||
n = 2
|
||||
mesh = RegularMesh()
|
||||
mesh.dimension = (n, n)
|
||||
bbox = model.geometry.bounding_box
|
||||
mesh.lower_left = (bbox.lower_left[0], bbox.lower_left[1])
|
||||
mesh.upper_right = (bbox.upper_right[0], bbox.upper_right[1])
|
||||
model.settings.random_ray['source_region_meshes'] = [
|
||||
(mesh, [model.geometry.root_universe])]
|
||||
|
||||
# Set the source shape to linear
|
||||
model.settings.random_ray['source_shape'] = 'linear'
|
||||
|
||||
# Set a material tally
|
||||
t = openmc.Tally(name = 'KF Tally')
|
||||
t.filters = [openmc.MaterialFilter(bins=1)]
|
||||
t.scores = ['kappa-fission']
|
||||
model.tallies.append(t)
|
||||
|
||||
harness = MGXSTestHarness('statepoint.10.h5', model)
|
||||
harness.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue