KitAMR.jl is a distributed adaptive Cartesian grid solver for kinetic equations, developed based on P4est.jl. Its goal is to achieve large-scale parallel solving of 2D and 3D flows across all regimes, leveraging GPUs, differentiable programming, and machine learning to enhance solving efficiency.
Currently, the development is in its initial stages, with the following functionalities implemented:
- 2D flow
- Square domain grid generation
- Geometric adaptation of physical space grids
- Dynamic adaptation of physical space grids
- Dynamic adaptation of velocity space grids
- Load balancing based on physical space grid density
- VanLeer reconstruction
- UGKS fluxes
- Post-processing
In kinetic theory, methods simulate the macroscopic motion of fluids by describing the evolution of distribution functions of fluid particles in velocity space over time. Such methods include direct simulation Monte Carlo (DSMC), discrete velocity method (DVM), lattice Boltzmann equation (LBE), gas-kinetic scheme, semi-Lagrangian method, implicit-explicit (IMEX) method, and others.
In kinetic methods, the state of the fluid is described by a distribution function
, where
The evolution of the distribution function follows the Boltzmann equation.
The Boltzmann equation holds a central position in kinetic theory, which is an integro-differential equation, with a four-fold integral term on the right-hand side. The complexity introduced by this term makes solving the Boltzmann equation challenging. Therefore, as a simplification, kinetic methods often solve its model equations instead.
The simplified equation obtained after simplifying the collision term is known as the Shakhov model equation:
, Where
The underlying discretization of the Boltzmann equation is based on finite volume method, with its discrete form as follows:
, where
The numerical scheme that the solver currently supports is UGKS, with interface variables obtained from VanLeer reconstruction. For specific implementation details, please refer to the relevant literature.
DVM is one of the popular approaches for solving rarefied flow problems. In this method, the particle velocity space is discretized into a finite set of points and the numerical quadrature rule is utilized to approximate the integration of moments. Since the particle velocity space is discretized into a finite set of points, the continuum Boltzmann equation is reduced to the corresponding discrete velocity Boltzmann equation (DVBE). A great variety of algorithms have been developed, including unified gas-kinetic scheme (UGKS), discrete unified gas-kinetic scheme (DUGKS), semi-Lagrangian method, etc. Overall, most of the above methods can be applied from free molecular regime to continuum regime. But in order to make the quadrature error to be small enough, a large number of discrete velocity points are usually required. In particular, for fluid flows near continuum regime, the computational cost of DVM is much larger than those traditional CFD methods based on the Navier-Stokes equation.
Considering the above limitations of DVM, we adopt Adaptive Mesh Refinement (AMR) to improve solving efficiency. AMR reallocates computational resources based on flow features, balancing efficiency and accuracy.
The current solver discretizes with tree-based Cartesian grids, adapting the mesh in both physical and velocity space simultaneously, according to characteristics including velocity field gradients, boundary complexity, and energy proportion at phase points. Users can also customize the criteria for grid refinement or coarsening according to their own needs.
Cartesian grids offer advantages such as high grid quality and automation but struggle with complex boundary shapes. In the subsequent development of the solver, we will introduce Immersed Boundary Method (IBM) to address this challenge.
The current solver does not yet provide a user interface. If you'd like to try it out, we recommend cloning the code repository from Git to your local machine and then using the Julia package manager to install its dependencies in the directory where the code resides:
julia> ]
(v1.10) pkg> activate .
(//your_path//) pkg> instantiate
Soon, we will provide a complete user interface with customizable boundaries, and we will register it in the Julia package registry. Stay tuned!
Currently, flow properties, initial contitions and boundary conditions are defined in Global_Data
in /src/types.jl
. It should be noted specifically that the boundary follows the sequence of -x, +x, -y, +y. The maximum level of the refinement is defined in /src/abstract.jl
by DVM_PS_MAXLEVEL
and DVM_VS_MAXLEVEL
respectively. Grid refinement and coarsening behaviors are defined in adaptive.jl
and vs_adaptive.jl
. Feel free to modify them according to your needs.