OFTBx is a Python toolbox for building, organizing, and running OpenFAST wind turbine models programmatically.
The goal is to simplify repetitive OpenFAST workflows such as:
- Building reusable turbine models from
.fstfiles - Managing turbine objects
- Generating simulation sweeps
- Creating organized run directories
- Executing OpenFAST cases from Python
Clone the repository:
git clone https://github.com/yourusername/OFTBx.git
cd OFTBxInstall in editable mode:
pip install -e .The model builder creates a reusable turbine model directory.
from OFTBx.builder import build_model_from_fst
model_path = build_model_from_fst(
fst_path="data/IEA-15-240-RWT/OpenFAST/IEA-15-240-RWT-Monopile/IEA-15-240-RWT-Monopile.fst",
model_name="iea15mw"
)Once the model has been built, create a Turbine object.
from OFTBx.builder import build_model_from_fst
from OFTBx.turbine import Turbine
# ------------------------------------------------------------
# 1. Build model (only once per turbine)
# ------------------------------------------------------------
model_dir = build_model_from_fst(
fst_path="data/IEA-15-240-RWT/OpenFAST/IEA-15-240-RWT-Monopile/IEA-15-240-RWT-Monopile.fst",
model_name="IEA15MW"
)
# ------------------------------------------------------------
# 2. Load turbine object
# ------------------------------------------------------------
turbine = Turbine(
name="IEA15MW",
model_path=model_dir
)Create multiple OpenFAST simulation cases across a wind speed range.
from OFTBx.turbine import Turbine
turbine = Turbine(
name="IEA15MW",
model_path="models/IEA15MW"
)
# Create simulation directories
turbine.inflow_sweep(
run_name="inflow_sweep",
U_min=4,
U_max=25,
n=10
)This generates a directory structure similar to:
runs/
└── inflow_sweep/
├── case_01/
│ └── case.fst
├── case_02/
│ └── case.fst
├── ...
└── case_10/
└── case.fst
Execute previously generated cases programmatically.
from pathlib import Path
from OFTBx.turbine import Turbine
turbine = Turbine(
name="IEA15MW",
model_path="models/IEA15MW"
)
cases_dir = Path("runs/inflow_sweep")
case_dirs = sorted([
d for d in cases_dir.iterdir()
if d.is_dir() and (d / "case.fst").exists()
])
results = [None] * len(case_dirs)
for i, case_dir in enumerate(case_dirs):
print(f"[RUN] {case_dir.name}")
results[i] = turbine.run_case(
case_dir,
exe="openfast" # or full executable path
)
print("DONE")Example project organization:
project/
│
├── data/
│ └── OpenFAST input files
│
├── models/
│ └── IEA15MW/
│
├── runs/
│ └── inflow_sweep/
│
└── scripts/
└── simulation scripts
- Python 3.10+
- OpenFAST installed and accessible from terminal
Verify your OpenFAST installation:
openfast --versionIf OpenFAST is not on your PATH, provide the full executable path:
turbine.run_case(
case_dir,
exe="/path/to/openfast"
)Planned / ongoing features:
- Batch execution utilities
- Parallel case execution
- Parametric studies
- Postprocessing tools
- Controller parameter sweeps
- Visualization utilities
MIT License