Crate ntools_mesh
Expand description
Mesh tally tools and file parsing
Module for storing and using mesh data from all output formats and geometry types.
All of the parsing and reader logic is re-exported to make reading files very simple, regardless of format. For example:
// Extract ALL meshes from a file into a Vec<Mesh>
let mesh_list = read("/path/to/meshtal.msht").unwrap();
// Extract just one target Mesh from a file
let mesh = read_target("/path/to/meshtal.msht", 104).unwrap();
§Supported output formats
For more detail, see the OUT
keyword for the FMESH
card definition in
the MCNPv6.2
or MCNPv6.3
user manuals.
Output format | Supported? | Description |
---|---|---|
XDMF/HDF5 | Yes | MCNP >6.3 runtape HDF5 format |
COL | Yes | Column data (MCNP default) |
CF | Yes | Column data including voxel volume |
IJ | Yes | 2D matrix of I (col) and J (row) data, grouped by K |
IK | Yes | 2D matrix of I (col) and K (row) data, grouped by J |
JK | Yes | 2D matrix of J (col) and K (row) data, grouped by I |
CUV (UKAEA) | Yes | UKAEA Cell-under-Voxel column data |
NONE | N/A | NONE or unknown output format |
Note that HDF5
formats require the hdf5 shared library to be installed
on your system. e.g.
sudo apt-get install libhdf5-dev
HDF5 is opt-in and will be enabled with the --hdf5
feature flag.
§Supported mesh geometries
All functionality is fully supported for both rectangular and cylindrical meshes.
Mesh geometry | Supported? | MCNP designators |
---|---|---|
Rectangular | Yes | rec, xyz |
Cylindrical | Yes | cyl, rzt |
Spherical | No | sph, rpt |
Spherical meshes are not currently supported because barely anyone knows about them, let alone uses them. They are a low priority.
§Quickstart example
Example to read in a mesh tally and perform varius operations.
fn main() {
// Read mesh 104 from the meshtal file
let mut mesh = read_target("./data/meshes/fmesh_104.msht", 104).unwrap();
// print a summary of the mesh (Display trait impemented)
println!("{mesh}");
// rescale, get data, do whatever is needed
mesh.scale(1.0e+06);
println!("Maximum flux: {:?}", mesh.maximum());
println!("Minimum flux: {:?}", mesh.minimum());
println!("Average flux: {:?}", mesh.average());
// Convert to VTK with the default configuration
let vtk = mesh_to_vtk(&mesh);
// Write the VTK to a file in one of several formats
write_vtk(vtk, "my_output.vtk", VtkFormat::Xml).unwrap();
}
Modules§
Structs§
- Mesh
- Common data structure representing a mesh tally
- Point
- Generic representation of a point in the mesh geometry
- Voxel
- Representation of a single voxel in the mesh
- Voxel
Coordinate - Convenience structure for collecting voxel coordiante information
Enums§
- Boundary
Treatment - Method variants for dealing with a Point on boundaries
- Error
- The error type for
ntools-mesh
- Format
- Meshtal output formats, e.g.
COL
,JK
,CUV
… - Geometry
- Mesh geometry types, i.e.
Rectangular
,Cylindrical
- Group
- Energy/Time groups are either
Total
or an upper bin edge - Particle
- Complete collection of MCNP particle variants
- Point
Kind - Variants for the type of Point coordinates
Traits§
- Voxel
Slice Ext - Extension trait for slices of voxels
Functions§
- mesh_
to_ vtk - Convert a mesh tally to vtk using default options
- read
- Read all meshes in a meshtal file
- read_
target - Read only the specified mesh from a meshtal file
- read_
target_ pb - Read only the specified mesh, with progress bar
- write_
vtk - Write any vtk to file