Full text
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” Developing a Machine Learning Model to predict CFD Simulations M. Magdy1, P. Metry2, S. Mekhael2 1 Department of Environmental Sciences and Engineering, NOVA University Lisbon, Lisbon, Portugal 2 Coventry University Branch in Egypt, The Knowledge Hub Universities, Cairo, Egypt ABSTRACT Buildings account for up to 40 % of global energy consumption and are a major source of greenhouse ‐ gas emissions. While Computational Fluid Dynamics (CFD) provides the spatially resolved accuracy needed for detailed thermal and airflow analyses, its high computational cost and expertise requirements limit its use in large ‐ scale parametric studies. Zero ‐ dimensional (0D) models offer rapid, cycle ‐ average predictions but cannot capture local phenomena critical to room-scale comfort and energy ‐ use assessments. In this work, we explore a hybrid approach that leverages machine-learning (ML) surrogates to emulate room-scale CFD simulations and thereby reduce the number of full CFD runs required. Experiments were conducted in a controlled laboratory room at an international university branch, generating CFD data under varying boundary conditions. A suite of ML algorithms was trained on datasets of increasing size to quantify the trade-off between training-set computational expense and surrogate-model accuracy. Results demonstrate that, depending on model type and training-set size, ML surrogates can predict key thermal and airflow metrics with up to 98 % accuracy, while cutting total simulation time by orders of magnitude compared to pure CFD workflows. This study shows that carefully calibrated ML models can serve as efficient proxies for CFD in building ‐ energy research, enabling rapid exploration of design and control strategies with minimal loss of fidelity. INTRODUCTION Thermal comfort within indoor environments significantly affects occupant well-being, productivity, and energy consumption. Standards such as ISO 7730 and ASHRAE 55 define thermal comfort through parameters including air temperature, mean radiant temperature, humidity, air velocity, clothing insulation, and metabolic rate. Traditional thermal comfort assessment relies on empirical models such as Fanger’s Predicted Mean Vote (PMV), yet these models simplify complex fluid dynamics and fail to capture spatial heterogeneity in temperature and airflow. Over the last two decades, CFD has become the cornerstone of detailed analysis in building physics, enabling spatially and temporally resolved predictions of airflow, heat transfer, and indoor environmental quality. High-fidelity CFD solvers—whether based on Reynolds-Averaged Navier–Stokes (RANS), Large Eddy Simulation (LES), or hybrid approaches—are routinely applied to HVAC design, contaminant dispersion, and thermal comfort assessments. Meanwhile, burgeoning interest in real-time building controls and applications has placed new demands on simulation speed: design teams and facility managers increasingly require rapid “what-if” evaluations to optimize comfort, energy use, and system resilience on the fly. Despite continual improvements in solver efficiency and hardware performance, CFD simulations remain computationally expensive. A single RANS transient run in a typical office-scale domain can consume 6–8 hours of wallclock time on a modern multicore cluster, making extensive parametric sweeps or on-line control infeasible. This cost is compounded when exploring factorial combinations of occupant loads, supply-air rates, and external conditions: a comprehensive study of even a few dozen scenarios can quickly accrue hundreds to thousands of CPU‐hours. Reduced‐Order Modeling (ROM) techniques (e.g., Proper Orthogonal Decomposition, Galerkin projection) alleviate some of this burden but often require problem-specific mode bases and struggle with large excursions in boundary conditions. Physics-Informed Neural Networks (PINNs) and convolutional-surrogate models promise greater generality, yet their training costs and data requirements can offset runtime gains—particularly when simulations must be repeated for each new
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” geometry or control strategy. The research addresses the dual challenge of high computational cost and limited surrogate generality by developing a data-driven framework for rapid thermal comfort prediction. We formulate the core problem as follows: given real-world operating conditions (occupancy, supply-air flow, outdoor temperature), how can we predict 3D temperature and velocity fields with fidelity comparable to full CFD, but at speeds compatible with real-time decision support? Our approach couples a carefully designed parametric CFD campaign—covering 648 steady scenarios in a representative office chamber—with machine-learning surrogates, culminating in an optimized Artificial Neural Network (ANN) that reproduces CFD results within 0.2 K of error and executes in milliseconds. Modern building operation and design face mounting pressures to balance occupant comfort, energy efficiency, and environmental impact. Facility managers require adaptive control systems that respond to changing loads—such as fluctuating occupancy and weather—while energy analysts need rapid screening tools to evaluate numerous HVAC configurations. Traditional design workflows, which rely on weeks-long CFD studies or simplified empirical models, cannot support interactive exploration or on-line optimization. As smart-building platforms and concepts gain traction, there is an urgent need for surrogate models that marry the accuracy of CFD with the speed of data-driven inference. Moreover, stakeholders—from architects to sustainability officers—demand quantitative confidence in surrogate predictions. Empirical comfort models (e.g., PMV) lack spatial resolution and can misrepresent localized discomfort, while ROMs and PINNs may not generalize across widely varying scenarios without extensive retraining. A robust, validated ANN surrogate can bridge these gaps by offering rapid, spatially resolved forecasts of thermal fields and by adapting to new operating regimes with minimal additional data. Such a tool would empower designers and operators alike, enabling informed decisions that enhance comfort, reduce energy use, and support corporate sustainability goals. The primary objective of this project is to create and rigorously validate a machine-learning surrogate model that can predict the room temperature using (1) outer temperature; (2) number of occupants and (3) internal fan speed after feeding normally obtained from CFD simulations in near real time. This research’s purposes were thoroughly identified in the Literature Review section, followed by the Machine Learning Framework that was applied and its Methodology; either in terms of CFD or ML models. The outcomes were discussed in further detail within the Results and Validation section.
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” SYMBOLS Occupant count (0–11 persons) Supply-air mass flow rate (kg/s) Outdoor ambient temperature (K) , Predicted and true target vectors [mean temp, max vel, pressure drop] , , , Regression coefficients in linear and polynomial models Output of the 𝑡th decision tree in a Random Forest Output of the 𝑘th decision tree in a Random Forest 𝑇 Number of trees in Random Forest or boosting rounds in XGBoost 𝑁 Number of training samples , Weight matrix and bias vector at layer ℓ of the ANN Pre-activation vector at ANN layer ℓ Activation (post-ReLU) vector at ANN layer ℓ ReLU(𝑥) || W || F Rectified Linear Unit activation function: max (0,𝑥) Frobenius norm of a matrix λ L2 regularization coefficient in the ANN loss function Total loss for ANN training: mean squared error plus regularization ℓ Pointwise loss function (squared error) Output of CNN filter kkk at spatial position 𝐾,𝐿 Kernel height 𝐾 and width 𝐿 in convolutional layers TERMS ACH Air Changes per Hour, a measure of how many times the entire volume of air in a space is replaced per hour. ANN Artificial Neural Network, a machine learning model inspired by biological neural networks. ASHRAE American Society of Heating, Refrigerating and Air-Conditioning Engineers, sets standards for thermal comfort. CFD Computational Fluid Dynamics, numerical methods solving fluid flow equations. CFL Courant–Friedrichs–Lewy condition, stability criterion for numerical simulation time steps.
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” DES Detached Eddy Simulation, a hybrid RANS-LES turbulence model. DNS Direct Numerical Simulation, fully resolves all turbulence scales. GPR Gaussian Process Regression, a non-parametric Bayesian regression method. GPU Graphics Processing Unit, used for accelerated ML training. LES Large Eddy Simulation, resolves large turbulent structures. L₂ L2 regularization, adds squared weight penalties to loss functions. MAE Mean Absolute Error, average of absolute prediction errors. ML Machine Learning, algorithms that learn patterns from data. MLR Multiple Linear Regression, a statistical method for modeling relationships. MPC Model Predictive Control, a control strategy using a model to predict future behavior. PMV Predicted Mean Vote, thermal comfort index from Fanger’s model. POD Proper Orthogonal Decomposition, a reduced-order modeling technique. R² Coefficient of Determination, statistical measure of model fit. RANS Reynolds‐Averaged Navier–Stokes, time-averaged fluid flow equations. REST Representational State Transfer, API design style. RF Random Forest, an ensemble ML method. ROM Reduced-Order Model, simplified model capturing main dynamics. RFR Random Forest Regression, ensemble regression method. RMS Root Mean Square, used in error metrics. RSM Response Surface Methodology, for design of experiments. SIMPLE Semi-Implicit Method for Pressure Linked Equations, a pressurevelocity coupling algorithm.
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” Literature Review CFD’s strength lies in its ability to solve the Navier–Stokes equations over finely resolved meshes, capturing subtle interactions between turbulence, buoyancy, and conduction. In the domain of indoor thermal comfort, researchers have leveraged CFD to optimize HVAC designs, predict temperature stratification, and assess occupant exposure to drafts and stagnation regions. Despite these successes, the computational expense of a single run—often measured in tens to hundreds of CPU‐hours—renders exhaustive parametric studies impractical and prohibits real‐time control applications. To alleviate this burden, the community has explored Reduced‐Order Modeling (ROM) techniques, which project the full solution onto a low‐dimensional basis. Proper Orthogonal Decomposition (POD) combined with Galerkin projection has been shown to reduce runtime by orders of magnitude at the cost of some accuracy loss (Alcántara-Ávila et al., 2019). However, ROM approaches typically require a priori knowledge of the dominant modes and struggle when boundary conditions shift substantially. In parallel, advances in Machine Learning (ML) have opened a new paradigm for rapid CFD approximation. Physics‐Informed Neural Networks (PINNs) embed the governing equations into a deep‐learning loss function, allowing the network to respect continuity and momentum conservation without explicit data labels (Raissi et al., 2019). Weakly supervised strategies (Wang et al., 2021) and Buckingham Pi–based feature scaling (Fukami et al., 2024) further push toward generalizable surrogates with minimal training samples. Nevertheless, most ML‐CFD surrogate models remain confined to steady‐state or mildly unsteady cases. Thermal comfort problems—where occupancy, supply flow rate, and external temperature vary simultaneously—have received far less attention. Moreover, the volume of high‐quality CFD data needed to train generic deep networks often exceeds practical limits in industrial settings. These observations underscore two critical gaps: Machine Learning models must adapt to time‐varying inputs (e.g., fluctuating occupancy and environmental conditions) without retraining. The Boundary Conditions’ factors ranged between 0-11 occupants, 0.09-0.49 kg/s for fanspeed and from 308-328 K for the outer temperature during every single iteration. Robust ML frameworks must achieve target accuracy with as few full‐order simulations as possible. Arising gaps around this research were met by integrating steady boundary‐condition results directly into a feedforward Artificial Neural Network, and by demonstrating that a few hundred high‐fidelity runs suffice to train a surrogate with errors under 0.2 K in predicted temperature fields. Machine Learning Framework To develop a robust surrogate capable of both interpolating within the training domain and extrapolating to the 20 missing CFD runs, we evaluated six algorithms: Multiple Linear Regression (MLR), standard Linear Regression (LR), Random Forest Regression (RFR), XGBoost, Convolutional Neural Networks (CNN), and an Artificial Neural Network (ANN). All models received the same three-dimensional input vector—occupant count, supply‐air mass flow, and outdoor temperature—and were tasked with predicting the missing temperatures simultaneously. Classical regressors (LR and MLR) provided a useful baseline but suffered from significant bias in high‐variance regimes, with mean absolute errors exceeding 0.5 K on a 10 % cross‐validation fold. Tree-based ensembles (RFR and XGBoost) reduced error to 0.25 K on average, but at the cost of increased computational overhead and less smooth predictions when interpolating. Our CNN architecture treated the three inputs as a pseudo-image of size 1 × 3 with one channel, passing through two convolutional layers before a dense output stage. While this model captured nonlinear interactions more effectively than ensembles (MAE = 0.18 K), it introduced unnecessary complexity given the low dimensionality of the input space.
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” The final ANN comprised an input layer of three neurons, three hidden layers of 64-128-64 neurons with ReLU activations, 20 % dropout, and L₂ weight regularization. Training proceeded for 150 epochs using the Adam optimizer (learning rate = 1 × 10⁻³, batch size = 32). This network achieved the best trade-off between accuracy and efficiency, with an MAE of 0.12 K and R² = 0.98 on held‐out CFD cases. Prediction time per sample was under 5 ms on a standard desktop GPU, facilitating real-time scenario evaluation. To predict the 20 missing runs, we fed their input triples into the trained ANN, generating temperature and flow-field proxies that fell within ±0.2 K of subsequently re-run CFD results. This agreement validated the surrogate’s capacity both to interpolate within the sampled parameter space and to recover failed simulations, thus closing the loop on a comprehensive, data‐driven CFD campaign. Methodology A comprehensive factorial dataset comprising 648 distinct scenarios was recorded—varying occupant counts from zero to eleven, supply-air mass flows between 0.09 and 0.49 kg/s, and outdoor temperatures spanning 308 K to 328 K— and execute high-fidelity CFD analyses. These simulations will incorporate detailed mesh and time-step sensitivity studies to guarantee solution accuracy within ±0.2 K. Once the raw CFD outputs were available, key scalar metrics (including mean room temperature, maximum local velocity and pressure drop across return grills) will be extracted and subjected to statistical characterization and clustering to reveal parameter sensitivities and identify any corner‐case behaviors. With this enriched dataset in hand, we will train and optimize a suite of six candidate surrogate algorithms—ranging from multiple linear regression and random forests to XGBoost, convolutional neural networks and multilayer artificial neural networks—employing rigorous hyperparameter sweeps and cross-validation. Crucially, on/off cycling dynamics observed in real sensor data will be integrated into the training process to enhance the model’s ability to predict steady‐state conditions accurately. Following algorithm selection, the surrogate’s predictive performance will be assessed against a reserved subset of CFD simulations as well as empirical measurements collected from room sensors, enabling quantification of both point-wise errors and overall uncertainty bounds. The leading neural network model will then be deployed as a RESTful microservice and embedded within a model predictive control (MPC) framework to demonstrate its capacity for real-time temperature and flow management. A targeted HVAC diffuser placement case study will be conducted to illustrate the surrogate’s practical impact: by comparing comfort uniformity and energy consumption against baseline diffuser layouts, we will quantify the surrogatedriven improvements in thermal comfort and operational efficiency. This end-to-end validation—from data generation through deployment and demonstration—ensures that the surrogate model not only achieves CFD-level fidelity but also delivers tangible benefits in real-world HVAC control applications. 4.1: GOVERNING EQUATIONS CFD EQUATIONS The CFD models were run using steady Reynolds‐Averaged Navier–Stokes (RANS) with the k–ε turbulence closure using the conventional governing equations. (Ji et al., 2023)
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” LINEAR REGRESSION For each target variable 𝑦 (e.g. mean temperature), the model assumes a linear relationship where { , , } denote occupant count, supply‐air mass flow rate, and outdoor temperature respectively, and coefficients are chosen to minimize the residual sum of squares as follows: Accordingly, the model yields a closed-form solution via normal equations that captures only first-order (linear) dependencies. MULTIPLE LINEAR REGRESSION Extending the linear model with second‐order and interaction terms yields where , , . The coefficients are again determined by least-square minimization. RANDOM FOREST REGRESSION A random forest with 𝑇 trees predicts by averaging over individual tree outputs: XG-BOOST (GRADIENT-BOOSTED TREES) XGBoost refines the tree-ensemble concept by adding trees sequentially to correct the residual errors of the previous ensemble. Assuming denotes the prediction after trees; the th tree was trained to minimize the regularized objective. where is the squared-error loss and penalizes the tree complexity. The final prediction was:
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” CONVOLUTIONAL NEURAL NETWORKS (CNN) CNNs treated the three-feature input as a one-row image of size 1×3×1. In each convolutional layer, the response for filter 𝑘 at position (i, j), was computed by the following equation: where 𝑊 and 𝑏 denote the convolutional weights and biases. The network then flattens the feature maps and applies two fully connected layers with ReLU activation before a linear output layer. FEED-FORWARD ARTIFICIAL NEURAL NETWORKS (ANN) The feed-forward ANN processes the normalized input vector = { , , } through three hidden layers of sizes 64, 128 and 64. At hidden layer ℓ, the pre-activation vector is: Figure 1 Random Forest Regression Results and the post-activation uses the Rectified Linear Unit After applying a 20% dropout mask to during training, the final linear layer computed: which produced the three targeted predictions. The network parameters , } are optimized by minimizing the mean squared error across all samples augmented with regularization: denotes the Frobenius norm of the weight matrix and 𝜆 the regularization strength. 4.2: THERMAL MODEL Energy equation solved with convection and conduction; Boussinesq approximation for buoyancy. Occupant heat load modeled as uniform volumetric sources at a Heat Flux value of 55 W/m2. The outer temperature ranged from 308 to 328 K for each fan speed and number of occupants, as such temperature ranges are normal in the MENA region.
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” Results and Validation 5.1: GEOMETRY & MESHING The physical domain replicates a rectangular test chamber measuring 5 m (length) × 4 m (width) × 3 m (height), instrumented with ceiling diffusers and perimeter return grilles. Internal obstacles—representing furniture and varying occupant loading—are positioned inside the CAD layout below. An unstructured tetrahedral mesh was generated in ANSYS Meshing (v2024 R1 & 2023 R1). Global element sizing was set to 300 mm to capture bulk flow, with curvature‐based refinement down to 18° and a minimum face sizing of 5 mm in regions of high gradient (e.g., near diffusers and heat sources) for further accuracy. Inflation layers (growth rate = 1.2, maximum five layers) were applied to walls to resolve the viscous sublayer. The final mesh comprised approximately 8.9 million elements and 1.6 million nodes, resulting in an average element quality above 0.7, where skewness tolerances were met for Fluent’s linear solver. Figure 2 CAD Design of Case-Study Room (left) and Meshing in Ansys FLUENT (right) 5.2: CONVERGENCE CRITERIA Residuals dropped below 10⁻⁶ for continuity and 10⁻⁵ for all other equations; mass‐flow balance within ±0.1 %. Each CFD run required 2–3 hours of computing time using an octa-core Intel CORE i7 Processor. Figure 3 Sample Plots of Scaled Residuals per iteration (left) and Temperature Settlement as the run ends (right) 5.3: SCENARIOS To explore the combined effects of occupant diversity, supply‐airflow, and external conditions, we defined a factorial set of 648 scenarios. Sampling ranges were chosen to mirror realistic office‐space variations:
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” Sudret, B. (2008). Global Sensitivity Analysis Using Polynomial Chaos Expansions. Reliability Engineering & System Safety, 93(7), 964-979. Wilcox, D. C. (1998). Turbulence modeling for CFD (Vol. 2, pp. 103-217). La Canada, CA: DCW industries. Raissi, M., Perdikaris, P., & Karniadakis, G. E. (2019). Physics-informed neural networks: A deep learning framework for solving forward and inverse problems involving nonlinear partial differential equations. Journal of Computational Physics, 378, 686-707. https://doi.org/10.1016/j.jcp.2018.10.045 Wang, S., Nikfar, M., Agar, J. C., & Liu, Y. (2021). Stacked generative machine learning models for fast approximations of steady-state Navier-Stokes equations. arXiv preprint arXiv:2112.06419. https://arxiv.org/abs/2112.06419 Peravali, S. K., Jafari, V., Samanta, A. K., Kuepper, J., Amin, M., Neumann, P., & Breuer, M. (2024). Accuracy and performance evaluation of low density internal and external flow predictions using CFD and DSMC. Computers & Fluids, 279, 106346. Cooper-Baldock, Z., Vara Almirall, B., & Inthavong, K. (2024). Speed, power, and cost implications for GPU acceleration of computational fluid dynamics on HPC systems. arXiv preprint arXiv:2404.02482. https://arxiv.org/abs/2404.02482 Lee, K. W., Moase, W. H., Khong, S. Z., Ooi, A., & Manzie, C. (2015). Aerodynamic shape optimization via global extremum seeking. IEEE Transactions on Control Systems Technology, 23(6), 2336-2347. https://doi.org/10.1109/TCST.2015.2396771 Lui, H. F. S., & Wolf, W. R. (2019). Construction of reduced-order models for fluid flows using deep feedforward neural networks. Journal of Fluid Mechanics, 872, 963-994. https://doi.org/10.1017/jfm.2019.358 Lee, K. W., Moase, W. H., Manzie, C., Hutchins, N., Ooi, A., Vethecan, J., & Riseborough, P. (2013). Is there a need for fully converged CFD solutions? Global extremum seeking applied to aerodynamic shape optimization. Proceedings of the 2013 Australian Control Conference, 385-390. https://ieeexplore.ieee.org/document/6697304 Ji, G., Zhang, M., Lu, Y., & Dong, J. (2023). The Basic Theory of CFD Governing Equations and the Numerical Solution Methods for Reactive Flows. IntechOpen. doi: 10.5772/intechopen.113253
EinB2025 – 12th International Conference “ENERGY in BUILDINGS 2025” APPENDIX Figure 1 Weekly AC Operation Timestamp demonstrating overall workload against time at normal working days Figure 2 PASCO Wireless Temperature Sensor