TrioCFD 1.9.8
TrioCFD documentation
Loading...
Searching...
No Matches
Code Architecture

This page describes how the multiphase software is programmed and managed within the TrioCFD/TRUST framework: the available problems, the structure of the system of equations, the matrix-filling principle, and the folder structure. It complements the physics-oriented Multiphase Flow section.

The problem

In TRUST/TrioCFD, a Problem (Pb) specifies the set of equations solved over the domain (equivalent to a module in other CFD codes). TrioCFD multiphase corresponds to the multiphase averaged Euler-Euler equation set. Two problems are currently available:

  • Pb_multiphase: solves \(N\) phases with \(3N\) equations (mass, momentum and energy for each phase) — the two-fluid model.
  • Pb_multiphase_HEM: solves 2 mechanically and thermally coupled phases at equilibrium via a single set of 3 equations (mass, momentum, energy for the mixture) — the drift-flux model with thermal equilibrium (see Homogeneous Equilibrium Model). It is a reduction of Pb_multiphase via the Evanescence operator (see Evanescence and Discretization Schemes), equivalent to adding to a Pb_multiphase dataset:
    evanescence { homogene { alpha_res 1 alpha_res_min 0.5 } }

The equations

With the structural hypothesis \(\sum_k\alpha_k=1\), the governing equations of Pb_multiphase are, for each phase \(k\):

\[\begin{aligned} (\mathcal{M}_k)\quad & \frac{\partial\alpha_k\rho_k}{\partial t}+\underbrace{\nabla\cdot(\alpha_k\rho_k\vec{u_k})}_{\text{convection}}=\underbrace{\Gamma_k}_{\text{sources}}\\ (\mathcal{Q}_k)\quad & \frac{\partial\alpha_k\rho_k\vec{u_k}}{\partial t}+\underbrace{\nabla\cdot(\alpha_k\rho_k\vec{u_k}\otimes\vec{u_k})}_{\text{convection}}=\underbrace{-\alpha_k\nabla P}_{\text{solveur\_pression}}+\underbrace{\nabla\cdot(\alpha_k\mu_k\nabla\vec{u_k})-\nabla\cdot(\alpha_k\rho_k\overline{u_i'u_j'})}_{\text{diffusion}}+\underbrace{\vec{F}_{ki}+\vec{F}_k}_{\text{sources}}\\ (\mathcal{E}_k)\quad & \frac{\partial\alpha_k\rho_k e_k}{\partial t}+\underbrace{\nabla\cdot(\alpha_k\rho_k e_k\vec{u_k})}_{\text{convection}}=\underbrace{\nabla\cdot(\alpha_k\lambda_k\nabla T-\alpha_k\rho_k\overline{u_i'e_k'})}_{\text{diffusion}}-\underbrace{p\left(\frac{\partial\alpha_k}{\partial t}+\nabla\cdot(\alpha_k\overline{u_k})\right)+q_{ki}+q_{kp}}_{\text{sources}} \end{aligned} \]

Each equation corresponds, in the code, to a time-dependent term for a conserved quantity, filled through keywords for its operators:

Equation Mass Momentum Energy
Keyword Masse_Multiphase QDM_Multiphase Energie_Multiphase
Abbreviation \((\mathcal{M}_k)\) \((\mathcal{Q}_k)\) \((\mathcal{E}_k)\)
Unknown \(\alpha_k\) \(p\), \(\vec{u_k}\) \(T\)
Conserved \(\rho_k\alpha_k\) \(\rho_k\alpha_k\vec{u_k}\) \(\rho_k\alpha_k e_k\)
Operators convection convection, diffusion, solveur_pression convection, diffusion

Correlation block and sources

The correlation block contains all closure laws and models usable as sources on the right-hand side of the equations; any term not handled by convection, diffusion or solveur_pression must inherit from Correlation_base. Source terms are semi-implicit (to manage the derivative tables); the only purely implicit term is interfacial friction. In ICE/SETS all other terms are semi-implicit; in PAT all terms are implicit except turbulent dispersion (due to the void-fraction gradient).

Turbulent viscosity

The turbulent viscosity is a Correlation_base, filled with the eddy viscosity method; a more complex form uses Viscosite_turbulente_multiple (the Reynolds-stress method), used by the WIT, WIF and Sato models.

Principle of matrix filling

New source terms are implemented by filling partial-derivative matrices using the chain rule. For a source \(F(t)=f(\alpha(t),T(t),P(t),\vec{u}(t))\), \(dF=\frac{\partial F}{\partial\alpha}\delta\alpha+\frac{\partial F}{\partial P}\delta P+\frac{\partial F}{\partial T}\delta T+\frac{\partial F}{\partial\vec{u}}\delta\vec{u}\), which fills the void-fraction, temperature, pressure and velocity matrices \(M_\alpha\), \(M_T\), \(M_P\), \(M_u\) and the right-hand side (secmem):

\[F^{n+1}=\underbrace{F^{n}}_{\text{secmem}}+\underbrace{\tfrac{\partial F}{\partial\alpha}}_{-M_\alpha}\delta\alpha+\underbrace{\tfrac{\partial F}{\partial P}}_{-M_P}\delta P+\underbrace{\tfrac{\partial F}{\partial T}}_{-M_T}\delta T+\underbrace{\tfrac{\partial F}{\partial\vec{u}}}_{-M_u}\delta\vec{u} \]

For example, the energy-equation pressure term \(-P(\frac{\partial\alpha_k}{\partial t}+\nabla\cdot(\alpha_k u_k))\): its temporal part \(P\frac{\partial\alpha}{\partial t}\) gives \(F^n=P^n\frac{\Delta\alpha}{\Delta t}\), \(\frac{\partial F}{\partial\alpha}=\frac{P^n}{\Delta t}\), \(\frac{\partial F}{\partial P}=\frac{\Delta\alpha}{\Delta t}\), \(\frac{\partial F}{\partial T}=0\), \(\frac{\partial F}{\partial u}=0\) — filling secmem, \(M_\alpha\) and \(M_P\) accordingly so that the assembled term is consistent with \(-(P\frac{\partial\alpha_k}{\partial t})^{n+1}\).

Warning
Pressure reduction. Not all dependencies are allowed: to perform pressure reduction, the \(\alpha\) and \(T\) dependency matrices must be kept empty for a momentum source. Thus:
  • in the mass equation (unknown \(\alpha\)): \(F(\alpha,T,P,\vec{u})\Leftrightarrow(M_\alpha,M_T,M_P,M_u)\);
  • in the energy equation (unknown \(T\)): \(F(\alpha,T,P,\vec{u})\Leftrightarrow(M_\alpha,M_T,M_P,M_u)\);
  • in the momentum equation (unknown \(\vec{u}\)): only \(F(P,\vec{u})\Leftrightarrow(M_P,M_u)\), otherwise pressure reduction is not allowed (see the Tchen force).

Only \(M_P\) and \(M_u\) (except \(M_u\) in the momentum equation) can have non-diagonal terms; \(M_\alpha\) and \(M_T\) are always diagonal.

Folder structure

Pb_multiphase from TRUST is common to several CEA codes (TrioCFD, CATHARE3, FLICA5, GENEPI+, TrioMC, SCONE), built as baltiks on top of Trust/Pb_multiphase. The TrioCFD multiphase code is split between the TRUST and TrioCFD folders:

~/
├── TRUST/src/ThHyd/Multiphase
│ ├── Correlations
│ ├── Equations
│ ├── Milieu
│ ├── Operateurs
│ ├── Problems
│ ├── Schema_Temps
│ ├── Sources
│ └── Turbulence
└── TrioCFD/src/Multiphase/CMFD
├── THyd/Multiphase
│ ├── Correlations
│ ├── Milieu
│ ├── PolyMAC_MPFA
│ └── Sources
└── Turbulence

The generic correlations (interfacial friction, lift, added mass, dispersion, flux, drift velocity, diphasic multipliers, phase change, bubble diameter, etc.) live in Trust/src/ThHyd/Multiphase/Correlations, while the TrioCFD-specific models live in TrioCFD/src/Multiphase/CMFD/ThHyd/Multiphase/Correlations:

Verification test cases (generic Pb_multiphase) live in TRUST/Validation/Rapports_automatiques/Verification/Multiphase; TrioCFD-specific validation cases (canal_plan_pb_multi, Gabillet, CoolProp_Single_phase_Debora, marche_descendante, drift-flux and k-τ/ω verifications, etc.) live in TrioCFD/share/Validation/Rapports_automatiques/Multiphase/CMFD.