A comprehensive OpenFOAM function object library for calculating and analysing the Reynolds Stress Transport Equation (RSTE) budget in Large Eddy Simulation (LES).
This repository provides a validated implementation of all terms in the Reynolds Stress Transport Equation budget for OpenFOAM-based LES simulations. The library enables detailed turbulence analysis by computing convection, production, turbulent transport, pressure-diffusion, pressure-strain, viscous diffusion, and dissipation terms, along with subgrid-scale (SGS) contributions.
- Complete RSTE Budget: Implementation of all terms in the Reynolds Stress Transport Equation
- Validated Implementation: Rigorously tested against DNS data for canonical flows
- OpenFOAM Integration: Seamless integration with OpenFOAM's function object framework
- Cartesian Coordinates: Full implementation in Cartesian coordinate system
- SGS Contributions: Subgrid-scale term calculations for LES - used as a residual term value
- DNS Compatibility: Can be run in DNS mode by setting turbulence model to "laminar"
- Memory Efficient: Optimised field calculations using OpenFOAM utilities
- Parallel Support: Full parallel computation support with HPC considerations
- Installation
- Quick Start
- Project Structure
- Usage
- Validation
- Implementation Details
- Examples
- Contributing
- License
- OpenFOAM (tested with recent version OpenFOAM-v2506)
- Git (for version control)
- Python 3.x (for parameter setup scripts)
-
Clone the repository:
git clone https://github.com/AUfluids/RSTE_budget.git cd RSTE_budget -
Copy the RSTE calculation codes:
# Copy the calcRSTEcode directory to your OpenFOAM case's system directory cp -r calcRSTEcode/ /path/to/your/case/system/ -
Configure your OpenFOAM case:
- Add the RSTE function objects to your
system/controlDict - Ensure proper field averaging setup
- Configure parallel execution if needed
- Add the RSTE function objects to your
-
Navigate to the example:
cd examples/channel_flow_Re_tau_180 -
Run the simulation:
# Make the script executable chmod +x Allrun # Run the case ./Allrun
-
View results:
- Check the
logs/directory for simulation output - RSTE budget terms are written to the case directory
- Use ParaView or other post-processing tools to visualise results
- Check the
The RSTE budget calculation is integrated into your OpenFOAM case through function objects. Add the following to your system/controlDict:
functions
{
#include "calcRSTEcode/fieldAverageRSTE"
#include "calcRSTEcode/calcProduction"
#include "calcRSTEcode/calcConvection"
#include "calcRSTEcode/calcTurbulentTransport"
#include "calcRSTEcode/calcPressureDiffusion"
#include "calcRSTEcode/calcPressureStrain"
#include "calcRSTEcode/calcViscousDiffusion"
#include "calcRSTEcode/calcDissipation"
#include "calcRSTEcode/calcSGS"
}RSTE_budget/
├── calcRSTEcode/ # Main RSTE calculation codes
│ ├── auxiliaryFunctionsRSTE # Helper functions
│ ├── calcConvection # Convective term calculation
│ ├── calcDissipation # Dissipation term calculation
│ ├── calcPressureDiffusion # Pressure diffusion term
│ ├── calcPressureStrain # Pressure-strain correlation
│ ├── calcProduction # Production term calculation
│ ├── calcSGS # Subgrid-scale term calculation
│ ├── calcTurbulentTransport # Turbulent transport term
│ ├── calcViscousDiffusion # Viscous diffusion term
│ └── fieldAverageRSTE # Field averaging configuration
├── examples/
│ └── channel_flow_Re_tau_180/ # Example channel flow case
│ ├── 0.orig/ # Initial conditions
│ ├── constant/ # Physical properties
│ ├── system/ # OpenFOAM configuration
│ │ ├── calcRSTEcode/ # Case-specific RSTE codes
│ │ ├── controlDict # Solver control
│ │ ├── fvSchemes # Numerical schemes
│ │ └── fvSolution # Solver settings
│ ├── pythonScripts/ # Parameter setup scripts
│ ├── Allrun # Run script
│ └── Allclean # Cleanup script
├── publication_description.tex # Scientific publication details
├── LICENSE # License information
└── README.md # This file
- Copy RSTE codes:
cp -r calcRSTEcode/ /path/to/your/case/system/-
Modify controlDict: Add the RSTE function objects to your
system/controlDict:functions { #include "calcRSTEcode/fieldAverageRSTE" // Add other terms as needed #include "calcRSTEcode/calcProduction" #include "calcRSTEcode/calcConvection" // ... etc } -
Configure field averaging: The
fieldAverageRSTEfunction object sets up the necessary field averaging for:- Mean velocity components
- Reynolds stress components
- Higher-order correlations
- Pressure-velocity correlations
-
Run your simulation:
# Serial execution pimpleFoam # Parallel execution mpirun -np 4 pimpleFoam -parallel
The RSTE budget calculation can also be run in DNS mode. To run in DNS mode:
-
Set turbulence model to laminar:
// In constant/turbulenceProperties simulationType laminar; -
Run the simulation: The same execution commands apply, but the SGS terms will be zero since no subgrid-scale model is active.
Note: DNS mode is primarily useful for validation purposes or when comparing with DNS data, but requires significantly higher computational resources and finer meshes.
For complex HPC systems, add the following to your system/controlDict to avoid compilation issues:
runTimeModifiable true;
OptimisationSwitches
{
fileModificationSkew 10; // Increase from default 1-2
// maxFileModificationPolls 100; // Optional: increase from default 50
}The library generates the following output fields:
- Reynolds Stress Components:
RMean(symmetric tensor) - Production Term:
P_ij_RSTE(symmetric tensor) - Convective Term:
C_ij_RSTE(symmetric tensor) - Turbulent Transport:
T_ij_RSTE(symmetric tensor) - Pressure Diffusion:
Dp_ij_RSTE(symmetric tensor) - Pressure-Strain:
Phi_ij_RSTE(symmetric tensor) - Viscous Diffusion:
D_ij_RSTE(symmetric tensor) - Dissipation:
eps_ij_RSTE(symmetric tensor) - SGS Term:
SGS_ij_RSTE(symmetric tensor)
The implementation has been rigorously validated against high-fidelity DNS data for canonical wall-bounded turbulent flows:
-
Channel Flow (Re_τ = 180)
- Comparison with DNS data from Lee & Moser (2015)
- Mesh refinement study (L₁ to L₄)
- All RSTE budget terms validated
-
Pipe Flow (Re_τ = 180) - Not included in this repository - Available in publication
- Comparison with DNS data from El Khoury et al. (2013)
- TKE budget validation (coordinate-invariant)
- Multiple mesh resolutions
- Systematic Convergence: Results converge systematically towards DNS data with mesh refinement
- Physical Accuracy: All budget terms show correct physical behaviour
- Numerical Robustness: Implementation handles near-wall regions correctly
- SGS Validation: Subgrid-scale contributions diminish appropriately with mesh refinement
The Reynolds Stress Transport Equation in Cartesian coordinates:
∂R_ij/∂t = C_ij + P_ij + T_ij + D_p,ij + Φ_ij + D_ν,ij + ε_ij + Π_ij*
Where:
- C_ij: Convective term
- P_ij: Production term
- T_ij: Turbulent transport term
- D_p,ij: Pressure diffusion term
- Φ_ij: Pressure-strain correlation
- D_ν,ij: Viscous diffusion term
- ε_ij: Viscous dissipation term
- Π_ij*: Subgrid-scale term (LES only)
- Field Expansion: Higher-order correlations expanded for on-the-fly averaging
- Conservative Form: Convective terms implemented in conservative form
- Gradient Calculations: Uses OpenFOAM's
gradanddivfunctions - Boundary Conditions: Proper handling of wall boundary conditions
- Memory Management: Efficient field creation and management
- Current: Cartesian coordinates (x, y, z)
- Future: Extension to cylindrical and spherical coordinates planned
- TKE Budget: Coordinate-invariant (trace of RSTE budget)
The included channel flow example demonstrates:
- Setup: Complete OpenFOAM case configuration
- Mesh: Structured hexahedral mesh with wall refinement
- Solver: pimpleFoam with WALE SGS model
- Initial Conditions: Python script with automatic initial conditions
- Analysis: Complete RSTE budget calculation
Important Note: Since the simulation starts from plug-flow conditions, a certain initial perturbation of the flow is necessary to onset turbulence and obtain a fully-developed turbulent channel flow. The example case DOES NOT includes appropriate initial perturbations to ensure proper turbulent development nor a script to post-process the RSTE budget data.
cd examples/channel_flow_Re_tau_180
# Run the simulation
./Allrun
# Clean up (optional)
./AllcleanTo adapt for your own cases:
- Modify mesh: Update
system/blockMeshDict - Adjust parameters: Edit
pythonScripts/paramSetup.py - Configure solver: Modify
system/fvSolutionandsystem/fvSchemes - Set initial conditions: Update
0.orig/directory
- Fork the repository
- Create a feature branch:
git checkout -b feature/new-feature - Make your changes
- Test with the example case
- Submit a pull request
- Code Style: Follow OpenFOAM coding conventions
- Documentation: Update comments and documentation
- Testing: Validate against known solutions
- Performance: Consider memory and computational efficiency
- Coordinate Systems: Extension to cylindrical/spherical coordinates
- Memory Optimisation: Reduced memory footprint
- Additional Terms: Implementation of additional turbulence terms
- Validation: New validation cases and comparisons
- Documentation: Improved user guides and examples
- OpenFOAM Library: Future implementation as a proper OpenFOAM library to avoid per-case compilation
This project is licensed under the Creative Commons License - see the LICENSE file for details.
- Mario Javier Rincón - Lead Developer - Aarhus University
- Christoffer Hansen - Lead-Developer - Aarhus University
- Aarhus University - Mechanical and Production Engineering Department
- Kamstrup A/S - Fluid Mechanics R&D Group in Quality and Sustainability Department
- OpenFOAM Community - For the excellent CFD framework
- DNS Data Providers - Lee & Moser, El Khoury et al. for validation data
- Scientific Community - For turbulence modelling research
- Rincón, M. J., Hansen, C., Reclari, M., & Abkar, M. (2026). Implementation and A-posteriori Validation of the Resolved Reynolds Stress Transport Equations in OpenFOAM®. OpenFOAM® Journal, 6:79-98.
- Lee, M. & Moser, R.D. (2015). Direct numerical simulation of turbulent channel flow up to Re_τ ≈ 5200. Journal of Fluid Mechanics, 774, 395-415.
- El Khoury, G.K., Schlatter, P., Noorani, A., Fischer, P.F., & Brethouwer, G. (2013). Direct numerical simulation of turbulent pipe flow at moderately high Reynolds numbers. Flow, Turbulence and Combustion, 91(3), 475-495.
- Pope, S.B. (2000). Turbulent Flows. Cambridge University Press.
This implementation supports research in:
- Turbulence Modelling: Development and validation of RANS models
- LES Analysis: Understanding subgrid-scale effects
- Wall-Bounded Flows: Analysis of near-wall turbulence physics
- Educational Purposes: Teaching turbulence physics and CFD
Note: This repository provides a validated tool for RSTE budget analysis in OpenFOAM. For questions or issues, please open an issue on GitHub or contact the authors.