# The Free and Easiest Computational Fluid Dynamics Software

# Flowsquare+ Solver

The following information is for the latest Flowsquare+. Most of input parameters are named after the variable names appearing in the equations.

## Transport Equations

Flowsquare+ solves for density, velocity, temperature, mass fraction of a substance in the fluid, and pressure . For cmode=0 "Fluid simulation mode", the below mass and momentum equations are considered, but not energy or ideal gas law (hence this mode can consider liquid flows as well as gas phase flows). The transport equation of the mass fraction can be considered in both **cmode**.
\begin{equation}
\rho(\mathbf{x},t)\:\:,\:\:\:\:
u_i(\mathbf{x},t)\:\:,\:\:\:\:
T(\mathbf{x},t)\:\:,\:\:\:\:
Y(\mathbf{x},t)\:\:,\:\:\:\:
p(\mathbf{x},t).
\end{equation}

Following spatially filtered transport equations are solved for mass: \begin{equation} \frac{\partial \bar{\rho}}{\partial t} = \frac{\partial}{\partial x_i}\left( \bar{\rho} \tilde{u_i} \right), \end{equation}

momentum: \begin{equation} \frac{\partial \bar{\rho} \tilde{u_i}}{\partial t} + \frac{\partial \bar{\rho} \tilde{u_i} \tilde{u_j}}{\partial x_j} = - \frac{\partial \bar{p}}{\partial x_i} + \frac{\partial}{\partial x_j} \left[ \mu \left( \frac{\partial \tilde{u_i}}{\partial x_j} + \frac{\partial \tilde{u_j}}{\partial x_i} \right) \right] - \underbrace{ \frac{\partial \bar{\rho} \tau_{ij}}{\partial x_j} }_{M_{I}} + \Delta \bar{\rho} g_{f, x_i}, \end{equation}

energy (temperature): \begin{equation} \frac{\partial \bar{\rho} \tilde{T}}{\partial t} + \frac{\partial \bar{\rho} \tilde{u_i} \tilde{T}}{\partial x_i} = \frac{\partial}{\partial x_i} \left( \bar{\rho} \alpha \frac{\partial \tilde{T}}{\partial x_i} \right) - \underbrace{ \frac{\partial \bar{\rho} \phi_i^T}{\partial x_i} }_{M_{II}} + \underbrace{ \frac{1}{c_p}\frac{\partial p_0}{\partial t} }_{M_{III}} + \underbrace{ \frac{\bar{Q}}{c_p} }_{M_{IV}}, \end{equation}

mass fraction of a substance in the fluid [2018R2 or later]: \begin{equation} \frac{\partial \bar{\rho} \tilde{Y}}{\partial t} + \frac{\partial \bar{\rho} \tilde{u_i} \tilde{Y}}{\partial x_i} = \frac{\partial}{\partial x_i} \left( \bar{\rho} D \frac{\partial \tilde{Y}}{\partial x_i} \right) - \underbrace{ \frac{\partial \bar{\rho} \phi_i^Y}{\partial x_i} }_{M_{V}} + \underbrace{ \bar{\omega}_Y}_{M_{VI}}, \end{equation}

fluid age variable [2021R1.0 or later]: \begin{equation} \frac{\partial \bar{\rho} \tilde{a}}{\partial t} + \frac{\partial \bar{\rho} \tilde{u_i} \tilde{a}}{\partial x_i} = \frac{\partial}{\partial x_i} \left( \bar{\rho} D \frac{\partial \tilde{a}}{\partial x_i} \right) - \underbrace{ \frac{\partial \bar{\rho} \phi_i^a}{\partial x_i} }_{M_{V}} + 1, \end{equation}

and ideal gas law: \begin{equation} p_0 = \rho R_u/W_{air} T. \end{equation}

Here, \(R_u\) is the gas constant, \(W_{air}\) is the air molar weight, and they are \(R_u=8.31\) (J/K/mol)、\(W_{air}=28.97\times10^{-3}\) (kg/mol). Other terms in the above equations are computed as follows. Note that the solver is based on low-Mach number approach, and pressure Poisson equation is solved instead of mass conservation equation.

SGS stress term： \begin{equation} \tau_{ij} = \widetilde{u_i u_j} - \tilde{u}_i \tilde{u}_j. \end{equation}

SGS turbulent scalr flux term of any quantity \(\Omega\): \begin{equation} \phi_i^\Omega = \widetilde{u_i \Omega} - \tilde{u}_i \tilde{\Omega}. \end{equation}

Spatial filtering operation: \begin{equation} \overline{q(\mathbf{x},t)} = \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} q(\mathbf{r},t')G(\mathbf{x-r},t-t')dt'd\mathbf{r}. \end{equation}

Favre spatial filtering operation: \begin{equation} \tilde{q} = \frac{\overline{\rho q}}{\bar{\rho}}. \end{equation}

Other minor equations: \begin{equation} p = p_0 + p' = {\rm presW} + p'. \end{equation} \begin{equation} \Delta \rho = \rho - \rho_0 = \rho - {\rm rhoW}. \end{equation} \begin{equation} \rho \alpha = \mu / Pr. \end{equation} \begin{equation} Pr = \frac{\nu}{\alpha} = \frac{\mu/\rho}{\lambda/c_p/\rho} = \frac{c_p\mu}{\lambda}. \end{equation} \begin{equation} Sc = \frac{\nu}{D} = \frac{\mu/\rho}{D}. \end{equation}

## Subgrid-Scale Models

In the above equations, following SGS turbulence models are used.

These models to include effects of under-resolved turbulent motions (\(M_I, M_{II}, M_V\) in the above equations) can be considered in version [2018R2] or later. Also, since thermo-chemical reactions are not considered, no terms for mean pressure increase (\(M_{III}\)) and heat release rate (\(M_{IV}, M_{VI}\)) are necessary.

SGS stress model [2018R2 or later]: \begin{equation} \tau_{ij} = -2\nu_T\tilde{S}_{ij} = -2\nu_T\left(\frac{\partial\tilde{u}_i}{\partial x_j}+\frac{\partial\tilde{u}_j}{\partial x_i}\right). \end{equation}

Eddy viscosity model [2018R2 or later]: \begin{equation} \nu_T=\left(C_S\Delta\right)^2\left|\tilde{S}\right|=\left(C_S\Delta\right)^2\sqrt{2\tilde{S}_{ij}\tilde{S}_{ij}}. \end{equation}

SGS turbulent scalar flux model for any quantity \(\Omega\) [2018R2 or later]: \begin{equation} \phi_i^\Omega = -\frac{\nu_T}{Sc_T}\frac{\partial \tilde{\Omega}}{\partial x_i}. \end{equation}

Model constants (below is usual value, user can change them) [2018R2 or later]: \begin{equation} C_S = 0.17, Sc_T = 0.7. \end{equation}

## Numerical Schemes

In Flowsquare+, the above transport equations are discretized by using a first order upwind difference scheme for the advection terms and second order central difference scheme for the other terms, which allow straightforward boundary specification and less computational costs. The time advancement is performed by the explicit Euler method.

All thermal and transport properties can be specified in the parameter setting, and treated as constant in the solver.

## Boundary Methods

In Flowsquare+, there are two boundary methods to specify physical boundaries, such as inflow boundary and wall boundary. They are (a) boundary methods based on mesh points, and (b) immersed boundary method. If not specified, Flowsquare+ employs (b) immersed boundary method as a default boundary method.

### (a) Boundary methods based on mesh points

In this method, all physical boundaries are specified explicitly on mesh points. For example, a mesh point corresponding to wall position yields zero velocity (no-slip condition) and zero-pressure gradient (inviscid assumption). Also, slip-wall conditions can be specified, but they are also specified only on mesh points. Thus, the wall with smooth curvature are numerically specified on mesh points, and any wall elements which do not conincide with mesh points are neglected.

### (b) Immersed boundary method

In the immersed boundary method, mesh points in the non-fluid regions are specified by considering the effects of physical boundaries that do not conincide mesh points. Thus, curved wall can be naturally treated (within the used spatial resolution). [2019R1 or later]