Python-based Heating and Current Drive (H&CD) Workflow for ITER plasma simulations.
| Audience | Recommended Setup | Command/Script |
|---|---|---|
| User | EasyBuild module (SDCC) | module load HCD-WF |
| User | SDCC Helper Script (SDCC) | ./config_hcd_iter_sdcc.sh |
| Developer | SDCC Helper Script (SDCC) | ./config_hcd_iter_sdcc.sh |
| Developer | Manual Setup (any system) | See Developer Setup |
module load HCD-WF
# All dependencies and actors are loaded automatically
hcd_nogui -c <config_folder> # Run a simulation
hcd_gui # Launch the GUI./config_hcd_iter_sdcc.sh # Uses default DD version (3.42.0)
./config_hcd_iter_sdcc.sh 4.0.0 # Use a different DD version if supported
# Optionally set ACTOR_FOLDER for local actors:
ACTOR_FOLDER=~/public/PYTHON_ACTORS ./config_hcd_iter_sdcc.shThis script will:
- Load all required modules (unless
ACTOR_FOLDERis set) - Create and activate the
devenvvirtual environment - Install the project and all development dependencies
# Run a simulation (console)
hcd_nogui -c tests/data/GRAYSCALE/
# Run a simulation (GUI)
hcd_gui
# Submit a batch job
hcd_batch -n 4 -t 8 -e user@iter.org -q all -c my_config/
# Run a single time slice (test)
hcdslice_nogui -c my_config/./config_hcd_iter_sdcc.sh- Loads modules, sets up Python venv, installs all dependencies (including dev tools)
# Clone the repository
git clone ssh://git@git.iter.org/wf/hcd-wf.git
cd hcd-wf
# Create virtual environment
python -m venv devenv
source devenv/bin/activate
# Install in editable mode with dev dependencies
pip install -e "[dev]"
# Load required modules (SDCC only)
module load Tkinter matplotlib IMAS-AL-Python/5.4.0-intel-2023b-DD-3.42.0
module load GRAYSCALE/1.1.0-intel-2023b-DD-3.42.0
module load HCD_MERGERS/1.0.0-intel-2023b-DD-3.42.0# Format code
black --line-length 120 hcdworkflow/ gui/ tools/ workflow/
# Check style
flake8 --max-line-length=120 --ignore=E203,W503 hcdworkflow/
# Run linter
pylint --max-line-length=120 hcdworkflow/
# Run tests
hcdslice_nogui -c tests/data/GRAYSCALE/
# Or use the CI script
bash ci-sdcc/st05-staticanalysis.shTo run the workflow integration tests using pytest:
- Ensure you have pytest installed in your environment:
pip install pytest
- Run all tests:
Or run all tests in the directory:
pytest tests/test_workflow.py
pytest tests/
These tests will execute the workflow commands for various configurations and check for successful completion.
cd actor_install
python actor_install.py --skipModules *.yml # Install all actors
python actor_install.py --skipModules grayscale.yml # Install specific actor- Multiple Execution Modes: Console, GUI, batch, single time-slice
- Flexible Actor System: Easy integration of new physics codes
- IMAS Integration: Full compatibility with IMAS IDSes
- Time-Loop Execution: Automated multi-timepoint simulations
- HPC Support: SLURM batch job submission
- Waveform Management: Integration with Waveform Cooker
- Modular Design: Clean separation of workflow logic and physics codes
hcd-wf/
├── hcdworkflow/ # Main workflow package
├── gui/ # GUI components
├── tools/ # Utility tools
├── workflow/ # Workflow wrapper
├── actor_install/ # Actor installation scripts
├── tests/ # Test data
├── ci-sdcc/ # CI/CD scripts
├── hcd_gui # GUI entry point
├── hcd_nogui # Console entry point
├── hcdslice_nogui # Single slice entry point
├── hcd_batch # Batch submission script
├── pyproject.toml # Project configuration
├── setup.cfg # Tool configurations
└── README.md # This file
The workflow is configured using a main XML file and optional YAML waveform files. These files define the simulation parameters, selected physics actors, and time-dependent waveforms.
- This XML file is required in your configuration folder.
- It defines:
- Workflow parameters: shot number, run numbers, time range, time step, etc.
- Actor selection: which physics codes (actors) to use for each process (e.g., ECRH, ICRH, NBI).
- Database and output settings (if needed).
Example structure:
<root>
<workflow_parameters>
<shot_nr>130012</shot_nr>
<run_in>5</run_in>
<run_out>6</run_out>
<tbegin>30.0</tbegin>
<tend>350.0</tend>
<dt_required>20</dt_required>
</workflow_parameters>
<actor_selection>
<main_process>
<ECRH>
<ec_wave_solver list="genray gray grayscale torbeam toray">3</ec_wave_solver>
</ECRH>
<ICRH>
<ic_wave_solver list="pion cyrano tomcat lion">1</ic_wave_solver>
</ICRH>
</main_process>
</actor_selection>
</root>- The
listattribute specifies available actors; the value (e.g.,3) selects which one to use (0-based index). - You can enable/disable actors and processes as needed for your simulation scenario.
- Used for specifying time-dependent parameters for each heating/current drive system.
- Typical files:
ec_waveforms.yaml– ECRH waveformsic_waveforms.yaml– ICRH waveformsnbi_waveforms.yaml– NBI waveformslh_waveforms.yaml– LHCD waveforms
- Place these files in your configuration folder if your simulation requires time-dependent input.
A typical configuration folder (e.g., tests/data/GRAY_PION) contains:
input_workflow.xml(main workflow definition)ec_waveforms.yaml,ic_waveforms.yaml, etc. (optional, for time-dependent scenarios)
You can run the workflow using:
hcd_nogui -c tests/data/GRAY_PION
hcdslice_nogui -c tests/data/GRAY_PION- IMAS-AL-Python
- Physics actor modules (GRAYSCALE, HCD_MERGERS, etc.)
- Tkinter (for GUI)
- matplotlib (for GUI plotting)
- Confluence Documentation
- Build locally:
cd docs pip install -e ".[docs]" make html # Open docs/build/html/index.html in browser
- Module import errors: Load required IMAS modules:
module load IMAS-AL-Python
See LICENSE.txt for details.
Copyright (c) 2019-2025, ITER Organization