@@ -259,8 +259,7 @@ def add_kinetics_parameters_tallies(self, num_groups: int | None = None):
259259 beta_tally = openmc .Tally (name = 'IFP beta numerator' )
260260 beta_tally .scores = ['ifp-beta-numerator' ]
261261 if num_groups is not None :
262- beta_tally .filters = [openmc .DelayedGroupFilter (
263- list (range (1 , num_groups + 1 )))]
262+ beta_tally .filters = [openmc .DelayedGroupFilter (list (range (1 , num_groups + 1 )))]
264263 self .tallies .append (beta_tally )
265264 if not any ('ifp-denominator' in t .scores for t in self .tallies ):
266265 denom_tally = openmc .Tally (name = 'IFP denominator' )
@@ -524,8 +523,7 @@ def deplete(
524523 check_value ('method' , method ,
525524 dep .integrators .integrator_by_name .keys ())
526525 integrator_class = dep .integrators .integrator_by_name [method ]
527- integrator = integrator_class (
528- depletion_operator , ** integrator_kwargs )
526+ integrator = integrator_class (depletion_operator , ** integrator_kwargs )
529527
530528 # Now perform the depletion
531529 with openmc .lib .quiet_dll (output ):
@@ -585,8 +583,7 @@ def export_to_xml(self, directory: PathLike = '.', remove_surfs: bool = False,
585583 # for all materials in the geometry and use that to automatically build
586584 # a collection.
587585 if self .materials :
588- self .materials .export_to_xml (
589- d , nuclides_to_ignore = nuclides_to_ignore )
586+ self .materials .export_to_xml (d , nuclides_to_ignore = nuclides_to_ignore )
590587 else :
591588 materials = openmc .Materials (self .geometry .get_all_materials ()
592589 .values ())
@@ -625,8 +622,7 @@ def export_to_model_xml(self, path: PathLike = 'model.xml', remove_surfs: bool =
625622 if not xml_path .exists ():
626623 xml_path .mkdir (parents = True , exist_ok = True )
627624 elif not xml_path .is_dir ():
628- raise FileExistsError (
629- f"File exists and is not a directory: '{ xml_path } '" )
625+ raise FileExistsError (f"File exists and is not a directory: '{ xml_path } '" )
630626 xml_path /= 'model.xml'
631627 # if this is an XML file location and the file's parent directory does
632628 # not exist, create it before continuing
@@ -1638,8 +1634,7 @@ def differentiate_mats(self, diff_volume_method: str = None, depletable_only: bo
16381634 Default is True, only depletable materials will be differentiated. If False, all materials will be
16391635 differentiated.
16401636 """
1641- check_value ('volume differentiation method' ,
1642- diff_volume_method , ("divide equally" , "match cell" , None ))
1637+ check_value ('volume differentiation method' , diff_volume_method , ("divide equally" , "match cell" , None ))
16431638
16441639 # Count the number of instances for each cell and material
16451640 self .geometry .determine_paths (instances_only = True )
@@ -1687,8 +1682,7 @@ def differentiate_mats(self, diff_volume_method: str = None, depletable_only: bo
16871682
16881683 # Clone materials
16891684 if cell .num_instances > 1 :
1690- cell .fill = [mat .clone ()
1691- for _ in range (cell .num_instances )]
1685+ cell .fill = [mat .clone () for _ in range (cell .num_instances )]
16921686 else :
16931687 cell .fill = mat .clone ()
16941688
@@ -1844,8 +1838,7 @@ def _create_mgxs_sources(
18441838 strengths .append (1.0 )
18451839
18461840 uniform_energy = openmc .stats .Discrete (x = midpoints , p = strengths )
1847- uniform_distribution = openmc .IndependentSource (
1848- spatial_dist , energy = uniform_energy , strength = 0.01 )
1841+ uniform_distribution = openmc .IndependentSource (spatial_dist , energy = uniform_energy , strength = 0.01 )
18491842 sources = [uniform_distribution ]
18501843
18511844 # If the user provided an energy distribution, use that
@@ -1961,7 +1954,13 @@ def _isothermal_infinite_media_mgxs(
19611954
19621955 # Generate MGXS
19631956 mgxs_lib = Model ._auto_generate_mgxs_lib (
1964- model , energy_groups , correction , directory , kinetic , num_delayed_groups )
1957+ model ,
1958+ energy_groups ,
1959+ correction ,
1960+ directory ,
1961+ kinetic ,
1962+ num_delayed_groups
1963+ )
19651964
19661965 if temperature != None :
19671966 return mgxs_lib .get_xsdata (domain = material , xsdata_name = name ,
@@ -2065,7 +2064,9 @@ def _generate_infinite_medium_mgxs(
20652064
20662065 # Write the file to disk.
20672066 mgxs_file = openmc .MGXSLibrary (
2068- energy_groups = energy_groups , num_delayed_groups = num_delayed_groups )
2067+ energy_groups = energy_groups ,
2068+ num_delayed_groups = num_delayed_groups
2069+ )
20692070 for mgxs_set in mgxs_sets :
20702071 mgxs_file .add_xsdata (mgxs_set )
20712072 mgxs_file .export_to_hdf5 (mgxs_path )
@@ -2092,9 +2093,14 @@ def _generate_infinite_medium_mgxs(
20922093 # Unpack the isothermal XSData objects and build a single XSData object per material.
20932094 mgxs_sets = []
20942095 for m in range (len (self .materials )):
2095- mgxs_sets .append (openmc .XSdata (self .materials [m ].name , energy_groups ,
2096- temperatures = temperatures ,
2097- num_delayed_groups = num_delayed_groups ))
2096+ mgxs_sets .append (
2097+ openmc .XSdata (
2098+ self .materials [m ].name ,
2099+ energy_groups ,
2100+ temperatures = temperatures ,
2101+ num_delayed_groups = num_delayed_groups
2102+ )
2103+ )
20982104 mgxs_sets [- 1 ].order = 0
20992105 for temperature in temperatures :
21002106 mgxs_sets [- 1 ].add_temperature_data (raw_mgxs_sets [temperature ][m ])
@@ -2256,8 +2262,13 @@ def _isothermal_stochastic_slab_mgxs(
22562262
22572263 # Generate MGXS
22582264 mgxs_lib = Model ._auto_generate_mgxs_lib (
2259- model , energy_groups , correction , directory , kinetic ,
2260- num_delayed_groups )
2265+ model ,
2266+ energy_groups ,
2267+ correction ,
2268+ directory ,
2269+ kinetic ,
2270+ num_delayed_groups
2271+ )
22612272
22622273 # Fetch all of the isothermal results.
22632274 if temperature != None :
@@ -2371,8 +2382,10 @@ def _generate_stochastic_slab_mgxs(
23712382 ).values ()
23722383
23732384 # Write the file to disk.
2374- mgxs_file = openmc .MGXSLibrary (energy_groups = energy_groups ,
2375- num_delayed_groups = num_delayed_groups )
2385+ mgxs_file = openmc .MGXSLibrary (
2386+ energy_groups = energy_groups ,
2387+ num_delayed_groups = num_delayed_groups
2388+ )
23762389 for mgxs_set in mgxs_sets :
23772390 mgxs_file .add_xsdata (mgxs_set )
23782391 mgxs_file .export_to_hdf5 (mgxs_path )
@@ -2396,9 +2409,14 @@ def _generate_stochastic_slab_mgxs(
23962409 # Unpack the isothermal XSData objects and build a single XSData object per material.
23972410 mgxs_sets = []
23982411 for mat in self .materials :
2399- mgxs_sets .append (openmc .XSdata (mat .name , energy_groups ,
2400- temperatures = temperatures ,
2401- num_delayed_groups = num_delayed_groups ))
2412+ mgxs_sets .append (
2413+ openmc .XSdata (
2414+ mat .name ,
2415+ energy_groups ,
2416+ temperatures = temperatures ,
2417+ num_delayed_groups = num_delayed_groups
2418+ )
2419+ )
24022420 mgxs_sets [- 1 ].order = 0
24032421 for temperature in temperatures :
24042422 mgxs_sets [- 1 ].add_temperature_data (raw_mgxs_sets [temperature ][mat .name ])
@@ -2479,7 +2497,13 @@ def _isothermal_materialwise_mgxs(
24792497
24802498 # Generate MGXS
24812499 mgxs_lib = Model ._auto_generate_mgxs_lib (
2482- model , energy_groups , correction , directory , kinetic , num_delayed_groups )
2500+ model ,
2501+ energy_groups ,
2502+ correction ,
2503+ directory ,
2504+ kinetic ,
2505+ num_delayed_groups
2506+ )
24832507
24842508 # Fetch all of the isothermal results.
24852509 if temperature != None :
@@ -2561,8 +2585,10 @@ def _generate_material_wise_mgxs(
25612585 ).values ()
25622586
25632587 # Write the file to disk.
2564- mgxs_file = openmc .MGXSLibrary (energy_groups = energy_groups ,
2565- num_delayed_groups = num_delayed_groups )
2588+ mgxs_file = openmc .MGXSLibrary (
2589+ energy_groups = energy_groups ,
2590+ num_delayed_groups = num_delayed_groups
2591+ )
25662592 for mgxs_set in mgxs_sets :
25672593 mgxs_file .add_xsdata (mgxs_set )
25682594 mgxs_file .export_to_hdf5 (mgxs_path )
@@ -2585,15 +2611,23 @@ def _generate_material_wise_mgxs(
25852611 # Unpack the isothermal XSData objects and build a single XSData object per material.
25862612 mgxs_sets = []
25872613 for mat in self .materials :
2588- mgxs_sets .append (openmc .XSdata (mat .name , energy_groups ,
2589- temperatures = temperatures ,
2590- num_delayed_groups = num_delayed_groups ))
2614+ mgxs_sets .append (
2615+ openmc .XSdata (
2616+ mat .name ,
2617+ energy_groups ,
2618+ temperatures = temperatures ,
2619+ num_delayed_groups = num_delayed_groups
2620+ )
2621+ )
25912622 mgxs_sets [- 1 ].order = 0
25922623 for temperature in temperatures :
25932624 mgxs_sets [- 1 ].add_temperature_data (raw_mgxs_sets [temperature ][mat .name ])
25942625
25952626 # Write the file to disk.
2596- mgxs_file = openmc .MGXSLibrary (energy_groups = energy_groups )
2627+ mgxs_file = openmc .MGXSLibrary (
2628+ energy_groups = energy_groups ,
2629+ num_delayed_groups = num_delayed_groups
2630+ )
25972631 for mgxs_set in mgxs_sets :
25982632 mgxs_file .add_xsdata (mgxs_set )
25992633 mgxs_file .export_to_hdf5 (mgxs_path )
@@ -2703,19 +2737,42 @@ def convert_to_multigroup(
27032737 if not Path (mgxs_path ).is_file () or overwrite_mgxs_library :
27042738 if method == "infinite_medium" :
27052739 self ._generate_infinite_medium_mgxs (
2706- energy_groups , nparticles , mgxs_path , correction , tmpdir ,
2707- source_energy , temperatures , temperature_settings ,
2708- kinetic , num_delayed_groups )
2740+ energy_groups ,
2741+ nparticles ,
2742+ mgxs_path ,
2743+ correction ,
2744+ tmpdir ,
2745+ source_energy ,
2746+ temperatures ,
2747+ temperature_settings ,
2748+ kinetic ,
2749+ num_delayed_groups
2750+ )
27092751 elif method == "material_wise" :
27102752 self ._generate_material_wise_mgxs (
2711- energy_groups , nparticles , mgxs_path , correction ,
2712- tmpdir , temperatures , temperature_settings ,
2713- kinetic , num_delayed_groups )
2753+ energy_groups ,
2754+ nparticles ,
2755+ mgxs_path ,
2756+ correction ,
2757+ tmpdir ,
2758+ temperatures ,
2759+ temperature_settings ,
2760+ kinetic ,
2761+ num_delayed_groups
2762+ )
27142763 elif method == "stochastic_slab" :
27152764 self ._generate_stochastic_slab_mgxs (
2716- energy_groups , nparticles , mgxs_path , correction ,
2717- tmpdir , source_energy , temperatures , temperature_settings ,
2718- kinetic , num_delayed_groups )
2765+ energy_groups ,
2766+ nparticles ,
2767+ mgxs_path ,
2768+ correction ,
2769+ tmpdir ,
2770+ source_energy ,
2771+ temperatures ,
2772+ temperature_settings ,
2773+ kinetic ,
2774+ num_delayed_groups
2775+ )
27192776 else :
27202777 raise ValueError (
27212778 f'MGXS generation method "{ method } " not recognized' )
@@ -2735,13 +2792,16 @@ def convert_to_multigroup(
27352792 # If making a set the time step size to 0.01
27362793 if kinetic :
27372794 self .settings .kinetic_simulation = True
2738- warnings .warn ("Kinetic model. Currently, only the random ray solver"
2739- " supports kinetic simulations. The number of time"
2740- " steps to run and material density transient using "
2741- " openmc.Settings.timestep_parameters['n_timesteps'] "
2742- " and openmc.Material.set_density(), respectively." )
2795+ warnings .warn (
2796+ "Kinetic model. Currently, only the random ray solver"
2797+ " supports kinetic simulations. The number of time"
2798+ " steps to run and material density transient using "
2799+ " openmc.Settings.timestep_parameters['n_timesteps'] "
2800+ " and openmc.Material.set_density(), respectively." )
27432801 self .settings .timestep_parameters = {
2744- 'dt' : 0.01 , 'timestep_units' : 's' }
2802+ 'dt' : 0.01 ,
2803+ 'timestep_units' : 's'
2804+ }
27452805
27462806 def convert_to_random_ray (self ):
27472807 """Convert a multigroup model to use random ray.
0 commit comments