saltproc.serpent_depcode module

class saltproc.serpent_depcode.SerpentDepcode(output_path, exec_path, template_input_file_path, geo_file_paths, zaid_convention)[source]

Bases: Depcode

Interface for running depletion steps in Serpent, as well as obtaining depletion step results.

neutronics_parameters

Holds Serpent2 depletion step neutronics parameters. Parameter names are keys and parameter values are values.

Type

dict of str to type

step_metadata

Holds Serpent2 depletion step metadata. Metadata labels are keys and metadata values are values.

Type

dict of str to type

runtime_inputfile

Path to Serpent2 input file used to run depletion step. Contains neutron settings and non-burnable materials.

Type

str

runtime_matfile

Path to Serpent2 material file containing burnable materials used to run depletion step, and modified after fuel reprocessing.

Type

str

npop

Size of neutron population per cycle

Type

int

active_cycles

Number of active cycles.

Type

int

inactive_cycles

Number of inactive cycles.

Type

int

__init__(output_path, exec_path, template_input_file_path, geo_file_paths, zaid_convention)[source]

Initialize a SerpentDepcode object.

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

convert_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 (Am242m1).

Return type

str

convert_nuclide_code_to_zam(nuc_code)[source]

Converts nuclide code from Serpent2 format to zam format. Checks Serpent2-specific meta stable-flag for zzaaam. For instance, 47310 instead of 471101 for Ag-110m1. Metastable isotopes represented with aaa started with 3.

Parameters

nuc_code (int) – Nuclide code in Serpent2 format (47310).

Returns

nuc_zzaam – Nuclide code in in zzaaam form (471101).

Return type

int

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_code_zam_to_serpent()[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

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’s neutronics_parameters attribute.

read_plaintext_file(file_path)[source]

Reads the content of a plaintext file for use by other methods.

Parameters

file_path (str) – Path to file.

Returns

file_lines – File lines.

Return type

list of str

read_step_metadata()[source]

Reads Serpent2 depletion step metadata and stores it in the SerpentDepcode object’s step_metadata attribute.

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?