f4enix.output.meshtal.meshtal.Meshtal#
- class f4enix.output.meshtal.meshtal.Meshtal(filename: Path | str | PathLike, filetype: str = 'MCNP')#
Bases:
objectMeshtal class to read and handle meshtal files.
- Parameters:
filename (PathLike) – path to the meshtal file to be read.
filetype (str, optional) – Output type of the file, by default “MCNP”. Other options are “CDGS” and “CUV”.
- Variables:
filetype (str) – Type of the meshtal file, can be “MCNP”, “CDGS”, or “CUV”.
mesh (dict[int, Fmesh]) – Dictionary containing Fmesh objects indexed by their mesh ID.
Methods
__init__(filename[, filetype])Meshtal class to read and handle meshtal files.
collapse_grids(name_dict)If the all the fmeshes indicated in the dictionary are defined on the same structured grid, returns a grid onto which all the fmeshes are collapsed.
create_filtered_mesh(mesh_id, binlabels[, ...])Create a filtered mesh based on the specified mesh ID and bin labels.
readMesh([mesh, norm, cell_filters])Read the meshtal file and build the mesh dictionary.
transform_fmesh(inp)Applies the transformation to the fmeshes in the meshtal object.
transform_multiple_fmesh(transf_dict)Transforms multiple fmeshes in the meshtal object.
write_all(outpath[, out_format])write all fmeshes to the outfolder in the specified format.
Attributes
Returns the list of mesh IDs.
- collapse_grids(name_dict: dict[int, list[str]]) DataSet#
If the all the fmeshes indicated in the dictionary are defined on the same structured grid, returns a grid onto which all the fmeshes are collapsed. That is, the returned grid will have all the field data that are stored in the different fmeshes.
- Parameters:
name_dict (dict[int, list[str, str]]) – this dictionary is used to assign names to the fields that are added to the grid. The key of the dictionary is the number of the fmesh, while the list of strings are [‘name of the values’, ‘name of the values statistical error’]. For instance {104: [‘neutron heating [W/cc]’, ‘neutron heating [Rel err]’]}
- Returns:
returns the pyvista grid where all fields from the different Fmeshes have been added
- Return type:
pv.DataSet
- Raises:
RuntimeError – if the fmeshes have different geometry if they do not contain only the default fields [‘Value - Total’, ‘Error - Total’].
- create_filtered_mesh(mesh_id: int, binlabels: tuple[str], ebin: int | None = None, tbin: int | None = None) Fmesh#
Create a filtered mesh based on the specified mesh ID and bin labels. That is, it returns a new Fmesh object with the data filtered only according to the time and energy bins requested.
- Parameters:
mesh_id (int) – ID of the mesh to filter.
binlabels (tuple[str]) – labels for the bins to be used in the filtered mesh.
ebin (int | None, optional) – Specific energy bin to extract, by default None
tbin (int | None, optional) – specific time bin to extract, by default None
- Returns:
Filtered Fmesh object containing only the specified bins.
- Return type:
- property mesh_ids: list[int]#
Returns the list of mesh IDs.
- readMesh(mesh: int | list[int] | None = None, norm: str | None = None, cell_filters: list[int] | None = None) None#
Read the meshtal file and build the mesh dictionary.
- Parameters:
mesh (int | list[int] | None, optional) – If None, all meshes are read. If an integer, only the mesh with that ID is read. If a list of integers, only the meshes with those IDs are read.
norm (str | None, optional) – Normalization option for CUV meshes. Default is None. Valid options are ‘ctot’ or ‘celf’. See D1SUNED manual for additional details
cell_filters (list[int] | None, optional) – List of cells with which voxels in CUV meshes are filtered. Default is None.
- transform_fmesh(inp: Input) None#
Applies the transformation to the fmeshes in the meshtal object. Given an input object, rototranslate the fmeshes in the meshtal object according to their tr=… flag in the FMESH card, by using the corresponding transformation.
- Parameters:
inp (Input) – MCNP input object including the fmesh cards and the transformations
- transform_multiple_fmesh(transf_dict: dict[int, Card]) None#
Transforms multiple fmeshes in the meshtal object. Given a dictionary of fmeshes numbers and transformation cards, rototranslate the fmeshes in the meshtal object according to the associated transformation card in the dict
- Parameters:
transf_dict (dict[int, parser.Card]) – dictionary of fmeshes numbers and transformation cards.
- write_all(outpath: Path | str | PathLike, out_format: str = 'vtk') None#
write all fmeshes to the outfolder in the specified format.
- Parameters:
outpath (os.PathLike) – path to the output folder.
out_format (str, optional) – output format. The allowed ones are [‘point_cloud’, ‘ip_fluent’, ‘csv’, ‘vtk’]. Default is .vtk