# Dynamic Modeling and Full-Process Simulation of the Core Engine Test Rig Main Test System
## 3 Modularization Modeling Approach
### Gas Mixing Apparatus Model
#### 3.3.1 Flow Model  
Continuity equation of species:  
\[\frac{\mathrm{d}m_{\mathrm{M,\;}i}}{\mathrm{d}t}=\frac{\mathrm{d}(\rho_{ \mathrm{M,\;}i}V)}{\mathrm{d}t}=\rho_{\mathrm{M,\;}i}^{\mathrm{in}}(u_{n}A_{n} )_{i}-\sum_{j=1}^{n_{\mathrm{out}}}\rho_{\mathrm{M,\;}i}(u_{0}A_{0})_{j}+\sum_ {k=1,k\
eq i}^{n_{\mathrm{in}}}\rho_{\mathrm{M,\;}i}\cdot\mathrm{fun}(Q_{ \mathrm{v,\;}k}),\;i=1,2,\cdots,n_{\mathrm{in}} \tag{10}\]  
\[\text{where }\mathrm{fun}(Q_{\mathrm{v,\;}k})=\left\{\begin{array}{cc}0& \text{if }(u_{n})_{k}\geq 0\\ \left(u_{n}A_{n}\right)_{k}&\text{if }(u_{n})_{k}<0\end{array}\right.\]  
Continuity equation:  
\[\frac{\mathrm{d}m}{\mathrm{d}t}=\frac{\mathrm{d}(\rho V)}{\mathrm{d}t}=\sum_ {i=1}^{n_{\mathrm{in}}}\rho_{\mathrm{M,\;}i}^{\mathrm{in}}(u_{n}A_{n})_{i}- \sum_{j=1}^{n_{\mathrm{out}}}\rho_{j}^{\mathrm{out}}(u_{0}A_{0})_{j} \tag{11}\]  
Energy equation:  
\[\frac{\mathrm{d}E}{\mathrm{d}t}=\frac{1}{V}\left\{\sum_{i=1}^{n_{\mathrm{in}} }[(E+p)Q_{\mathrm{v}}]_{i}^{\mathrm{in}}-\sum_{j=1}^{n_{\mathrm{out}}}[(E+p) Q_{\mathrm{v}}]_{j}^{\mathrm{out}}-(E+p)\frac{\mathrm{d}V}{\mathrm{d}t}-\hat{q}S\right\} \tag{12}\]  
Mixture fraction equation:  
\[\frac{\mathrm{d}f_{\mathrm{mix}}}{\mathrm{d}t}=\ \frac{1}{m}\left\{\sum_{i=1}^{n_{ \mathrm{in}}}\left[(\rho uA)_{i}^{\mathrm{in}}\left(f_{\mathrm{mix,\;}i}^{ \mathrm{in}}-f_{\mathrm{mix}}\right)\right]-\sum_{j=1}^{n_{\mathrm{out}}} \left[(\rho uA)_{j}^{\mathrm{out}}\left(f_{\mathrm{mix,\;}j}^{\mathrm{out}}- f_{\mathrm{mix}}\right)\right]\right\} \tag{13}\]  
Partial density calculation formula of species:  
\[\rho_{\mathrm{M,\;}i}=m_{\mathrm{M,\;}i}/V \tag{14}\]  
Partial mole number calculation formula of species:  
\[nmol_{\mathrm{M,\;}i}=m_{\mathrm{M,\;}i}/\,M_{\mathrm{w}\mathrm{M,\;}i} \tag{15}\]  
Total mass calculation formula of mixture:  
\[m=\sum_{i=1}^{n_{\mathrm{in}}}m_{\mathrm{M,\;}i} \tag{16}\]  
Total mole number calculation formula of mixture:  
\[nmol=\sum_{i=1}^{n_{\mathrm{in}}}nmol_{\mathrm{M,\;}i}=\sum_{i=1}^{n_{ \mathrm{in}}}m_{\mathrm{M,\;}i}/\,M_{\mathrm{w}\mathrm{M,\;}i} \tag{17}\]  
Total density calculation formula of mixture:  
\[\rho=m/V=\sum_{i=1}^{n_{\mathrm{in}}}m_{\mathrm{M,\;}i}/V=\sum_{i=1}^{n_{ \mathrm{in}}}\rho_{\mathrm{M,\;}i} \tag{18}\]Mass flow-rate equation:  
\[Q_{\text{m}}=\frac{1}{2}\left[\sum_{i=1}^{n_{\text{m}}}\left(Q_{\text{m}}^{\text{ in}}\right)_{i}+\sum_{j=1}^{n_{\text{out}}}\left(Q_{\text{m}}^{\text{out}} \right)_{j}\right] \tag{19}\]  
Velocity (mean velocity) calculation formula:  
\[u_{\text{T}}=\frac{Q_{\text{m}}}{\rho A}=\left[\sum_{i=1}^{n_{\text{m}}}\left( \rho^{\text{in}}Q_{\text{v}}^{\text{in}}\right)_{i}+\sum_{j=1}^{n_{\text{out}} }\left(\rho^{\text{out}}Q_{\text{v}}^{\text{out}}\right)_{j}\right]/(2\rho A) \tag{20}\]  
Pressure calculation formula of mixture:  
\[p=(\gamma-1)\left(E-\rho u_{\text{T}}^{2}/2\right) \tag{21}\]  
Temperature calculation formula of mixture:  
\[T=p/(\rho R) \tag{22}\]  
In the equations, \(\rho_{\text{M, }i}\) and \(m_{\text{M, }i}\) (\(i=1,2,\cdots,n_{\text{in}}\)) are partial density and mass of various gas species involved in mixing, respectively. When calculating the mass and energy exchange among the state elements of gas mixing apparatus and connected pipes, the upwind scheme is used to ensure compatibility of the state equations, that is  
\[Var_{i}^{\text{in}}=\left\{\begin{array}{ll}\left(Var_{n}\right)_{i}&\text{if } \left(u_{n}\right)_{i}\geq 0\\ Var&\text{if }\left(u_{n}\right)_{i}<0\end{array}\right.,\ Var_{j}^{\text{out}}= \left\{\begin{array}{ll}Var&\text{if }\left(u_{0}\right)_{j}\geq 0\\ \left(Var_{0}\right)_{j}\text{if}\left(u_{0}\right)_{j}<0\end{array}\right., \ Var\in\left\{\rho,p,E,f_{\text{mix}}\right\}\]  
The adiabatic model is used for the wall heat transfer.