Skip to content

Commit 290f576

Browse files
authored
Merge pull request #70 from SteSeg/restore_doc3
more documentation
2 parents 1ba896a + c6689d7 commit 290f576

File tree

10 files changed

+530
-3
lines changed

10 files changed

+530
-3
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Benchmark Collection
2+
3+
Available benchmarks. Each listed name matches the identifier expected by the `Benchmark` parent class (e.g., `OpenmcBenchmark`) in the OFB Python API for instantiation.
4+
5+
```{toctree}
6+
:maxdepth: 2
7+
8+
oktavian/index
9+
```
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# OKTAVIAN Benchmarks
2+
3+
| **Aspect** | **Details** |
4+
|-------------------------------|-----------------------------------------------------------------------------|
5+
| **Facility** | Osaka University, operational since 1981 |
6+
| **Neutron Source** | 250 keV D⁺ beam on 370 GBq tritium target |
7+
| | D-T fusion up to 3×10¹² neutrons/s |
8+
| **Experiments (1984–1988)** | Sphere pile (Al, Co, Cr, Cu, LiF, Mn, Mo, Si, Ti, W, Zr) |
9+
| **Measurement Technique** | TOF at 11 m, 55° angle |
10+
| **Neutron Detector** | NE-218 liquid scintillator (12.7 cm ⌀ × 5.1 cm) |
11+
| **Gamma Detector** | NaI scintillator at 5.8 m |
12+
| **Source Characterization** | Same TOF setup; isotropic source assumed for analysis |
13+
| **Background Suppression** | Polyethylene/iron layered collimator facing detector |
14+
| **Calibration** | Cf-252 TOF + graphite leakage spectra; Nb foil activation (Nb-92m) |
15+
| **Gamma Reactions Observed** | Mainly (n,n’), (n,2n); minimal (n,xγ) contribution |
16+
17+
```{toctree}
18+
:maxdepth: 1
19+
20+
oktavian_readme
21+
oktavian_al
22+
```
File renamed without changes.

docs/source/oktavian_readme.md renamed to docs/source/benchmark_collection/oktavian/oktavian_readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The experimental setup employed hollow stainless-steel spherical vessels filled
88

99
## Description of Source and Experimental Configuration
1010

11-
![Experimental configuration of OKTAVIAN experiments.](images/oktavian_exp_config.png)
11+
![Experimental configuration of OKTAVIAN experiments.](../../images/oktavian_exp_config.png)
1212

1313
The experimental configuration is illustrated in the figure above {cite}`konno2023jendl`.
1414

docs/source/index.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ Welcome to the **OpenMC Fusion Benchmarks** project - a modular, code-agnostic,
88
:maxdepth: 2
99
1010
intro
11+
quickstart
1112
user_installation
12-
oktavian_readme
13-
oktavian_al_benchmark
13+
specifications/index
14+
benchmark_collection/index
1415
```

docs/source/quickstart.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Quickstart Guide
2+
3+
This guide walks you through the basic steps to install the package, load a benchmark, run a simulation, and view results — using the **OpenMC Fusion Benchmarks** framework.
4+
5+
> ⚠️ This guide assumes you have Python 3.9+ and a working OpenMC installation. For OpenMC setup, refer to the [OpenMC documentation](https://docs.openmc.org/en/stable/).
6+
7+
---
8+
9+
## Install the Package
10+
11+
Clone the repository and install dependencies in a clean Python environment:
12+
13+
```shell
14+
git clone --recurse-submodules https://github.com/eepeterson/openmc_fusion_benchmarks.git
15+
cd openmc_fusion_benchmarks
16+
pip install .
17+
```
18+
19+
You may wish to make use of a virtual environment using [Conda](https://docs.conda.io/projects/conda/en/stable/user-guide/tasks/manage-environments.html), [Mamba](https://mamba.readthedocs.io/en/latest/user_guide/mamba.html) or [Venv](https://docs.python.org/3/library/venv.html).
20+
21+
22+
## Run a Benchmark Simulation
23+
24+
Minimal working example of instantiating and running a benchmark with the [OpenMC](https://docs.openmc.org/en/stable/) transport code.
25+
26+
```python
27+
import openmc_fusion_benchmarks as ofb
28+
29+
benchmark = ofb.OpenmcBenchmark(name='oktavian_al')
30+
benchmark.run()
31+
```
32+
33+
Running in uncertainty quantification mode:
34+
35+
```python
36+
import openmc_fusion_benchmarks as ofb
37+
38+
benchmark = ofb.OpenmcBenchmark(name='oktavian_al')
39+
benchmark.run(uq=True)
40+
```
41+
42+
## Read Results
43+
44+
Results from an OFB benchmark simulation follow a standardized [Xarray](https://docs.xarray.dev/en/stable/) structure and are easily accessible as DataArray objects through the OFB Python API.
45+
46+
```python
47+
import openmc_fusion_benchmarkas as ofb
48+
```
49+
50+
## Extract Results From Database
51+
52+
OFB features a standardized, continuously updated database that includes both experimental and computational benchmark results.
53+
54+
```python
55+
import openmc_fusion_benchmarkas as ofb
56+
```
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Benchmark Specifications
2+
3+
Detailed documentation on the standardized definition of benchmarks `specifications.yaml` and validation against the `benchmark_schema.yaml`.
4+
5+
```{toctree}
6+
:maxdepth: 2
7+
8+
overview
9+
structure
10+
schema
11+
```
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Overview
2+
3+
The **OpenMC Fusion Benchmarks (OFB)** project uses a structured, YAML-based specification format to define every component of a radiation transport benchmark. This approach ensures **clarity, reproducibility, and automation** in defining, running, and analyzing benchmarks.
4+
5+
Each benchmark is defined by a `specifications.yaml` file that is **validated against a strict schema (`benchmark_schema.yaml`)** to enforce consistency and completeness across the benchmark suite. We define a benchmark `specifications` as:
6+
7+
> The minimum amount of technical data necessary to unambiguously model a benchmark and collect standardized results.
8+
9+
---
10+
11+
## Specifications Sections
12+
13+
The `specifications.yaml` file captures all essential aspects of a benchmark, including:
14+
15+
- **Metadata**
16+
General information such as benchmark name, description, references, authors, and version.
17+
18+
- **Materials**
19+
Composition, temperature, density, and other nuclear properties defined in a structured format.
20+
21+
- **Geometry**
22+
CAD-based geometry definitions, including references to CAD files and meshing parameters.
23+
24+
- **Sources**
25+
Neutron or photon source definitions, including energy, spatial, and angular distributions.
26+
27+
- **Settings**
28+
Transport code configuration such as particle count, batches, and other run control parameters.
29+
30+
- **Tallies**
31+
Definition of observables (e.g., flux, dose) with filters and expected data structure.
32+
33+
- **Uncertainty Quantification (Optional)**
34+
Setup for input perturbations, sampling, and uncertainty propagation metrics.
35+
36+
- **Irradiation Schedule (Optional)**
37+
Time-dependent irradiation and cooling steps for activation and shutdown dose rate analysis.
38+
39+
---
40+
41+
## Schema Validation
42+
43+
To guarantee interoperability and catch user errors early, every `specifications.yaml` file must conform to the `benchmark_schema.yaml`. The schema:
44+
45+
- Enforces required fields and correct types
46+
- Validates units, formats, and structure
47+
- Allows custom extensions while preserving core validation
48+
49+
Validation is automatically handled by the OFB Python API.
50+
51+
---
52+
53+
## Why This Matters
54+
55+
- **Consistency** across all benchmarks
56+
- **Automation** of modeling, simulation, and analysis workflows
57+
- **Comparability** of results across codes and experiments
58+
- **Modularity** to support method testing and rapid development
59+
60+
---
61+
62+
## Learn More
63+
64+
- [Specifications Structure](structure.md) — detailed documentation of `specifications.yaml` structure and syntax
65+
- [Benchmark Schema](schema.md) — documentation of the `benchmark_schema.yaml` and `specifications` validation
Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
# Benchmark Schema
2+
3+
The OpenMC Fusion Benchmarks (OFB) project uses a modular, schema-driven format to ensure that all benchmark `specifications` follow a consistent, machine-validated structure.
4+
5+
## Validation
6+
7+
Validation can be performed anually using the OFB Python API:
8+
9+
```python
10+
import openmc_fusion_benchmarks as ofb
11+
12+
ofb.validate_benchmark('benchmark_name')
13+
```
14+
15+
Alternatively, you can run the `validate_all_benchmarks.py` script located in the repository’s `scripts/` folder. This script iterates through all benchmark `specifications.yaml` files and validates them against the repository’s `benchmark_schema`.
16+
17+
Validation output looks like:
18+
19+
```shell
20+
🔍 Validating benchmark file: benchmark_name
21+
✅ benchmark_name is valid!
22+
```
23+
24+
Or in case of validation errors:
25+
26+
```shell
27+
🔍 Validating benchmark file: oktavian_al
28+
❌ 1 errors found in oktavian_al:
29+
- None is not of type 'object' (at ['materials', 1, 'composition', 'data'])
30+
```
31+
32+
In the example above, the material with `id` 1 is missing a defined composition.
33+
34+
Validation is also automatically triggered when instantiating a `benchmark` object:
35+
36+
```python
37+
import openmc_fusion_benchmarks as ofb
38+
39+
benchmark = ofb.OpenmcBenchmark(name='benchmark_name')
40+
```
41+
```shell
42+
🔍 Validating benchmark file: benchmark_name
43+
✅ benchmark_name is valid!
44+
```
45+
46+
## Purpose of the Schema
47+
48+
To guarantee interoperability and automation, each `specifications.yaml` file must conform to a predefined [JSON Schema](https://json-schema.org/). This enables:
49+
50+
- **Automatic validation** of input files
51+
- **Improved error reporting** for malformed benchmarks
52+
- **Robust tooling** for model generation and testing
53+
- **Future extensibility** of the specification format
54+
55+
## Schema-to-Specifications Mapping
56+
57+
The `benchmark_schema` outlines the main _sections_ expected in a `specifications.yaml` file:
58+
59+
```yaml
60+
$ref: "#/components/schemas/Benchmark"
61+
components:
62+
schemas:
63+
Benchmark:
64+
type: object
65+
required:
66+
- metadata
67+
- materials
68+
- geometry
69+
- sources
70+
- settings
71+
- tallies
72+
properties:
73+
metadata:
74+
$ref: '#/components/schemas/Metadata'
75+
materials:
76+
type: array
77+
items:
78+
$ref: '#/components/schemas/Material'
79+
...
80+
```
81+
82+
Some sections are optional and included only when relevant to the benchmark:
83+
84+
```yaml
85+
...
86+
irradiation_schedule:
87+
$ref: '#/components/schemas/IrradiationSchedule'
88+
uncertainty_quantification:
89+
$ref: '#/components/schemas/UncertaintyQuantification'
90+
```
91+
92+
Beyond defining the structure at a high level, the `schema` specifies the internal _hierarchy_ and _data types_ for each object:
93+
94+
```yaml
95+
Tally:
96+
type: object
97+
required: [name, particle, filters, scores]
98+
properties:
99+
name:
100+
type: string
101+
...
102+
particle:
103+
type: string
104+
enum: [neutron, photon, electron, positron]
105+
filters:
106+
type: array
107+
items:
108+
type: object
109+
required: [type, values]
110+
...
111+
```
112+
113+
Each section in a benchmark’s `specifications.yaml` is _validated_ against its corresponding `schema` definition.
114+
115+
For example, a `density` object in the `specifications` might appear as:
116+
```yaml
117+
density:
118+
value: 0.997
119+
units: g/cm3
120+
```
121+
122+
Its `schema` counterpart ensures the expected structure and value types:
123+
124+
```yaml
125+
density:
126+
type: object
127+
properties:
128+
value:
129+
type: number
130+
units:
131+
type: string
132+
enum: [g/cm3]
133+
required: [value, units]
134+
```
135+
136+
Likewise, a complete `material` entry in the `materials` list could be:
137+
138+
```yaml
139+
- id: 1
140+
name: Water
141+
composition:
142+
composition_type: element
143+
fraction_type: atomic
144+
data:
145+
H: 0.67
146+
O: 0.33
147+
density:
148+
value: 0.997
149+
units: g/cm3
150+
```
151+
152+
And its definition in the `schema` would be:
153+
154+
```yaml
155+
Material:
156+
type: object
157+
required: [id, name, composition, density]
158+
properties:
159+
id:
160+
type: integer
161+
name:
162+
type: string
163+
composition:
164+
type: object
165+
properties:
166+
composition_type:
167+
type: string
168+
fraction_type:
169+
type: string
170+
enum: [atomic, weight]
171+
data:
172+
type: object
173+
additionalProperties:
174+
type: number
175+
required: [composition_type, fraction_type, data]
176+
density:
177+
...
178+
```
179+
180+
## Unified Schema Format
181+
182+
The OFB schema is a **single, unified JSON Schema file** that defines the complete structure of a valid `specifications.yaml` file. It includes all top-level sections—such as `metadata`, `geometry`, `materials`, `source`, `tallies`, and others—and their corresponding nested fields.
183+
184+
Although the schema is written modularly (with subschemas for each section), it is maintained as **one file** for simplicity, validation consistency, and ease of distribution.

0 commit comments

Comments
 (0)