## 2 Methods and Tools
### Thermodynamic Model Description
The sum of heat transfer and heat release rates is calculated by considering the burnt mass rate from Equation (4) above, and the sum of enthalpy flowrates is calculated by considering the valve inlet and outlet mass flowrates, in accordance to the Equations (6) and (7) respectively:  
\[\dot{Q}_{\sum}=\dot{m}_{fb}h_{form}-C_{w}\sum_{j}A_{j}(T-T_{j}) \tag{6}\]  
\[\dot{H}_{\sum}=\dot{m}_{i}h_{i}-\dot{m}_{o}h_{o} \tag{7}\]  
where \(h_{form}\) is the fuel enthalpy of formation, \(C_{w}\) is the Woschni heat transfer coefficient [7], and \(A_{j}\), \(T_{j}\) are the heat transfer areas and surface temperatures respectively for the \(j^{\prime}h\) cylinder part. The subscript \(j\) denotes the piston, cylinder head, liner and exhaust valve. The scavenging period (from the SPO to EVC) is modelled by employing the two-zone approach [41], which considers that the cylinder is divided into two zones, namely, the charge air zone, and the exhaust gas zone (the latter contains a mixture of the exhaust gas and charge air). By applying the energy and mass conservation equations as well as the ideal gas law and considering the homogeneous mixture, the following system of ODE is obtained:  
\[ \begin{bmatrix}\dot{p}\\ \dot{V}_{1}\\ \dot{T}_{1}\\ \dot{V}_{2}\\ \dot{T}_{2}\\ \dot{\xi}_{2}\end{bmatrix} = \begin{bmatrix}0&1&0&1&0&0\\ V_{1}&p&-m_{1}R_{1}&0&0&0\\ 0&p&m_{1}\frac{\partial u_{1}}{\partial T_{1}}&0&0&0\\ V_{2}&0&0&p&-m_{2}R_{2}&0\\ 0&0&0&p&m_{2}\frac{\partial u_{2}}{\partial T_{2}}&0\\ 0&0&0&0&0&1\end{bmatrix} ^{-1} \begin{bmatrix}\dot{V}\\ \dot{m}_{1}R_{1}T_{1}\\ \dot{Q}_{1}+\dot{m}_{i}h_{i}-\dot{m}_{1,2}h_{1}-\dot{m}_{1}u_{1}\\ T_{2}\left(\dot{m}_{2}R_{2}+\frac{\partial R_{2}}{\partial\phi_{2}}m_{2} \dot{\phi}_{2}\right)\\ \dot{Q}_{2}+\dot{m}_{1,2}h_{1}-\dot{m}_{o}h_{o}-\dot{m}_{2}u_{2}-\frac{ \partial u_{2}}{\partial\phi_{2}}m_{2}\dot{\phi}_{2}\\ F_{s}\dot{\phi}_{2}(1-\xi_{2})^{2}\end{bmatrix}  \tag{8}\]  
where the subscripts \(1\) and \(2\) denote the charge air and mixture zones respectively, and the subscript \(1,2\) denotes the charge air flow from zone \(1\) to zone \(2\). Furthermore, \(\dot{Q}_{1}\) and \(\dot{Q}_{2}\)denote the heat transfer rates for each zone respectively, which are calculated using the Woschni heat transfer coefficient \(C_{w}\) in accordance to the following equations:  
\[\dot{Q}_{1} =-C_{w}\bigg{[}A_{p}(T-T_{p})+A_{l}\frac{V_{1}}{V}(T-T_{l})\bigg{]} \tag{9}\] \[\dot{Q}_{2} =-C_{w}\bigg{[}\sum_{q}A_{q}(T-T_{q})+A_{l}\frac{V_{2}}{V}(T-T_{l}) \bigg{]} \tag{10}\]  
where the subscripts \(p\) and \(l\) denote the piston and cylinder liner respectively, and the subscript \(q\) denotes the valve and cylinder head. The mass flow rate from zone 1 to zone 2 is calculated according to the following equation:  
\[m_{1,2}=c_{s}m_{i} \tag{11}\]  
where \(c_{s}\) is the scavenging mixing factor calibrated at every load point [41]. The application of the mass and volume conservation provide the following equations:  
\[\dot{m}_{1} =(1-c_{s})\dot{m}_{i} \tag{12}\] \[\dot{m}_{2} =c_{s}\dot{m}_{i}-\dot{m}_{o}\] (13) \[\dot{V} =\dot{V}_{1}+\dot{V}_{1} \tag{14}\]  
The switch between the one-zone and two-zone approaches takes place after the scavenge ports open, when the charge air zone volume \(V_{1}\) is sufficiently large, such that singularities during the matrix inversion in Equation (8) are avoided [45]. In specific, when the scavenge ports open, the one-zone approach equations from Equation (1) continue to be integrated, along with the following additional differential equation:  
\[\dot{V}_{1}=\dot{m}_{1}R_{1}T_{1}p^{-1} \tag{15}\]  
Subsequently, the zone volume fraction is utilised as the criterion which performs the switch from the one-zone to the two-zone approach, according to whether the following inequality is satisfied:  
\[\frac{V_{1}}{V}\geq\mathrm{c} \tag{16}\]  
where c is set to \(10^{-3}\).