saltproc.SerpentDepcode¶
- class saltproc.SerpentDepcode(output_path, exec_path, template_input_file_path, geo_file_paths, zaid_convention)[source]¶
Interface for running depletion steps in Serpent, as well as obtaining depletion step results.
- Parameters
output_path (str) – Path to results storage directory.
exec_path (str) – Path to Serpent2 executable.
template_input_file_path (str) – Path to user input file for Serpent2
geo_file_paths (str or list) – Path to file that contains the reactor geometry. List of str if reactivity control by switching geometry is On or just str otherwise.
zaid_convention (str) –
ZAID naming convention for nuclide codes.
’serpent’ - The third digit in ZA for nuclides in isomeric states is 3 (e.g. 47310 for for Ag-110m).
’mcnp’ - ZA = Z*1000 + A + (300 + 100*m). where m is the mth isomeric state (e.g. 47510 for Ag-110m)
’nndc’ - Identical to ‘mcnp’, except Am242m1 is 95242 and Am242 is 95642
- Variables
neutronics_parameters (dict of str to type) – Holds Serpent2 depletion step neutronics parameters. Parameter names are keys and parameter values are values.
step_metadata (dict of str to type) – Holds Serpent2 depletion step metadata. Metadata labels are keys and metadata values are values.
depcode_metadata (dict of str to type) – Holds Serpent2 simulation metadata. Metadata labels are keys and metadata values are values.
runtime_inputfile (str) – Path to Serpent2 input file used to run depletion step. Contains neutron settings and non-burnable materials.
runtime_matfile (str) – Path to Serpent2 material file containing burnable materials used to run depletion step, and modified after fuel reprocessing.
npop (int) – Size of neutron population per cycle
active_cycles (int) – Number of active cycles.
inactive_cycles (int) – Number of inactive cycles.
- create_runtime_matfile(file_lines)[source]¶
Creates the runtime material file tracking burnable materials and inserts the path to this file in the Serpent2 runtime input file
- Parameters
file_lines (list of str) – Serpent2 runtime input file.
- Returns
file_lines – Serpent2 runtime input file with updated material file path.
- Return type
list of str
- get_neutron_settings(file_lines)[source]¶
Get neutron settings (no. of neutrons per cycle, no. of active and inactive cycles) from the Serpent2 input file
- Parameters
file_lines (list of str) – Serpent2 runtime input file.
- insert_path_to_geometry(lines)[source]¶
Inserts
include <first_geometry_file>
line on the 6th line of Serpent2 input file.- Parameters
lines (list of str) – Serpent2 runtime input file.
- Returns
lines – Serpent 2 runtime input file containing modified path to geometry
- Return type
list of str
- map_nuclide_name_to_serpent_name()[source]¶
Creates a dictionary mapping nuclide codes in zzaaam format to Serpent2’s nuclide code format.
- Returns
nuc_code_map – Maps zzaaam nuclide codes to Serpent2 nuclide codes.
key
Nuclide code in zzaaam format. For example, 922350 or 982510.
value
Nuclide code in Serpent2 format. For instance, 92235.09c for a nuclide with cross section data or 982510 for a decay-only nuclide.
- Return type
dict of str to str
- name_to_nuclide_code(nucname)[source]¶
Converts depcode nuclide name to ZA nuclide code
- Parameters
nucname (str) – Nuclide namce
- Returns
nuc_name – ZA nuclide code
- Return type
str
- nuclide_code_to_name(nuc_code)[source]¶
Converts Serpent2 nuclide code to symbolic nuclide name. If nuclide is in a metastable state, the nuclide name is concatenated with the letter m and the state index.
- Parameters
nuc_code (str) – Nuclide code in Serpent2 format (47310.09c)
- Returns
nuc_name – Symbolic nuclide name (Am242_m1).
- Return type
str
- read_depcode_metadata()[source]¶
Reads Serpent2 metadata and stores it in the
SerpentDepcode
object’sdepcode_metadata
attribute.
- read_depleted_materials(read_at_end=False)[source]¶
Reads depleted materials from Serpent2’s *_dep.m file and returns a dictionary containing them.
- Parameters
read_at_end (bool, optional) – If True, the function reads data at the end of the depletion step. Otherwise, the function reads data at the beginning of the depletion step.
- Returns
depleted_materials – Dictionary containing depleted materials.
key
Name of burnable material.
value
Materialflow
object holding material composition and properties.
- Return type
dict of str to Materialflow
- read_neutronics_parameters()[source]¶
Reads Serpent2 depletion step neutronics parameters and stores them in
SerpentDepcode
object’sneutronics_parameters
attribute.
- read_step_metadata()[source]¶
Reads Serpent2 depletion step metadata and stores it in the
SerpentDepcode
object’sstep_metadata
attribute.
- resolve_include_paths(lines)[source]¶
Resolves relative paths in runtime input file into absolute paths.
- Parameters
lines (list of str) – Serpent2 runtime input file.
- Returns
lines – Serpent 2 runtime input file containing modified include paths
- Return type
list of str
- run_depletion_step(mpi_args=None, threads=None)[source]¶
Runs a depletion step in Serpent2 as a subprocess.
- i Parameters
- mpi_argslist of str
Arguments for running simulations on supercomputers using
mpiexec
or similar programs.- threadsint
Threads to use for shared-memory parallelism
- set_power_load(file_lines, reactor, step_idx)[source]¶
Set the power for the current depletion step
- Parameters
file_lines (list of str) – Serpent2 runtime input file.
reactor (Reactor) – Contains information about power load curve and cumulative depletion time for the integration test.
step_idx (int) – Current depletion step.
- Returns
file_lines – Serpent2 runtime input file with power load specification.
- Return type
list of str
- switch_to_next_geometry()[source]¶
Inserts line with path to next Serpent geometry file at the beginning of the Serpent iteration input file.
- update_depletable_materials(mats, dep_end_time)[source]¶
Update material file with reprocessed material compositions.
- Parameters
mats (dict of str to Materialflow) –
Dictionary containing reprocessed material compositions
key
Name of burnable material.
value
Materialflow
object holding composition and properties.
dep_end_time (float) – Current time at the end of the depletion step (d).
- write_runtime_input(reactor, dep_step, restart)[source]¶
Write Serpent2 runtime input file for running depletion step
- Parameters
reactor (Reactor) – Contains information about power load curve and cumulative depletion time for the integration test.
dep_step (int) – Current depletion time step.
restart (bool) – Is the current simulation restarted?