Skip to main content

Tools to process MCNP models and results

Project description

https://img.shields.io/badge/Maintained%3F-yes-green.svg https://github.com/dvp2015/mckit/workflows/Tests/badge.svg https://codecov.io/gh/dvp2015/mckit/branch/devel/graph/badge.svg?token=05OFBQS3RX https://img.shields.io/badge/code%20style-black-000000.svg https://img.shields.io/badge/%20imports-isort-%231674b1?style=flat&labelColor=ef8336 https://img.shields.io/github/license/dvp2015/mckit

MCKIT: MCNP model and results processing utilities

The mckit package provides a programming framework and command line tools to manipulate complex MCNP models. When a model is rather complex and its description occupies thousands of text lines it becomes hard to modify it and integrate several model manually. The package automates integration process.

Usage

Command line interface

Usage: mckit [OPTIONS] COMMAND [ARGS]...

  Tools to process MCNP models and results

Options:
  --override / --no-override
  --version                   Show the version and exit.
  -v, --verbose               Log debugging info to stderr.  [default: False]
  -q, --quiet                 Suppress info to stderr.  [default: False]
  --logfile / --no-logfile    Log to file.  [default: True]
  --profile_mem               Profile peak memory use.  [default: False]
  --help                      Show this message and exit.

Commands:
  check      Read MCNP model(s) and show statistics and clashes.
  compose    Merge universes and envelopes into MCNP model using merge...
  concat     Concat text files.
  decompose  Separate an MCNP model to envelopes and filling universes
  split      Splits MCNP model to text portions (opposite to concat)
  transform  Transform MCNP model(s) with one of specified transformation.

Library

The library allows subtraction and merging models, renaming objects (cells, surfaces, compositions, universes), simplification of cell expressions (removing redundant surfaces), homogenization, computation of cell volumes and material masses, and more.

LOG.info("Loading c-model envelopes")
envelopes = load_model(str(CMODEL_ROOT / "c-model.universes/envelopes.i"))

cells_to_fill = [11, 14, 75]
cells_to_fill_indexes = [c - 1 for c in cells_to_fill]

LOG.info("Attaching bounding boxes to c-model envelopes %s", cells_to_fill)
attach_bounding_boxes(
    [envelopes[i] for i in cells_to_fill_indexes], tolerance=5.0, chunk_size=1
)
LOG.info("Backing up original envelopes")
envelopes_original = envelopes.copy()

antenna_envelop.rename(start_cell=200000, start_surf=200000)

LOG.info("Subtracting antenna envelop from c-model envelopes %s", cells_to_fill)
envelopes = subtract_model_from_model(
    envelopes, antenna_envelop, cells_filter=lambda c: c in cells_to_fill
)
LOG.info("Adding antenna envelop to c-model envelopes")
envelopes.add_cells(antenna_envelop, name_rule="clash")
envelopes_path = "envelopes+antenna-envelop.i"
envelopes.save(envelopes_path)
LOG.info("The model of HFSR in envelopes is saved to %s", envelopes_path)

Installation

Installing from pypi:

pip3 install mckit

Installing from github.com:

pip3 install git+https://github.com/MC-kit/mckit.git

Versioning

This software follows Semantic Versioning

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for mckit, version 0.5.12
Filename, size File type Python version Upload date Hashes
Filename, size mckit-0.5.12-cp37-cp37m-macosx_10_15_x86_64.whl (727.2 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size mckit-0.5.12-cp37-cp37m-manylinux_2_31_x86_64.whl (807.2 kB) File type Wheel Python version cp37 Upload date Hashes View
Filename, size mckit-0.5.12-cp38-cp38-macosx_10_15_x86_64.whl (727.3 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size mckit-0.5.12-cp38-cp38-manylinux_2_31_x86_64.whl (809.9 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size mckit-0.5.12-cp38-cp38-win_amd64.whl (765.0 kB) File type Wheel Python version cp38 Upload date Hashes View
Filename, size mckit-0.5.12-cp39-cp39-macosx_10_15_x86_64.whl (727.3 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size mckit-0.5.12-cp39-cp39-manylinux_2_31_x86_64.whl (808.8 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size mckit-0.5.12-cp39-cp39-win_amd64.whl (765.0 kB) File type Wheel Python version cp39 Upload date Hashes View
Filename, size mckit-0.5.12.tar.gz (2.1 MB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page