# Title: rhoSimpleFoam for stationary compressible turbulent internals flows

Posted December 9, 2020 at 06:01 by dlahaye

1/ Introduction

The scope of these notes is to discuss the simulation of stationary compressible turbulent flow in OpenFoam using the rhoSimpleFoam solver. We assume the reader to be familiar with the concept of stationary incompressible turbulent flows and the simulation of these flows in OpenFoam. This allows us to focus here on the transition from incompressible to compressible. We target internal flow with Mach number between 0.4 and 2. The application to external flows and/or higher mach Numbers is out of scope and described elsewhere. We thus consider the case of e.g. the mixing of various gasses injected into a vessel. In target scenarios the gas enters the vessel through a nozzle with small diameter at high mass flow rate. The assumption that the Mach number is bounded by 0.4 is violated in proximity of the nozzle outlet. An incompressible formulation no longer applies. We limit ourselves to case in which the various gasses mix without chemically reacting. We do have the modeling of the reacting case as final scope however.

what is rhoSimpleFoam: Stationary compressible turbulent flow in OpenFoam can be modeled using the rhoSimpleFoam solver.

why this notes: A lot of information on rhoSimpleFoam can be found elsewhere (cite wiki, cite Moukalled). Our aim here is to provide timely and updated description of the solver that includes

* a description of the thermodynamics (rhoThermo vs. psiThermo); rhoSimpleFoam is a pressure based solver. We thus need to recover density (rho) from pressure (p) using either rhoThermo or psiThermo;

* a description of transonic option (when to use it, change in energy equation, what are its advantages in terms of computational cost, what its limitations);

* numerical stability, sign of source terms, the presence of pressure waves (or the absence thereof and techniques to avoid them, see e.g. \cite{pressure-waves-sprayFoam});

* the comparison of convergence criteria (residuals vs. outlet quantities);

* a description of possible limitations of the solver (what happens e.g. at sufficiently high Mach numbers, break-down of multigrid for pressure solve due to transport term, advice on when to switch to alternative density base and/or coupled solvers), comparison between segregated and coupled solvers (HISA project);

what concept are assumed to be known to the reader (and thus not discussed here):

rhoSimpleFoam is a pressure-based segregated solver that iterates between the pressure, velocity and energy fields using the SIMPLE (or SIMPLE-C) algorithm (and possibly turbulent quantities) (cite wikipedia, Malaseekara, Moukalled). rhoSimpleFoam thus builds on components developed elsewhere in OpenFoam. In particular

* from basic solvers in OpenFoam: cell-centered finite volume discretization for scalar fields, non-linear iteration for scalar fields, linear solvers, parallel set-up and solver run;

* from incompressible solvers in OpenFoam: Reynolds averaging, cell-centered finite volume discretization for pressure-velocity coupling, Rhie-Chow interpolation, SIMPLE iteration for pressure-velocity coupling, consistent SIMPLE (SIMPLEC);

* from incompressible solvers in OpenFoam: solving for turbulent quantities;

what is outside scope of this page: transient formulation (using local time stepping), turbulence modeling beyond RANS with two-equation turbulence models (thus no Reynolds stress model, no LES), no thermodynamics beyond the ideal gas law; no adaptive mesh refinement;

References:

* wikipedia, RANS: https://en.wikipedia.org/wiki/Reynol...okes_equations

* CFD-Online, pressure-waves-sprayFoam: SprayFoam simulation of LOX-CH4 combustion

* CFD-Online, e-vs-h-in-energy-equation-1: question about fvm::laplacian(turbulence->alphaEff(), he) in rhoSimpleFoam

* CFD-Online, e-vs-h-in-energy-equation-2: When choose sensibleInternalEnergy or sensibleEnthalpy in thermophysicalProperties

* CFD-Online, e-vs-h-in-energy-equation-3: https://github.com/OpenFOAM/OpenFOAM...25ab9817b3ec62 (It is generally more convergent and stable to solve for internal energy if the fluid is incompressible or weakly compressible.)

2/ Representation of the Thermodynamics

The representation of the thermodynamics or the equation of state in a finite volume computation requires a separate data structure. In OpenFoam, the thermodynamics of the fluid in represented by the fluidThermo class (collection of data and operations of this data). The fluidThermo class is a parent class for rhoThermo and psiThermo. Both classes store the density (rho), compressibility (psi) and dynamic viscosity (mu). Both of the latter classes allow to update the density once a new pressure field has been computed. This update is performed through the correct() member function.

Questions

* how exactly is thermophysicalTransport->correct() in rhoSimpleFoam.C and thermo.correct in EEqn.H complementary to each other?

* what is rhoDelta as argument of correct() in rhoThermo?

* what is the body of correct() in psiThermo left body?

3/ Pressure in Compressible Flow Computations

In an incompressible flow simulation, density is constant, the flow equations (conservation of mass and momentum) can be divided by density and the kinematic pressure (p/rho [m^2/s^2]) is solved for. In a compressible flow simulation instead, the static pressure (p [Pa]) is solved for. This will have an impact on the boundary conditions being imposed, and thus the case set-up in OpenFoam. More … .

References:

* OpenFoam v2006 Users manual: various forms of the pressure: https://www.openfoam.com/documentati...-pressure.html

4/ Internal Energy vs. Enthalpy in Compressible Flow Computations

1.4/ Analytical Considerations

Heat capacity at constant volume ([units]): cv

Heat capacity at constant volume ([units]): cp

Thermal conductivity ([units]): k (heat flux = k (temperature flux) )

Thermal diffusivity when solving for enthalpy (h [units]): \alpha_{h} = \kappa / (\rho cv)

Thermal diffusivity when solving for internal energy (e [units]): \alpha_{e} = \kappa / (\rho cp)

Prandtl number is ratio of momentum diffusivity (kinematic viscosity nu) and thermal diffusivity \alpha

Prandtl number when solving for enthalpy = \nu/\alpha = (cv \mu)/ k

Prandtl number when solving for internal energy = \nu/\alpha = (cp \mu)/ k

This difference are taken care of in the implementation. Details are here: question about fvm::laplacian(turbulence->alphaEff(), he) in rhoSimpleFoam

2.4/ Numerical Considerations

It is generally more convergent and stable to solve for internal energy (instead of enthalpy) if the fluid is incompressible or weakly compressible. See https://github.com/OpenFOAM/OpenFOAM...25ab9817b3ec62 and When choose sensibleInternalEnergy or sensibleEnthalpy in thermophysicalProperties . Keep energy positive by keeping source term positive. See book Patankar.

References:

5/ Problem formulation

1.5/ Conservation Equations (conversation of mass, momentum and energy closed by an equation of state to which turbulent quantities are added)

Density no longer constant. Pressure is dynamic pressure. Various expressions for the energy (internal energy, enthalpy and temperate exists);

1.1.5/ Conversation of mass

2.1.5/ Conservation of momentum

3.1.5/ Conservation of energy

4.1.5/ Solving for turbulent quantities

5.1.5/ Update of density through thermo-physical quantities (psi = R T)

2.5/ Boundary conditions (inlet, outlet and walls)

6/ Segregated Solution via SIMPLE Algorithm

After finite volume discretization, flow equations need to solve. Given SIMPLE for incompressible flow (and implemented in e.g. simpleFoam), add two steps. First step is update of the density (using the equation of state). Second step is the solve for the energy (enthalpy or temperature);

7/ Implementation in rhoSimpleFoam in OpenFoam

Show here UEqn.H, pEqn.H and EEqn.H and turbulent quantities;

8/ Guidelines on using the Solver

1.8/ Starting from Initial Guess Provided by simpleFoam (see notes)

2.8/ Handle on converge

limitT and limitU (first print values, then limit)

9/ Tutorials

1.9/ sBend

2.9/ elbow

3.9/ Sandia Flame D

4.9/ reverseBurner

References

* https://github.com/OpenFOAM/OpenFOAM...b71e7cf0172c34

User guide/Wiki-1/Wiki-2/Code guide/Code Wiki

Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak-FSB

OpenFOAM Governance and Technical Committees

Report bugs/Request features: OpenFOAM (ESI-OpenCFD-Trademark)

Report bugs/Request features: FOAM-Extend (Wikki-FSB)

Report bugs: OpenFOAM (Foundation)

How to create a MWE.

10/ References

* Greenshield

* Moukalled

* Malalaseekara and Versteeg

* wiki on compressible Navier-Stokes Equations: https://en.wikipedia.org/wiki/Navier...wtonian_fluids

* SIMPLE algorithms: https://en.wikipedia.org/wiki/SIMPLE_algorithm

11/ Open End

* is similar description above available elsewhere?

* when does rhoSimpleFoam break?

* how to add source terms for radiation and chemistry?

* how do implementation in various flavor of OpenFoam differ

The scope of these notes is to discuss the simulation of stationary compressible turbulent flow in OpenFoam using the rhoSimpleFoam solver. We assume the reader to be familiar with the concept of stationary incompressible turbulent flows and the simulation of these flows in OpenFoam. This allows us to focus here on the transition from incompressible to compressible. We target internal flow with Mach number between 0.4 and 2. The application to external flows and/or higher mach Numbers is out of scope and described elsewhere. We thus consider the case of e.g. the mixing of various gasses injected into a vessel. In target scenarios the gas enters the vessel through a nozzle with small diameter at high mass flow rate. The assumption that the Mach number is bounded by 0.4 is violated in proximity of the nozzle outlet. An incompressible formulation no longer applies. We limit ourselves to case in which the various gasses mix without chemically reacting. We do have the modeling of the reacting case as final scope however.

what is rhoSimpleFoam: Stationary compressible turbulent flow in OpenFoam can be modeled using the rhoSimpleFoam solver.

why this notes: A lot of information on rhoSimpleFoam can be found elsewhere (cite wiki, cite Moukalled). Our aim here is to provide timely and updated description of the solver that includes

* a description of the thermodynamics (rhoThermo vs. psiThermo); rhoSimpleFoam is a pressure based solver. We thus need to recover density (rho) from pressure (p) using either rhoThermo or psiThermo;

* a description of transonic option (when to use it, change in energy equation, what are its advantages in terms of computational cost, what its limitations);

* numerical stability, sign of source terms, the presence of pressure waves (or the absence thereof and techniques to avoid them, see e.g. \cite{pressure-waves-sprayFoam});

* the comparison of convergence criteria (residuals vs. outlet quantities);

* a description of possible limitations of the solver (what happens e.g. at sufficiently high Mach numbers, break-down of multigrid for pressure solve due to transport term, advice on when to switch to alternative density base and/or coupled solvers), comparison between segregated and coupled solvers (HISA project);

what concept are assumed to be known to the reader (and thus not discussed here):

rhoSimpleFoam is a pressure-based segregated solver that iterates between the pressure, velocity and energy fields using the SIMPLE (or SIMPLE-C) algorithm (and possibly turbulent quantities) (cite wikipedia, Malaseekara, Moukalled). rhoSimpleFoam thus builds on components developed elsewhere in OpenFoam. In particular

* from basic solvers in OpenFoam: cell-centered finite volume discretization for scalar fields, non-linear iteration for scalar fields, linear solvers, parallel set-up and solver run;

* from incompressible solvers in OpenFoam: Reynolds averaging, cell-centered finite volume discretization for pressure-velocity coupling, Rhie-Chow interpolation, SIMPLE iteration for pressure-velocity coupling, consistent SIMPLE (SIMPLEC);

* from incompressible solvers in OpenFoam: solving for turbulent quantities;

what is outside scope of this page: transient formulation (using local time stepping), turbulence modeling beyond RANS with two-equation turbulence models (thus no Reynolds stress model, no LES), no thermodynamics beyond the ideal gas law; no adaptive mesh refinement;

References:

* wikipedia, RANS: https://en.wikipedia.org/wiki/Reynol...okes_equations

* CFD-Online, pressure-waves-sprayFoam: SprayFoam simulation of LOX-CH4 combustion

* CFD-Online, e-vs-h-in-energy-equation-1: question about fvm::laplacian(turbulence->alphaEff(), he) in rhoSimpleFoam

* CFD-Online, e-vs-h-in-energy-equation-2: When choose sensibleInternalEnergy or sensibleEnthalpy in thermophysicalProperties

* CFD-Online, e-vs-h-in-energy-equation-3: https://github.com/OpenFOAM/OpenFOAM...25ab9817b3ec62 (It is generally more convergent and stable to solve for internal energy if the fluid is incompressible or weakly compressible.)

2/ Representation of the Thermodynamics

The representation of the thermodynamics or the equation of state in a finite volume computation requires a separate data structure. In OpenFoam, the thermodynamics of the fluid in represented by the fluidThermo class (collection of data and operations of this data). The fluidThermo class is a parent class for rhoThermo and psiThermo. Both classes store the density (rho), compressibility (psi) and dynamic viscosity (mu). Both of the latter classes allow to update the density once a new pressure field has been computed. This update is performed through the correct() member function.

Questions

* how exactly is thermophysicalTransport->correct() in rhoSimpleFoam.C and thermo.correct in EEqn.H complementary to each other?

* what is rhoDelta as argument of correct() in rhoThermo?

* what is the body of correct() in psiThermo left body?

3/ Pressure in Compressible Flow Computations

In an incompressible flow simulation, density is constant, the flow equations (conservation of mass and momentum) can be divided by density and the kinematic pressure (p/rho [m^2/s^2]) is solved for. In a compressible flow simulation instead, the static pressure (p [Pa]) is solved for. This will have an impact on the boundary conditions being imposed, and thus the case set-up in OpenFoam. More … .

References:

* OpenFoam v2006 Users manual: various forms of the pressure: https://www.openfoam.com/documentati...-pressure.html

4/ Internal Energy vs. Enthalpy in Compressible Flow Computations

1.4/ Analytical Considerations

Heat capacity at constant volume ([units]): cv

Heat capacity at constant volume ([units]): cp

Thermal conductivity ([units]): k (heat flux = k (temperature flux) )

Thermal diffusivity when solving for enthalpy (h [units]): \alpha_{h} = \kappa / (\rho cv)

Thermal diffusivity when solving for internal energy (e [units]): \alpha_{e} = \kappa / (\rho cp)

Prandtl number is ratio of momentum diffusivity (kinematic viscosity nu) and thermal diffusivity \alpha

Prandtl number when solving for enthalpy = \nu/\alpha = (cv \mu)/ k

Prandtl number when solving for internal energy = \nu/\alpha = (cp \mu)/ k

This difference are taken care of in the implementation. Details are here: question about fvm::laplacian(turbulence->alphaEff(), he) in rhoSimpleFoam

2.4/ Numerical Considerations

It is generally more convergent and stable to solve for internal energy (instead of enthalpy) if the fluid is incompressible or weakly compressible. See https://github.com/OpenFOAM/OpenFOAM...25ab9817b3ec62 and When choose sensibleInternalEnergy or sensibleEnthalpy in thermophysicalProperties . Keep energy positive by keeping source term positive. See book Patankar.

References:

5/ Problem formulation

1.5/ Conservation Equations (conversation of mass, momentum and energy closed by an equation of state to which turbulent quantities are added)

Density no longer constant. Pressure is dynamic pressure. Various expressions for the energy (internal energy, enthalpy and temperate exists);

1.1.5/ Conversation of mass

2.1.5/ Conservation of momentum

3.1.5/ Conservation of energy

4.1.5/ Solving for turbulent quantities

5.1.5/ Update of density through thermo-physical quantities (psi = R T)

2.5/ Boundary conditions (inlet, outlet and walls)

6/ Segregated Solution via SIMPLE Algorithm

After finite volume discretization, flow equations need to solve. Given SIMPLE for incompressible flow (and implemented in e.g. simpleFoam), add two steps. First step is update of the density (using the equation of state). Second step is the solve for the energy (enthalpy or temperature);

7/ Implementation in rhoSimpleFoam in OpenFoam

Show here UEqn.H, pEqn.H and EEqn.H and turbulent quantities;

8/ Guidelines on using the Solver

1.8/ Starting from Initial Guess Provided by simpleFoam (see notes)

2.8/ Handle on converge

limitT and limitU (first print values, then limit)

9/ Tutorials

1.9/ sBend

2.9/ elbow

3.9/ Sandia Flame D

4.9/ reverseBurner

References

* https://github.com/OpenFOAM/OpenFOAM...b71e7cf0172c34

User guide/Wiki-1/Wiki-2/Code guide/Code Wiki

Nilsson/Guerrero/Holzinger/Holzmann/Nagy/Santos/Nozaki/Jasak-FSB

OpenFOAM Governance and Technical Committees

Report bugs/Request features: OpenFOAM (ESI-OpenCFD-Trademark)

Report bugs/Request features: FOAM-Extend (Wikki-FSB)

Report bugs: OpenFOAM (Foundation)

How to create a MWE.

10/ References

* Greenshield

* Moukalled

* Malalaseekara and Versteeg

* wiki on compressible Navier-Stokes Equations: https://en.wikipedia.org/wiki/Navier...wtonian_fluids

* SIMPLE algorithms: https://en.wikipedia.org/wiki/SIMPLE_algorithm

11/ Open End

* is similar description above available elsewhere?

* when does rhoSimpleFoam break?

* how to add source terms for radiation and chemistry?

* how do implementation in various flavor of OpenFoam differ

Total Comments 0