Skip to content

Commit 0260525

Browse files
committed
Merge branch 'improve-docs'
2 parents 44ca3ce + f29d3ea commit 0260525

23 files changed

Lines changed: 716 additions & 480 deletions

.github/workflows/docs.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ jobs:
4040
run: |
4141
git config user.name "github-actions[bot]"
4242
git config user.email "github-actions[bot]@users.noreply.github.com"
43-
# Deploy this version and update the "latest" alias
43+
# Deploy this version and update the "latest" alias
4444
pip install mike
4545
mike deploy --push --update-aliases "${{ steps.version.outputs.version }}" latest
46-
mike set-default --push latest
46+
# Set the site root to the numeric release version
47+
mike set-default --push "${{ steps.version.outputs.version }}"

docs/best-practices.md

Lines changed: 0 additions & 99 deletions
This file was deleted.

docs/best_practices.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Best Practices
2+
3+
This document lists some recommended practices for managing your Gitronics project.
4+
Following these practices will help you avoid common pitfalls and make your project easier to maintain.
5+
6+
## Modularization
7+
8+
Every file (or system) in a Gitronics project should be independent of the others.
9+
This means that a filler model should not reference cells or surfaces from other filler models or the envelope structure directly.
10+
11+
- Filler models should not share surfaces.
12+
- Filler models should not share surfaces with the envelope structure.
13+
- Avoid the use of `#` cells. If used, they should be defined in the same file, not a reference to a cell defined in other file.
14+
15+
## Envelope cell definition
16+
17+
It is recommended to place the envelope name place holder at the end of the cell definition.
18+
19+
??? note "Example"
20+
```
21+
21055 0 1 -2 8 -7 -6 -5
22+
imp:n=1.0 imp:p=1.0
23+
$ @env:toroidal_field_coil_18
24+
```
25+
26+
!!! Warning "Space for the `FILL` card"
27+
The `FILL` card will be inserted by Gitronics right after the last cell parameter of the cell definition (after the `imp:p=1.0` in the example above). If there is not space to the right of the last parameter, the newly added `FILL` card may break the maximum line length of MCNP. To avoid this, it is recommended to leave some space after the last parameter of the cell definition before the envelope name placeholder as in the example above.
28+
29+
## Title cards
30+
31+
All the Gitronic files (geometry and data card files) should have a title card at the top of the file.
32+
The title card is a single line that will be ignored by Gitronics when assembling the model, but it is useful to provide a brief description for the user when viewing the independent file.
33+
34+
## Do not commit large files
35+
36+
The Gitronics methodology is designed to manage the source files of a model, not the assembled MCNP input files.
37+
Via the information in the header of the `assembled.mcnp` file, it is possible to reproduce the exact same model from the source files. Therefore, it is not necessary to commit the assembled MCNP input files to the repository.
38+
39+
Commiting large files to the repository will make it slower to clone and checkout branches, and it will also make it harder to track changes.
40+
41+
!!! tip "Use `.gitignore`"
42+
Make use of the `.gitignore` file to avoid committing unnecessary files. You can place a `.gitignore` file with the content `*` in a folder to ignore all files in that folder (like the `output/` folder).
43+
You can ignore specific files by name or extension.
44+
For example, to ignore all `.mcnp` files of a folder, you can add the line `*.mcnp` to the `.gitignore` file.
45+
46+
!!! Warning "Do not commit binary files"
47+
It is considered a bad practice to commit binary files to the repository (Excel files, runtpe, etc).
48+
Binary files cannot be diffed, and they will make the repository size grow unnecessarily.
49+
Even if the files are text-based, do not commit large files like the `output` file of an MCNP run.
50+
51+
## Use descriptive, lowercase stem names
52+
53+
Stem names appear in configuration files and in assembled-model metadata. Choose names that describe the *physics content*, not the version or date:
54+
55+
| Avoid | Prefer |
56+
|---|---|
57+
| `model_2024_v3_final` | `blanket_tungsten_fw` |
58+
| `mat_13` | `reduced_activation_ferritic_steel` |
59+
| `tally1` | `tritium_breeding_ratio` |
60+
61+
## Nested universes
62+
63+
Each filler model file should contain only one universe.
64+
The `$ @env:<envelope_name>` placeholder will only work on envelope structure files.
65+
66+
If a nested universe is absolutely needed, place the level 2 universe in the same file as the level 1 universe.
67+
Make sure that the level 1 universe have the `FILL` cards correctly defined for the level 2 universe, which is placed right after the definition of the level 1.
68+
69+
## Track origin of the model in the metadata
70+
71+
Add a field like `reference` or similar to the `.metadata` files of each filler model to track the origin of the model.
72+
This is useful for future reference and for understanding the provenance of the model.
73+
74+
## Tag releases
75+
76+
Every time you build a model for a formal assessment or publication, create a git tag. Gitronics records the commit hash in the assembled file's metadata, but a tag makes it trivially easy to check out the exact source state later.
77+
78+
```bash
79+
git tag -a v1.2.0 -m "Design freeze for FDR submission"
80+
git push origin v1.2.0
81+
```
82+
83+
## Include metadata files in version control
84+
85+
The `.metadata` files alongside each filler model are part of the source. Commit them alongside the `.mcnp` files.

docs/changelog.md

Lines changed: 0 additions & 25 deletions
This file was deleted.

docs/examples.md

Lines changed: 1 addition & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## `example_project` — minimal working project
44

5-
The repository ships with a small example project in `example_project/`. It demonstrates the essential project layout and a valid configuration file.
5+
The repository ships with a small example project in [`example_project/`](https://github.com/Fusion4Energy/gitronics/tree/main/example_project). It demonstrates the essential project layout and a valid configuration file.
66

77
### Structure
88

@@ -45,54 +45,6 @@ cd example_project
4545
gitronics build configurations/valid_configuration.yaml --output-path output/
4646
```
4747

48-
---
49-
50-
## `big_example` — large-scale fusion model
51-
52-
The `big_example/` directory contains a real-world-scale configuration for a tokamak neutronics model, showcasing how Gitronics handles large numbers of envelopes and multiple configuration variants.
53-
54-
### Configuration variants
55-
56-
| File | Description |
57-
|---|---|
58-
| `baseline.yaml` | Full reference model with all blanket sectors and fillers. |
59-
| `baseline_void_check.yaml` | Same geometry, all fillers replaced with void — useful for checking cell volumes. |
60-
| `in_vessel_only.yaml` | Only the in-vessel components; useful for fast scoping calculations. |
61-
62-
### Envelope / filler pattern
63-
64-
The baseline configuration maps blanket sectors to their corresponding filler models row by row:
65-
66-
```yaml
67-
envelopes:
68-
blanket_sector_01_r1_c03: blk_dt1_w_fd_row_1_c03
69-
blanket_sector_01_r1_c02: blk_dt1_w_fd_row_1_c02
70-
blanket_sector_01_r1_c01: blk_dt1_w_fd_row_1_c01
71-
# ...
72-
```
73-
74-
The `baseline_void_check.yaml` uses `overrides: baseline.yaml` and sets all envelopes to `null`, leaving the geometry intact but removing all materials — a standard MCNP void-check technique.
75-
76-
### Running a build
77-
78-
```bash
79-
cd big_example
80-
gitronics build configurations/baseline.yaml --output-path output/
81-
```
82-
83-
---
84-
85-
## Migrating your own model
86-
87-
<!-- TODO: Add a worked example using a publicly available MCNP benchmark model -->
88-
89-
!!! note "Fill in this section"
90-
If you have a representative public MCNP model you can share, add a migration walkthrough here showing:
91-
92-
1. The original monolithic input file
93-
2. The `gitronics migrate` command
94-
3. The resulting project structure
95-
4. Any manual clean-up steps needed
9648

9749
---
9850

@@ -106,5 +58,3 @@ import gitronics
10658
# Build a model — equivalent to running the CLI
10759
gitronics.run(["gitronics", "build", "configurations/baseline.yaml", "-o", "output/"])
10860
```
109-
110-
<!-- TODO: Expand with richer Python workflow examples if the Python API grows -->

docs/getting-started.md

Lines changed: 0 additions & 105 deletions
This file was deleted.

0 commit comments

Comments
 (0)