Live Production Platform: https://firetwin.vercel.app
Coupled Multiphysics Engineering Simulator uniting Incompressible Boussinesq Navier-Stokes CFD, Large Eddy Simulation (LES), P1 Radiation Transport, Fourier Neural Operator (FNO) Surrogates, Eurocode 3 Structural Degradation, Helbing Social Force Evacuation, and Automated Publication-Grade 3-Page PDF Reporting.
- Executive Summary
- End-to-End System Architecture
- Comprehensive Mathematical & Physical Formulations
- 3.1 Incompressible Boussinesq Navier-Stokes LES Equations
- 3.2 Smagorinsky-Lilly Subgrid-Scale Stress Closure
- 3.3 P1 Radiation Transport Model
- 3.4 Combustion Dynamics, Species Transport & $t^2$ Growth Curve
- 3.5 2-Zone Smoke Layer Descent & Volumetric Filling
- 3.6 Eurocode 3 (EN 1993-1-2) Structural-Thermal Degradation
- 3.7 Helbing Social Force Pedestrian Evacuation Dynamics
- 3.8 Fourier Neural Operator (FNO 2D) Spectral Convolution
- 3.9 Fractional Effective Dose (FED) Toxic Incapacitation (ISO 13571)
- 3.10 Egress Safety Margin: ASET vs RSET
- Platform Simulation Workflow
- Interactive UI & Configurator Engineering
- Automated 3-Page Deep Analytics PDF Generator
- Verification & Validation (V&V) Matrix
- RESTful API Reference
- Local Development & Testing
- Vercel Cloud Deployment & CI/CD
firetwin is an advanced computational engineering and life-safety simulation platform developed for structural fire protection engineers, building safety authorities, and CFD researchers. It couples fluid hydrodynamics, radiative and convective heat transfer, toxic gas dispersion, thermal degradation of structural elements, and pedestrian evacuation behavior into a single, cohesive digital twin.
Key engineering capabilities:
-
Dual-Engine Hydrodynamics: Switch seamlessly between a high-fidelity Full LES (accuracy) solver and an ultrafast Fourier Neural Operator (FNO surrogate) delivering continuous temperature and velocity fields in
$< 5,\text{ms}$ . - Interactive Building Layout Configurator: Real-time manipulation of room geometries, multi-compartment wall barriers, door opening states, mechanical HVAC fans, rooftop SHEV exhaust vents, and multiple simultaneous fire ignition sources.
-
Structural Integrity Link: Direct real-time mapping of gas temperatures into unprotected structural steel members via Eurocode 3 lumped capacitance equations, computing temperature-dependent reduction factors
$k_y(T)$ and$k_E(T)$ with JSON export for nonlinear FEA solvers (nonlinear-fea-studio). -
Life Safety & ISO 13571 Tenability: Continuous evaluation of toxic gas Fractional Effective Dose (
$FED$ ), smoke optical extinction ($K_{\text{ext}}$ ), upper hot layer flashover risks, and Available Safe Egress Time ($ASET$ ) vs Required Safe Egress Time ($RSET$ ). - Automated Publication-Grade Reports: Serverless generation of 3-page vector PDF compliance dossiers complete with 6 embedded Matplotlib telemetry plots and standards compliance matrix tables.
graph TB
subgraph UI ["Interactive User Interface (React 18 + TypeScript)"]
UI_Geo["Building Layout Configurator<br/>(Presets, Geometry L×W×H, Multi-Fire Sources)"]
UI_Wall["Partition Wall & Door Canvas Editor<br/>(Move, Add/Delete, Length Inspector)"]
UI_Vent["Ventilation Control<br/>(SHEV Vents 0-100%, HVAC Fans, Facade Louvers)"]
UI_Views["Multi-Tab Viewport<br/>(CFD Heatmap, Evacuation Vectors, FEA Link, Charts, Math)"]
end
subgraph Solvers ["Coupled Multiphysics Simulation Engines"]
direction TB
CFD["Boussinesq Incompressible Navier-Stokes<br/>LES with Smagorinsky SGS Closure"]
FNO["Fourier Neural Operator 2D Surrogate<br/>(Spectral Convolution in Fourier Domain)"]
RAD["P1 Radiation Transport Equation<br/>Participating Grey Soot Media"]
COMB["$t^2$ Fire Growth Rate & Species Kinetics<br/>HRR(t), O2 Depletion, CO & Soot Yield"]
ZONE["2-Zone Layer Descent & Plume Entrainment<br/>(Thomas / Zukoski Plume Dynamics)"]
STRUC["Eurocode 3 Structural Degradation<br/>Lumped Capacitance T_s(t), k_y(T), k_E(T)"]
EVAC["Helbing Social Force Evacuation<br/>Speed Attenuation in Smoke + Panic Drift"]
end
subgraph Analytics ["Life Safety & Regulatory Analytics"]
FED["Toxic FED Accumulation<br/>(ISO 13571 Criteria: FED < 0.30)"]
MARGIN["ASET vs RSET Egress Safety Margin<br/>(NFPA 101 Life Safety Code)"]
FLASH["Flashover Probability Index<br/>(T_layer > 600°C / Flux > 20 kW/m²)"]
end
subgraph Output ["Dossier & Interoperability Outputs"]
FEA_EXP["Project 2 JSON Export<br/>(Nonlinear FEA Studio Link)"]
PDF["ReportLab 3-Page Vector PDF Report<br/>(6 Matplotlib Charts + Standards Tables)"]
VERCEL["Vercel Serverless Production API<br/>https://firetwin.vercel.app"]
end
UI_Geo --> Solvers
UI_Wall --> Solvers
UI_Vent --> Solvers
Solvers --> Analytics
Analytics --> UI_Views
Solvers --> FEA_EXP
Analytics --> PDF
Solvers --> PDF
PDF --> VERCEL
Thermal buoyancy-driven flows within compartments are governed by the filtered incompressible Navier-Stokes equations under the Boussinesq approximation:
Where:
-
$\mathbf{\bar{u}} = (\bar{u}, \bar{v}, \bar{w})$ is the filtered velocity vector field$(\text{m/s})$ . -
$\rho_0$ is the ambient reference density of air ($1.204,\text{kg/m}^3$ at$20^\circ\text{C}$ ). -
$\beta = 1/T_0$ is the thermal expansion coefficient ($1/293.15,\text{K}^{-1}$ ). -
$\mathbf{g} = (0, -9.81),\text{m/s}^2$ is gravitational acceleration. -
$\alpha_{th} = k/(\rho_0 c_p)$ is the thermal diffusivity of air$(\text{m}^2/\text{s})$ . -
$\dot{q}'''_{comb}$ is the volumetric combustion heat generation rate$(\text{W/m}^3)$ . -
$\nabla \cdot \mathbf{q}_r$ is the radiative flux divergence$(\text{W/m}^3)$ .
The unresolved subgrid-scale Reynolds stress tensor
Where the resolved strain rate tensor
-
$C_s \approx 0.18$ is the Smagorinsky constant calibrated for buoyant indoor compartment fire plumes. - Effective kinematic viscosity:
$\nu_{eff} = \nu_{laminar} + \nu_{sgs}$ .
In participating absorbing-emitting soot media, the radiative transfer equation is solved using the differential
Where:
-
$D_{rad} = \frac{1}{3(\kappa + \sigma_s)}$ is the radiation diffusion coefficient ($\text{m}$ ). -
$\kappa = \kappa_{gas} + \kappa_{soot} \approx 0.1 + 0.9\left(\frac{Y_{soot}}{0.05}\right)$ is the Planck mean absorption coefficient ($\text{m}^{-1}$ ). -
$\sigma_s$ is the scattering coefficient (assumed isotropic,$\approx 0$ for small carbonaceous soot particles). -
$\sigma = 5.670374 \times 10^{-8},\text{W}/(\text{m}^2\text{K}^4)$ is the Stefan-Boltzmann constant.
The volumetric radiative heat source/sink term entering the energy conservation equation is:
Fire heat output follows a standard NFPA/Eurocode parabolic growth profile modulated by fuel availability and ventilation limitations:
| Growth Regime | Coefficient |
Typical Fuel Commodity |
|---|---|---|
| Slow | Densely packed archives, solid hardwood | |
| Medium | Standard office desks, cotton mattresses | |
| Fast | Padded furniture, cardboard packaging | |
| Ultra-Fast | Foam plastics, flammable liquids, pallet racks |
Total released thermal energy accumulated over time:
Chemical species mass fractions
Oxygen consumption rate is related to HRR via Thornton's rule (
Soot and carbon monoxide production rates:
In multi-compartment enclosures, buoyancy stratifies gases into a distinct upper hot smoke layer and lower ambient cold layer.
Where plume air entrainment rate
Where $\dot{Q}c = 0.70 \dot{Q}$ is the convective component of the heat release rate and $z = H - z{layer}$ is plume height.
Vent mass outflow under natural buoyancy pressure difference:
Standard nominal fire time-temperature curve defining exposure conditions:
Member temperature rise
Where:
-
$A_m / V$ is the member section factor ($140,\text{m}^{-1}$ for typical I-sections). -
$\rho_s = 7850,\text{kg/m}^3$ is the density of carbon steel. -
$c_s(T_s)$ is temperature-dependent specific heat per Eurocode 3:$$c_s(T_s) = 425 + 7.73 \times 10^{-1} T_s - 1.69 \times 10^{-3} T_s^2 + 2.22 \times 10^{-6} T_s^3 \quad [\text{J}/(\text{kg}\cdot\text{K})]$$ -
$h_c = 25,\text{W}/(\text{m}^2\cdot\text{K})$ is the convective heat transfer coefficient. -
$\epsilon_{res} = \left(\frac{1}{\epsilon_f} + \frac{1}{\epsilon_s} - 1\right)^{-1} \approx 0.7$ is resultant surface emissivity.
Nonlinear material property degradation factors:
Numerical values per EN 1993-1-2 Table 3.1:
Pedestrian evacuation is governed by the Helbing Social Force Model extended with smoke extinction attenuation:
Where
Smoke visibility reduction and ocular irritation diminish pedestrian free-walking speed according to the Jin empirical model:
Where
Where
The Fourier Neural Operator learns mesh-independent mappings between input boundary hazard conditions
The non-local spectral integral kernel
Where:
-
$\mathcal{F}$ and$\mathcal{F}^{-1}$ denote forward and inverse 2D Fourier transforms. -
$R_\phi(k)$ is a learnable complex tensor parameterized in frequency space, truncated at mode cutoffs$k_{max,x} = 12$ ,$k_{max,y} = 10$ . -
$W$ is a local linear transformation matrix. -
$\sigma(\cdot)$ is the GELU activation function.
Graceful Fallback: In environments without PyTorch (e.g. lightweight serverless containers), fno_surrogate.py falls back to a high-speed NumPy Gaussian convolution kernel preserving real-time execution.
The toxic tenability index
Where
Where
-
Safe Zone:
$FED < 0.30$ (Statistically protects sensitive populations). -
Incapacitation Threshold:
$0.30 \le FED < 1.0$ (Loss of motor skills, severe disorientation). -
Lethal Exposure:
$FED \ge 1.0$ (50% fatality probability in exposed population).
Under NFPA 101 Life Safety Code requirements, an enclosure is tenable if and only if the Available Safe Egress Time exceeds the Required Safe Egress Time:
If
-
Floorplan Configuration:
- Select from 7 standardized presets or build bespoke multi-room layouts.
- Adjust floor length (
$5 - 20,\text{m}$ ), width ($4 - 15,\text{m}$ ), and ceiling height ($2.4 - 6.0,\text{m}$ ).
-
Barrier & Aperture Placement:
- Draw, resize, and translate horizontal and vertical partition walls directly on canvas.
- Assign fire doors (Solid Core, Open Passage, EI60 Fire Rated, Double-Swing Glass).
-
Ventilation Strategy:
- Control rooftop SHEV smoke exhaust vents (
$0 - 100%$ ). - Toggle mechanical HVAC fans between
OFF,EXTRACT, andPRESSURIZE. - Open/close exterior facade louvers and windows.
- Control rooftop SHEV smoke exhaust vents (
-
Ignition Hazards:
- Position multiple simultaneous fire sources across the grid.
- Customize individual
$t^2$ growth coefficients ($\alpha$ ), peak HRRs, and ignition delays.
-
Coupled Solve:
- Hydrodynamics and species disperse through connected rooms.
- Upper layer temperatures conduct into structural steel members.
- Agents navigate floorplans utilizing social force vectors and RL smoke-avoidance wayfinding.
-
Telemetry & PDF Dossier Generation:
- Review 6 interactive time series charts and ISO compliance tables in-browser.
- Click PDF Report to compile a publication-grade 3-page engineering dossier via FastAPI/ReportLab.
The frontend is built with React 18 and Vanilla CSS, engineered with responsive layout controls to prevent vertical scrolling:
- Default 560px Width: Prevents vertical stacking, allowing controls to sit side-by-side in clean 2-column and 3-column rows.
- Header Width Controls: Quick toggle between
560pxand650px, plus◀ ▶increment buttons (380px – 750px). - Category Filter Tabs: Focus on individual domains (
Room & Grid,Doors & Vents,Fire Sources,Barriers) with zero vertical scrolling.
The backend includes a ReportLab PDF engine generating vector reports:
-
Page 1: Executive Overview & Coupled Thermal-Structural Dynamics:
- Executive summary metrics (Peak Gas Temp, Steel Member Temp, ASET, RSET, Egress Margin, Released Energy).
- High-resolution Matplotlib Chart 1: Coupled Gas vs Steel Temperature vs ISO 834 Curve.
- Matplotlib Chart 2: Eurocode 3 Material Yield Degradation ($k_y(T)$ vs $k_E(T)$).
-
Page 2: Life Safety, Smoke Dispersion & Subsystem Solver Verification:
- Matplotlib Chart 3: Two-Zone Smoke Layer Interface Descent & Optical Density.
- Matplotlib Chart 4: Combustion Power $\dot{Q}(t)$ vs Oxygen Depletion.
- Full Subsystem Solver V&V Matrix Table.
-
Page 3: Toxic Gas Tenability & Regulatory Standards Compliance:
- Matplotlib Chart 5: ISO 13571 Cumulative Toxic Gas Exposure ($FED$ vs Tenability Limit).
- Matplotlib Chart 6: Multi-Compartment Hot Layer Thermal Cascade ($T_1, T_2, T_3$).
- Standards Compliance Matrix Table (ISO 13571, NFPA 101, NFPA 92, Eurocode 3).
All numerical models have been validated against analytical formulations and experimental fire test data:
| Test Case | Physics Domain | Analytical / Benchmark Basis | Tolerance | Status |
|---|---|---|---|---|
test_iso834_fire_curve |
Thermal Action | EN 1991-1-2 Nominal Equation | PASSED | |
test_steel_yield_degradation |
Structural Response | EN 1993-1-2 Table 3.1 ( |
PASSED | |
test_les_cfd_solver_step |
Fluid Dynamics | Boussinesq Buoyant Plume Incompressibility | PASSED | |
test_p1_radiation_model |
Radiation Heat Transfer | Radiative Transfer Equation ( |
Divergence Stability | PASSED |
test_fno_surrogate_l2_threshold |
Neural Operator | Spectral Convolution vs High-Res LES | Rel. Error |
PASSED |
test_evacuation_agent_dynamics |
Human Behavior | Helbing Social Force Wall Boundary | No penetration | PASSED |
test_fastapi_endpoints |
API & Reporting | REST Simulation Endpoints & PDF Gen | HTTP 200 / Valid PDF | PASSED |
Run the automated test suite locally:
PYTHONPATH=backend/src pytest backend/tests/ -v| Method | Endpoint | Description | Sample Response / Status |
|---|---|---|---|
GET |
/health |
Service health status check | {"status": "ok", "app": "firetwin"} |
GET |
/scenarios |
List available simulation scenarios | [{"scenario_id": "demo-scen-01", ...}] |
POST |
/simulation/step |
Run one simulation integration timestep | SimulationStep telemetry JSON |
GET |
/reports/{scenario_id}/pdf |
Generate publication-grade 3-page PDF | application/pdf binary stream |
GET |
/api/reports/{scenario_id}/pdf |
Vercel Serverless proxy PDF endpoint | application/pdf binary stream |
- Node.js
$\ge 18$ - Python
$\ge 3.10$
git clone https://github.com/10tan/firetwin.git
cd firetwin/backend
# Create virtual environment
python3 -m venv venv
source venv/bin/activate
# Install dependencies & run tests
pip install -r requirements.txt
PYTHONPATH=src pytest tests/ -v
# Start FastAPI server
uvicorn firetwin.main:app --host 0.0.0.0 --port 8000 --reloadcd ../frontend
npm install
npm run devfiretwin is configured for continuous zero-cost deployment on Vercel:
- Frontend: Built via
@vercel/static-buildusing Vite and React 18. - Backend API: Deployed as a Python serverless function via
@vercel/python(api/index.py). - Configuration: Managed in
vercel.jsonwith route rewriting rules.
Deploy from the command line:
npx vercel deploy --prodLive deployment is accessible globally at: https://firetwin.vercel.app
This project is licensed under the MIT License — see the LICENSE file for details.
Copyright © 2026 DNV Research Labs & Contributors.



