-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjetson2d_random_ray.py
More file actions
70 lines (55 loc) · 2.08 KB
/
jetson2d_random_ray.py
File metadata and controls
70 lines (55 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
"""Random ray weight window generation benchmark for the Jetson 2D model.
Converts the Jetson 2D model to multigroup (using a pre-existing mgxs.h5),
then runs random ray with a FW-CADIS weight window generator.
"""
from __future__ import annotations
from pathlib import Path
import openmc
import openmc.mgxs
import openmc.stats
from ._jetson2d import RO, build_base_model, _chdir
from benchmarks.config import _CONFIGS
BENCHMARK_NAME = "Jetson2dRandomRay"
_MODELS_DIR = Path(__file__).parent
CONFIGS = tuple(config for config in _CONFIGS if config[1] is None)
def build_model() -> openmc.Model:
model, mesh, plasma_cell = build_base_model()
group_edges = openmc.mgxs.GROUP_STRUCTURES["CASMO-4"]
# Convert to multigroup using the pre-existing mgxs.h5
with _chdir(_MODELS_DIR):
model.convert_to_multigroup(
method="stochastic_slab",
nparticles=10000,
groups=openmc.mgxs.EnergyGroups(group_edges),
overwrite_mgxs_library=False,
correction=None,
)
# Convert to random ray mode
model.convert_to_random_ray()
# Random ray settings
model.settings.random_ray["source_region_meshes"] = [
(mesh, [model.geometry.root_universe])
]
model.settings.particles = 500
model.settings.batches = 100
model.settings.inactive = 50
model.settings.random_ray["distance_inactive"] = 4000
model.settings.random_ray["distance_active"] = 20000
model.settings.random_ray["ray_source"] = openmc.IndependentSource(
space=openmc.stats.Box(
lower_left=[-RO, -RO, -RO],
upper_right=[RO, RO, RO],
only_fissionable=False,
)
)
model.settings.random_ray["source_shape"] = "flat"
model.settings.random_ray["sample_method"] = "halton"
model.settings.random_ray["volume_estimator"] = "hybrid"
# FW-CADIS weight window generator
wwg = openmc.WeightWindowGenerator(
method="fw_cadis",
mesh=mesh,
max_realizations=model.settings.batches,
)
model.settings.weight_window_generators = wwg
return model