Development of a non-equilibrium gas flow capability within Code_Saturne using the Method of Moments
eCSE10-01Key Personnel
PI/Co-I: Charles Moulinec (STFC) & David R. Emerson (STFC)
Technical: Xiaojun Gu (STFC)
Relevant documents
eCSE Technical Report: Development of a non-equilibrium gas flow capability within Code_Saturne using the Method of Moments
Project summary
In this project, the functionality of the open-source CFD software Code_Saturne has been extended to enable the research community to investigate and predict non-equilibrium gaseous transport in complicated geometries in real engineering applications. For example, flow past a cluster of randomly distributed cylinders is often used to study the permeability of porous media.
Non-equilibrium gas flows represent a fundamental modelling challenge and exist in many industrial applications and scientific research facilities, including mass spectrometry, low-pressure environments, vacuum pumps, micro-electro-mechanical systems (MEMS), high-altitude vehicles, and porous media. The extent of the non-equilibrium state is usually measured by the Knudsen number, which is the ratio of the gas molecular mean free path to the characteristic macroscopic length scale of the flow.
If the Knudsen number is very small (Kn<0.001), the no-slip boundary condition is valid and continuum theory is valid, i.e. the Navier-Stokes-Fourier (NSF) equations can be used in the prediction of flow fields. When 0.001<Kn<0.1, the flow is in the slip regime and the NSF equations can only be used with velocity-slip and temperature-jump boundary conditions. When Kn>0.1, the flow is in the transition regime and the NSF equations are no longer able to predict flow fields with any degree of accuracy. Kinetic theory approaches, such as the Boltzmann equation or direct simulation Monte Carlo (DSMC), can be used in this regime. For the Boltzmann equation, the complexity of the collision term makes it difficult to use in all but simple canonical problems. In the case of DSMC, the computational cost is prohibitive and, apart from flow with high Kn, simulations are limited to 2-D and low-speed problems can take weeks to solve. However, there is currently no software available which can solve non-equilibrium flows in the early transition regime (0.1<Kn<1) in 3-D complex geometries with a computational efficiency similar to conventional CFD problems.
In the early transition regime (0.1<Kn<1), the moment method offers the best approach for capturing rarefied phenomena. More physics is embedded in the moment equations than in the NSF equations with only a modest increase in computational cost. An understanding of the flow is essential to design, predict, and operate devices in the transition regime. It is now timely and beneficial to develop software that will bridge the gap between the continuum approach and kinetic theory.
The open source CFD software Code_Saturne, which performs well on ARCHER, provides a well-defined and flexible platform to solve the moment equations. It already has a wide and growing range of academic and industrial users and this enhancement will expand its capability into a new research and industrial dimension by developing and implementing a rarefied gas dynamics module with the moment equations.
Achievement of objectives
The objectives of the work were to:
- The primary objective was the development of a non-equilibrium gas flow capability within the open-source CFD software Code_Saturne to
move beyond the current Navier-Stokes-Fourier (NSF) equations.
- The velocity-slip and temperature-jump boundary conditions have been implemented for the NSF equations for flows in the slip flow regime.
- The regularised 13-moment (R13) equations along with their wall boundary conditions have been implemented for flows in the slip and early transition regime.
- The regularised 20-moment (R20) equations have been successfully implemented for flows in the slip to mid-transition regime.
- The regularised 26-moment (R26) equations have been implemented for flows in the mid-transition regime based up on the previous implementation.
- Success at each stage has been demonstrated by validating each implementation phase by rigorously
testing the boundary conditions with computation of flow past classical test cases in the slip, early and mid-transition regimes:
- a regular channel configuration
- flow past an infinite circular cylinder (2-D)
- flow past a sphere (3-D)
- At each stage, parallel performance has been assessed to maintain the excellent scalability of the code.
- All the new added subroutines have been transferred to the Code_Saturne development team. They will be released within the official validated version of Code_Saturne. This will require further interactions with the Code_Saturne development team.
Figure 1 Velocity vectors of the gas through a cluster of randomly distributed cylinders.
Figure 2 Velocity profiles at the exit and middle of the computational domain.
Summary of the Software
Four different sets of equations of different level of complexity were developed for Code_Saturne without alteration of the core code. In the current implementation, the user subroutine facility provided by Code_Saturne was used to incorporate the changes into Code_Saturne. All the added subroutines were written in Fortran 90 and will be merged as a module into the core code in collaboration with the development team of Code_Saturne in EDF. All the subroutines have been transferred to the EDF Code_Saturne team. They will be released through the Code_Saturne web page by the EDF Code_Saturne team: https://www.code-saturne.org/
In the NSF part with slip boundary condition, the slip velocity and temperature jump on the solid wall are calculated in the subroutine "cs_user_boundary_conditions.f90". In the moment equation parts, the individual Cartesian components of each tensor are treated as a scalar. Both cell centre and boundary arrays of all the added variables are created in the subroutine "cs_user_parameters_base.c". Arrays of derivatives are created in the subroutine "cs_usr_modules.f90". Additional subroutines are created to calculate the source terms for the moment equations inside "cs_usr_modules.f90". These source terms are fed into the solver through the subroutine "cs_user_source_terms.f90". The wall boundary conditions are implemented in the subroutine "cs_user_boundary_conditions.f90".
Performance improvement of the open-source CFD software Code_Saturne is not the purpose of the project. The primary objective is the development of a new non-equilibrium gas flow module within the open-source CFD software Code_Saturne to move beyond the current Navier-Stokes-Fourier (NSF) equations. However, the added implementations improve the speedup of the code significantly as shown in figure 3, since more transport equations are solved per time-step.
Scientific Benefits
The primary objective of this project is to add new functionality to Code_Saturne which, for the first time, will allow users to simulate non-equilibrium gas flows in the slip and early transition regime. It moves beyond the conventional no-slip boundary conditions implemented in Code_Saturne and the new boundary conditions also pave the way for further extensions where slip occurs, such as for hydrophobic applications and non-Newtonian flows.
For flows in the early transition regime, kinetic approaches have to be used to produce correct solutions but the computational cost is extremely high and this limits applications to 2-D or the use of small gradients to linearise the problem. The introduction of the moment method significantly reduces the computational cost without losing the accuracy required in real 3-D applications. Moreover, as the macroscopic variables are directly computed in the moment method, no kinetic data, such as the molecular distribution function, is required to be output during the computation. This reduces the I/O operation significantly in comparison to the kinetic approaches.
A major pathway is through open-source software. This represents an important method for maximising the impact of international research and development across all disciplines. The low up-front cost of open source software means that market penetration beyond our immediate beneficiaries can potentially be very high, but industrial uptake is often slow. We will address the known barriers to industrial uptake of open-source software by providing validated and relevant test cases, user documentation, and end-user training initially to EDF, Waters, and Renuda but this will be extended through the addition of new course material for the Code_Saturne training course.
Additional impact from this work will be with the very long and established relationship between the Computational Engineering Group (led by Professor David R. Emerson) and EDF R&D France, which develop and maintain Code_Saturne. We anticipate this module benefitting all the EDF business in the UK and particularly EDF Energy R&D UK Centre, which is led by Dr J. C. Uribe for the fluid dynamics applications. Over the years, this has provided a very fruitful collaboration, promoting Code_Saturne as one of the two CFD multipurpose benchmark codes selected for the Unified European Applications Benchmark software suite, to help evaluate prototype systems and petascale procurements.
Figure 3 Speedup of the various non-equilibrium gas flow implementations on ARCHER