## 6 Discussion  
The CFD-Based Digital Twins have proven to be a robust approach to analysing transient two-phase flows in pipeline filling and emptying operations. This study has demonstrated the capacity of DTs to replicate complex hydraulic phenomena, offering a predictive tool for optimising operational procedures. One of the key findings of this research is the role of air pockets in influencing transient pressure conditions. The results show that entrapped air pockets significantly affect both the filling and emptying processes, with their size and distribution altering the pressure response. In filling procedures, large air pockets cause rapid pressure surges due to compression effects, particularly when air expulsion is not adequately controlled (e.g., Type II with an AV D040 and III with an AV S050). Conversely, air pockets contribute to vacuum pressure formation in emptying processes, which can lead to structural risks in the pipeline system if not properly managed. The results highlight the impact of different air valve configurations on the pressure regulation for emptying procedures. Scenarios incorporating air valves, such as Type IV and V for the emptying procedures, exhibit smoother pressure transitions and reduced pressure peaks compared to the cases without air regulation. This is consistent with the previous research indicating that controlled air admission and expulsion mechanisms are fundamental to mitigate hydraulic transients  
Figure 18: Confusion matrix: (**a**) Filling Procedures, and (**b**) Emptying Procedures. [PERSON] et al. [73]. In the case of the study of air valves in filling procedures, it is observed that the use of a 7 mm orifice (Type IV) demonstrates a more gradual pressure variation, suggesting that optimising valve size and placement can enhance system stability. The comparison between real-time pressure measurements and numerical data confirmed the reliability of the DT models. Calibration efforts, including mesh sensitivity analysis and turbulence model selection, accurately represented transient hydraulic behaviours. The DTs demonstrated an adequate predictive capability, obtaining the time series associated with the evolution of hydraulic-thermodynamic parameters at any point in the geometric domain, such as pressure and velocity, as well as the opportunity to visualise the spatial distribution of these same variables at different points in time. The differences between the numerical and measured values are slight, with relative errors remaining within the acceptable limits, typically below 6.54% for the filling procedures and 0.16% for the emptying procedures. However, some discrepancies were noted in the secondary oscillations post-filling (in the case of the filling procedures), likely due to pipe-wall interactions that were not explicitly accounted for in the model. A 2D approach is chosen to simulate emptying procedures and efficiently capture the evolution of air pockets and vacuum pressures along the pipeline. Since the flow is predominantly stratified (as shown in Figure 15 in Test 12 as an example), with air entering the system from the highest point and water draining from the lowest, a two-dimensional model provides sufficient resolution while optimising computational resources. For filling procedures, a 3D CFD model is necessary to capture the complex dynamics of air compression and expulsion. Unlike the emptying processes, filling involves a more intricate interaction between air and water, with significant pressure surges and turbulent mixing occurring in multiple directions. The three-dimensional approach allows for a more detailed representation of the air pockets' spatial evolution, the effects of valve positioning, and the potential for asymmetric flow patterns that cannot be captured in a 2D framework. On the other hand, the potential of integrating machine learning techniques within the Digital Twin framework is highlighted.