Abstract:This paper, solves the 3D fluid dynamics problem in a complex environment by taking advantage of the parallelism and programmability of GPU (graphics processing unit). In difference from other methods, innovation is made in two aspects. Firstly, more general boundary conditions could be processed on GPU in the method. By the method, the boundary from a 3D scene with capped solid clipping is generated, making the computation run on GPU despite of the complexity of the whole geometry scene. Then by grouping the voxels into different types according to their positions relative to the obstacles and locating the voxel that determines the value of the current voxel, the values on the boundaries are modified according to the boundary conditions. Secondly, more compact structure in data packing is designed at the fragment processing level to enhance parallelism and reduce execution passes. The scalar variables including density and temperature are packed into four channels of texels to accelerate the computation of 3D Navier-Stokes Equations. The test results show the efficiency of the method, and as a result, it is feasible to run middle-scale problems of 3D fluid dynamics in an interactive speed for more general environment with complex geometry on PC platform.