Welcome to the PyCFAST documentation#

PyCFAST is a Python interface for the Consolidated Fire and Smoke Transport (CFAST) fire simulation software, providing an easy-to-use Python programming interface for building and running fire scenarios. It allows researchers and engineers to automate CFAST runs, build and modify input files programmatically, execute simulations, and analyze results using the broader Python ecosystem.

Motivation#

CFAST is a long-established fire modeling software written in Fortran and traditionally run through its graphical interface (CEdit). This reliance on a GUI can make large parametric studies, automation, and reproducibility cumbersome.

PyCFAST was originally developed internally at Orano to integrate CFAST with the Python scientific ecosystem (notably for the scipy.optimize module), and complements existing tools like CData by exposing every CFAST component programmatically. Below is a diagram of how the components of PyCFAST interact with the CFAST model:

PyCFAST workflow

You describe a fire scenario with Python objects (Compartment, Fire, WallVent, Device…), assemble them into a CFASTModel, and launch the simulation with run. You can also start from an existing .in file with parse_cfast_file.

Quickstart#

Below is a minimal example to create a model, run it, and obtain results of the compartment as a pandas DataFrame:

from pycfast import CFASTModel, Compartment, SimulationEnvironment

model = CFASTModel(
    simulation_environment=SimulationEnvironment(title="My Simulation"),
    compartments=[Compartment(id="ROOM1", width=5.0, depth=4.0, height=2.7)],
    file_name="my_simulation.in",
)

results = model.run()

run returns a dictionary of pandas DataFrame, one per output CSV file:

>>> list(results)
['compartments', 'devices', 'masses', 'vents', 'walls', 'zone']

>>> results["compartments"]
   Time   ULT_1  LLT_1  HGT_1  VOL_1  PRS_1  ...
0   0.0   20.00  20.00   5.00   0.01    0.0  ...
1   1.0   20.83  20.00   5.00   0.10    0.0  ...

More details on how to use PyCFAST are available in the Getting Started guide or the Examples section, which includes more complex use cases.