@@ -25,30 +25,35 @@ def __init__(self, name: str):
25
25
self ._read_metadata ()
26
26
27
27
@abstractmethod
28
- def build_materials (self ):
28
+ def _build_materials (self ):
29
29
"""Build materials for the benchmark."""
30
30
pass
31
31
32
32
@abstractmethod
33
- def build_geometry (self ):
33
+ def _build_geometry (self ):
34
34
"""Build geometry for the benchmark."""
35
35
pass
36
36
37
37
@abstractmethod
38
- def build_source (self ):
38
+ def _build_source (self ):
39
39
"""Build source for the benchmark."""
40
40
pass
41
41
42
42
@abstractmethod
43
- def build_settings (self ):
43
+ def _build_settings (self ):
44
44
"""Build settings for the benchmark."""
45
45
pass
46
46
47
47
@abstractmethod
48
- def build_tallies (self ):
48
+ def _build_tallies (self ):
49
49
"""Build tallies for the benchmark."""
50
50
pass
51
51
52
+ @abstractmethod
53
+ def _build_model (self ):
54
+ """Build the whole model for the benchmark."""
55
+ pass
56
+
52
57
def _read_metadata (self ):
53
58
"""Read metadata from the benchmark specification."""
54
59
metadata = self ._benchmark_spec ['metadata' ]
@@ -108,7 +113,9 @@ def __init__(self, name: str):
108
113
self ._settings = None
109
114
self ._tallies = None
110
115
111
- def build_materials (self ):
116
+ self .model = self ._build_model ()
117
+
118
+ def _build_materials (self ):
112
119
# Implement the logic to build materials for OpenMC
113
120
material_data = self ._benchmark_spec ['materials' ]
114
121
@@ -135,7 +142,7 @@ def build_materials(self):
135
142
136
143
return materials
137
144
138
- def build_geometry (self ):
145
+ def _build_geometry (self ):
139
146
140
147
def build_mesh (cad_file : str , material_tags , set_size : dict , global_mesh_size_min : float , global_mesh_size_max : float , mesh_file : str = "mesh.h5m" ):
141
148
@@ -181,7 +188,7 @@ def build_mesh(cad_file: str, material_tags, set_size: dict, global_mesh_size_mi
181
188
182
189
return openmc .Geometry (root = dag_universe )
183
190
184
- def build_source (self ):
191
+ def _build_source (self ):
185
192
source_data = self ._benchmark_spec ['sources' ]
186
193
187
194
def energy_conversion (values , units ):
@@ -296,7 +303,7 @@ def angular_conversion(values, units):
296
303
297
304
return source
298
305
299
- def build_tallies (self ):
306
+ def _build_tallies (self ):
300
307
tallies_data = self ._benchmark_spec ['tallies' ]
301
308
302
309
# Initialize openmc tallies
@@ -333,7 +340,7 @@ def build_tallies(self):
333
340
334
341
return tallies
335
342
336
- def build_settings (self ):
343
+ def _build_settings (self ):
337
344
settings_data = self ._benchmark_spec ['settings' ]
338
345
339
346
settings = openmc .Settings ()
@@ -353,3 +360,16 @@ def build_settings(self):
353
360
settings .source = source
354
361
355
362
return settings
363
+
364
+ def _build_model (self ):
365
+ materials = self ._build_materials ()
366
+ geometry = self ._build_geometry ()
367
+ settings = self ._build_settings ()
368
+ tallies = self ._build_tallies ()
369
+ model = openmc .Model (
370
+ materials = materials ,
371
+ geometry = geometry ,
372
+ settings = settings ,
373
+ tallies = tallies
374
+ )
375
+ return model
0 commit comments