pycfast.parsers.CFASTParser#
- class pycfast.parsers.CFASTParser[source]#
Parser for CFAST input files (.in format).
This class can read CFAST input files and convert them back to CFASTModel objects with all the component classes properly instantiated. The parser handles various CFAST namelist blocks including simulation environment, materials, compartments, vents, fires, and devices.
- Parameters:
simulation_environment (SimulationEnvironment) – object containing simulation settings.
material_properties (List[MaterialProperties]) – List of MaterialProperties objects.
compartments (List[Compartments]) – List of Compartments objects.
wall_vents (List[WallVents]) – List of WallVents objects.
ceiling_floor_vents (List[CeilingFloorVents]) – List of CeilingFloorVents objects.
mechanical_vents (List[MechanicalVents]) – List of MechanicalVents objects.
fires (List[Fires]) – List of Fires objects.
devices (List[Devices]) – List of Devices objects.
surface_connections (List[SurfaceConnections]) – List of SurfaceConnections objects.
Examples
>>> parser = CFASTParser() >>> model = parser.parse_file("example.in") >>> print(model.simulation_environment.title)
- parse_file(file_path, output_path=None)[source]#
Parse a CFAST input file and return a CFASTModel object.
Reads and parses a CFAST input file (.in format), extracting all namelist blocks and converting them to appropriate PyCFAST component objects.
- Parameters:
- Returns:
CFASTModel object with all components parsed from the file, including: - Simulation environment settings - Material properties - Compartment definitions - Vent configurations - Fire definitions - Device specifications
- Return type:
- Raises:
FileNotFoundError: – If the input file doesn’t exist at the specified path.
ValueError: – If the file format is invalid or required parameters are missing.
Examples
>>> parser = CFASTParser() >>> model = parser.parse_file("/path/to/simulation.in") >>> print(f"Parsed {len(model.compartments)} compartments")