I am wondering how to calculate accurately the loss of total temperature of a moving gas which has exchanging heat through walls and pressure drop.
More precisely, let's consider a gas in motion in a duct, and let's consider two small cells, 1 and 2, of the duct next to each other (cell 2 is right after cell 1). And I will assume that thermodynamic properties are homogeneous in each cell (it's like meshing the duct).
The frame of reference is the static, motionless duct, and the gas is moving inside the duct at constant mass flow rate $\dot m$.
As the gas is moving in that frame, we can define static and total temperatures ($T_s$ and $T_i$ resp.), as well as static and total pressures ($P_s$ and $P_i$ resp.).
When gas is flowing from cell 1 to cell 2, there is a pressure drop $\Delta P_i$, such that $P_{i_2} = P_{i_1} - \Delta P_i$.
Because of the walls, heat is exchanged through the walls between the moving gas and the ambient, outer air surrounding the duct. The specific exchange heat is $q_1$.
Finally, I know the dependence of the specific heat capacity ratio with static temperature : $c_p = f(T_s)$.
The problem is summarized in the image below, with the notation :
$c_p$ : specific constant-pressure heat capacity (J/kg/K)
$\gamma$ : specific heat ratio
$M$ : mach number
$q_1$ : specific heat exchanged with outer atmosphere through the wall at cell 1 (J/kg)
$T_{out}$ : temperature of outer atmosphere
I would like to estimate the loss in total temperature, that is to say estimate $T_{i_2}$ knowing thermodynamic state at cell 1. But I am not sure which of the two following options I have thought is the right one (maybe none of them are right ?) :
1 - Energy at cell 1 = Energy at cell 2 + energy loss through the wall
So : $c_{p_1}*T_{i_1} = c_{p_2}*T_{i_2} +q_1$
Then I resolve the following system of equations of unknows $T_{i_2}$, $T_{s_2}$, $P_{s_2}$, $M_2$, $c_{p_2}$
$\begin{Bmatrix} c_{p_2}(T_{s_2})*T_{i_2}=c_{p_1}(T_{s_1})*T_{i_1}-q_1 \\ T_{i_2} = T_{s_2}*(1+\frac{\gamma_2-1}{2}M_2^2) \\ P_{i_2}=P_{s_2}*(1+\frac{\gamma_2-1}{2}M_2^2)^{\frac{\gamma_2}{\gamma_2-1}} \\ M_2^2=\frac{\dot{m}^2\,r\,T_{s_2}}{\gamma_2A^2P_{s_2}^2} \\ c_{p_2}=f(T_{s_2}) \end{Bmatrix}$
2 - First law of thermodynamic, assuming no mechanical work : $\Delta H +\Delta E_{kinetic} = -q_1$
So $\int\limits_1^2 c_p(T_s)\,\mathrm{d}T_s + \frac{1}{2}(V_2^2-V_1^2) = -q_1$
As $V = \frac{\dot{m}}{\rho\,A} = \frac{\dot{m}\,r\,T_s}{P_s\,A}$
and given $P_{i_2}=P_{s_2}*(1+\frac{\gamma_2-1}{2}M_2^2)^{\frac{\gamma_2}{\gamma_2-1}}$
I find $T_{s_2}$, $P_{s_2}$, $M_2$, then I calculate $T_{i_2} = T_{s_2}*(1+\frac{\gamma_2-1}{2}M_2^2)$
Thank you for your help