An efficient discrete-to-continuous conversion method based on CPU and GPU heterogeneous parallelism
By using a heterogeneous parallel approach between CPU and GPU, a finite element-particle bidirectional index table is constructed in the GPU memory. This solves the problems of particle transformation judgment and mechanical state continuity during powder pressing, achieving efficient discrete-continuous transformation. It is applicable to the pressing and forming of materials such as metal powder and ceramic powder.
Patent Information
- Application Number
- CN202611252360.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-18
- Publication Date
- 2026-11-17
AI Technical Summary
Existing technologies lack effective methods to determine when particles complete their transformation, how to ensure the continuity of mechanical state at the transformation moment, and how to coordinate the coupling and advancement of DEM and FEM within the same time step. This results in a huge computational load for the powder pressing process, which is difficult to process by CPU and cannot meet the time requirements.
A heterogeneous parallel approach using CPU and GPU is adopted to construct a finite unit-particle bidirectional attribution index table in GPU memory, enabling parallel computation of particle conversion factor calculation, unit conversion factor aggregation, and coupling force transfer, and completing the discrete-to-continuous conversion process through the GPU.
It achieves efficient discrete-to-continuous conversion, reduces CPU-GPU communication latency, lowers computational overhead, and is suitable for the pressing and forming process of powder materials such as metal powder and ceramic powder, significantly improving computational efficiency.
Smart Images

Figure CN123116751A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of numerical simulation technology in computational mechanics, specifically to an efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU. Background Technology
[0002] In engineering processes such as powder compaction, a large number of tiny metal, ceramic, or composite powder particles are gradually compressed and fused under external pressure, eventually forming a continuous solid. Accurately simulating this process requires tracking the contact and collision behavior of the particles at each stage and describing the stress-strain response of the resulting continuum. Therefore, it is necessary to maintain discrete particle images (DEMs) and finite element continuous images (FEMs) within the same framework, and to gradually transform the mechanical characterization of the particles from a discrete state to a continuous state during the compaction process. However, a complete and systematic method for this discrete-to-continuous gradual transformation process is currently lacking. How to determine when the particle transformation is complete, how to ensure the continuity of the mechanical state at the transformation moment, and how to coordinate the coupled advancement of DEMs and FEMs within the same time step—these questions lack mature methodological frameworks in existing literature and implementations. Furthermore, powder compaction problems typically involve hundreds of thousands or even millions of particles, and the computational load involved in each time step is extremely large. Relying solely on CPU processing would result in unacceptable time overhead, urgently requiring acceleration using the massive parallel capabilities of GPUs. Summary of the Invention
[0003] To address the technical problems existing in the background technology mentioned above, this invention proposes an efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU. By constructing a finite unit-particle bidirectional attribution index table in the GPU memory, the particle conversion factor calculation, unit conversion factor aggregation, and coupling force transfer are all completed in parallel on the GPU side in an integrated manner, realizing efficient GPU parallel computing for discrete-to-continuous conversion.
[0004] To address the aforementioned technical problems, this invention provides an efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU, comprising the following steps:
[0005] (1) In the numerical solution initialization stage, a discrete domain particle array and a continuous domain finite element array are established in the GPU memory respectively. The particle domain corresponding to the discrete domain particle array and the finite element domain corresponding to the continuous domain finite element array are set to have the same spatial range and boundary, and a finite element-particle bidirectional attribution index table is established.
[0006] (2) The finite cell to which each particle belongs is determined by body-centered mapping in parallel with a per-particle thread, and the finite cell number is directly written into the particle end cell number array. At the same time, each finite cell in each continuous domain finite cell array is counted in parallel with atomic accumulation operation. The finite cell particle number array obtained after the atomic accumulation operation is counted in parallel is subjected to parallel prefix scan to obtain the cell end offset array. The cell end particle number list is filled in parallel with a per-particle thread again to complete the establishment of the belonging index.
[0007] (3) The CPU triggers the GPU to execute the particle conversion factor calculation and finite element conversion factor aggregation process, specifically: the CPU pre-configures the start conversion threshold and the completion conversion threshold; the GPU calculates the particle conversion factor of each particle according to the pre-selected volume stress conversion criterion or bulk modulus conversion criterion; and the particle conversion factor is only used to represent the degree of conversion achieved by the current local mechanical state of the corresponding particle, and does not directly trigger particle-level conversion; the GPU aggregates each particle conversion factor into the corresponding continuous domain finite element according to the particle volume;
[0008] (4) The CPU triggers the GPU to execute the contact force calculation process, specifically: the GPU calculates the contact force between three types of contact pairs in the current calculation time step, namely particle-particle, particle-finite element, and finite element-finite element, according to the pre-selected contact model, with one thread corresponding to one contact pair; for particle-particle contact pairs, the contact forces of equal magnitude and opposite direction are accumulated to the resultant force of the corresponding particle by atomic addition operation; for particle-finite element contact pairs, the contact force is allocated to the corresponding finite element node, and the reaction force is accumulated to the resultant force of the corresponding particle; for finite element-finite element contact pairs, the contact force and its reaction force are allocated to the corresponding finite element nodes of both contacting parties; after completing the parallel calculation of all contact pairs, the particle contact resultant force array and the finite element node contact resultant force array are obtained, which are used as the external force input for particle time integration and finite element node integration in the following step (5);
[0009] (5) For particles that are still in a discrete state, perform time integration on the contact resultant force written into the particle resultant force array in step (4); for continuous domain finite elements that have not yet been transformed, update the coordinates of each node in a Lagrange kinematic manner: take the volume-weighted average velocity of each particle in the continuous domain finite element to advance the node position, only perform kinematic follow-up update, do not perform stiffness matrix assembly or equation solving, so that the finite element mesh composed of the continuous domain finite elements always covers the particle domain during the process of the particle being compressed and moved downward, and no empty elements are generated; for the finite element transformation factor For the first continuous domain finite element that reaches 1, its mode flag is switched to the converted state, and the constitutive parameters of the continuum are initialized in the kernel function of finite element mode switching and constitutive parameter initialization. The initial relative density is the volume weighted average density of each particle in the continuous domain finite element at the switching time, and the initial stress tensor is the average stress of each particle contact force in the volume of the continuous domain finite element at the switching time. The equivalent plastic strain and other internal state variables are set to zero, and the pre-selected constitutive model type identifier is written into the corresponding field of the continuous domain finite element array. For the continuous domain finite element that has been switched to FEM mode, FEM stress update and node integration are performed. The node force is determined by the internal force generated by the FEM internal stress and the contact resultant force written into the finite element node resultant force array in step (4). The node coordinates are driven by FEM node integration to complete the current time step advancement.
[0010] (6) After completing steps (3) to (5) in each computation time step, the GPU updates the relative cumulative displacement of each particle still in a discrete state relative to the reference frame of its continuous domain finite element in parallel. That is, the difference between the displacement increment of the particle in the current computation time step and the follow-up displacement increment of the finite element of its continuous domain is added to the relative cumulative displacement of the particle. Then, the GPU parallel reduction algorithm is used to first obtain the maximum relative cumulative displacement in each thread block, and then the maximum value of each thread block is reduced to obtain the global maximum relative cumulative displacement. The CPU reads the global maximum relative cumulative displacement and compares it with the pre-set value stored in the CPU. The displacement threshold of the belonging index table in the U-end parameter variable is compared. If the displacement threshold of the belonging index table is exceeded, step (2) is triggered at the beginning of the next calculation time step to rebuild the finite element-particle bidirectional belonging index table and clear the relative cumulative displacement field in the discrete domain particle array to zero. Otherwise, step (2) is skipped and step (3) is directly entered. The relative cumulative displacement, rather than the absolute displacement of the particle, is used as the reconstruction trigger quantity to filter out the displacement accumulation caused by the synchronous translation of the particle with the finite element of the continuous domain, so as to avoid frequent unnecessary reconstruction of the belonging index table when the finite element mesh composed of the continuous domain finite element moves as a whole.
[0011] As a preferred embodiment of the present invention: the discrete domain particle array in step (1) is indexed by particle number and stored continuously in GPU memory in the format of structure array, i.e. SoA, and includes fields such as particle centroid coordinates, velocity, resultant force, sphere radius, mode flag, particle conversion factor and cumulative displacement modulus.
[0012] The continuous domain finite element array in step (1) is indexed by element number and stored continuously in SoA format. It includes the coordinates of each node, stress, strain, element transformation factor, constitutive model type identifier, and fields of constitutive state variables.
[0013] As a preferred embodiment of the present invention, the finite element-particle bidirectional attribution index table in step (1) consists of three arrays: the finite element number array P2E to which the particle belongs, the finite element particle offset array O, and the finite element particle number array E2P.
[0014] The finite element particle offset array O and the finite element particle number array E2P form an element-particle orientation index in CSR format. The particle numbers contained in element j are stored continuously in the element end particle number list, and their start and end positions are determined by the j-th and j+1-th items in the element end offset array.
[0015] The finite element number array P2E of the particle directly stores the number of the element to which the particle belongs, with the particle number as the index. The number of the element to which particle i belongs is directly given by the i-th item of the particle end element number array.
[0016] All three arrays reside in GPU memory, and the ownership lookup in both directions is an O(1) random access, without needing to access CPU memory.
[0017] In a preferred embodiment of the present invention, step (2) involves the CPU triggering the GPU to execute the finite cell-particle bidirectional attribution index table establishment process, specifically as follows:
[0018] Parallel processing is performed with one GPU thread corresponding to one particle. The unique finite element number e of the continuous domain to which the p-th particle belongs is determined based on the centroid position of the p-th particle. p And number the continuous domain finite element e p Write the finite element number array P2E to which the particle belongs, that is:
[0019]
[0020] Initialize each element in the finite cell particle count array C to 0; each GPU thread performs an atomic increment operation on C[e] based on the continuous domain finite cell to which the corresponding particle belongs, to obtain the number of particles contained in each continuous domain finite cell, where:
[0021]
[0022] In the above formula, N p The total number of particles; when the p-th particle belongs to the e-th continuous finite element. ,otherwise ;
[0023] Perform a parallel prefix scan on the finite element particle count array C to obtain the finite element particle offset array O, where:
[0024] O[0] = 0;
[0025] O[e+1]=O[e]+C[e], e=0, 1,…,N e -1;
[0026] In the above formula, N e O[e] represents the total number of finite elements in the continuous domain, and O[e] represents the starting position of the particle number corresponding to the e-th finite element in the finite element particle number array E2P.
[0027] Based on the finite element particle offset array O, the corresponding contiguous storage area is divided for each contiguous domain finite element in the finite element particle number array E2P; a temporary write position count array W is set, and each element in W is initialized to 0; parallel processing is again performed with one GPU thread corresponding to one particle; for the p-th particle, the GPU thread processing the particle is determined according to the finite element number e of its contiguous domain. p , for W[e p Perform an atomic increment operation, and then convert the W[e] before the atomic increment operation to 1. p The value w is used as the permutation number of the p-th particle within its corresponding finite element in the continuous domain. p The writing position q of the p-th particle number in the finite element particle number array E2P is calculated according to the following formula. p :
[0028] ;
[0029] ;
[0030] ;
[0031] In the above formula, AtomicFetchAdd(W[e p ],1) indicates reading W[e atomically. p The value before the increment operation is performed is returned as w. p and in the same atomic operation, W[e p Updated to W[e p +1; After completing the parallel writing of all particle numbers, the particle numbers contained in the e-th continuous domain finite cell are stored in the continuous storage range defined by E2P[O[e]] to E2P[O[e+1]-1]; The finite cell number array P2E to which the particle belongs is used to establish the belonging relationship between the particle and the continuous domain finite cell. The finite cell particle offset array O and the finite cell particle number array E2P are used together to establish the belonging relationship between the continuous domain finite cell and the particle. The three together constitute the finite cell-particle bidirectional belonging index table.
[0032] As a preferred embodiment of the present invention: the belonging relationship between the particle and the continuous domain finite element in step (2) is determined by body-centered mapping: when the particle's centroid is located inside a certain continuous domain finite element, the particle is assigned to that continuous domain finite element, and each particle is assigned to only one continuous domain finite element.
[0033] In a preferred embodiment of the present invention, step (3) involves the CPU triggering the GPU to perform particle conversion factor calculation, and the specific process is as follows:
[0034] The CPU pre-configures the start and end conversion thresholds; the GPU calculates the particle conversion factor for each particle based on the pre-selected volumetric stress conversion criterion or bulk modulus conversion criterion.
[0035] When using the volume stress conversion criterion, processing is performed in parallel with one GPU thread corresponding to one particle. For the i-th particle, the contact forces acting on that particle are read, and the volume stress of that particle is calculated according to the following formula:
[0036] ;
[0037] In the above formula, V represents the volume stress of the i-th particle at the n-th computation time step. i Let be the volume of the i-th particle; It is the set of all contact points that come into contact with the i-th particle; Let c be the contact force acting on the i-th particle at the contact point; Let c be the branch vector pointing from the contact point c to the centroid of the i-th particle;
[0038] Calculate the particle transformation factor based on the volume stress of the i-th particle:
[0039]
[0040] In the above formula, The body stress threshold at which the transformation begins. The body stress threshold required to complete the transformation, and ;
[0041] When using the bulk modulus conversion criterion, the continuous domain finite element to which each particle belongs is taken as the local computational region where the corresponding particle is located; for the j-th continuous domain finite element, the set of particles S contained in the finite element is determined according to the finite element-particle bidirectional attribution index table. j The solid volume fraction of the finite element at the nth computation time step is calculated according to the following formula:
[0042] ;
[0043] In the above formula, Let be the solid volume fraction of the j-th continuous domain finite element at the n-th computation time step. Let be the current volume of the continuous domain finite element at the nth computation time step. The local pressure of the j-th continuous domain finite element is calculated according to the following formula:
[0044] ;
[0045] The compressive volumetric strain of the j-th continuous domain finite element is calculated according to the following formula:
[0046] ;
[0047] In the above formula, Let the solid volume fraction be the initial state of the j-th continuous domain finite element in the numerical solution; based on the local pressure increment and compressive volumetric strain increment of two adjacent calculation time steps, calculate the equivalent bulk modulus of the j-th continuous domain finite element according to the following formula:
[0048]
[0049] When the compressive volumetric strain increments of two adjacent computation time steps are 0, the equivalent bulk modulus of the j-th continuous domain finite element in the previous computation time step remains unchanged; the equivalent bulk modulus of the i-th particle is taken as the equivalent bulk modulus of its corresponding continuous domain finite element.
[0050] ;
[0051] In the above formula, The finite element number of the i-th particle in the finite element number array P2E is recorded as the continuous domain finite element number of the i-th particle; the particle transformation factor is calculated based on the equivalent bulk modulus of the i-th particle.
[0052]
[0053] In the above formula, The equivalent bulk modulus threshold at which the transformation begins. The equivalent bulk modulus threshold for completing the transformation.
[0054] As a preferred embodiment of the present invention, the specific process of the GPU aggregating each particle conversion factor into the corresponding continuous domain finite element according to the particle volume in step (3) is as follows:
[0055] Initialize all elements in the finite element transformation factor numerator array A and the finite element particle accumulation array B to 0; the GPU thread processing the i-th particle determines the continuous domain finite element number e to which the particle belongs based on the finite element number array P2E to which the particle belongs. i And use atomic addition operations to respectively Accumulate to A[ei ]、 V i Accumulate to B[e i After all particles have been accumulated in parallel, the unit transformation factor of the j-th continuous domain finite element is calculated using the following formula, with one GPU thread corresponding to one continuous domain finite element:
[0056] ;
[0057] In the above formula, The unit transformation factor of the j-th continuous domain finite element at the n-th computation time step has a value range of [0, 1]. The unit transformation factor serves as the basis for judging the overall transformation of the continuous domain finite element in step (5). The overall transformation of the corresponding continuous domain finite element is triggered only when the unit transformation factor reaches 1 for the first time, and the transformation is not triggered at the granular level.
[0058] As a preferred embodiment of the present invention: in step (4), the particle-unit contact occurs between the particle, which is still in a discrete state, and the surface of the transformed finite element. The contact force is applied to the finite element node and the reaction force is applied to the particle, ensuring the conservation of momentum and mechanical balance on both sides of the transformation front. In the current time step of step (4), the contact forces between the three types of contact pairs, namely particle-particle, particle-unit, and unit-unit, are calculated in parallel on the GPU in a thread-by-thread manner and are accumulated to the particle resultant force array or the finite element node force array by atomic addition operations.
[0059] As a preferred embodiment of the present invention: In step (5), the constitutive parameter initialization of the continuum is completed within the kernel function of finite element mode switching and constitutive parameter initialization. The initialization content includes: taking the volume weighted average density of each particle in the finite element of the continuum domain at the switching time as the initial relative density of the finite element of the continuum domain; taking the average stress of the contact force of each particle in the volume of the finite element of the continuum domain at the switching time as the initial stress tensor to ensure the continuity of the mechanical state at the transition time; setting the equivalent plastic strain and other internal state variables to zero.
[0060] The continuum constitutive parameters are the parameters and internal state variables required for stress updating of the continuum constitutive model; the continuum constitutive model can be an elastoplastic constitutive model, a Shima-Oyane powder plastic model, or a Drucker-Prager-Cap model, and is selected by writing the corresponding constitutive model type identifier into the constitutive model type identifier field of the continuum domain finite element array.
[0061] In a preferred embodiment of the present invention, in step (5), the finite element mesh composed of the continuous domain finite elements operates in a Lagrangian follower mode, and is divided into two behavior modes according to the transformation stage of the continuous domain finite elements:
[0062] When the element transformation factor of the j-th continuous domain finite element At that time, the continuous domain finite element is in the unconverted stage and only serves as a geometric container. In each computation time step, the coordinates of each node are updated with the volume-weighted average velocity of each particle in the continuous domain finite element, completing pure kinematic following. Stiffness matrix assembly and linear equation solving are not performed. The computational cost is proportional to the number of particles rather than related to the mesh size.
[0063] When the element transformation factor of the j-th continuous domain finite element At this point, the continuous domain finite element enters the transformed stage and switches to perform a complete finite element method mechanical calculation, with the nodal coordinates driven by the finite element nodal integration.
[0064] As a preferred embodiment of the present invention: the CPU and GPU heterogeneous task division runs through steps (1) to (6). The CPU is responsible for time step loop control, conversion parameter configuration, reading the global maximum relative cumulative displacement obtained by GPU reduction, determining whether to trigger the reconstruction of the attribution index table, and outputting the results; the GPU is responsible for establishing the attribution index table, calculating particle stress, calculating particle conversion factor, calculating the element conversion factor of each continuous domain finite element according to step (3), calculating the three types of contact force, switching the finite element mode and initializing constitutive parameters, time integration of the discrete element method, stress update and node integration of the finite element method, updating the relative cumulative displacement in parallel for each particle, and obtaining the global maximum relative cumulative displacement through parallel reduction;
[0065] The process of establishing the attribution index table is completed before the particle conversion factor calculation flow is started, the unit conversion factor calculation flow is completed before the contact force calculation flow is started, and the discrete element method time integration flow and the finite element method stress update flow are scheduled in parallel after the contact force calculation flow is completed.
[0066] In step (6), the CPU compares the global maximum relative cumulative displacement obtained by the GPU reduction with the pre-set displacement threshold of the reconstruction of the home index table stored in the CPU-side parameter variables; when the global maximum relative cumulative displacement exceeds the displacement threshold of the reconstruction of the home index table, the reconstruction of the home index table is triggered, and the relative cumulative displacement field in the discrete domain particle array is cleared to zero; the corresponding index entry of the particle belonging to the transformed continuous domain finite element is marked as invalid in the home index table and is skipped in subsequent particle calculations.
[0067] By adopting the above technical solution, the present invention has the following beneficial effects:
[0068] The present invention is based on a reasonable and efficient discrete-to-continuous conversion method using heterogeneous parallelism of CPU and GPU. The unconverted unit adopts a Lagrange follower mechanism to follow the particle movement, and the computational overhead adaptively increases with the converted region. It is suitable for large-scale GPU parallel numerical simulation of the pressing and forming process of powder materials such as metal powder and ceramic powder.
[0069] This invention explicitly stores the bidirectional attribution relationship between finite units and particles in GPU memory, efficiently establishing it through a three-step parallel pipeline across the entire GPU. It supports fast bidirectional queries, eliminating the performance bottleneck of sequential traversal on the CPU. Particle conversion factor calculation, unit conversion factor aggregation, and coupling force transfer are all completed in parallel on the GPU, eliminating the need for CPU-GPU data round trips and removing communication latency in the judgment and distribution stages of existing methods. The attribution index table is reconstructed on demand based on the cumulative displacement of particles, and combined with the incremental invalidation markers of already converted particles, significantly reducing the frequency of full reconstruction. The overall method structure is suitable for large-scale parallel implementation on GPUs and can be applied to various powder material pressing and forming scenarios, including metal powders, ceramic powders, composite powders, and pharmaceutical powders.
[0070] Compared with the prior art, the present invention has the following technical features and advantages:
[0071] (1) GPU parallel construction of finite element-particle bidirectional attribution index table
[0072] In discrete-to-continuous transformation problems such as powder pressing, the particle domain and the finite element domain completely overlap in the same spatial region, and the two types of objects coexist from the start of the computation. Each particle belongs to exactly one finite element (determined by a body-centered mapping model, the element where the particle's centroid is located is its belonging element), and each finite element contains several particles. This invention establishes a two-way finite element-particle belonging index table in GPU memory, storing the above belonging relationships in three compact arrays: the element-end offset array and the element-end particle number list form an element-particle direction index in CSR format, and the particle-end element number array directly stores the one-to-one mapping from particle to element. All of these support fast random access and serve the following two operations: when aggregating element conversion factors, the belonging element is found from the particle end and the contribution is atomically added; when transferring coupling forces, the belonging element is found from the particle end, and the contact force is distributed to the element nodes.
[0073] The establishment of the attribution index table is completed through a three-step GPU kernel function pipeline: First, each particle is assigned to a finite cell using body-centered mapping in parallel per-particle thread, and its cell number is directly written into the cell number array at the particle end. Atomic addition operations are then used to perform parallel counting of the number of particles contained in each cell. Second, a GPU parallel prefix scan is performed on the count array to obtain the starting offset of each cell in the cell-side particle number list. Third, the particle number is again written into the list range of the corresponding cell in parallel per-particle thread, completing the establishment of the attribution index table. The attribution index table is rebuilt as needed based on the cumulative particle displacement. Transformed particles are marked as invalid in the index table and skipped during calculation, eliminating the need for full reconstruction.
[0074] (2) GPU parallel conversion factor calculation and progressive state switching based on the attribution index table
[0075] Particle conversion factor Indicates particles The degree of discrete-to-continuous transformation is determined by a criterion: in the volume stress transformation criterion, As the particles are subjected to stress from arrive Linear increase; in the bulk modulus conversion criterion Equivalent bulk modulus of the region where the particle is located from arrive It increases linearly. When When the particle is in a purely discrete state, The time-varying particles are completely transformed into continuous states. Parallel computation is performed using GPU threads per particle. Each thread only needs to read the resultant contact force or equivalent modulus of its own particle, resulting in a constant computational load and full parallelization.
[0076] Finite element Unit conversion factor The conversion factor of all particles within a unit is a volume-weighted average, i.e. The aggregation process is performed entirely on the GPU, with each particle being assigned to a specific unit through a parallel GPU thread. The numerator and denominator are accumulated using atomic addition operations, and then division is performed in parallel using a unit-by-unit thread.
[0077] As the suppression process progresses... Gradually increase It then tends towards 1. When When the value reaches 1 for the first time, the GPU switches the mode flag of the unit to "transformed" within the same kernel function and completes the initialization of the constitutive parameters of the continuum—using the volume-weighted average density of the particles at the time of switching as the initial relative density and the average stress of the particle contact force as the initial stress tensor, to ensure the continuity of the mechanical state at the time of conversion.
[0078] (3) Lagrangian follower mechanism of background finite element mesh
[0079] In large deformation scenarios such as powder pressing, the particles move downwards with the indenter. If the background finite element mesh remains fixed (Eulerian description), the upper elements will gradually lose particle coverage and form empty elements, affecting the belonging index and... The computation becomes meaningless. This invention employs a Lagrange follower mechanism: for finite elements that have not yet completed the transformation, the coordinates of each node are updated at each time step using the volume-weighted average velocity of each particle within the element. Only kinematic following is performed; stiffness matrix assembly or equation solving is not performed, thus ensuring that the background mesh always covers the particle domain. At this stage, the finite element only serves as a geometric background container, with extremely low computational overhead, increasing only linearly with the number of particles and independent of the total size of the background mesh. For elements that have completed the transformation, the calculation switches to full FEM mechanical calculation, with node coordinates driven by FEM node integration. The overall computational cost adaptively increases with the volume of the transformed region, initially being almost zero, demonstrating the efficiency advantage of this invention in discrete-to-continuous transformation scenarios. Attached Figure Description
[0080] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0081] Figure 1 This is an overall flowchart of the efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU in this invention;
[0082] Figure 2 This is a schematic diagram of the process for establishing a finite element-particle bidirectional index table for the efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU in this invention.
[0083] Figure 3 This is a schematic diagram illustrating the GPU parallel conversion factor calculation and coupling of the efficient discrete-continuous conversion method based on CPU and GPU heterogeneous parallelism in this invention.
[0084] Figure 4The particle conversion factors in the powder pressing examples of the efficient discrete-continuous conversion method based on CPU and GPU heterogeneous parallelism of the present invention are shown below. With unit conversion factor Evolution diagram of the pressing process. Detailed Implementation
[0085] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0086] The present invention will be further explained below with reference to specific embodiments.
[0087] like Figure 1 As shown in the figure, this embodiment provides an efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU, which includes the following steps:
[0088] (1) In the numerical solution initialization stage, a discrete domain particle array and a continuous domain finite element array are established in the GPU memory respectively. The particle domain corresponding to the discrete domain particle array and the finite element domain corresponding to the continuous domain finite element array are set to have the same spatial range and boundary, and a finite element-particle bidirectional attribution index table is established.
[0089] (2) The CPU triggers the GPU to execute the kernel function for establishing the home index table.
[0090] The finite cell to which each particle belongs is determined by body-centered mapping in parallel using a per-particle thread, and the finite cell number to which the particle belongs is directly written into the particle-end cell number array. At the same time, each finite cell in each continuous domain finite cell array is counted in parallel using atomic accumulation operations. The finite cell particle count array obtained after the atomic accumulation operation is counted in parallel is then subjected to parallel prefix scanning to obtain the cell-end offset array. The cell-end particle number list is then filled in parallel again using a per-particle thread to complete the establishment of the belonging index.
[0091] (3) The CPU triggers the GPU to execute the conversion factor calculation kernel function.
[0092] The stress on each particle or the equivalent bulk modulus of its region is calculated in parallel using a per-particle thread, and then linearly normalized and mapped to an intermediate quantity of local particle transformation—the particle transformation factor. , It only reflects the local mechanical state of the particles and does not directly trigger any transformation decisions; then, in parallel threading per particle, the transformation factor of each particle is accumulated by volume weighting to its corresponding finite element using the element-end index, and the element transformation factor of each finite element j is calculated. ; For unit-level transformation judgment quantity, when The overall conversion of a unit is triggered only when a preset threshold is reached. The conversion decision is made at the unit level, not at the granular level.
[0093] (4) The CPU triggers the GPU to execute the contact force calculation kernel function.
[0094] The CPU triggers the GPU to execute the contact force calculation process. The GPU calculates the contact force between three types of contact pairs in the current calculation time step, namely particle-particle, particle-finite element, and finite element-finite element, according to the pre-selected contact model, with one thread corresponding to one contact pair. For particle-particle contact pairs, the contact forces of equal magnitude and opposite direction are accumulated to the resultant force of the corresponding particle by atomic addition. For particle-finite element contact pairs, the contact force is distributed to the corresponding finite element node, and the reaction force is accumulated to the resultant force of the corresponding particle. For finite element-finite element contact pairs, the contact force and its reaction force are distributed to the corresponding finite element nodes of both contacting parties. After completing the parallel calculation of all contact pairs, the particle contact resultant force array and the finite element node contact resultant force array are obtained, which serve as the external force input for particle time integration and finite element node integration in step (5).
[0095] (5) The GPU proceeds in separate paths based on the updated mode flag.
[0096] For particles still in a discrete state, perform time integration on the contact resultant force written into the particle resultant force array in step (4); for continuous domain finite elements that have not yet completed the transformation, update the coordinates of each node using Lagrange kinematics: take the volume-weighted average velocity of each particle in the continuous domain finite element to advance the node position, only perform kinematic follow-up updates, do not perform stiffness matrix assembly or equation solving, so that the finite element mesh composed of the continuous domain finite elements always covers the particle domain during the process of the particle being compressed and moved downward, and does not generate empty elements; for the finite element transformation factor For the first continuous domain finite element that reaches 1, its mode flag is switched to the converted state, and the constitutive parameters of the continuum are initialized in the kernel function of finite element mode switching and constitutive parameter initialization. The initial relative density is the volume weighted average density of each particle in the continuous domain finite element at the switching time, and the initial stress tensor is the average stress of each particle contact force in the volume of the continuous domain finite element at the switching time. The equivalent plastic strain and other internal state variables are set to zero, and the pre-selected constitutive model type identifier is written into the corresponding field of the continuous domain finite element array. For the continuous domain finite element that has been switched to FEM mode, FEM stress update and node integration are performed. The node force is determined by the internal force generated by the FEM internal stress and the contact resultant force written into the finite element node resultant force array in step (4). The node coordinates are driven by FEM node integration to complete the current time step advancement.
[0097] (6) After completing steps (3) to (5) in each computation time step, the GPU updates the relative cumulative displacement of each particle still in a discrete state relative to the reference frame of the finite element of the continuous domain in parallel. That is, the difference between the displacement increment of the particle in the current computation time step and the follow-up displacement increment of the finite element of the continuous domain is added to the relative cumulative displacement of the particle. Then, the GPU parallel reduction algorithm commonly used in this field is used to first obtain the maximum relative cumulative displacement in each thread block, and then the maximum value of each thread block is reduced to obtain the global maximum relative cumulative displacement. The CPU reads the global maximum relative cumulative displacement and compares it with the preset and stored values. The displacement threshold of the belonging index table in the CPU parameter variables is compared. If the displacement threshold is exceeded, step (2) is triggered at the beginning of the next calculation time step to rebuild the finite element-particle bidirectional belonging index table and clear the relative cumulative displacement field in the discrete domain particle array. Otherwise, step (2) is skipped and step (3) is directly entered. The relative cumulative displacement, rather than the absolute displacement of the particle, is used as the reconstruction trigger quantity to filter out the displacement accumulation caused by the synchronous translation of the particle with the finite element of the continuous domain, so as to avoid frequent unnecessary reconstruction of the belonging index table when the finite element mesh composed of the continuous domain finite element moves as a whole.
[0098] The discrete-domain particle array in step (1) above is indexed by particle number and stored continuously in GPU memory in the format of SoA structure array, containing fields such as particle centroid coordinates, velocity, resultant force, sphere radius, mode flag, particle conversion factor and cumulative displacement modulus.
[0099] The continuous domain finite element array in step (1) above is indexed by element number and stored continuously in SoA format. It includes the coordinates of each node, stress, strain, element transformation factor, constitutive model type identifier and fields of constitutive state variables.
[0100] The finite element-particle bidirectional attribution index table in step (1) above consists of three arrays: the finite element number array P2E, the finite element particle offset array O, and the finite element particle number array E2P. The finite element particle offset array O and the finite element particle number array E2P form a unit-particle direction index in CSR format. The particle numbers contained in unit j are stored continuously in the unit-end particle number list, and their start and end positions are determined by the j-th and j+1-th items in the unit-end offset array. The finite element number array P2E directly stores the unit number to which the particle belongs using the particle number as an index. The unit number to which particle i belongs is directly given by the i-th item in the particle-end unit number array. All three arrays reside in GPU memory, and the attribution query in both directions is an O(1) random access, without needing to access CPU memory.
[0101] In addition, such as Figure 2 As shown, the establishment of the attribution index table is executed by the GPU kernel function in three steps. The first step starts a thread of the same size as the number of particles, with each thread corresponding to one particle. Using a body-centered mapping, the thread searches for the finite cell containing the centroid of the particle through a background space hash grid. The finite cell number is directly written into the particle-side cell number array, and the particle count of each finite cell in the continuous domain finite cell array is accumulated using atomic addition operations (atomic addition refers to atomic accumulation operations in the GPU; when multiple particles belong to the same finite cell, the particle count corresponding to that finite cell is incremented by 1 using atomic addition to avoid counting errors caused by multiple threads writing simultaneously). The second step performs a GPU parallel prefix scan on the finite cell particle count array obtained after atomic addition parallel counting (each element in the array represents the number of particles contained in the corresponding finite cell), obtaining the starting offset of each cell in the cell-side particle number list. The third step starts another thread of the same size, with each thread using atomic addition to sequentially write to the cell-side particle number list from its respective offset starting point, completing the establishment of the attribution index table.
[0102] In step (2) above, the affiliation relationship between particles and continuous domain finite elements is determined by body-centered mapping: when the particle's mass center is located inside a certain continuous domain finite element, the particle is assigned to that continuous domain finite element, and each particle is assigned to only one continuous domain finite element.
[0103] The specific implementation process of step (2) above is as follows:
[0104] The CPU triggers the GPU to execute the finite element-particle bidirectional affiliation index table establishment process. This is processed in parallel, with one GPU thread corresponding to one particle. The unique finite element number e of the contiguous domain to which the p-th particle belongs is determined based on its centroid position. p And number the continuous domain finite element e pWrite the finite element number array P2E to which the particle belongs, that is:
[0105] ;
[0106] Initialize each element in the finite cell particle count array C to 0. Each GPU thread performs an atomic increment operation on C[e] based on the finite cell of the corresponding continuous domain to obtain the number of particles contained in each finite cell, where:
[0107] ;
[0108] In the formula, N p The total number of particles; when the p-th particle belongs to the e-th continuous finite element. ,otherwise .
[0109] Perform a parallel prefix scan on the finite element particle count array C to obtain the finite element particle offset array O, where:
[0110] O[0] = 0;
[0111] O[e+1]=O[e]+C[e], e=0, 1,…,N e -1.
[0112] In the above formula, N e O[e] represents the total number of finite elements in the continuous domain, and O[e] represents the starting position of the particle number corresponding to the e-th finite element in the finite element particle number array E2P.
[0113] Based on the finite element particle offset array O, a corresponding contiguous storage region is partitioned for each contiguous domain finite element in the finite element particle number array E2P. A temporary write position count array W is set, and each element in W is initialized to 0. Processing is again performed in parallel with one GPU thread per particle; for the p-th particle, the GPU thread processing that particle is determined according to its corresponding contiguous domain finite element number e. p , for W[e p Perform an atomic increment operation, and then convert the W[e] before the atomic increment operation to 1. p The value w is used as the permutation number of the p-th particle within its corresponding finite element in the continuous domain. p The writing position q of the p-th particle number in the finite element particle number array E2P is calculated according to the following formula. p :
[0114] ;
[0115] ;
[0116] ;
[0117] In the above formula, AtomicFetchAdd(W[e p ],1) indicates reading W[e atomically. p The value before the increment operation is performed is returned as w. p and in the same atomic operation, W[e p Updated to W[e p +1. After completing the parallel writing of all particle numbers, the particle numbers contained in the e-th continuous domain finite cell are stored in a contiguous storage range defined by E2P[O[e]] to E2P[O[e+1]-1]. The finite cell number array P2E is used to establish the affiliation relationship between particles and continuous domain finite cells. The finite cell particle offset array O and the finite cell particle number array E2P are used together to establish the affiliation relationship between continuous domain finite cells and particles. The three together constitute a finite cell-particle bidirectional affiliation index table.
[0118] In addition, such as Figure 3 As shown, the conversion factor calculation kernel function starts threads of the same size as the number of particles, with each thread processing one particle. In the volume stress conversion criterion, the thread reads the resultant force on the particle from the particle contact force array and calculates the volume stress according to the contact force tensor formula. Press again The particle conversion factor is obtained and written back to the corresponding field in the particle array. Subsequently, threads of equal size are used to find the corresponding unit using the particle-level attribution index. Using atomic addition operations to Accumulated to the unit molecule register, Accumulated to the unit denominator register; after all particles are completed, the calculation is performed in parallel using a unit-by-unit thread. The division operation will Write back to the cell array.
[0119] The specific implementation process of step (3) above is as follows:
[0120] The CPU triggers the GPU to execute the particle conversion factor calculation and finite element conversion factor aggregation process. The CPU pre-configures the start and end conversion thresholds; the GPU calculates the particle conversion factor for each particle based on a pre-selected volume stress conversion criterion or bulk modulus conversion criterion. When using the volume stress conversion criterion, processing is done in parallel with one GPU thread per particle. For the i-th particle, the contact forces acting on it are read, and the volume stress of the particle is calculated according to the following formula:
[0121] ;
[0122] In the above formula, V represents the volume stress of the i-th particle at the n-th computation time step. i Let be the volume of the i-th particle; It is the set of all contact points that come into contact with the i-th particle; Let c be the contact force acting on the i-th particle at the contact point; Let c be the branch vector pointing from the contact point c to the centroid of the i-th particle.
[0123] Calculate the particle transformation factor based on the volume stress of the i-th particle:
[0124]
[0125] In the above formula, The body stress threshold at which the transformation begins. The body stress threshold required to complete the transformation, and .
[0126] When using the bulk modulus conversion criterion, the continuous domain finite element to which each particle belongs is considered as the local computational region where the corresponding particle resides. For the j-th continuous domain finite element, the set of particles S contained in that finite element is determined according to the finite element-particle bidirectional attribution index table. j The solid volume fraction of the finite element at the nth computation time step is calculated according to the following formula:
[0127] ;
[0128] In the above formula, Let be the solid volume fraction of the j-th continuous domain finite element at the n-th computation time step. Let be the current volume of the continuous domain finite element at the nth computation time step. The local pressure of the j-th continuous domain finite element is calculated according to the following formula:
[0129] ;
[0130] The compressive volumetric strain of the j-th continuous domain finite element is calculated according to the following formula:
[0131] ;
[0132] In the above formula, Let be the solid volume fraction of the j-th continuous domain finite element in the initial state of the numerical solution. Based on the local pressure increment and compressive volumetric strain increment between two adjacent computation time steps, the equivalent bulk modulus of the j-th continuous domain finite element is calculated according to the following formula:
[0133] ;
[0134] When the compressive volumetric strain increments of two adjacent computation time steps are 0, the equivalent bulk modulus of the j-th continuous domain finite element in the previous computation time step remains unchanged. The equivalent bulk modulus of the i-th particle is taken as the equivalent bulk modulus of its corresponding continuous domain finite element.
[0135] ;
[0136] In the above formula, The finite element number of the i-th particle in the finite element number array P2E is recorded as the continuous domain finite element number of the i-th particle. The particle transformation factor is calculated based on the equivalent bulk modulus of the i-th particle.
[0137]
[0138] In the above formula, Let be the equivalent bulk modulus of the finite element in the continuous domain to which the i-th particle belongs at the n-th computation time step. The equivalent bulk modulus threshold at which the transformation begins. The equivalent bulk modulus threshold for completing the transformation.
[0139] The particle conversion factor is only used to represent the degree of conversion achieved by the current local mechanical state of the corresponding particle, and does not directly trigger particle-level conversion. The GPU aggregates the particle conversion factors into the corresponding continuous domain finite element according to the particle volume. Specifically, the elements in the finite element conversion factor molecule array A and the finite element particle volume accumulation array B are initialized to 0; the GPU thread processing the i-th particle determines the continuous domain finite element number e to which the particle belongs based on the finite element number array P2E to which the particle belongs. i And use atomic addition operations to respectively Accumulate to A[e i ]、 V i Accumulate to B[e i After all particles have been accumulated in parallel, the unit transformation factor of the j-th continuous domain finite element is calculated using the following formula, with one GPU thread corresponding to one continuous domain finite element:
[0140] ;
[0141] In the above formula, Let be the element transformation factor of the j-th continuous domain finite element at the n-th computation time step, and its value range is [0, 1].
[0142] The above-mentioned unit conversion factor serves as the basis for judging the overall conversion of the continuous domain finite element in step (5); the overall conversion of the corresponding continuous domain finite element is triggered only when the unit conversion factor reaches 1 for the first time, and the conversion is not triggered at the granular level.
[0143] In step (4) above, particle-unit contact occurs between particles that are still in a discrete state and the surface of the transformed finite element. The contact force is applied to the finite element node and the reaction force is applied to the particle, ensuring the conservation of momentum and mechanical balance on both sides of the transformation front. In the current time step of step (4) above, the contact forces between particle-particle, particle-unit and unit-unit contact pairs are calculated in parallel on the GPU in a thread-by-thread manner and accumulated to the particle resultant force array or the finite element node force array by atomic addition operations.
[0144] In step (5) above, the constitutive parameter initialization of the continuum is completed within the kernel function of finite element mode switching and constitutive parameter initialization. The initialization content includes: using the volume weighted average density of each particle in the finite element of the continuum domain at the switching time as the initial relative density of the finite element of the continuum domain; using the average stress of each particle contact force in the volume of the finite element of the continuum domain at the switching time as the initial stress tensor to ensure the continuity of the mechanical state at the transition time; and setting the equivalent plastic strain and other internal state variables to zero.
[0145] The aforementioned continuum constitutive parameters are the parameters and internal state variables required for stress updating of the continuum constitutive model; the continuum constitutive model can be an elastoplastic constitutive model, a Shima-Oyane powder plastic model, or a Drucker-Prager-Cap model, and is selected by writing the corresponding constitutive model type identifier into the constitutive model type identifier field of the continuum domain finite element array.
[0146] In step (5) above, the finite element mesh composed of the continuous domain finite elements operates in a Lagrangian follower mode, and its behavior is divided into two modes according to the transformation stage of the continuous domain finite element:
[0147] When the element transformation factor of the j-th continuous domain finite element At that time, the continuous domain finite element is in the unconverted stage and only serves as a geometric container. In each computation time step, the coordinates of each node are updated with the volume-weighted average velocity of each particle in the continuous domain finite element, completing pure kinematic following. Stiffness matrix assembly and linear equation solving are not performed. The computational cost is proportional to the number of particles rather than related to the mesh size.
[0148] When the element transformation factor of the j-th continuous domain finite element At this point, the continuous domain finite element enters the transformed stage and switches to perform a complete finite element method mechanical calculation, with the nodal coordinates driven by the finite element nodal integration.
[0149] The CPU and GPU heterogeneous task partitioning of the present invention runs through steps (1) to (6). The CPU is responsible for time step loop control, conversion parameter configuration, reading the global maximum relative cumulative displacement obtained by GPU reduction, determining whether to trigger the reconstruction of the attribution index table, and outputting the results. The GPU is responsible for establishing the attribution index table, calculating particle stress, calculating particle conversion factor, calculating the element conversion factor of each continuous domain finite element according to step (3), calculating the three types of contact force, switching the finite element mode and initializing the constitutive parameter, time integration of the discrete element method, stress update and node integration of the finite element method, updating the relative cumulative displacement in parallel for each particle, and obtaining the global maximum relative cumulative displacement through parallel reduction.
[0150] Each GPU kernel function is organized sequentially through CUDA streams: the process of establishing the ownership index table is completed before the particle conversion factor calculation stream is started, the unit conversion factor calculation stream is completed before the contact force calculation stream is started, and the discrete element method time integration stream and the finite element method stress update stream are scheduled in parallel after the contact force calculation stream is completed.
[0151] In step (6) above, the CPU compares the global maximum relative cumulative displacement obtained by the GPU reduction with the pre-set displacement threshold of the reconstruction of the home index table stored in the CPU-side parameter variables; when the global maximum relative cumulative displacement exceeds the displacement threshold of the reconstruction of the home index table, the reconstruction of the home index table is triggered, and the relative cumulative displacement field in the discrete domain particle array is cleared to zero; the corresponding index entry of the particle belonging to the transformed continuous domain finite element in the home index table is marked as invalid and skipped in subsequent particle calculations.
[0152] This invention solves the computational bottleneck in large-scale discrete-continuous transformation simulation by explicitly establishing a finite unit-particle bidirectional attribution index table in GPU memory, which enables the calculation of particle conversion factors, aggregation of unit conversion factors, and transmission of coupling force to be completed in parallel on the GPU, eliminating the need for CPU-GPU round-trip transmission.
[0153] Example 1:
[0154] This embodiment simulates a three-dimensional powder compaction process using the volumetric stress transformation criterion and the Drucker-Prager-Cap (DPC) model as the finite element constitutive model. A cylindrical compaction model with a diameter of 20 mm and a height of 60 mm was established, and 21,720 DEM spherical particles (0.5 mm radius) and 8,640 tetrahedral finite elements were simultaneously arranged in the same spatial region. The particle density was 1800 kg / m³. 3 The elastic modulus is 1 GPa, Poisson's ratio is 0.25, and the internal friction angle is 35°. The Hertz contact model is used for the DEM contact model. The conversion of body stress begins. Termination of transformation stress ; Trigger coefficient for rebuilding the index table The pressure head applies a quasi-static velocity load downwards at a rate of 1 mm / min.
[0155] At the start of the computation, the GPU initializes the particle array and the finite element array, and establishes a bidirectional attribution index table using a three-step kernel pipeline. The particle domain and the finite element domain completely overlap in the same cylindrical region, and the background tetrahedral mesh follows the particle movement in a Lagrangian manner. As the pressing progresses, the stress on each particle gradually increases. The particle stress in the locally high-stress regions is the first to exceed [a certain threshold]. The conversion factor of the corresponding particles Start increasing from 0; as the pressure head stroke increases, when the body stress exceeds... After that, the corresponding particles Reaching 1, the unit to which it belongs It also tends towards 1 and triggers mode switching: within the same kernel function, the GPU sets the mode flag of the cell to "transformed" and initializes the DPC constitutive parameters using the particle volume-weighted average density and the average stress of the contact force at the switching moment, ensuring the continuity of the mechanical state at the transformation moment. As the indenter continues to descend, the transformed region expands continuously, and the computational weight of FEM stress update increases adaptively accordingly; the DEM time integration stream and the FEM stress update stream are scheduled in parallel through CUDA streams, keeping the overall GPU utilization stable. The GPU tracks the relative cumulative displacement in parallel per-particle thread, and the CPU only triggers the process when the relative cumulative displacement exceeds the trigger threshold. The on-demand reconstruction of the attribution index table, using relative displacement rather than absolute displacement as the trigger, effectively filters out invalid accumulation caused by the overall translation of particles along with the background mesh. The number of on-demand reconstructions of the attribution index table is significantly less than that of the step-by-step full reconstruction scheme. (Particle conversion factors...) With unit conversion factor The typical evolution process of the pressure head stroke is as follows: Figure 4 As shown.
[0156] Example 2:
[0157] This embodiment simulates three-powder pressing, employing the bulk modulus conversion criterion. The Shima-Oyane powder plasticity model is used as the finite element constitutive model, and body-centered cubic mapping is employed for spatial mapping. A cubic pressing model with sides of 20mm × 20mm and a height of 25mm is established, simultaneously arranging 18,500 DEM spherical particles (0.4mm radius) and 7,200 tetrahedral finite elements within the same spatial region. The particle density is 7800 kg / m³. 3 The elastic modulus is 200 GPa, Poisson's ratio is 0.28, the interparticle friction coefficient is 0.3, the Hertz contact model is used for DEM contact model, and the initial packing relative density is 0.62. The conversion of equivalent bulk modulus begins. Termination of conversion equivalent bulk modulus ; Trigger coefficient for rebuilding the index table The upper pressure head applies a quasi-static velocity load downwards at a rate of 1 mm / min.
[0158] At the start of the computation, the GPU establishes a bidirectional attribution index table using a three-step kernel function pipeline. As the compression progresses, the GPU computes the equivalent bulk modulus of the region where each particle resides in parallel using per-particle threads. , and according to Calculate the particle conversion factor. As particles are gradually compacted, the number of local particle contacts increases, and the equivalent bulk modulus... The pressure rises accordingly; high-pressure compaction zone First to surpass Transformation factor Starts from 0 and increases. Unit conversion factor Aggregated by granular-end attribution index using GPU atomic addition, when Upon reaching step 1, the GPU triggers a mode switch. The initial relative density is set using the particle volume-weighted average relative density at the time of switch, and the initial stress tensor is set using the average stress of particle contact forces. This initializes the Shima-Oyane constitutive parameters, ensuring the continuity of porosity and stress state at the conversion point. As the indenter continues to descend, the converted region expands. During the unconverted phase, the background mesh continuously follows the particle movement in a Lagrangian manner, maintaining complete coverage of the particle domain and preventing the generation of empty elements. The attribution index table is reconstructed as needed, triggered by relative cumulative displacement. During reconstruction, the centroid of each particle is reassigned to a new finite element, and the attribution relationships are correctly updated. The overall calculation process is consistent with Example 1.
[0159] This invention establishes a bidirectional attribution index table in the GPU memory, enabling the calculation of conversion factors, contact force, and mode switching to be completed in parallel on the GPU, eliminating the need for CPU-GPU round-trip transmission. Unconverted units follow the particle movement using a Lagrange follower mechanism, with computational overhead adaptively increasing with the converted region. This invention is applicable to large-scale GPU parallel numerical simulation of the pressing and forming process of powder materials such as metal powder and ceramic powder.
[0160] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A highly efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU, characterized in that, Includes the following steps: (1) In the numerical solution initialization stage, a discrete domain particle array and a continuous domain finite element array are established in the GPU memory respectively. The particle domain corresponding to the discrete domain particle array and the finite element domain corresponding to the continuous domain finite element array are set to have the same spatial range and boundary, and a finite element-particle bidirectional attribution index table is established. (2) The finite cell to which each particle belongs is determined by body-centered mapping in parallel with a per-particle thread, and the finite cell number is directly written into the particle end cell number array. At the same time, each finite cell in each continuous domain finite cell array is counted in parallel with atomic accumulation operation. The finite cell particle number array obtained after the atomic accumulation operation is counted in parallel is subjected to parallel prefix scan to obtain the cell end offset array. The cell end particle number list is filled in parallel with a per-particle thread again to complete the establishment of the belonging index. (3) The CPU triggers the GPU to execute the particle conversion factor calculation and finite element conversion factor aggregation process, specifically: the CPU pre-configures the start conversion threshold and the completion conversion threshold; the GPU calculates the particle conversion factor of each particle according to the pre-selected volume stress conversion criterion or bulk modulus conversion criterion; and the particle conversion factor is only used to represent the degree of conversion achieved by the current local mechanical state of the corresponding particle, and does not directly trigger particle-level conversion; the GPU aggregates each particle conversion factor into the corresponding continuous domain finite element according to the particle volume; (4) The CPU triggers the GPU to execute the contact force calculation process, specifically: the GPU calculates the contact force between three types of contact pairs in the current calculation time step, namely particle-particle, particle-finite element, and finite element-finite element, according to the pre-selected contact model, with one thread corresponding to one contact pair; for particle-particle contact pairs, the contact forces of equal magnitude and opposite direction are accumulated to the resultant force of the corresponding particle by atomic addition operation; for particle-finite element contact pairs, the contact force is allocated to the corresponding finite element node, and the reaction force is accumulated to the resultant force of the corresponding particle; for finite element-finite element contact pairs, the contact force and its reaction force are allocated to the corresponding finite element nodes of both contacting parties; after completing the parallel calculation of all contact pairs, the particle contact resultant force array and the finite element node contact resultant force array are obtained, which are used as the external force input for particle time integration and finite element node integration in the following step (5); (5) For particles that are still in a discrete state, perform time integration on the contact resultant force written into the particle resultant force array in step (4); for continuous domain finite elements that have not yet been transformed, update the coordinates of each node in a Lagrange kinematic manner: take the volume weighted average velocity of each particle in the continuous domain finite element to advance the node position, only perform kinematic follow-up update, do not perform stiffness matrix assembly or equation solving, so that the finite element mesh composed of the continuous domain finite elements always covers the particle domain during the process of the particle being compressed and moved downward, and no empty elements are generated. Transformation factor for finite elements For the first continuous domain finite element that reaches 1, its mode flag is switched to the converted state, and the constitutive parameters of the continuum are initialized in the kernel function of finite element mode switching and constitutive parameter initialization. The initial relative density is the volume weighted average density of each particle in the continuous domain finite element at the switching time, and the initial stress tensor is the average stress of each particle contact force in the volume of the continuous domain finite element at the switching time. The equivalent plastic strain and other internal state variables are set to zero, and the pre-selected constitutive model type identifier is written into the corresponding field of the continuous domain finite element array. For the continuous domain finite element that has been switched to FEM mode, FEM stress update and node integration are performed. The node force is determined by the internal force generated by the FEM internal stress and the contact resultant force written into the finite element node resultant force array in step (4). The node coordinates are driven by FEM node integration to complete the current time step advancement. (6) After completing steps (3) to (5) in each computation time step, the GPU updates the relative cumulative displacement of each particle still in a discrete state relative to the reference frame of its continuous domain finite element in parallel. That is, the difference between the displacement increment of the particle in the current computation time step and the follow-up displacement increment of the finite element of its continuous domain is added to the relative cumulative displacement of the particle. Then, the GPU parallel reduction algorithm is used to first obtain the maximum relative cumulative displacement in each thread block, and then the maximum value of each thread block is reduced to obtain the global maximum relative cumulative displacement. The CPU reads the global maximum relative cumulative displacement and compares it with the pre-set value stored in the CPU. The displacement threshold of the belonging index table in the U-end parameter variable is compared. If the displacement threshold of the belonging index table is exceeded, step (2) is triggered at the beginning of the next calculation time step to rebuild the finite element-particle bidirectional belonging index table and clear the relative cumulative displacement field in the discrete domain particle array to zero. Otherwise, step (2) is skipped and step (3) is directly entered. The relative cumulative displacement, rather than the absolute displacement of the particle, is used as the reconstruction trigger quantity to filter out the displacement accumulation caused by the synchronous translation of the particle with the finite element of the continuous domain, so as to avoid frequent unnecessary reconstruction of the belonging index table when the finite element mesh composed of the continuous domain finite element moves as a whole.
2. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that: The discrete-domain particle array in step (1) is indexed by particle number and stored continuously in GPU memory in the format of SoA structure array, containing fields such as particle centroid coordinates, velocity, resultant force, sphere radius, mode flag, particle conversion factor and cumulative displacement modulus. The continuous domain finite element array in step (1) is indexed by element number and stored continuously in SoA format. It includes the coordinates of each node, stress, strain, element transformation factor, constitutive model type identifier, and fields of constitutive state variables.
3. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that, The finite element-particle bidirectional attribution index table in step (1) consists of three arrays: the finite element number array P2E to which the particle belongs, the finite element particle offset array O, and the finite element particle number array E2P. The finite element particle offset array O and the finite element particle number array E2P form an element-particle orientation index in CSR format. The particle numbers contained in element j are stored continuously in the element end particle number list, and their start and end positions are determined by the j-th and j+1-th items in the element end offset array. The finite element number array P2E of the particle directly stores the number of the element to which the particle belongs, with the particle number as the index. The number of the element to which particle i belongs is directly given by the i-th item of the particle end element number array. All three arrays reside in GPU memory, and the ownership lookup in both directions is an O(1) random access, without needing to access CPU memory.
4. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that, In step (2), the CPU triggers the GPU to execute the finite cell-particle bidirectional affiliation index table establishment process, the specific process of which is as follows: In parallel processing mode of one GPU thread corresponding to one particle, the unique continuous domain finite element number e of the pth particle is determined according to the position of the center of mass of the pth particle p , and the continuous domain finite element number e p is written into the finite element number array P2E to which the particle belongs, that is: ; Initialize each element in the finite element particle counting array C to 0; Each GPU thread performs an atomic increment operation on C[e] based on the finite cell of the contiguous domain to which the corresponding particle belongs, to obtain the number of particles contained in each finite cell of the contiguous domain, where: ; In the above formula, N p The total number of particles; when the p-th particle belongs to the e-th continuous finite element. ,otherwise ; Perform a parallel prefix scan on the finite element particle count array C to obtain the finite element particle offset array O, where: O[0]=0; O[e+1] = O[e]+C[e], e = 0, 1, ..., N e -1; In the above formula, N e O[e] represents the total number of finite elements in the continuous domain, and O[e] represents the starting position of the particle number corresponding to the e-th finite element in the finite element particle number array E2P. Based on the finite element particle offset array O, the corresponding contiguous storage area is divided for each contiguous domain finite element in the finite element particle number array E2P; a temporary write position count array W is set, and each element in W is initialized to 0; parallel processing is again performed with one GPU thread corresponding to one particle; for the p-th particle, the GPU thread processing the particle is determined according to the finite element number e of its contiguous domain. p , for W[e p Perform an atomic increment operation, and then convert the W[e] before the atomic increment operation to 1. p The value w is used as the permutation number of the p-th particle within its corresponding finite element in the continuous domain. p The writing position q of the p-th particle number in the finite element particle number array E2P is calculated according to the following formula. p : ; ; ; In the above formula, AtomicFetchAdd(W[e p ],1) indicates reading W[e atomically. p The value before the increment operation is performed is returned as w. p and in the same atomic operation, W[e p Updated to W[e p +1; After completing the parallel writing of all particle numbers, the particle numbers contained in the e-th continuous domain finite cell are stored in the continuous storage range defined by E2P[O[e]] to E2P[O[e+1]-1]; The finite cell number array P2E to which the particle belongs is used to establish the belonging relationship between the particle and the continuous domain finite cell. The finite cell particle offset array O and the finite cell particle number array E2P are used together to establish the belonging relationship between the continuous domain finite cell and the particle. The three together constitute the finite cell-particle bidirectional belonging index table.
5. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that: In step (2), the affiliation between particles and continuous domain finite elements is determined by body-centered mapping: when the particle's centroid is located inside a certain continuous domain finite element, the particle is assigned to that continuous domain finite element, and each particle is assigned to only one continuous domain finite element.
6. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that, In step (3), the CPU triggers the GPU to perform particle conversion factor calculation. The specific process is as follows: The CPU pre-configures the start and end conversion thresholds; the GPU calculates the particle conversion factor for each particle based on the pre-selected volumetric stress conversion criterion or bulk modulus conversion criterion. When using the volume stress conversion criterion, processing is performed in parallel with one GPU thread corresponding to one particle. For the i-th particle, the contact forces acting on that particle are read, and the volume stress of that particle is calculated according to the following formula: ; In the above formula, V represents the volume stress of the i-th particle at the n-th computation time step. i Let be the volume of the i-th particle; This is the set of all contact points that come into contact with the i-th particle; Let c be the contact force acting on the i-th particle at the contact point; Let c be the branch vector pointing from the contact point c to the centroid of the i-th particle; Calculate the particle transformation factor based on the volume stress of the i-th particle: ; In the above formula, The body stress threshold at which the transformation begins. The body stress threshold required to complete the transformation, and ; When using the bulk modulus conversion criterion, the continuous domain finite element to which each particle belongs is taken as the local computational region where the corresponding particle is located; for the j-th continuous domain finite element, the set of particles S contained in the finite element is determined according to the finite element-particle bidirectional attribution index table. j The solid volume fraction of the finite element at the nth computation time step is calculated according to the following formula: ; In the above formula, Let be the solid volume fraction of the j-th continuous domain finite element at the n-th computation time step. Let be the current volume of the continuous domain finite element at the nth computation time step. The local pressure of the j-th continuous domain finite element is calculated according to the following formula: ; The compressive volumetric strain of the j-th continuous domain finite element is calculated according to the following formula: ; In the above formula, Let the solid volume fraction be the initial state of the j-th continuous domain finite element in the numerical solution; based on the local pressure increment and compressive volumetric strain increment of two adjacent calculation time steps, calculate the equivalent bulk modulus of the j-th continuous domain finite element according to the following formula: ; When the compressive volumetric strain increments of two adjacent computation time steps are 0, the equivalent bulk modulus of the j-th continuous domain finite element in the previous computation time step remains unchanged; the equivalent bulk modulus of the i-th particle is taken as the equivalent bulk modulus of its corresponding continuous domain finite element. ; In the above formula, The continuous domain finite element number of the i-th particle is recorded in the finite element number array P2E; the particle transformation factor is calculated based on the equivalent bulk modulus of the i-th particle. ; In the above formula, The equivalent bulk modulus threshold at which the transformation begins. The equivalent bulk modulus threshold for completing the transformation.
7. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 6, characterized in that, The specific process by which the GPU aggregates each particle conversion factor into the corresponding continuous domain finite element according to the particle volume in step (3) is as follows: Initialize all elements in the finite element transformation factor numerator array A and the finite element particle accumulation array B to 0; the GPU thread processing the i-th particle determines the continuous domain finite element number e to which the particle belongs based on the finite element number array P2E to which the particle belongs. i And use atomic addition operations to respectively Accumulate to A[e i ]、 V i Accumulate to B[e i After all particles have been accumulated in parallel, the unit transformation factor of the j-th continuous domain finite element is calculated using the following formula, with one GPU thread corresponding to one continuous domain finite element: ; In the above formula, The unit transformation factor of the j-th continuous domain finite element at the n-th computation time step has a value range of [0, 1]. The unit transformation factor serves as the basis for judging the overall transformation of the continuous domain finite element in step (5). The overall transformation of the corresponding continuous domain finite element is triggered only when the unit transformation factor reaches 1 for the first time, and the transformation is not triggered at the granular level.
8. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that: In step (4), the particle-element contact occurs between the particle, which is still in a discrete state, and the surface of the transformed finite element. The contact force is applied to the finite element node and the reaction force is applied to the particle, ensuring the conservation of momentum and mechanical balance on both sides of the transformation front. In step (4), the contact forces between the three types of contact pairs—particle-particle, particle-unit, and unit-unit—are calculated in parallel on the GPU in a thread-by-thread manner and accumulated to the particle resultant force array or the finite element node force array by atomic addition operations.
9. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that: In step (5), the constitutive parameter initialization of the continuum is completed within the kernel function of finite element mode switching and constitutive parameter initialization. The initialization content includes: using the volume weighted average density of each particle in the finite element of the continuous domain at the switching time as the initial relative density of the finite element of the continuous domain; using the average stress of the contact force of each particle in the volume of the finite element of the continuous domain at the switching time as the initial stress tensor to ensure the continuity of the mechanical state at the transition time; and setting the equivalent plastic strain and other internal state variables to zero. The continuum constitutive parameters are the parameters and internal state variables required for stress updating of the continuum constitutive model; the continuum constitutive model can be an elastoplastic constitutive model, a Shima-Oyane powder plastic model, or a Drucker-Prager-Cap model, and is selected by writing the corresponding constitutive model type identifier into the constitutive model type identifier field of the continuum domain finite element array.
10. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that, In step (5), the finite element mesh composed of the continuous domain finite elements operates in a Lagrangian follower mode, and its behavior is divided into two modes according to the transformation stage of the continuous domain finite element: When the element transformation factor of the j-th continuous domain finite element At that time, the continuous domain finite element is in the unconverted stage and only serves as a geometric container. In each computation time step, the coordinates of each node are updated with the volume-weighted average velocity of each particle in the continuous domain finite element, completing pure kinematic following. Stiffness matrix assembly and linear equation solving are not performed. The computational cost is proportional to the number of particles rather than related to the mesh size. When the element transformation factor of the j-th continuous domain finite element At this point, the continuous domain finite element enters the transformed stage and switches to perform a complete finite element method mechanical calculation, with the nodal coordinates driven by the finite element nodal integration.
11. The efficient discrete-to-continuous conversion method based on heterogeneous parallelism of CPU and GPU according to claim 1, characterized in that: The CPU and GPU heterogeneous task division runs through steps (1) to (6). The CPU is responsible for time step loop control, conversion parameter configuration, reading the global maximum relative cumulative displacement obtained by GPU reduction, determining whether to trigger the reconstruction of the attribution index table, and outputting the results. The GPU is responsible for establishing the attribution index table, calculating particle stress, calculating particle conversion factor, calculating the element conversion factor of each continuous domain finite element according to step (3), calculating the three types of contact force, switching the finite element mode and initializing the constitutive parameters, time integration of the discrete element method, stress update and node integration of the finite element method, updating the relative cumulative displacement in parallel for each particle, and obtaining the global maximum relative cumulative displacement through parallel reduction. The process of establishing the attribution index table is completed before the particle conversion factor calculation flow is started, the unit conversion factor calculation flow is completed before the contact force calculation flow is started, and the discrete element method time integration flow and the finite element method stress update flow are scheduled in parallel after the contact force calculation flow is completed. In step (6), the CPU compares the global maximum relative cumulative displacement obtained by the GPU reduction with the pre-set displacement threshold of the reconstruction of the home index table stored in the CPU-side parameter variables; when the global maximum relative cumulative displacement exceeds the displacement threshold of the reconstruction of the home index table, the reconstruction of the home index table is triggered, and the relative cumulative displacement field in the discrete domain particle array is cleared to zero; the corresponding index entry of the particle belonging to the transformed continuous domain finite element is marked as invalid in the home index table and is skipped in subsequent particle calculations.
