Command line tool to convert MCNP mesh tallies of any type to a mesh-based global weight window.
This uses the Method of Automatic Generation of Importances by Calculation (a.k.a MAGIC) with configurable de-tuning options.
Usage: mesh2ww <file> <number> [options] [+]
Arguments:
<file> Path to meshtal file
<number> Mesh tally identifier
Weight options:
-p, --power <num>... Set the softening/de-tuning factor
-e, --error <num>... Maximum rel. error, use analogue above
-t, --total Weights from 'Total' groups only
-s, --scale <num> Multiply all weights by a constant
Global file options:
-o, --output <path> Name of output file ('wwinp' default)
--trim Exclude unused particles from wwinp header
Global VTK options:
--vtk Write VTK files for plotting weights
-f, --format <fmt> Set the VTK file format
-r, --resolution <cst> Cylindrical mesh resolution
--endian <end> Byte ordering/endian
--compressor <cmp> Compression method for XML
Flags:
-v, --verbose... Verbose logging (-v, -vv)
-q, --quiet Supress all log output (overrules --verbose)
--help Print help info (see more with '--help')
See --help for detail and examples
Help is printed with the -h flag, and --help will show default values,
examples, and any important behaviour.
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 |
All functionality is fully supported for 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 supported because barely anyone knows about them, let alone uses them. They are therefore a low priority, but raise an issue if anyone needs it.
Download and unpack the latest binary executable release here for running in a terminal/powershell.
Unpack the relevant executable from the latest release.
# Linux
tar -xjf mesh2ww-x86_64-unknown-linux-gnu.tar.xz # Generic linux
tar -xjf mesh2ww-aarch64-unknown-linux-gnu.tar.xz # ARM64 Linux
# MacOS
tar -xjf mesh2ww-x86_64-apple-darwin.tar.xz # Intel macOS
tar -xjf mesh2ww-aarch64-apple-darwin.tar.xz # Apple Silicon macOSAnd either run from there or add the executable to your $PATH.
./mesh2ww -hExtract mesh2ww-x86_64-pc-windows-msvc.zip from the latest release.
Navigate to this folder and run from powershell.
.\mesh2ww.exe -hThis may be set as an alias for convenience.
Set-Alias -Name mesh2ww -Value C:\Path\To\Folder\mesh2ww.exeTypical usage will generally define a de-tuning factor (-p/--power) and
possibly a relative error cutoff (-e/--error) for generating weights.
# Chenge the de-tuning factor and relative error cut
mesh2ww /path/to/file.msht 104 --power 0.70 --error 0.25The --power value modifies calculated weights by w => w^(power), which
helps with softening extreme values. Any voxels with errors above --error
(>25% in this case) continue to use analogue transport until the uncertainty
imporves.
The weight window file may be renamed as needed.
# Chenge output file name to "mywwmesh.wwinp"
mesh2ww file.msht 104 --output mywwmesh.wwinpIt is often fine to simply generate a global weight window using the 'Total' group rather than every explicit energy/time group.
# Only use the Total energy/time groups
mesh2ww file.msht 104 --totalThis is probably the recommended use case for any finely binned groups, as nobody should really be trying to optimise for every energy in a 175-group mesh anyway.
Generated weights are typically normalised to the total flux for each group. These may be rescaled by a constant multiplier.
# Multiply all normalised weights by x2.5
mesh2ww file.msht 104 --scale 2.5Multiple tallies may be combined for weight windows covering multiple
particle types. This is achieved using the + operator.
The usage is as simple as combining multiple argument sets with + as the
delimiter.
# Syntax for combining weights for multiple particle types
mesh2ww <file> <number> [options] + \
<file> <number> [options] + \
<file> <number> [options]For example:
NP_tallies.mshtcontains neutron (FMESH14:n) and photon (FMESH24:p) talliesE_tallies.mshtcontains an electron (FMESH34:e) tally
If all of these are the same geometry, they may be combined with all the usual options applied to each tally individually:
# Make weight windows for neutrons, photons, and electrons
mesh2ww NP_tallies.msht 14 + \
NP_tallies.msht 24 -p 0.8 -e 0.15 + \
E_tallies.msht 34 --total \Here the neutron tally uses defaults, the photon tally de-tunes weights, and the electron tally only uses the total energy/time bins.
A Visual Toolkit file can be generated for every weight window set using the
--vtk flag.
# Write to VTK for plotting
mesh2ww file.msht 14 --vtkOf course all the usual options are available, such as increasing the resolution of cylindrical meshes with few theta bins.
# Change cylindrical mesh resolution
mesh2ww file.msht 14 --vtk --resolution 2Advanced options include changing the file format, byte ordering of binary outputs, and which compressor to use for XML.
# Change VTK file format options
mesh2ww file.msht 14 --vtk \
--format legacy-ascii \
--compressor lzma \
--endian big-endianFor fine control, the --power and --error parameters may be set
explicitly for every unique group.
For example, if a mesh has 3 energy groups at 1.0 MeV, 10.0 MeV, and
100.0 MeV, the power factor for each may be set to 0.8, 0.7, and 0.65
respectively.
# Set energy group power factors individually
mesh2ww file.msht 104 --power 0.8 0.7 0.65This also applies to time bins. To set values for all unique groups, the values must be given in the order expected by MCNP.
For example, a mesh with 3x energy groups and 2x time groups:
Energy 1.0 Power
Time 1e10 0.9
Time 1e20 0.7
Energy 10.0
Time 1e10 0.8
Time 1e20 0.8
Energy 100.0
Time 1e10 0.6
Time 1e20 0.5
# Set energy and time group power factors individually
mesh2ww file.msht 104 --power 0.9 0.7 0.8 0.8 0.6 0.5