Metadata-Version: 2.5
Name: radmodeling
Version: 2.1.1
Summary: CAD preparation and CAD-to-MCNP quality assurance tools
Project-URL: Documentation, https://radmodeling.readthedocs.io
Project-URL: Source, https://github.com/Fusion4Energy/RadModeling
Project-URL: Issues, https://github.com/Fusion4Energy/RadModeling/issues
Author: Alvaro Cubi
License-Expression: EUPL-1.2
License-File: LICENSE
Keywords: CAD,GEOUNED,MCNP,STEP,neutronics,radiation transport
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.12
Requires-Dist: cadquery-ocp-novtk>=7.8
Requires-Dist: matplotlib>=3.7
Requires-Dist: migjorn>=0.3.11
Requires-Dist: numpy>=1.26
Requires-Dist: rich>=13
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: cadquery-ocp-stubs>=7.8; extra == 'dev'
Requires-Dist: pyright>=1.1.380; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.5; extra == 'dev'
Provides-Extra: docs
Requires-Dist: zensical>=0.0.67; extra == 'docs'
Description-Content-Type: text/markdown

![GitHub last commit](https://img.shields.io/github/last-commit/Fusion4Energy/RadModeling)
![GitHub issues](https://img.shields.io/github/issues/Fusion4Energy/RadModeling)
![PyPI](https://img.shields.io/pypi/v/radmodeling)
![](https://img.shields.io/badge/license-EUPL--1.2-blue)

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Fusion4Energy/RadModeling/master/docs/assets/logo-wordmark-dark.svg">
  <img alt="RadModeling" src="https://raw.githubusercontent.com/Fusion4Energy/RadModeling/master/docs/assets/logo-wordmark-light.svg" width="420">
</picture>

# RadModeling

RadModeling prepares CAD models for Monte Carlo radiation transport and checks the
MCNP geometry obtained from them. It is a Python package with a command line tool,
`radmod`, plus a few thin SpaceClaim tools for the interactive part of the work.

```
machine.step ──radmod init──▶ machine_simplified.step + machine_registry.csv
                                   │
                    simplify in SpaceClaim (or any CAD program)
                                   │
machine_simplified.step ──radmod check──▶ volumes, tori, splines, invalid solids
                        ──radmod export─▶ machine_export.step
                                   │
                         GEOUNED (or another converter)
                                   │
machine_export.mcnp ──radmod compare───▶ CAD vs MCNP volumes, density correction factors
                    ──radmod materials─▶ materials and densities in the cells
                    ──radmod slice─────▶ slice plots with the CAD overlaid
                    ──radmod atlas─────▶ PDF of slices: whole model + every problem
```

* **Stable component IDs**: tags like `Pump casing [rm12]` in the component names
  survive any CAD program, so simplified models always match the original components.
* **One registry**: an Excel-friendly CSV with materials, densities, volumes and
  density correction factors.
* **CAD vs MCNP comparison without running MCNP**: the MCNP cells are evaluated
  directly to measure their volumes, their disagreement with the CAD, and to plot
  slices with the CAD on top.
* **Geometry tools** in SpaceClaim: FMESH cards from the selected boxes, toroidal
  elbows to mitred cylinders.
* **SpaceClaim tools published once** that always run the latest installed code.

## Installation

```bash
pip install radmodeling
```

Where the `radmod` executable is blocked ("Access is denied"), write
`python -m radmod` instead, with the same arguments.

## Quick start

```bash
radmod init machine.step                       # tag + registry
# fill the 'material' column of machine_registry.csv
# simplify machine_simplified.step in SpaceClaim, save it back as STEP
radmod check machine_simplified.step
radmod export machine_simplified.step
# convert machine_export.step to machine_export.mcnp with GEOUNED
radmod compare machine_export.mcnp machine_export.step
radmod materials machine_export.mcnp -l materials.toml
radmod slice machine_export_materials.mcnp machine_export.step --normal z
radmod atlas machine_export_materials.mcnp machine_export.step
```

Every command finds `machine_registry.csv` next to its input files (`-r` gives
another one). SpaceClaim tools: `radmod spaceclaim-loaders <folder>` and publish the
loaders once.

Full documentation: https://radmodeling.readthedocs.io

## License

Copyright 2019 F4E | European Joint Undertaking for ITER and the Development of Fusion
Energy (‘Fusion for Energy’). Licensed under the EUPL, Version 1.2 (the “Licence”); see
[LICENSE](https://github.com/Fusion4Energy/RadModeling/blob/master/LICENSE). You may not
use this work except in compliance with the Licence. Unless required by applicable law
or agreed to in writing, software distributed under the Licence is distributed on an “AS
IS” basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See
the Licence for the specific language governing permissions and limitations under the
Licence.
