Skip to content

Repository files navigation

Reactor Fuel Channel Temperature Profile

FORTRAN77 program that calculates the coolant, cladding, and maximum fuel temperature along a PWR or AGR fuel channel from a given neutron flux profile, run and plotted through a Jupyter notebook.

This is part of the FORTRAN77 assignment (2022/23) for the Physics and Technology of Nuclear Reactors (PTNR) course at the University of Birmingham.

Why a Docker image

The original assignment is plain FORTRAN77, compiled with gfortran. That normally runs fine on Linux and Windows, but gfortran on macOS (especially Apple Silicon) can be a pain to set up and sometimes behaves differently depending on how it was installed. To sidestep that entirely, this repo is packaged as a Docker image: it builds the FORTRAN source and runs a Jupyter server inside a Linux container, so it behaves the same on any machine with Docker installed, regardless of OS.

Repo Architecture

reactor-temp-profile-main/
├── Dockerfile                    - builds the image (gfortran + Jupyter)
├── docker-compose.yml            - one-command build & run
├── requirements.txt              - Python deps for the notebook
├── Reactor_temp_profile.ipynb    - compiles the FORTRAN, runs PWR & AGR, plots results
├── src/
│   ├── main.f             - main program
│   ├── io_routines.f      - file/reactor-type prompts, flux reading, output
│   ├── reactor_setup.f    - PWR/AGR input data, derived constants
│   └── physics.f          - the temperature calculations
├── data/
│   └── flux.txt           - neutron flux profile (input)
└── results/
    ├── PWR_output.txt, AGR_output.txt          - saved temperature tables
    └── PWR_temp_profiles.png, AGR_temp_profiles.png - saved plots

For the physics behind the calculation — how the flux data is turned into a heat generation rate, and how each of the four temperatures is worked out — see the markdown cell at the top of Reactor_temp_profile.ipynb.

Running it

Docker installed. Nothing else — no local gfortran, no local Python setup.

Option 1: build it yourself

git clone <https://github.com/light0vij/reactor-temp-profile>
cd reactor-temp-profile-main
docker compose up --build

Option 2: pull the prebuilt image

Every push to main builds and publishes the image to GitHub Container Registry via .github/workflows/docker-publish.yml, so you can skip building it locally:

docker pull ghcr.io/light0vij/reactor-temp-profile:latest
docker run -p 8888:8888 ghcr.io/light0vij/reactor-temp-profile:latest

Either way, once it's running, open http://localhost:8888 in a browser. Open Reactor_temp_profile.ipynb and run the cells top to bottom to compile the FORTRAN source, run it for both PWR and AGR, and plot the temperature profiles.

Using a different flux profile

docker-compose.yml mounts the local data/ folder into the container, so dropping a new flux file into data/ on your machine makes it available inside the notebook straight away — no rebuild needed.