Crate mctal
Expand description
Module for reading MCNP MCTAL files
§Quickstart example
Suppose there is a tally for the following:
fc104 Example simple flux tally
f104:n 901 902 903 $ cells to tally
e104 1e-5 1.0 1e3 $ energy bins
The resulting MCTAL file may be read into a Mctal instance for further analysis.
// Read all file data into the core data structure
let mctal = Mctal::from_file("/path/to/file.m").expect("unable to read file");
// Find the data for `F104:N`
let tally = mctal.get_tally(104).expect("Tally 104 not found");
// Do whatever you want with the information...
assert_eq!(tally.id, 104);
assert_eq!(tally.particles, vec![Particle::Neutron]);
assert_eq!(tally.comment, "Example simple flux tally");
assert_eq!(tally.region_bins.values, vec![901.0, 902.0, 903.0]);
assert_eq!(tally.energy_bins.values, vec![1e-5, 1.0, 1e3]);
// Find the results for a particular cell
let cell_902 = tally.find_result(902).expect("cell 902 not found in tally");
// iter() is implemented for the results in region sets
let mut results = tally.iter();
results.next(); // results for cell 901
results.next(); // results for cell 902
results.next(); // results for cell 903
§Core concepts
MCNP MCTAL files contain all tally results from the latest RUNTAPE dump, and are relatively fixed-format*.
The extracted data may be broadly categorised as:
Data block | Description |
---|---|
Mctal | Primary structure containing all extracted data blocks |
Header | file metadata and run information |
Tally | all standard F tallies, including tally fluctuation chart |
Tmesh | superimposed Mesh Tally Type A (a.k.a TMESH) |
Kcode | criticality results (KCODE) |
Note that TMESH
mesh tallies are written to the MCTAL file, while FMESH
mesh tallies are not. Tools for reading FMESH
data are available in other
ntools crates (See mesh).
For all tallies, the bin data are parsed to a unified structure to be internally consistent and completely explicit. See BinData for details.
* Note: numerical items do not need to be in the columns implied by fortran formats, only blank-delimited and in the right order
Structs§
- BinData
- Struct containing all relevant bin data
- Header
- Mctal file header information
- Kcode
- KCODE tally data
- Kcode
Result - KCODE quantities for a cycle
- Mctal
- Data structure to store MCTAL file content
- Tally
- Standard tally type data
- Tally
Result - Tally result containing a value and relative error
- Tfc
- Tally fluctuation chart
- TfcResult
- Tally fluctuation chart results
- Tmesh
- TMESH tally type data
Enums§
- BinFlag
- User flag for interpretation (i.e.
Upper bounds
,Discrete points
) - BinKind
- Standard bin modifiers (i.e.
None
,Total
,Cumulative
) - Error
- The error type for
ntools-mctal
- Geometry
- Mesh geometry types
- Modifier
- Tally modifier
- Particle
- Complete collection of MCNP particle variants
- Tally
Kind - Types of detector tally