ALARA Input and Output Interfaces – pyne.alara
¶
This is a module for reading and writing ALARA input to and from PyNE Mesh objects. The functionality of the module can be obtained by importing as such:
from pyne import alara
ALARA API¶
This module contains functions relevant to the ALARA activation code and the Chebyshev Rational Approximation Method
-
pyne.alara.
cram
(N, t, n_0, order)[source]¶ This function returns matrix exponential solution n using CRAM14 or CRAM16
Parameters: N : list or array
Array of nuclides under consideration
t : float
Time step
n_0 : list or array
Nuclide concentration vector
order : int
Order of method. Only 14 and 16 are supported.
-
pyne.alara.
irradiation_blocks
(material_lib, element_lib, data_library, cooling, flux_file, irr_time, output = “number_density”, truncation=1E-12, impurity = (5E-6, 1E-3), dump_file = “dump_file”)[source]¶ This function returns a string of the irradation-related input blocks. This function is meant to be used with files created by the mesh_to_geom function, in order to append the remaining input blocks to form a complete ALARA input file. Only the simplest irradiation schedule is supported: a single pulse of time <irr_time>. The notation in this function is consistent with the ALARA users’ guide, found at:
http://alara.engr.wisc.edu/users.guide.html/
Parameters: material_lib : str
Path to material library.
element_lib : str
Path to element library.
data_library : str
The data_library card (see ALARA user’s guide).
cooling : str or iterable of str
Cooling times for which output is requested. Given in ALARA form (e.g. “1 h”, “0.5 y”). Note that “shutdown” is always implicitly included.
flux_file : str
Path to the “fluxin” file.
irr_time : str
The duration of the single pulse irradiation. Given in the ALARA form (e.g. “1 h”, “0.5 y”).
output : str or iterable of str, optional.
The requested output blocks (see ALARA users’ guide).
truncation : float, optional
The chain truncation value (see ALARA users’ guide).
impurity : tuple of two floats, optional
The impurity parameters (see ALARA users’ guide).
dump_file: str, optional
Path to the dump file.
Returns: s : str
Irradition-related ALARA input blocks.
-
pyne.alara.
mesh_to_fluxin
(flux_mesh, flux_tag, fluxin=’fluxin.out’, reverse=False)[source]¶ This function creates an ALARA fluxin file from fluxes tagged on a PyNE Mesh object. Fluxes are printed in the order of the flux_mesh.__iter__().
Parameters: flux_mesh : PyNE Mesh object
Contains the mesh with fluxes tagged on each volume element.
flux_tag : string
The name of the tag of the flux mesh. Flux values for different energy groups are assumed to be represented as vector tags.
fluxin : string
The name of the ALARA fluxin file to be output.
reverse : bool
If true, fluxes will be printed in the reverse order as they appear in the flux vector tagged on the mesh.
-
pyne.alara.
mesh_to_geom
(mesh, geom_file, matlib_file)[source]¶ This function reads the materials of a PyNE mesh object and prints the geometry and materials portion of an ALARA input file, as well as a corresponding matlib file. If the mesh is structured, xyz ordering is used (z changing fastest). If the mesh is unstructured iMesh.iterate order is used.
Parameters: mesh : PyNE Mesh object
The Mesh object containing the materials to be printed.
geom_file : str
The name of the file to print the geometry and material blocks.
matlib_file : str
The name of the file to print the matlib.
-
pyne.alara.
num_density_to_mesh
(lines, time, m)[source]¶ - This function reads ALARA output containing number density information and
- creates material objects which are then added to a supplied PyNE Mesh object. The volumes within ALARA are assummed to appear in the same order as the idx on the Mesh object.
Parameters: lines : list or str
ALARA output from ALARA run with ‘number_density’ in the ‘output’ block of the input file. Lines can either be a filename or the equivalent to calling readlines() on an ALARA output file. If reading in ALARA output from stdout, call split(‘
‘) before passing it in as the lines parameter.
- time : str
The decay time for which number densities are requested (e.g. ‘1 h’, ‘shutdown’, etc.)
- m : PyNE Mesh
Mesh object for which mats will be applied to.
-
pyne.alara.
photon_source_hdf5_to_mesh
(mesh, filename, tags)[source]¶ This function reads in an hdf5 file produced by photon_source_to_hdf5 and tags the requested data to the mesh of a PyNE Mesh object. Any combinations of nuclides and decay times are allowed. The photon source file is assumed to be in mesh.__iter__() order
Parameters: mesh : PyNE Mesh
The object containing the imesh instance to be tagged.
filename : str
The path of the hdf5 version of the photon source file.
tags: dict
A dictionary were the keys are tuples with two values. The first is a string denoting an nuclide in any form that is understood by pyne.nucname (e.g. ‘1001’, ‘U-235’, ‘242Am’) or ‘TOTAL’ for all nuclides. The second is a string denoting the decay time as it appears in the file (e.g. ‘shutdown’, ‘1 h’ ‘3 d’). The values of the dictionary are the requested tag names for the combination of nuclide and decay time. For example if one wanted tags for the photon source densities from U235 at shutdown and from all nuclides at 1 hour, the dictionary could be:
tags = {(‘U-235’, ‘shutdown’) : ‘tag1’, (‘TOTAL’, ‘1 h’) : ‘tag2’}
-
pyne.alara.
photon_source_to_hdf5
(filename, chunkshape=(10000, ))[source]¶ Converts a plaintext photon source file to an HDF5 version for quick later use.
This function produces a single HDF5 file named <filename>.h5 containing the table headings:
- idx : int
- The volume element index assuming the volume elements appear in xyz order (z changing fastest) within the photon source file in the case of a structured mesh or imesh.iterate() order for an unstructured mesh.
- nuc : str
- The nuclide name as it appears in the photon source file.
- time : str
- The decay time as it appears in the photon source file.
- phtn_src : 1D array of floats
- Contains the photon source density for each energy group.
Parameters: filename : str
The path to the file
chunkshape : tuple of int
A 1D tuple of the HDF5 chunkshape.
-
pyne.alara.
phtn_src_energy_bounds
(input_file)[source]¶ Reads an ALARA input file and extracts the energy bounds from the photon_source block.
Parameters: input_file : str
The ALARA input file name, which must contain a photon_source block.
Returns: e_bounds : list of floats
The lower and upper energy bounds for the photon_source discretization.
-
pyne.alara.
record_to_geom
(mesh, cell_fracs, cell_mats, geom_file, matlib_file, sig_figs=6)[source]¶ This function preforms the same task as alara.mesh_to_geom, except the geometry is on the basis of the stuctured array output of dagmc.discretize_geom rather than a PyNE material object with materials. This allows for more efficient ALARA runs by minimizing the number of materials in the ALARA matlib. This is done by treating mixtures that are equal up to <sig_figs> digits to be the same mixture within ALARA.
Parameters: mesh : PyNE Mesh object
The Mesh object for which the geometry is discretized.
- cell_fracs : structured array
The output from dagmc.discretize_geom(). A sorted, one dimensional array, each entry containing the following fields:
idx: int The volume element index. cell: int The geometry cell number. vol_frac: float The volume fraction of the cell withing the mesh ve. rel_error: float The relative error associated with the volume fraction. - cell_mats : dict
Maps geometry cell numbers to PyNE Material objects. Each PyNE material object must have ‘name’ specified in Material.metadata.
geom_file : str
The name of the file to print the geometry and material blocks.
matlib_file : str
The name of the file to print the matlib.
sig_figs : int
The number of significant figures that two mixtures must have in common to be treated as the same mixture within ALARA.