A GPU computing method for computational fluid dynamics simulation

By adopting a hybrid programming framework of CPU/GPU heterogeneous systems and the OpenFOAM-GPU data structure in computational fluid dynamics, the calculation of thermal physical quantities is migrated to the GPU. The parallel computing strategy and one-dimensional array structure optimization solve the data communication problem between the CPU and GPU, thereby improving computing efficiency and resource utilization.

CN119271366BActive Publication Date: 2025-09-09NORTHWESTERN POLYTECHNICAL UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411204059.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2025-09-09
Estimated Expiration
2044-08-30

AI Technical Summary

Technical Problem

In computational fluid dynamics, data communication problems between CPUs and GPUs lead to low parallel efficiency, and numerical simulation methods require a large amount of computing resources. Especially in the field of thermal physical quantity calculation, existing technologies make it difficult to effectively manage data exchange and reduce communication costs.

Method used

A hybrid programming framework based on CPU/GPU heterogeneous systems is adopted, and the OpenFOAM-GPU data structure is used to migrate the thermal physical quantity calculation tasks to the GPU. A parallel computing strategy is adopted, the memory copy logic is improved, and the two-dimensional array is reconstructed into a one-dimensional array structure to reduce the frequency of data exchange between the CPU and GPU. CUDA, CUBLAS, CUSPARSE, CULATools, MAGMA and Thrust libraries are used for optimization.

Benefits of technology

It significantly improves the computing speed, reduces the number of communications between the CPU and GPU, reduces communication costs, optimizes memory access patterns, and improves the efficiency of parallel computing and data throughput.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271366B_ABST
    Figure CN119271366B_ABST
Patent Text Reader

Abstract

The present invention provides a GPU computing method for computational fluid dynamics simulation, comprising building a hybrid programming framework based on a CPU / GPU heterogeneous system; establishing an OpenFOAM-GPU data structure; migrating chemical calculations to the GPU; migrating thermal physical quantity calculation tasks from the CPU to the GPU for execution; improving memory copy logic to reduce the frequency of data exchange between the GPU memory and the CPU during the calculation process; and reconstructing a two-dimensional array structure originally used on the CPU into a one-dimensional array structure suitable for GPU parallel computing. The method solves the problem that the numerical simulation method consumes a large amount of computing resources due to low parallel efficiency caused by data communication problems between the CPU and the GPU, thereby reducing the number of communications between the CPU and the GPU, lowering the communication cost, and improving the efficiency of parallel computing and data throughput.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of high-performance computational fluid dynamics (CFD), specifically CFD computational methods and structural optimization for large-scale CPU / GPU heterogeneous high-performance computing systems. This invention focuses on GPU-accelerated computation of thermal quantities, data transmission optimization, and adaptive modification of array structures. It can be applied to the rapid calculation of flow fields within wide-range composite engines, aiming to achieve higher computational efficiency and resource utilization. Background Art

[0002] In the history of the development of computational fluid dynamics (CFD), with the increasing demand for computing, traditional CPU-centric computing methods have gradually become unable to cope with the situation. Wide-band combination engines are an important source of power for future high-speed aircraft. However, the more stringent working performance requires a large amount of numerical calculations to meet the design requirements during the design process. For the solution of finite element meshes in the millions or tens of millions, current numerical simulations need to be implemented through parallel computing of hundreds of CPUs. Due to the data communication problem between CPUs, the parallel efficiency is not high, which causes conventional numerical simulation methods to consume a lot of computing resources. Especially in the field of calculation of thermal physical quantities, accurate simulation of key parameters such as temperature, pressure, and entropy is crucial for predicting fluid behavior and design optimization. However, these computing tasks often require processing large amounts of data and complex numerical methods, resulting in time-consuming and resource-intensive calculations.

[0003] The CPU, as the computer's computational control core, excels at complex logical operations; while the GPU, as a graphics processing unit, possesses a large number of stream processors (SPs) and excels at parallel processing of image data. As the GPU's outstanding parallel processing capabilities become widely recognized, its potential for application in the CFD field is gradually being explored. GPUs not only offer more computing cores than CPUs, but are also designed to perform large-scale parallel computing tasks. This makes GPUs an ideal choice for accelerating CFD simulations, especially for highly parallel tasks such as calculating thermal quantities.

[0004] However, migrating CFD computations from CPUs to GPUs is not without its challenges. Firstly, there's the issue of data structure adaptation. Traditional two-dimensional array structures, while efficient on CPUs, can lead to inefficient memory access and index conflicts on GPUs. Secondly, the frequent data exchange between the CPU and GPU becomes a bottleneck affecting computational performance. Effectively managing this data exchange and reducing communication costs are key to improving CFD computational performance. Summary of the Invention

[0005] In response to the above problems, the present invention provides a GPU computing method for computational fluid dynamics simulation, which solves the problem that the numerical simulation method needs to consume a large amount of computing resources due to the data communication problem between the CPU and the GPU, reduces the number of communications between the CPU and the GPU, reduces the communication cost, and improves the efficiency of parallel computing and data throughput.

[0006] The present invention adopts the following technical solutions to achieve the purpose: a GPU computing method for computational fluid dynamics simulation, comprising:

[0007] (1) Build a hybrid programming framework based on CPU / GPU heterogeneous systems;

[0008] (2) Based on the OpenFOAM open source computing framework, establish the OpenFOAM-GPU data structure;

[0009] (3) Migrating chemical calculations to GPUs;

[0010] (4) Migrate thermal physical quantity calculation tasks from CPU to GPU and adopt parallel computing strategy;

[0011] (5) Improve memory copy logic to reduce the frequency of data exchange between GPU memory and CPU during calculation;

[0012] (6) Reconstruct the two-dimensional array structure originally used on the CPU into a one-dimensional array structure suitable for GPU parallel computing;

[0013] Wherein, in said step (1), said building of a hybrid programming framework based on a CPU / GPU heterogeneous system includes optimizing linear algebra operations using the CUBLAS and CUSPARSE function libraries of the CUDA version of the basic linear algebra subroutine library provided by NVIDIA, performing matrix decomposition using CULATools and MAGMA, and programming through the Thrust parallel algorithm library to establish a hybrid programming framework for a CPU / GPU heterogeneous system;

[0014] In the step (2), the OpenFOAM-GPU data structure is established based on the OpenFOAM open source computing framework, including rewriting the native classes of OpenFOAM for GPU, and combining the hybrid programming framework of the CPU / GPU heterogeneous system built in step (1), so that the GPU has a data structure that meets the OpenFOAM computing requirements and can edit and perform computing operations on the data structure;

[0015] In step (3), the chemical calculation includes calculation of chemical reaction-related data based on thermal correlation; specifically, the chemical calculation is migrated to the GPU, including calculation of chemical source terms and optimization of reaction rate parameters based on the original chemistryModel class of OpenFOAM, solution of chemical reaction source terms, and parallel reconstruction of pressure P, temperature T, and density rho parameters;

[0016] In step (4), the thermal physical quantity calculation task is migrated from the CPU to the GPU for execution, and a parallel computing strategy is adopted, including: firstly, the relevant physical quantity fields are stored in the GPU memory, then the parallel algorithm of the thrust library is used to distribute the calculation task to multiple GPU threads, and finally, the parallel processing of the grid data points is realized through the transform function, make_zip_iterator and counting_iterator;

[0017] In step (5), improving the memory copy logic includes: before calculation, uniformly copying the necessary data to the CPU memory, and then uniformly copying it back to the GPU memory after the calculation is completed;

[0018] In the step (6), the two-dimensional array structure originally used on the CPU is converted into a one-dimensional array structure suitable for GPU parallel computing, including using labelgpuList to store the converted data to realize parallel computing of field interpolation from cells to points.

[0019] Optionally, the OpenFOAM-GPU data structure established in step (2) includes constructing data fields of the scalargpuField type, including enthalpy, pressure, temperature, specific volume, viscosity and thermal conductivity.

[0020] Optionally, the step (3) further specifically includes defining a chemistryModelCaculateFunctor<DeltaTType,ThermoType> The function object named func of the class provides corresponding processing methods for pressure P, temperature T, and density rho, and then performs parallel computing acceleration through functions in the Thrust parallel algorithm library.

[0021] Optionally, the step (4) further specifically includes a calculate() function of the thermal physical quantity hePsiThermo class responsible for processing scalargpuField type data in the GPU memory.

[0022] Optionally, step (5) further specifically includes first transferring the enthalpy, pressure, and temperature field data from the CPU memory to the GPU memory, and then using a unified data copy strategy to copy the mass, momentum, and enthalpy source term data from the GPU memory back to the host storage. Optionally, when performing GPU parallel computing, step (6) further specifically includes flattening the two-dimensional array into a one-dimensional array through data structure reconstruction, using labelgpuList to store the converted data, and implementing parallel computing on the GPU, and implementing parallel computing of field interpolation from cells to points through thrust::for_each combined with a counting iterator.

[0023] Optionally, in step (5), the field data is transferred from the CPU memory to the GPU memory using cudaMemcpyAsync and cudaMemcpySync functions for data transfer.

[0024] Compared with the existing technology, the present invention has the following beneficial effects: first, by migrating the calculation of thermal physical quantities to the GPU and utilizing its parallel computing capabilities, the calculation speed is significantly improved; second, by introducing a data batch copy method, the number of communications between the CPU and the GPU is reduced, thereby reducing the communication cost; finally, by reconstructing the two-dimensional array structure into a one-dimensional array structure, the memory access mode is optimized, and the efficiency of parallel computing and data throughput are improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 The figure is a flow chart of a GPU computing method for computational fluid dynamics simulation provided according to an embodiment. DETAILED DESCRIPTION

[0026] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.

[0027] like Figure 1 As shown, a GPU computing method for computational fluid dynamics simulation includes:

[0028] (1) Build a hybrid programming framework based on CPU / GPU heterogeneous systems;

[0029] (2) Based on the OpenFOAM open source computing framework, establish the OpenFOAM-GPU data structure;

[0030] (3) Migrating chemical calculations to GPUs;

[0031] (4) Migrate thermal physical quantity calculation tasks from CPU to GPU and adopt parallel computing strategy;

[0032] (5) Improve memory copy logic to reduce the frequency of data exchange between GPU memory and CPU during calculation;

[0033] (6) Reconstruct the two-dimensional array structure originally used on the CPU into a one-dimensional array structure suitable for GPU parallel computing;

[0034] Wherein, in said step (1), said building of a hybrid programming framework based on a CPU / GPU heterogeneous system includes optimizing linear algebra operations using the CUBLAS and CUSPARSE function libraries of the CUDA version of the basic linear algebra subroutine library provided by NVIDIA, performing matrix decomposition using CULATools and MAGMA, and programming through the Thrust parallel algorithm library to establish a hybrid programming framework for a CPU / GPU heterogeneous system;

[0035] In the step (2), the OpenFOAM-GPU data structure is established based on the OpenFOAM open source computing framework, including rewriting the native classes of OpenFOAM for GPU, and combining the hybrid programming framework of the CPU / GPU heterogeneous system built in step (1), so that the GPU has a data structure that meets the OpenFOAM computing requirements and can edit and perform computing operations on the data structure;

[0036] In step (3), the chemical calculation includes calculation of chemical reaction-related data based on thermal correlation; specifically, the chemical calculation is migrated to the GPU, including calculation of chemical source terms and optimization of reaction rate parameters based on the original chemistryModel class of OpenFOAM, solution of chemical reaction source terms, and parallel reconstruction of pressure P, temperature T, and density rho parameters;

[0037] In step (4), the thermal physical quantity calculation task is migrated from the CPU to the GPU for execution, and a parallel computing strategy is adopted, including: firstly, the relevant physical quantity fields are stored in the GPU memory, then the parallel algorithm of the thrust library is used to distribute the calculation task to multiple GPU threads, and finally, the parallel processing of the grid data points is realized through the transform function, make_zip_iterator and counting_iterator;

[0038] In step (5), improving the memory copy logic includes: before calculation, uniformly copying the necessary data to the CPU memory, and then uniformly copying it back to the GPU memory after the calculation is completed;

[0039] In the step (6), the two-dimensional array structure originally used on the CPU is converted into a one-dimensional array structure suitable for GPU parallel computing, including using labelgpuList to store the converted data to realize parallel computing of field interpolation from cells to points.

[0040] This embodiment will introduce the details of each step in detail according to the order of the steps of the above method.

[0041] In step (1), the present invention uses the following function library to build a CPU / GPU heterogeneous system:

[0042] (a) CUBLAS and CUSPARSE

[0043] CUBLAS and CUSPARS provide parallel acceleration of the most basic linear algebra operations such as vector-matrix addition, subtraction, multiplication and division. The difference is that CUBLAS is optimized for dense linear algebra operations, while CUSPARSE is optimized for sparse linear algebra operations.

[0044] (b) CULATools and MAGMA

[0045] CULATools is a GPU-accelerated version of the LAPACK library functions, which can be used to solve multivariate linear equations, least-squares solutions to linear systems of equations, calculate eigenvectors, and perform QR decomposition. MAGMA supports multi-core and multi-GPU support and is mainly used for dense matrix calculations.

[0046] (c)THRUST

[0047] Thrust is a general-purpose parallel algorithm library that provides a set of interfaces similar to the C++ Standard Template Library (STL). Thrust provides a flexible high-level language interface for programming on GPUs. The emergence of Thrust has greatly improved the productivity of general-purpose programming on GPUs. To improve compatibility and portability, Thrust currently supports not only GPU parallelism implemented by CUDA, but also CPU parallelism implemented by specifying OpenMPI.

[0048] (d)CUSP

[0049] CUSP is an open-source CUDA library for sparse linear algebra and graph computations. Licensed under Apache License 2.0, CUSP uses a Thrust-based generic programming approach and not only supports basic sparse linear algebra operations but also provides several basic sparse equation solvers.

[0050] In the step (2), a data structure that can be used for GPU device calculation is established based on the OpenFOAM basic data structure.

[0051] The optimization contents of OpenFOAM-GPU data structure are as follows:

[0052] (a)DeviceMemory

[0053] The main function of this function is to copy data between the host and data terminals and allocate memory on the device side, so that the read data can be copied to the GPU device for calculation. The main functional functions used are:

[0054] ① Apply for and release device memory

[0055] ②Copy host data to the device

[0056] ③Copy device data to the host

[0057] ④Device-to-device data copying

[0058] It implements the functions of allocating and releasing memory on the device and copying data between the host and the device. It creates a custom MemoryPool class to create and manage memory pools for cached data, which is used to dynamically allocate and release memory blocks. It implements two cache strategies: timeout release and small memory consumption into the cache. The program can dynamically allocate and release these memory blocks during operation to reduce the performance overhead caused by frequent memory allocation and release operations.

[0059] (b)GPUList

[0060] This class is essentially the same as the List class in OpenFOAM, a one-dimensional array of a specified type, with similar functionality to a vector array. However, it has been rewritten using GPU parallel computing methods to support device-side operations, including I / O operations. The functions are implemented using DeviceMemory for device-side memory operations. Within this array, three templates, List, UList, and gpuList, are first declared in the Foam namespace and serve as pointers to manage device memory on the GPU.

[0061] Defines the template class gpuList for managing arrays on the GPU and implements methods and functions for operating arrays, such as implementing memory pointers on the GPU through member variables or member functions, checking and setting array sizes, or returning specific locations in the array.

[0062] (c) gpuField

[0063] The field gpuField is also used to store velocity fields, pressure fields, etc., and directly inherits gpuList <type>, rewrite the functional functions of the List class:

[0064] Constructors and destructors

[0065] Operator redefinition of =, +=, *=, / =, <<, >>

[0066] (d) DimensionedField

[0067] Based on gpuField, DimensionedField is rewritten to represent a field with physical dimensions. The DimensionedField class combines values ​​and units to ensure physical meaning and consistency during calculations. It contains not only the field's numerical data but also information about the field's physical dimensions, units, and coordinate system.

[0068] By assigning appropriate physical dimensions to field quantities, DimensionedField allows for automatic conversion across various calculations and solvers, providing more accurate and consistent results. It can also be used for calculations, interpolation, and other common operations between field quantities. Simply replace all fields in OpenFOAM's existing Field class with gpuField, and apply DimensionedField to the upper layer, allowing for seamless use without modification.

[0069] In step (3), since the Chemistry class is a class related to chemical reactions, it is based on the class related to thermal reactions. GPU parallel computing is used to optimize and accelerate this part. A chemistryModelCaculateFunctor is defined.<DeltaTType,ThermoType> The function object named func of the class provides corresponding processing methods for pressure P, temperature T, and density rho, and then uses the functions in the Thrust library to accelerate parallel computing: first, the thrust::transform function is used to apply the elements in a range to the given function object one by one, and the results are stored in the output iterator. Then, the thrust::make_zip_iterator function is used to package multiple input sequences, and the previously defined func function is called to start iterative calculations for P, T, and rho. Finally, the results are stored in this->deltachem_.getField. This method can greatly improve the computational efficiency when processing large amounts of data in parallel.

[0070] In step (4), the calculate() function of the hePsiThermo class processes the scalargpuField type data in the GPU memory to calculate thermophysical quantities such as enthalpy, pressure, temperature, specific volume, viscosity, and thermal conductivity. This process uses the parallel computing capabilities of the thrust library to achieve parallel processing of grid data points through the transform function, make_zip_iterator, and counting_iterator. It includes the following substeps:

[0071] a. Data preparation: Relevant physical quantity fields are stored in GPU memory to ensure fast access.

[0072] b. Parallel computing framework: Utilizes the parallel algorithms of the thrust library to distribute computing tasks to multiple GPU threads.

[0073] c. Temperature calculation: Use the transport equation for enthalpy and update the thermal physical quantities through the **thermo.correct() function. The **calculate()** function of hePsiThermo calculates the temperature and other thermal physical quantities for each grid cell.

[0074] d. Computational performance optimization: The temperature calculation of each grid cell is processed independently and in parallel to improve efficiency.

[0075] The calculation logic is as follows:

[0076] T celli =mixture.THE(h celli ,p celli ,T celli )

[0077] ψ celli =mixture.ψ(p celli ,T celli )

[0078] μ celli =mixture.μ(p celli ,T celli )

[0079] α celli =mixture.α h (p celli ,T celli )

[0080] In this framework, T celli ,ψ celli ,μ celli , and α celli The mixture object represents the temperature, specific volume, viscosity, and thermal conductivity of a cell, respectively. The mixture object determines the corresponding thermophysical quantities based on the enthalpy, pressure, and temperature of each cell. This allows the calculation of thermophysical quantities to be migrated from the CPU to the GPU, optimizing the computational process of CFD simulations.

[0081] In step (5), a new memory copy logic is used (using the example of calculating spray combustion in a specific embodiment) to optimize the data transmission between the CPU and GPU. This solution includes the following sub-steps:

[0082] a. Memory copy logic: Before calculation, necessary data is copied to the CPU memory and then copied back to the GPU memory after calculation.

[0083] b. Reduced communication overhead: The new copy strategy reduces the number of memory swaps and reduces communication overhead.

[0084] c. Data transfer function: Use cudaMemcpyAsync and cudaMemcpySync functions for efficient data transfer.

[0085] d. Performance improvement: The implementation of a unified data copy strategy further improves the performance of granular computing.

[0086] Its core logic is:

[0087] dm=np·dMass[i]

[0088] tmp=td.rhoTrans_[gid][cellI].get(cellI)+dm

[0089] tmpVec=td.cloud().UTrans().getField().get(cellI)+dm·UO

[0090] tmp=td.cloud().hsTrans().getField().get(cellI)+dm·hs

[0091] Where dm represents the mass change, tmp and tmpVec represent the updated density and velocity vectors respectively. These calculations involve fetching and assigning values ​​from GPU memory, as well as particle calculations in the lagrangian module.

[0092] The step (6) converts the two-dimensional array structure originally used in the serial calculation logic into a one-dimensional array structure suitable for GPU parallel calculation. By reconstructing the data structure, the two-dimensional array is flattened into a one-dimensional array, and labelgpuList is used to store the converted data, thereby achieving more efficient parallel calculation on the GPU. The parallel calculation of field interpolation from cell to point is realized by thrust::for_each combined with the counting iterator.

[0093] pointCells=calcPointCells(cells,faces)

[0094]

[0095] The calcPointCells function calculates the grid to which each point belongs. It traverses all grids and marks the grid associated with each point. pointCells is a two-dimensional array that stores information about the grids associated with each point. In GPU parallel computing, since each calculation is independent and has no context dependency, the two-dimensional array structure is converted to a one-dimensional array structure to facilitate parallel computing.

[0096] Specific embodiment application calculation:

[0097] Based on the present invention, CFD calculations were performed for 20 million, 10 million, and 6 million grids, respectively, and the acceleration effects were compared for two types of problems: gas-phase flow combustion and spray flow combustion. Table 1 below shows a comparison of the single-round calculation time for spray flow combustion and Table 2 shows a comparison of the single-round calculation time for gas-phase flow combustion under various grid calculation examples. It can be seen that in the 20 million grid spray flow combustion example, the time for a single round of parallel calculation using a 128-core CPU is 2.66 seconds, while the time for parallel calculation using four 4090 GPU cards is 1 second, with an acceleration ratio of 2.66 times. In the 20 million grid gas-phase flow combustion example, the time for a single round of parallel calculation using a 128-core CPU is 1.64 seconds, while the time for parallel calculation using four 3080 GPU cards is 0.45 seconds, with an acceleration ratio of 3.64 times.

[0098] Table 1 Spray combustion calculation results

[0099]

[0100]

[0101] Table 2 Gas phase combustion calculation results

[0102] Gas phase flow combustion 20 million 10 million 6 million 320-core CPU 0.53s 0.2s 0.07s 128-core CPU 1.64s 0.75s 0.3s GPU-A100 0.81s 0.45s 0.34s GPU-4090 Insufficient video memory 0.48s 0.26s GPU-4090*2 0.51s 0.33s 0.18s GPU-3080*4 0.45s 0.28s 0.18s < / type>

Claims

1. A GPU computing method for computational fluid dynamics simulation, characterized in that: The following steps are involved: (1) Build a hybrid programming framework based on CPU / GPU heterogeneous systems; (2) Establish the OpenFOAM-GPU data structure based on the OpenFOAM open source computing framework; (3) Migrating chemical calculations to GPUs; (4) Migrate thermal physical quantity calculation tasks from CPU to GPU and adopt parallel computing strategy; (5) Improve memory copy logic to reduce the frequency of data exchange between GPU memory and CPU during calculation; (6) Reconstruct the two-dimensional array structure originally used on the CPU into a one-dimensional array structure suitable for GPU parallel computing; Wherein, in said step (1), said building of a hybrid programming framework based on a CPU / GPU heterogeneous system includes optimizing linear algebra operations using the CUBLAS and CUSPARSE function libraries of the CUDA version of the basic linear algebra subroutine library provided by NVIDIA, performing matrix decomposition using CULATools and MAGMA, and programming through the Thrust parallel algorithm library to establish a hybrid programming framework for a CPU / GPU heterogeneous system; In the step (2), the OpenFOAM-GPU data structure is established based on the OpenFOAM open source computing framework, including rewriting the native classes of OpenFOAM for GPU, and combining the hybrid programming framework of the CPU / GPU heterogeneous system built in step (1), so that the GPU has a data structure that meets the OpenFOAM computing requirements and can edit and perform computing operations on the data structure; In step (3), the chemical calculation includes the calculation of chemical reaction-related data based on thermal correlation; specifically, the migration of the chemical calculation to the GPU includes the calculation of chemical source terms and optimization of reaction rate parameters based on the original chemistryModel class of OpenFOAM, the solution of chemical reaction source terms, and the parallel reconstruction of pressure P, temperature T, and density rho parameters; In the step (4), the thermal physical quantity calculation task is migrated from the CPU to the GPU for execution, and a parallel computing strategy is adopted, including: firstly, the relevant physical quantity fields are stored in the GPU memory, then the parallel algorithm of the thrust library is used to distribute the calculation task to multiple GPU threads, and finally the parallel processing of the grid data points is realized through the transform function, make_zip_iterator and counting_iterator; In step (5), improving the memory copy logic includes: before calculation, uniformly copying the data to the CPU memory, and then uniformly copying it back to the GPU memory after the calculation is completed; In the step (6), the two-dimensional array structure originally used on the CPU is converted into a one-dimensional array structure suitable for GPU parallel computing, including using labelgpuList to store the converted data to realize parallel computing of field interpolation from cells to points.

2. The GPU computing method for computational fluid dynamics simulation according to claim 1, characterized in that: The OpenFOAM-GPU data structure established in step (2) includes constructing data fields of the scalargpuField type, including enthalpy, pressure, temperature, specific volume, viscosity and thermal conductivity.

3. The GPU computing method for computational fluid dynamics simulation according to claim 1, characterized in that: The step (3) further specifically includes defining a chemistryModelCaculateFunctor<DeltaTType,ThermoType> The function object named func of the class provides corresponding processing methods for pressure P, temperature T, and density rho, and then performs parallel computing acceleration through functions in the Thrust parallel algorithm library.

4. The GPU computing method for computational fluid dynamics simulation according to claim 1, characterized in that: The step (4) further specifically includes a calculate() function of the thermal physical quantity hePsiThermo class responsible for processing scalargpuField type data in the GPU memory.

5. The GPU computing method for computational fluid dynamics simulation according to claim 1, characterized in that: The step (5) further specifically includes first transferring the enthalpy, pressure and temperature field data from the CPU memory to the GPU memory, and then using a unified data copy strategy to copy the mass, momentum and enthalpy source term data from the GPU memory back to the host storage.

6. The GPU computing method for computational fluid dynamics simulation according to claim 1, characterized in that: The step (6) of GPU parallel computing also specifically includes flattening the two-dimensional array into a one-dimensional array through data structure reconstruction, using labelgpuList to store the converted data, and implementing parallel computing on the GPU. The parallel computing of field interpolation from cells to points is implemented by using thrust::for_each combined with a counting iterator.

7. The GPU computing method for computational fluid dynamics simulation according to claim 5, characterized in that: In step (5), the field data is transferred from the CPU memory to the GPU memory using the cudaMemcpyAsync and cudaMemcpySync functions.

Citation Information

Patent Citations

  • Character string matching method and system based on graphic processing unit (GPU) heterogeneous computing platform

    CN103559017A

  • fluid machinery simulation program heterogeneous acceleration method based on a GPU

    CN109522127A