SCALE Interface¶
This module contains funcions specific to the the ‘SCALE <https://www.ornl.gov/scale>_’ simulation suite. If running the Monte Carlo transport for each step with a different simulation suite, this module should be altered/replaced.
Created on Tue Sep 6 08:55:17 2022
@author: noahwalton
- ADAM.scale_interface.create_tsunami_input(template_file, input_file, step, hex_number, generations)[source]¶
Creates a tsunami input file from the template file with a random number seed, adds number of generations and removes read source input if on the first step.
- Parameters
template_file (string) – Filename of template file.
input_file (string) – Filename of input file to create.
steps (int) – Step number in the gradient descent algorithm.
hex_number (float) – Python generated random number seed.
generations (int) – Monte Carlo generations to be run in each step.
- Return type
None.
- ADAM.scale_interface.get_combined_derivatives(pixel_array, material_dict_base)[source]¶
Combines nuclide derivatives for each region and then for each parameter within each pixel in the pixel array.
See also
pixel.combine_derivatives_wrt_nuclides
- Parameters
pixel_array (TYPE) – DESCRIPTION.
material_dict_base (TYPE) – DESCRIPTION.
- Returns
DataFrame of sensitivities wrt optimization parameters.
- Return type
DataFrame
- ADAM.scale_interface.material_string(pixel)[source]¶
Creates the updated material string attribute for pixel object.
This attribute is a string specific to the pixel object it belongs to corresponding to a SCALE material composition input. The material id format is as follows, the first 4 digits represent the pixel, the last digit, or digit with magnitude 1e0, represents the region within the pixel and will repeat within each pixel.
- Raises
ValueError – DESCRIPTION.
- Return type
SCALE composition material string for the given pixel.
- ADAM.scale_interface.parse_sdf_file_into_dict(tsunami_file_string)[source]¶
Parses the SDF file to get energy integrated sensitivities.
This is a legacy function and will not work with the current ADAM implementation. The current implementation reads energy integrated sensitivities from the .out file. The .sdf file contains energy binned sensitivity data as well as energy integrated. This function was kept in case the user wishes to update the algorithm to read sensitivities from .sdf files rather than the output.
- Parameters
tsunami_file_string (TYPE) – DESCRIPTION.
- Raises
ValueError – DESCRIPTION.
- Returns
data_dict – DESCRIPTION.
- Return type
TYPE
- ADAM.scale_interface.read_keff(tsunami_file_string)[source]¶
Reads a SCALE.out file to pull the k-eff and statistical uncertainty.
- Parameters
tsunami_file_string (string) – Filename of the SCALE.out file to be read.
- Returns
keff (float) – k-eigenvalue of the system.
unc (float) – Statistical uncertainty in the k-eigenvalue.
- ADAM.scale_interface.read_total_sensitivity_by_mixture(tsunami_file_string)[source]¶
Reads a SCALE.out file and parses out the sensitivities by mixture.
Because these sensitivities are coming directly from the SCALE.out file, they are relative, S = sig/k * dk/dsig See the theory in the SCALE manual or research papers associated with this work.
- Parameters
tsunami_file_string (string) – Filename of the SCALE.out file to be read.
- Returns
DataFrame with columns mixture_id, sensitivity, and uncertainty. The sensitivity is relative, see theory. The uncertainty is absolute with respect to the sensitivity and due to the statistical nature of the Monte Carlo problem.
- Return type
DataFrame
- ADAM.scale_interface.read_total_sensitivity_by_nuclide(tsunami_file_string, pixel_array)[source]¶
Reads out energy integrated total sensitivities for each nuclide for each material id.
This function reads sensitivity data from the SDF, but needs to read the output file as well in order to get atom densities. A more simple implementation is to also read sensitivities from the output file, but a weird bug in TSUNAMI causes these not to always be written correctly. See the old function “read_total_sensitivity_by_nuclide_OUTPUTFILEONLY” in this scale_interface module for the more simple implemntation. Perhaps the TSUNAMI bug will be fixed in the future.
- Parameters
tsunami_file_string (string) – Basename of the of the SCALE outfiles file to read.
pixel_array (object array) – Array of pixel objects describing the problem geometry.
- Returns
data – Nested dictionary where first set of keys are scale material id numbers, then second set of keys are nuclides. For a given material/isotope key-set, 4 values are given as a tuple: (sensitivity, uncertainty, atom_density, absolute_sensitivity)
- Return type
nested dict
- ADAM.scale_interface.read_total_sensitivity_by_nuclide_OUTPUTFILEONLY(tsunami_file_string, pixel_array)[source]¶
Reads out energy integrated total sensitivities for each nuclide in each material id region.
This function is no longer used because of a weird bug in TSUNAMI where every now and then a random material sensitivity won’t write to the Total Sensitivity Coefficients by Nuclide table in the output file.
The updated function in this module that is actually used in ADAM reads sensitivites from the SDF file then atom densities from the output file. This, however, is a more complicated procedure. The weird bug in TSUNAMI, was noticed to only occur when a material id’s sensitivites are all zero! This is evident of a deeper bug, hoever, if this more simple function for reading sensitivities from the output file is desired, include some logic that sets sensitivities to zero for all isotopes in a given material ID if that ID id not found in the output file.
- Parameters
tsunami_file_string (string) – Filenmae of the SCALE.out file to read.
- Returns
data – Nested dictionary where first set of keys are scale material id numbers, then second set of keys are nuclides. For a given material/isotope key-set, 4 values are given as a tuple: (sensitivity, uncertainty, atom_density, absolute_sensitivity)
- Return type
nested dict