## 4 Improvement for Energy Equation
### Derivation of Energy Equation  
The energy equation was derived in order to compare it with the one used in OpenFOAM. The derivation of the energy equation in the integral form is as follows:  
\[\frac{dE}{dt}=\frac{d}{dt}\bigg{(}\int_{\text{CV}}e\rho dV\bigg{)}+\int_{\text{ CS}}e\rho(\textbf{{U}}\textbf{{\cdot}}\textbf{{n}})dA=\frac{dQ}{dt}-\frac{dW}{dt}+ \text{Source}\]  
\[\frac{d}{dt}\bigg{(}\int_{\text{CV}}e\rho dV\bigg{)}+\int_{\text{CS}}e\rho( \textbf{{U}}\textbf{{\cdot}}\textbf{{n}})dA=\dot{Q}-\Big{(}\dot{W}_{pressure}+ \dot{W}_{viscous\ stress}\Big{)}+\text{Source}\]  
Hence, the energy equation in the integral form is the following:  
\[\frac{d}{dt}\bigg{(}\int_{\text{CV}}e\rho dV\bigg{)}+\int_{\text{CS}}e\rho( \textbf{{U}}\textbf{{\cdot}}\textbf{{n}})dA=\dot{Q}-\bigg{(}\int_{\text{CS}}p (\textbf{{U}}\textbf{{\cdot}}\textbf{{n}})dA-\int_{\text{CS}}\textbf{{\cdot }}\textbf{{\cdot}}\textbf{{U}}dA\bigg{)}+\text{Source} \tag{8}\]  
where \(e=e_{internal}+e_{kinetic}+e_{potential}=\hat{u}+\frac{1}{2}U^{2}+gz\), and the potential energy is negligible. From Equation (8), the derivation of the energy equation in the differential form is as follows:  
\[\begin{array}{c}\text{L.H.S.}=\Big{[}\frac{\partial}{\partial t}(\rho e)+ \frac{\partial}{\partial x}(\rho\eta e)+\frac{\partial}{\partial y}(\rho ve)+ \frac{\partial}{\partial z}(\rho ve)\Big{]}dxdydz\\ \hskip 142.26378 pt=\Big{[}\frac{\partial}{\partial t}(\rho e)+\
abla{\cdot}( \rho\textbf{{U}}e)\Big{]}dxdydz\\ \hskip 142.26378 ptR.H.S.=\big{[}\
abla{\cdot}(k\
abla T)-\
abla{\cdot}(\textbf {{U}}p)+\
abla{\cdot}\big{(}\textbf{{U}}\textbf{{\cdot}}\textbf{{\cdot}} \textbf{{\cdot}}\textbf{{\cdot}}\textbf{{\cdot}}\textbf{{\cdot}}\textbf{{ \cdot}}\textbf{{\cdot}}\textbf{{\cdot}}\textbf{{\cdot}}\textbf{{\cdot}}\textbf{ {\cdot}}\textbf{{\cdot}}\textbf{{\cdot}}\textbf{{\cdot}}\textbf{{\cdot}} \textbf{{\cdot}}\textbf{{\cdot}}\textbf{{\cdot}}\  
However, this code is different from the energy equation while lacking the kinetic energy term. This code calculates the divergence of the rothalpy, which includes static enthalpy and kinetic energy, but it is same as calculating the total enthalpy.  
Therefore, it is advisable to modify the rothalpy equation properly and then modify the code accordingly. First, it is necessary to separate the rothalpy. The rothalpy can be separated by the kinetic energy term relative to the velocity, as follows:  
\[i_{0}=i+\frac{1}{2}U_{rel}^{2}=h_{0}-U_{rot}U_{\theta}=h+\frac{1}{2}U_{rel}^{2}- \frac{1}{2}U_{rot}^{2} \tag{14}\]  
\[\therefore i=h-\frac{1}{2}U_{rot}^{2} \tag{15}\]  
Equation (14) has the same form as static enthalpy from the total enthalpy, and accordingly, a new relationship between the separated rothalpy and the static enthalpy is formed in Equation (15). If the above relation is used, the rothalpy equation can be modified as follows:  
\[\
abla\cdot(\rho\textbf{U}i)+\
abla\cdot\left(\rho\textbf{U}\left(0.5U_{rel}^ {2}\right)\right)-\rho\alpha\
abla^{2}i=0 \tag{16}\]  
This equation resembles the general enthalpy equation, and the energy equation is solved exactly the same as the enthalpy equation in the stationary domain, and the rothalpy separated from the kinetic energy is solved in the rotating domain. The energy equation code iEqn.H, considering Equation (16), is as follows:  
Figure 8: Comparison of temperature by rhoSimpleFoam of foam-extend–4.1: (**a**) original code and (**b**) modified code. fvScalarMatrixiEqn (  fvm:div(phi, i) + fvc:div(phi, volScalarField(\"K\", 0.5=magSqr(Urel)))  - fvm:laplacian(turbulence->alphaEff(), i) ); iEqn.relax(); iEqn.solve(); // Fromrothalpy,calculate enthalpy after solution of rothalpy equation h = i + 0.5*(magSqr(Urot)); ```  
This code yields the final enthalpy, which yields the temperature of the whole flow field. When using the separated rothalpy and the modified code, the libraries for the boundary conditions must be modified, too. Typically, when using fixedEthalpy and gradientEnthalpy, the newly defined separated rothalpy relation equation should be applied.