Space charge effect potential calculation method, device, equipment and storage medium

By employing a GPU parallel architecture in the PICNIC algorithm and dividing the potential and charge grids into subsets for parallel computation, the problem of high computational complexity in large-scale 3D mesh simulation of the PICNIC algorithm is solved, achieving efficient potential calculation and making it suitable for large-scale accelerator beam dynamics simulation.

CN121683671BActive Publication Date: 2026-04-28INST OF MODERN PHYSICS CHINESE ACADEMY OF SCI +1
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
INST OF MODERN PHYSICS CHINESE ACADEMY OF SCI
Filing Date
2026-02-12
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

The PICNIC algorithm has high computational complexity in large-scale three-dimensional mesh space charge effect numerical simulations, which increases computational time costs and limits its application value in the numerical simulation of space charge effect in high-current linear accelerators.

Method used

A GPU parallel architecture is adopted, which divides the potential distribution grid and the charge distribution grid into multiple potential calculation subsets and charge source subsets along the first dimension, respectively, and allocates a GPU thread block to each potential calculation subset. The contribution of charge to potential is calculated using a pre-stored distance coefficient table to achieve parallel computing.

Benefits of technology

It reduces the complexity of potential calculation from O(N) to an efficient mode that can be processed in parallel, improves the calculation speed, and is suitable for large-scale accelerator beam dynamics simulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121683671B_ABST
    Figure CN121683671B_ABST
Patent Text Reader

Abstract

The application provides a space charge effect potential calculation method, device, equipment and storage medium, relates to the technical field of calculation physics, and the space charge effect potential calculation method comprises the steps that a charge distribution grid and a potential distribution grid are provided; the potential distribution grid is divided into a plurality of potential calculation subsets, and each potential calculation subset is assigned a GPU thread block; the charge distribution grid is divided into a plurality of charge source subsets; each GPU thread block traverses all the charge source subsets, and for each traversed charge source subset: based on the charge data of the charge source subset read and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, the potential contribution of the charge source subset to each target potential grid point in the potential calculation subset is calculated; the calculated potential contribution is accumulated into the total potential of the potential calculation subset; and according to the total potential of the potential calculation subset obtained by all the GPU thread blocks, the potential calculation result of the potential distribution grid is obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computational physics, and in particular to a method, apparatus, device, and storage medium for calculating the potential of space charge effect. Background Technology

[0002] In numerical simulations of three-dimensional space charge effects based on the PIC (Particle-in-Cell) algorithm, solving for the potential at grid points is a key step, which is usually achieved using the PICNIC (Particles In Cells Numerical Integration between Cubes) algorithm.

[0003] The PICNIC algorithm, based on Coulomb's law, calculates the potential distribution across the entire simulation region by integrating the potential generated by each grid point charge at all other grid points. However, because the PICNIC algorithm requires global double-layer grid traversal and integration calculations, its time complexity is extremely high. O( ) Where N is the number of grid points in a single dimension. As the simulation scale increases and the grid resolution improves, the computational load grows exponentially, leading to a sharp increase in computation time. This makes the PICNIC algorithm face huge computational and time costs when processing large-scale three-dimensional grids, limiting its practical application value in numerical simulations of the space charge effect in high-current linear accelerators. Summary of the Invention

[0004] In view of this, this application provides a method, apparatus, device and readable storage medium for calculating the potential of the space charge effect, which accelerates the potential integral calculation in the PICNIC algorithm by utilizing the GPU parallel architecture, thereby improving computational efficiency and reducing computation time cost.

[0005] In a first aspect, embodiments of this application provide a method for calculating the potential of a space charge effect, including providing a charge distribution grid and a potential distribution grid with the same three-dimensional grid structure, wherein the charge distribution grid includes multiple charge grid points, and the potential distribution grid includes multiple potential grid points; dividing the potential distribution grid into multiple potential calculation subsets along a first dimension, each potential calculation subset including multiple target potential grid points arranged along the first dimension, and allocating a GPU thread block to each potential calculation subset; dividing the charge distribution grid into multiple charge source subsets along the first dimension, each charge source subset including multiple target potential grid points arranged along the first dimension. Multiple charge grid points arranged in a dimensional pattern; each GPU thread block traverses all the charge source subsets, and for each traversed charge source subset, performs the following operations: based on the charge data of the read charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, calculate the potential contribution of the charge source subset to each of the target potential grid points in the potential calculation subset; accumulate the calculated potential contribution into the total potential of the potential calculation subset; and obtain the potential calculation result of the potential distribution grid according to the total potential of the potential calculation subsets with corresponding relationships calculated by all GPU thread blocks.

[0006] Secondly, embodiments of this application provide a potential calculation device for space charge effect. The device includes: a data providing module for providing a charge distribution grid and a potential distribution grid with the same three-dimensional grid structure, wherein the charge distribution grid includes multiple charge grid points and the potential distribution grid includes multiple potential grid points; a grid partitioning module for partitioning the potential distribution grid along a first dimension into multiple potential calculation subsets, each potential calculation subset including multiple target potential grid points arranged along the first dimension, and allocating a GPU thread block to each potential calculation subset; and a module for partitioning the charge distribution grid along the first dimension into multiple charge source subsets, each charge source subset including multiple target potential grid points arranged along the first dimension. The system comprises multiple charge grid points arranged in the first dimension; a parallel computing module, configured to control each GPU thread block to traverse all the charge source subsets, and for each traversed charge source subset, perform the following operations: based on the charge data of the read charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, calculate the potential contribution of the charge source subset to each of the target potential grid points in the potential calculation subset; accumulate the calculated potential contribution to the total potential of the potential calculation subset; and a result synthesis module, configured to obtain the potential calculation result of the potential distribution grid based on the total potential of the potential calculation subset with corresponding relationships calculated by all GPU thread blocks.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor and a memory, the memory storing a program or instructions that can run on the processor, the program or instructions implementing the steps of the method as described in the first aspect when executed by the processor.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method as described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0010] In a sixth aspect, embodiments of this application provide a computer program product stored in a storage medium, which is executed by at least one processor to implement the method as described in the first aspect.

[0011] The space charge effect potential calculation method provided in this application divides the potential grid and charge grid into multiple potential calculation subsets and multiple charge source subsets along the first dimension, respectively, and allocates a GPU thread block to each potential calculation subset, thus constructing a task-parallel architecture based on GPU thread blocks. Each GPU thread block traverses all charge source subsets, calculates the contribution of charge to the potential using a pre-stored distance coefficient table, and accumulates the results. Finally, the calculation results of all GPU thread blocks are summarized to obtain the global potential. The space charge effect potential calculation method provided in this application reduces the computational complexity of the traditional PICNIC algorithm from... O( ) The process is reduced to an efficient mode that can be processed in parallel, which improves the speed of potential calculation and makes it suitable for large-scale accelerator beam dynamics simulation.

[0012] The above description is only an overview of the technical solution of this application. In order to better understand the technical means of this application and to implement it in accordance with the contents of the specification, and to make the above and other objects, features and advantages of this application more obvious and understandable, the following are specific embodiments of this application. Attached Figure Description

[0013] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:

[0014] Figure 1 This illustration shows one of the flowcharts of a method for calculating the potential of space charge effect according to an embodiment of this application;

[0015] Figure 2 This illustration shows a schematic diagram of potential integration calculation performed on a GPU in a potential calculation method for space charge effect according to an embodiment of this application;

[0016] Figure 3 The diagram illustrates the distance symmetry between charge grid points in a potential calculation method for space charge effect according to an embodiment of this application. (a) represents the first cycle stage, (b) represents the second cycle stage, and (c) represents the third cycle stage.

[0017] Figure 4 This illustration shows a schematic diagram of potential integration calculation using distance symmetry on a GPU in a potential calculation method for space charge effect according to an embodiment of this application.

[0018] Figure 5 This is a second schematic flowchart illustrating a method for calculating the potential of the space charge effect according to an embodiment of this application;

[0019] Figure 6 A structural block diagram of a method for calculating the potential of space charge effect according to an embodiment of this application is shown;

[0020] Figure 7 A structural block diagram of a method for calculating the potential of space charge effect according to an embodiment of this application is shown. Detailed Implementation

[0021] The technical solutions of the embodiments of this application will be clearly described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. All other embodiments obtained by those skilled in the art based on the embodiments of this application are within the scope of protection of this application.

[0022] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0023] The potential calculation method for the space charge effect provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0024] like Figure 1 As shown, this application provides a method for calculating the potential of the space charge effect, which can be executed by an electronic device or computing system equipped with a graphics processing unit (GPU). The method includes:

[0025] Step 101: Provide a charge distribution grid and a potential distribution grid with the same three-dimensional grid structure.

[0026] The charge distribution grid contains multiple charge grid points, and the potential distribution grid contains multiple potential grid points.

[0027] In this embodiment, the electronic device determines the three-dimensional computational region based on the spatial dimensions of the particle bundle to be simulated and the required simulation accuracy. Then, this three-dimensional computational region is discretized into a structured three-dimensional mesh structure, which has [specific characteristics] in three mutually perpendicular directions (X, Y, and Z directions). , , Each grid point. The three-dimensional grid structure is the underlying spatial discrete framework followed by both the charge distribution grid and the potential distribution grid, and the two can be geometrically aligned.

[0028] Specifically, the charge distribution grid can be a grid structure used to store spatial charge density data. In the PIC (Particle-in-Cell) algorithm, the macroscopic charge carried by each particle is assigned to its corresponding grid cell, ultimately forming a discrete charge density value at each charge grid point. Therefore, the charge grid point is the basic storage unit in the charge distribution grid, storing a scalar value representing the charge density at that spatial location. The charge distribution grid serves as the input data source for the entire potential calculation, and its data can be read-only during the calculation process.

[0029] The potential distribution grid can be a grid structure used to store the potential values ​​to be solved. During initialization, the potential value of each potential grid point in the potential distribution grid can be set to zero or a certain initial value. During the calculation, the value of each potential grid point is gradually updated by accumulating the potential contributions generated at all charge grid points. Ultimately, the potential distribution grid stores the calculated global potential field, which is used for subsequent electric field calculations and particle propulsion.

[0030] The charge distribution grid and the potential distribution grid have the same three-dimensional grid structure, meaning that the charge distribution grid and the potential distribution grid have the same number of grid points in the three dimensions mentioned above. , , The grid points are identical, and their spatial positions correspond one-to-one. Thus, when calculating the potential contribution of any charge grid point to any potential grid point, the spatial distance between them can be accurately determined by the difference in their grid structure indices (i.e., index distance), providing a foundation for subsequent rapid table lookup calculations using a pre-calculated distance coefficient table.

[0031] It should be noted that the charge distribution grid serves as the input source for the calculation, while the potential distribution grid serves as the output target. The separation of the two also avoids the generation of overlay or contamination of source data during the iterative accumulation process.

[0032] Step 102: Divide the potential distribution grid into multiple potential calculation subsets along the first dimension. Each potential calculation subset includes multiple target potential grid points arranged along the first dimension, and allocate a GPU thread block to each potential calculation subset.

[0033] The first dimension corresponds to one of the three spatial dimensions (X, Y, Z) of the potential distribution grid. Based on the hardware characteristics of the GPU (Graphics Processing Unit) (such as thread bundle size and shared memory capacity) and computational memory access optimization requirements, the electronic device selects the dimension with a larger number of grid points or better data continuity as the first dimension. In this embodiment, grid partitioning is exemplarily illustrated using the X direction as the first dimension. Charge data can be stored in a row-first manner; partitioning along this dimension ensures efficient and consolidated access to global memory by GPU thread blocks.

[0034] Based on the selected first dimension, the electronic device divides the entire potential distribution grid. Specifically, it divides the grid along the first dimension into multiple consecutive, non-overlapping intervals, each interval constituting a potential calculation subset. This potential calculation subset is the basic unit of the parallel computing task, containing multiple target potential grid points arranged consecutively along the first dimension. These target potential grid points are the grid points from which the parallel task block (GPU thread block) needs to calculate the potential values.

[0035] The electronic device allocates a GPU thread block to each partitioned potential calculation subset. That is, there is a mapping relationship between the potential calculation subset and the GPU thread block: a GPU thread block is an independently schedulable execution unit on the GPU, and threads within a GPU thread block can efficiently collaborate and communicate through shared memory. By mapping a potential calculation subset to a GPU thread block, a parallel model is established where each GPU thread block is responsible for calculating the total potential of all target potential grid points within each potential calculation subset.

[0036] The number of threads contained within a GPU thread block can be matched or proportional to the number of target potential grid points within the potential calculation subset, so that each thread in the GPU thread block can be responsible for the calculation of one or more target potential grid points.

[0037] Thus, by dividing the potential grid along the first dimension, the massive potential calculation problem is decomposed into multiple independent potential calculation subsets, and the calculation tasks of each subset are mapped to a GPU thread block, forming a parallel computing framework. This fully utilizes the parallel capabilities of the GPU to achieve synchronous calculation of multiple potential calculation subsets, which is the basis for the efficient calculation of the potential calculation method provided in this application embodiment.

[0038] Step 103: Divide the charge distribution grid into multiple charge source subsets along the first dimension, each charge source subset including multiple charge grid points arranged along the first dimension.

[0039] To match the parallel computing framework established in the aforementioned process, the charge distribution grid, which serves as the input data source, needs to be partitioned accordingly. Consistent with the partitioning of the potential distribution grid, the electronic device also divides the entire charge distribution grid into multiple continuous, non-overlapping intervals along the first dimension; each interval is called a subset of charge sources.

[0040] The charge source subset comprises multiple charge grid points arranged consecutively along the first dimension, with each grid point storing charge data. This partitioning along the same first dimension ensures the order in which charge data is stored in the GPU's global memory, i.e., row-first storage, fixed Y and Z indices, and contiguous in the X direction. This aligns with the configuration and access mode of GPU thread blocks, enabling efficient merged memory access.

[0041] Step 104: Each GPU thread block traverses all charge source subsets. For each traversed charge source subset, perform the following operations: Based on the charge data of the read charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, calculate the potential contribution of the charge source subset to each target potential grid point in the potential calculation subset; accumulate the calculated potential contribution to the total potential of the potential calculation subset.

[0042] Based on the partitioning of the charge distribution grid and the potential distribution grid, each assigned GPU thread block executes its computational task. This task is manifested as a traversal process: the GPU thread block visits each subset of charge sources in a predetermined order. All GPU thread blocks begin their respective traversal loops simultaneously, but the data they process (the subset of charge sources) and the computational target (the corresponding subset of potential calculations) are different for each.

[0043] For the subset of charge sources currently being accessed, the corresponding GPU thread block performs the following operations:

[0044] The GPU thread block reads the charge data of all charge grid points in the current charge source subset from the GPU global memory into the shared memory inside the GPU thread block.

[0045] The GPU thread determines the index distance between the current subset of charge sources and the subset of potential calculations it is responsible for. Based on this index distance, the GPU thread reads the corresponding set of distance coefficients from the pre-stored global distance coefficient table (Distance CoefficientTable) into shared memory. The distance coefficient set has been pre-calculated and stored to contain the potential coefficients corresponding to any index distance.

[0046] The GPU thread block uses the charge data and distance coefficient set in shared memory to calculate in parallel the potential contribution of all charge grid points in the current charge source subset to each target potential grid point in the potential calculation subset. The calculated potential contributions can be accumulated into the accumulators maintained internally by the GPU thread block, corresponding to each target potential grid point.

[0047] After the GPU thread block completes the above traversal of all charge source subsets, it indicates that the GPU thread block has accumulated the potential contribution of all charge source subsets to all target potential grid points within the potential calculation subset it is responsible for. At this point, the values ​​in each accumulator are the total potential accumulation result of that potential calculation subset. Then, the GPU thread block can write this final result back to the corresponding location of the potential distribution grid in the GPU global memory.

[0048] Thus, the problem of calculating complex potential integrals is decomposed on the GPU into microscopic, parallel potential contribution calculation tasks. A pre-stored distance coefficient table simplifies complex physical calculations into efficient mathematical calculations, and accumulation operations are used to progressively aggregate the potential calculation results. Each GPU thread block acts as an independent integration unit, efficiently solving for the total potential of its corresponding subset of potential calculations.

[0049] Step 105: Based on the total potential of the potential calculation subset with corresponding relationships obtained from all GPU thread blocks, obtain the potential calculation result of the potential distribution grid.

[0050] All GPU thread blocks perform traversal and accumulation calculations in parallel on the GPU. Once all GPU thread blocks have finished executing, meaning each GPU thread block has completed the total potential calculation for all target potential grid points within its corresponding potential calculation subset, the data scattered in the GPU's global memory needs to be integrated.

[0051] Specifically, each GPU thread block calculates the total potential of a corresponding subset of potential calculations. Due to the aforementioned potential distribution grid partitioning steps, all potential calculation subsets are guaranteed to be non-overlapping and cover the entire potential distribution grid as a whole. Therefore, the electronic device can logically reconstruct the complete global potential field by stitching together the total potential data of these dispersed, already calculated potential calculation subsets according to their original spatial relationships.

[0052] In this way, the potential distribution grid stored in the GPU's global memory has been updated with the final potential value for each grid point, forming the global potential field of the entire simulation region, i.e., the potential calculation result of the potential distribution grid.

[0053] Thus, the potential calculation method for the space charge effect provided in this application divides the potential grid and charge grid into multiple potential calculation subsets and multiple charge source subsets along the first dimension, respectively, and allocates a GPU thread block to each potential calculation subset, constructing a task-parallel architecture based on GPU thread blocks. Each GPU thread block traverses all charge source subsets, calculates the contribution of charge to the potential using a pre-stored distance coefficient table, and accumulates the results. Finally, the calculation results of all GPU thread blocks are summarized to obtain the global potential field, that is, the potential calculation result of the potential distribution grid. The potential calculation method for the space charge effect provided in this application reduces the computational complexity of the traditional PICNIC algorithm from... O( ) The process is reduced to an efficient mode that can be processed in parallel, which improves the speed of potential calculation and makes it suitable for large-scale accelerator beam dynamics simulation.

[0054] In some embodiments, as a refinement and extension of the specific implementation of the above embodiments, and to fully illustrate the implementation of this embodiment, step 104 above: calculating the potential contribution of the charge source subset to each target potential grid point in the potential calculation subset based on the charge data of the read charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, may specifically include steps 1041 to 1045, which are executed by the GPU thread block respectively:

[0055] Step 1041: Read the charge data of all charge grid points in the charge source subset being traversed.

[0056] When each GPU thread block accesses a subset of charge sources during its traversal loop, it needs to load the charge values ​​stored in all charge grid points within that subset of charge sources into the GPU's shared memory for subsequent calculations.

[0057] In one specific implementation, the GPU thread block defines a subset of charge sources as having a fixed second-dimensional index. Third-dimensional index And the first dimension index ranges from 0 to All the charge grid points, that is, a "row" of charge source grid points.

[0058] Thread index within GPU thread block Corresponding to the first dimension index of the charge grid point, each thread Responsible for reading charge grid points The charge value. All threads work together to read contiguous addresses.

[0059] In some embodiments, step 1041: after reading the charge data of all charge grid points in the currently traversed charge source subset, the method further includes:

[0060] Step 10411: Store the read charge data in the shared memory of the GPU thread block so that the GPU thread block can access it when performing the multiplication and accumulation operation of the charge data and the distance coefficient set.

[0061] After a GPU thread block reads the charge data of the currently traversed subset of charge sources from global memory, it transfers this data entirely to shared memory within the GPU thread block. Shared memory is a high-speed, low-latency storage unit located on the GPU, with access speeds higher than global memory, and allows all threads within the same GPU thread block to perform fast read / write operations and share data.

[0062] Specifically, after the GPU thread block finishes reading the charge data, this charge data is stored in a one-dimensional array (e.g., ...) in the shared memory of the GPU thread block. Within ) where array subscripts It stores charge grid points The charge.

[0063] In this way, in subsequent calculations, threads within the GPU thread block can access any charge value with extremely low latency, reducing computational latency. Thus, by loading data into the GPU's shared memory all at once, all subsequent calculations are based on the data in the shared memory, transforming high-frequency global memory access into access to high-speed shared memory, significantly improving computational efficiency.

[0064] Step 1042: Determine the index distance between the currently traversed subset of charge sources and the subset of potential calculations.

[0065] The index distance is a three-dimensional vector used to characterize the relative positional relationship between the charge source subset and the potential calculation subset in the three-dimensional mesh structure.

[0066] In one specific embodiment, the potential calculation subset can be indexed by a fixed second dimension. and third-dimensional index To identify the currently traversed subset of charge sources, a fixed second-dimensional index is used. and the third-dimensional index To identify them. The components of the index distance between these two subsets in the second and third dimensions are respectively... and .

[0067] The index distance in the first dimension is related to the location of a specific grid point within the subset. For a subset located within the potential calculation subset, the first dimension index is... The target potential grid point, and a first-dimensional index located within a subset of charge sources. The charge grid points, the index distance between them in the first dimension is . and It is threads Target potential grid points responsible for calculation With the currently visited subset of charge sources The index distance in the second and third dimensions. The index distance determines the set of coefficients that the GPU thread block should read from the distance coefficient table.

[0068] Step 1043: Based on the index distance, retrieve the corresponding distance coefficient set from the pre-stored distance coefficient table.

[0069] Based on the determined index distance of the second and third dimensions ( The GPU thread block needs to retrieve a series of distance coefficients corresponding to the currently traversed subset of charge sources from the pre-stored distance coefficient table.

[0070] Specifically, the index of the first dimension in the GPU thread block read distance coefficient table is... The second dimension index is The third-dimensional index is All values. These values ​​form a set of distance coefficients in the form of a one-dimensional array. This set of distance coefficients is loaded into the shared memory of the GPU thread block, forming a memory array. .

[0071] For example, such as Figure 2 As shown, the index is The GPU thread block, whose corresponding potential calculation subset is Figure 2 The text is marked in orange and has an index of [missing information]. The target potential grid point. When the GPU thread block traverses to the index of the second dimension... Third-dimensional index The subset of charge sources (i.e. Figure 2 The items marked in blue are indexed as follows: When determining the potential calculation subset and the charge source subset (at the charge grid points), the index distance is set as follows: .

[0072] Based on this index distance, the GPU thread block reads the first dimension index from the distance coefficient table. All elements with a second-dimensional index of 1 and a third-dimensional index of 2 (i.e., Figure 2 The coefficient rows marked in green are used as the set of distance coefficients required for this calculation and loaded into a shared memory array. middle.

[0073] Step 1044: Multiply and accumulate the read charge data with the distance coefficient set to obtain the potential contribution of the current charge source subset to each target potential grid point in the potential calculation subset.

[0074] Each thread within a GPU thread block is independently responsible for calculating the contribution of a target potential grid point. For a single thread within a GPU thread block, that thread is responsible for calculating the contribution at index [index missing]. The target potential grid point's potential. This thread executes an accumulation loop, traversing all charge grid points in the current charge source subset (index in the first dimension from 0 to...). In each loop, the thread performs the following operations:

[0075] (1) From shared memory Subscript The position is read to correspond to the charge grid point. Charge data .

[0076] (2) Based on the charge grid points Index of the target potential grid point Determine the index distance as Based on the index distance, the corresponding distance coefficient is retrieved from the distance coefficient set. .

[0077] (3) Calculate charge data With distance coefficient The product of the values ​​is added to the accumulator of the thread, which is used to temporarily store the target potential grid points. The potential contribution.

[0078] The GPU thread block performs multiplication and summation calculations on the charge data and the distance coefficient set, including:

[0079] The potential contribution of the current charge source grid point to each target grid point in the computation subset is calculated using the following formula:

[0080]

[0081] in, The index in the potential calculation subset is... The cumulative potential of the target grid points For the first dimension index, These are the second-dimensional index and the third-dimensional index, respectively. This indicates that the index read from the currently traversed subset of charge sources is... Charge data of charge grid points, first dimension The range of values ​​is [0, 1, 2, 3, 4, 5, 6, 7, 8 , This indicates the number of charge grid points in the first dimension. These are the second and third dimension indices of the currently traversed subset of charge sources, respectively; This represents the distance coefficient obtained from the set of distance coefficients, corresponding to the index distance of... The distance coefficient, which reflects the index as The charge pair index of the charge grid point is The potential contribution of the target potential grid points.

[0082] In other embodiments, to further improve computational efficiency and reduce repeated access to the distance coefficient table, step 104: calculating the potential contribution of the charge source subset to each target potential grid point in the potential calculation subset based on the charge data of the read charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, may further include steps 1045 to 1049, which are executed by the GPU thread block respectively.

[0083] Step 1045: Identify at least one symmetric charge source subset that has the same index distance to the currently traversed charge source subset in the second and third dimensions.

[0084] This step is mainly used to identify other charge source subsets that can share the same set of distance coefficients with the currently traversed charge source subset, i.e., symmetric charge source subsets.

[0085] The identification condition for a symmetric charge source subset is as follows: if there exists another charge source subset whose index distances to the potential calculation subset in the second and third dimensions are equal to the index distances between the currently traversed charge source subset and the same potential calculation subset in the corresponding dimensions, then the charge source subset is identified as a symmetric charge source subset.

[0086] For example, when the potential calculation subset index is The index of the currently traversed subset of charge sources is When, the index is , and The subset of charge sources all satisfy this condition, and therefore can be identified as a subset of symmetric charge sources.

[0087] Step 1046: Synchronously read the charge data of the currently traversed subset of charge sources and all identified subsets of symmetric charge sources.

[0088] When a GPU thread block traverses to a subset of charge sources, it can not only read the data of that subset, but also, based on the principle of distance symmetry, simultaneously read the charge data of other subsets of charge sources that have the same index distance to that subset of potential calculations in the second and / or third dimensions. This process efficiently organizes a single data loading operation. After reading, the charge data is temporarily stored in shared memory, providing a foundation for subsequent batch multiply-accumulate calculations.

[0089] In some embodiments, step 1046: the step of synchronously reading the charge data of the currently traversed subset of charge sources and all identified subsets of symmetrical charge sources, includes steps 10461 to 10463:

[0090] Step 10461: Divide the process of traversing all subsets of charge sources into multiple cyclic stages in the second and third dimensions.

[0091] The GPU thread block iterates through all subsets of charge sources using nested loops. To efficiently utilize symmetry, the GPU thread block iterates the entire process based on a loop variable (i.e., the index of the currently traversed subset of charge sources). With a fixed reference point (i.e., the index of the subset for potential calculation) The relative positions between them can be logically divided into several different stages.

[0092] Specifically, the traversal process is divided into two phases in the second and third dimensions respectively:

[0093] Second Dimension Phase: According to and The comparison is divided into and Two stages.

[0094] Third Dimension Stage: According to and The comparison is divided into and Two stages.

[0095] These two dimensions combine to define the four logical states the traversal process can reach, namely, four loop phases. Each loop phase corresponds to... Compared to A relative position quadrant. Within each loop phase, a fixed set of rules can be applied to determine the presence and quantity of a subset of symmetric charge sources, thereby deciding how to perform synchronous data reading.

[0096] Thus, the traversal process is transformed from a simple sequential execution into a location-based, intelligent, and phased decision-making efficient computational process.

[0097] Step 10462: In different loop stages, based on the relationship between the index of the currently traversed charge source subset and the index of the potential calculation subset, confirm whether there is a symmetrical charge source subset.

[0098] Within each loop segment, the GPU thread block determines whether a subset of symmetrical charge sources exists in the current loop phase and determines its quantity based on a preset symmetry rule. The symmetry rule for this determination is: if the index distance between another subset of charge sources and the potential calculation subset in the second and third dimensions is the same as that of the currently traversed subset of charge sources, then that subset is a subset of symmetrical charge sources.

[0099] For example, combined Figure 3 The specific regions and symmetry are related as follows:

[0100] (1) When and At times, such as Figure 3 In (a) of the diagram, the blue-marked grid points, representing the first cycle stage, indicate the existence of three subsets of symmetrical charge sources, with indices of [insert indices here]. , and .

[0101] (2) When and At times, such as Figure 3 In (b) of the diagram, the blue-marked grid points, representing the second cycle stage, indicate the existence of a subset of symmetric charge sources with the index [index missing]. .

[0102] (3) When and At times, such as Figure 3 In (c), the blue-marked grid points, i.e., during the third cycle stage, indicate the existence of a subset of symmetric charge sources with the index [index missing]. .

[0103] (4) When and At that time, that is, in the fourth cycle stage, there is no subset of symmetric charge sources.

[0104] Step 10463: If it exists, then in the current loop phase, synchronously read the charge data of the currently traversed subset of charge sources and all subsets of symmetric charge sources.

[0105] (1) When and At that time, that is, during the first cycle phase, such as Figure 3 As shown in (a), the GPU thread block synchronous read index is its index as follows: , and The charge data of these four charge source subsets are as follows: three blue-marked symmetrical charge source subsets and one orange-marked charge source subset currently being traversed; the red-marked subsets are the target potential grid points.

[0106] (2) When and At that time, that is, during the second cycle phase, such as Figure 3 As shown in (b), the GPU thread block synchronous read index is The charge data for these two subsets of charge sources, one of which is a symmetric subset of charge sources marked in blue and the other of the charge source subset currently being traversed is marked in orange.

[0107] (3) When and At that time, that is, during the third cycle stage, such as Figure 3 As shown in (c), the GPU thread block synchronous read index is The charge data for these two subsets of charge sources, one of which is a symmetric subset of charge sources marked in blue and the other of the charge source subset currently being traversed is marked in orange.

[0108] (4) When and At that time, that is, in the fourth loop phase, there is no subset of symmetric charge sources, and the GPU thread block only reads the index at which... The charge data for this subset of charge sources can be obtained by reading the charge data of the currently traversed subset of charge sources, which is marked in orange.

[0109] Figure 4 A concrete example of potential integration calculation using distance symmetry on a GPU is given. Figure 4 As shown, assuming the index is The GPU thread block is responsible for calculating a subset of the potential calculations, i.e. Figure 4 The orange-marked index is The potential of the target potential grid point. When the GPU thread block accesses the index during traversal... The subset of charge sources ( Figure 4 The grid points marked in red in the middle At that time, the GPU thread block is identified based on the principle of distance symmetry.

[0110] Calculations show that the index distance between the red-marked charge source subset and the orange-marked potential calculation subset is... Based on this distance, the GPU thread block can identify three additional subsets of symmetric charge sources, namely, index... , and The subset of charge sources ( Figure 4 (Highlighted in blue).

[0111] Step 1047: Determine the index distance between the currently traversed subset of charge sources and the subset of potential calculations.

[0112] GPU thread blocks compute the index of the currently traversed subset of charge sources. Index of the subset of potential calculation The index distance between them, the result is .

[0113] It should be noted that since all identified subsets of symmetric charge sources satisfy the same index distance condition, this index distance is shared by all subsets of charge sources in the current synchronous calculation batch and only needs to be calculated once, which greatly reduces the amount of computation.

[0114] Step 1048: Based on the index distance, retrieve the corresponding set of distance coefficients from the distance coefficient table.

[0115] Based on the determined shared index distance The GPU thread block reads the index from the distance coefficient table. All elements of the array are used. These elements form a one-dimensional array, which is the set of distance coefficients used in this synchronous computation. The set of distance coefficients is loaded into the shared memory of the GPU thread block, forming a memory array. .

[0116] Step 1049: Using the same set of distance coefficients, multiply and accumulate the charge data of all charge source subsets read synchronously to obtain the potential contribution of all charge source subsets to each target potential grid point in the potential calculation subset.

[0117] The GPU thread block uses the same set of distance coefficients acquired for the current loop phase to perform batch calculations with charge data from multiple charge source subsets read synchronously. This allows the contributions of all symmetric charge sources to be processed in a single computation loop. In this way, what would have required multiple independent calculations on multiple subsets is compressed into a single calculation, significantly reducing the computational workload and achieving a substantial reduction in computational complexity.

[0118] In some embodiments, step 1049 may include steps 10491 and 10492:

[0119] Step 10491: Perform position merging processing on the charge data of the currently traversed subset of charge sources and all symmetric charge source subsets read synchronously to obtain merged charge data.

[0120] After the GPU thread block synchronously reads the charge data of multiple charge source subsets into shared memory, this charge data may be stored in different locations in the shared memory or in different temporary arrays depending on the source subset.

[0121] GPU thread blocks perform bit-merging, that is: merging bits from different subsets of charge sources that have the same first-dimensional index. The charge data of the charge grid points are summed by addition.

[0122] For example: if four subsets of charge sources are read simultaneously, then the indices of these four subsets will all be the same. , 、 The charge data are added together to obtain a merged charge data. For all c in the first dimension (from 0 to ...), ... Performing this operation yields a one-dimensional array of merged charge data.

[0123] The above processing can be completed in shared memory, allowing subsequent calculations to access only one set of merged charge data instead of multiple independent sets of data.

[0124] Step 10492: Perform corresponding multiplication and summation calculations on the merged charge data and the distance coefficient set.

[0125] The GPU thread block performs the corresponding multiplication and summation calculations on the merged charge data and the distance coefficient set, which can be obtained from the following formula:

[0126]

[0127] in, The index in the potential calculation subset is... The cumulative potential at the target potential grid points For the first dimension index, These are the second-dimensional index and the third-dimensional index, respectively.

[0128] , , as well as These represent the subset of charge sources traversed from the current point (the second and third indices are...). Its three symmetric charge source subsets, namely the second and third indices, are respectively , , The charge data of the charge grid points read from the database, with the first index dimension being c, where the value of the first dimension c ranges from [0, ...]. ], This indicates the number of charge grid points in the first dimension; This indicates the distance coefficient obtained from the set of distance coefficients, corresponding to the index distance. The distance coefficient reflects the index. The charge pair index of the charge grid point is The potential contribution of the target potential grid point, and this coefficient is the same for all synchronously processed subsets of charge sources.

[0129] For example, combined Figure 5 In the example, the GPU thread block synchronously reads the charge data of the red-marked subset of charge sources and all three identified blue-marked subsets of symmetrical charge sources, performs bit-by-bit addition in shared memory, and saves the merged charge data to a shared memory array. middle.

[0130] Since all the charge source subsets (marked in red and blue) have the same index distance as the potential calculation subset (marked in orange) Therefore, they share the same set of distance coefficients. This GPU thread block ( Only one operation is needed to read the index from the distance coefficient table. The distance coefficients (i.e., the coefficient rows marked in green in the figure) are used as the set of distance coefficients shared in this calculation and loaded into a shared memory array. middle.

[0131] Subsequently, the GPU thread block, according to Formula 2, retrieves data from the shared memory array. neutralization The merged charge data and shared distance coefficients are read separately, and multiplication and accumulation operations are performed. In this single calculation process, the total potential contribution of the four charge source subsets (marked in red and all marked in blue) to each grid point in the orange potential calculation subset is obtained simultaneously.

[0132] Thus, the method provided in this application embodiment utilizes distance symmetry to enable GPU thread blocks to synchronously identify and process multiple subsets of symmetric charge sources in a single loop iteration. By sharing the same set of distance coefficients for batch calculation, it greatly reduces repeated access to the distance coefficient table and the number of loop iterations, thereby improving the overall computational efficiency of potential integration and GPU resource utilization while maintaining high data parallelism.

[0133] In some embodiments, such as Figure 5 As shown, the pre-stored distance coefficient table is established through the following process:

[0134] Step 501: Create a coefficient calculation grid with the same three-dimensional grid structure as the charge distribution grid. The coefficient calculation grid contains multiple coefficient grid points.

[0135] Electronic devices can temporarily create a dimension similar to the charge distribution grid. , , The same coefficient calculation grid. Each grid point in the coefficient calculation grid is called a coefficient grid point, used to calculate and store distance coefficients. For example, the index is... The coefficient grid points will be used to store index distances of . The distance coefficient.

[0136] Step 502: Using the first coefficient grid point in the coefficient calculation grid as the reference grid point, for any second coefficient grid point other than the first coefficient grid point, calculate the distance coefficient between the second coefficient grid point and the first coefficient grid point.

[0137] The electronic device selects the first coefficient grid point in the coefficient calculation grid as the reference grid point. In actual calculations, the index can be selected as... Then, for each other coefficient grid point in the coefficient calculation grid other than the first coefficient grid point, i.e., the second coefficient grid point, the electronic device calculates the distance coefficient of the second coefficient grid point relative to the first coefficient grid point.

[0138] In some embodiments, step 502 may specifically include steps 5021 to 5023:

[0139] Step 5021: Establish a diffuse grid centered on the second coefficient grid point, and divide the diffuse grid into multiple diffuse sub-grids.

[0140] For the current index to be calculated, The second coefficient grid point, centered at its physical location, forms a cubic region called the diffuse grid. The size of the diffuse grid is the same as the size of a single grid cell in the charge distribution grid. Electronic devices further subdivide this diffuse grid in three dimensions. Smaller cubes, each called a diffuse subgrid.

[0141] Step 5022: Launch multiple GPU thread blocks on the GPU, each GPU thread block corresponding to a second coefficient grid point.

[0142] The number of electronically initiated GPU thread blocks is the same as the total number of second coefficient grid points to be computed, i.e., the same as the number of grid points in the coefficient computation grid excluding the first coefficient grid points. Each GPU thread block is accessed through its index. , with an index The second coefficient grid point establishes a correspondence. This GPU thread block will be responsible for calculating the distance coefficients of all diffuse sub-grids within the diffuse grid corresponding to this second coefficient grid point.

[0143] Step 5023: Within each GPU thread block, start multiple threads. Each thread is used to calculate the distance between a diffuse sub-grid and the first coefficient grid point to obtain the distance coefficient of each sub-grid.

[0144] Within each GPU thread block, multiple threads can be launched. The number of threads is the same as the total number of diffuse sub-mesh segments into which the diffuse mesh is divided. One. Index of GPU thread block. This corresponds to the second coefficient grid point in the current calculation. (Indexed by the thread within the GPU thread block.) Each thread establishes a mapping with a diffuse subgrid.

[0145] Specifically, the index is Each thread is responsible for calculating the distance coefficients of the diffuse subgrids located at corresponding positions within the diffuse grid. Within this GPU thread block: each thread calculates the distance coefficients based on its index within the GPU thread block. The thread first reads the second coefficient grid points to determine the diffuse subgrid it is responsible for calculating. coordinates Then, the center coordinates of the diffuse subgrid it is responsible for are calculated using the following formula three. :

[0146]

[0147]

[0148]

[0149] in, The physical dimensions of the charge distribution grid. The index of each thread within the GPU thread block. ) represents the dimension of the diffuse mesh.

[0150] Subsequently, each thread calculates the center of the diffuse submesh. To the first coefficient grid point The physical distance is calculated, and the distance coefficient of the diffuse subgrid is obtained according to Coulomb's law. First, the physical coordinates of the center of the diffuse subgrid are calculated. Then, according to Coulomb's law, the distance from the center of the diffuse subgrid to the first coefficient grid point is calculated. The physical distance is then used to obtain the subgrid distance coefficient of the diffuse subgrid.

[0151] The calculation formula is as follows: Formula 4:

[0152]

[0153] Step 5024: Sum the distance coefficients of all sub-grids and divide the sum by the total volume of the diffuse grid to obtain the distance coefficients of the second coefficient grid points relative to the first coefficient grid points.

[0154] Within the same GPU thread block, the distance coefficients of the diffuse subgrids calculated by all threads are summed through internal cooperation within the GPU thread block (such as using shared memory), and then the summation result is divided by the total volume of the charge distribution grid. The average value is obtained, which is the current second coefficient grid point. The distance coefficient relative to the first coefficient grid point.

[0155] The calculation formula is as follows: Formula 5:

[0156]

[0157] Step 503: Store the distance coefficients of all second coefficient grid points relative to first coefficient grid points in a three-dimensional array according to the index of the second coefficient grid points in the coefficient calculation grid to form a pre-stored distance coefficient table.

[0158] In the GPU parallel construction process, the distance coefficient of each computation is completed. The corresponding GPU thread block writes the data into a three-dimensional array (i.e., the distance coefficient table) at index [index missing]. The location.

[0159] Furthermore, as a specific implementation of the above-mentioned method for calculating the potential of the space charge effect, embodiments of this application provide a device for calculating the potential of the space charge effect. For example... Figure 6 As shown, the potential calculation device 600 for the space charge effect includes: a data providing module 601, a mesh generation module 602, a parallel computing module 603, and a result synthesis module 604.

[0160] Data providing module 601 is used to provide a charge distribution grid and a potential distribution grid with the same three-dimensional grid structure, wherein the charge distribution grid contains multiple charge grid points and the potential distribution grid contains multiple potential grid points;

[0161] The meshing module 602 is used to divide the potential distribution mesh into multiple potential calculation subsets along the first dimension, each potential calculation subset including multiple target potential mesh points arranged along the first dimension, and to allocate a GPU thread block to each potential calculation subset; and to divide the charge distribution mesh into multiple charge source subsets along the first dimension, each charge source subset including multiple charge mesh points arranged along the first dimension.

[0162] The parallel computing module 603 is used to control each GPU thread block to traverse all charge source subsets. For each traversed charge source subset, the following operations are performed: based on the charge data of the read charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, the potential contribution of the charge source subset to each target potential grid point in the potential calculation subset is calculated; the calculated potential contribution is accumulated into the total potential of the potential calculation subset.

[0163] The result synthesis module 604 is used to obtain the potential calculation results of the potential distribution grid based on the total potential of the potential calculation subset with corresponding relationships calculated by all GPU thread blocks.

[0164] The potential calculation device for the space charge effect in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the device.

[0165] In some embodiments, the parallel computing module 603 is further configured to: read the charge data of all charge grid points in the currently traversed charge source subset; determine the index distance between the currently traversed charge source subset and the potential calculation subset; obtain the corresponding distance coefficient set from the pre-stored distance coefficient table according to the index distance; and perform corresponding multiplication and accumulation calculations on the read charge data and the distance coefficient set to obtain the potential contribution of the current charge source subset to each target potential grid point in the potential calculation subset.

[0166] In some embodiments, the parallel computing module 603 is further configured to control the GPU thread block to store the read charge data in the shared memory of the GPU thread block, so that the GPU thread block can access it when performing the multiplication and accumulation operation of the charge data and the distance coefficient set.

[0167] In some embodiments, the parallel computing module 603 is further configured to: identify at least one symmetric charge source subset that has the same index distance to the currently traversed charge source subset in the second and third dimensions; synchronously read the charge data of the currently traversed charge source subset and all identified symmetric charge source subsets; determine the index distance between the currently traversed charge source subset and the potential calculation subset; obtain the corresponding distance coefficient set from the distance coefficient table based on the index distance; and use the same distance coefficient set to multiply and accumulate the charge data of all synchronously read charge source subsets to obtain the potential contribution of all charge source subsets to each target potential grid point in the potential calculation subset.

[0168] In some embodiments, the parallel computing module 603 is further configured to divide the process of traversing all charge source subsets into multiple loop stages in the second and third dimensions; in different loop stages, based on the relationship between the index of the currently traversed charge source subset and the index of the potential calculation subset, determine whether there is a symmetrical charge source subset; if there is, then in the current loop stage, synchronously read the charge data of the currently traversed charge source subset and all symmetrical charge source subsets.

[0169] In some embodiments, the parallel computing module 603 is further configured to perform alignment and merging processing on the charge data of the currently traversed subset of charge sources and all symmetric charge source subsets read synchronously to obtain merged charge data; and perform corresponding multiplication and accumulation calculations on the merged charge data and the distance coefficient set.

[0170] In some embodiments, the potential calculation device for the space charge effect further includes a table creation module 605. The table creation module 605 is used to: create a coefficient calculation grid with the same three-dimensional grid structure as the charge distribution grid, the coefficient calculation grid containing multiple coefficient grid points; using a first coefficient grid point in the coefficient calculation grid as a reference grid point, calculate the distance coefficient of any second coefficient grid point relative to the first coefficient grid point for any second coefficient grid point other than the first coefficient grid point; and store the distance coefficients of all second coefficient grid points relative to the first coefficient grid point in a three-dimensional array according to the index of the second coefficient grid point in the coefficient calculation grid to form a pre-stored distance coefficient table.

[0171] In some embodiments, the table creation module 605 is further configured to: establish a diffuse grid centered on the second coefficient grid point, and divide the diffuse grid into multiple diffuse sub-grids; launch multiple GPU thread blocks on the GPU, each GPU thread block corresponding to a second coefficient grid point; launch multiple threads within each GPU thread block, each thread being used to calculate the distance between a diffuse sub-grid and the first coefficient grid point, obtaining the distance coefficient of each sub-grid; sum all the sub-grid distance coefficients, and divide the summation result by the total volume of the diffuse grid to obtain the distance coefficient of the second coefficient grid point relative to the first coefficient grid point.

[0172] The potential calculation device for space charge effect provided in this application embodiment can achieve... Figures 1 to 5 The various processes implemented in the method implementation examples will not be described again here to avoid repetition.

[0173] This application also provides an electronic device, such as... Figure 7 As shown, the electronic device 700 includes a processor 701 and a memory 702. The memory 702 stores a program or instructions that can run on the processor 701. When the program or instructions are executed by the processor 701, they implement the various steps of the above-described embodiment of the potential calculation method for the space charge effect and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0174] The memory 702 can be used to store software programs and various data. The memory 702 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 702 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 702 in the embodiments of this application includes, but is not limited to, these and any other suitable types of memory.

[0175] Processor 701 may include one or more processing units; optionally, processor 701 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into processor 701.

[0176] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described space charge effect potential calculation method embodiment and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0177] This application also provides a chip, which includes a processor and a communication interface. The communication interface and the processor are coupled. The processor is used to run programs or instructions to implement the various processes of the above-described space charge effect potential calculation method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0178] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0179] This application also provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the above-described space charge effect potential calculation method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0180] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0181] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A method for calculating the potential of the space charge effect, characterized in that, include: A charge distribution grid and a potential distribution grid with the same three-dimensional grid structure are provided, wherein the charge distribution grid contains multiple charge grid points and the potential distribution grid contains multiple potential grid points; The potential distribution grid is divided into multiple potential calculation subsets along the first dimension. Each potential calculation subset includes multiple target potential grid points arranged along the first dimension, and a GPU thread block is allocated to each potential calculation subset. The charge distribution grid is divided into multiple charge source subsets along the first dimension, and each charge source subset includes multiple charge grid points arranged along the first dimension; Each GPU thread block traverses all the charge source subsets. For each traversed charge source subset, the following operations are performed: based on the charge data of the read charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, the potential contribution of the charge source subset to each of the target potential grid points in the potential calculation subset is calculated. The calculated potential contribution is added to the total potential of the potential calculation subset; The potential calculation result of the potential distribution grid is obtained based on the total potential of the corresponding potential calculation subsets calculated by all the GPU thread blocks.

2. The method for calculating the potential of the space charge effect according to claim 1, characterized in that, The step of calculating the potential contribution of the charge source subset to each target potential grid point in the potential calculation subset based on the read charge data of the charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table specifically includes: Read the charge data of all charge grid points in the currently traversed charge source subset; Determine the index distance between the currently traversed subset of charge sources and the subset of potential calculations; Based on the index distance, obtain the corresponding distance coefficient set from the pre-stored distance coefficient table; The read charge data is multiplied and accumulated with the distance coefficient set to obtain the potential contribution of the current charge source subset to each target potential grid point in the potential calculation subset.

3. The method for calculating the potential of the space charge effect according to claim 2, characterized in that, After reading the charge data of all charge grid points in the currently traversed subset of charge sources, the method further includes: The GPU thread block stores the read charge data in the shared memory of the GPU thread block, so that the GPU thread block can access it when performing the multiplication and accumulation operation of the charge data and the distance coefficient set.

4. The method for calculating the potential of the space charge effect according to claim 1, characterized in that, The step of calculating the potential contribution of the charge source subset to each target potential grid point in the potential calculation subset based on the read charge data of the charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table specifically includes: Identify at least one symmetric subset of charge sources that has the same index distance to the currently traversed subset of charge sources in the second and third dimensions; Simultaneously read the charge data of the currently traversed subset of charge sources and all identified subsets of symmetrical charge sources; Determine the index distance between the currently traversed subset of charge sources and the subset of potential calculations; Based on the index distance, obtain the corresponding distance coefficient set from the distance coefficient table; Using the same set of distance coefficients, the charge data of all the charge source subsets read synchronously are multiplied and accumulated to obtain the potential contribution of all the charge source subsets to each of the target potential grid points in the potential calculation subset.

5. The method for calculating the potential of the space charge effect according to claim 4, characterized in that, The index distances between the symmetric charge source subset and the potential calculation subset in the second and third dimensions are respectively equal to the index distances between the currently traversed charge source subset and the potential calculation subset in the corresponding dimensions.

6. The method for calculating the potential of the space charge effect according to claim 4, characterized in that, The step of synchronously reading the charge data of the currently traversed subset of charge sources and all identified subsets of symmetrical charge sources includes: The process of traversing all the aforementioned subsets of charge sources is divided into multiple loop stages in the second and third dimensions; In different loop stages, based on the relationship between the index of the currently traversed subset of charge sources and the index of the potential calculation subset, it is confirmed whether the symmetric charge source subset exists. If they exist, then in the current loop phase, the charge data of the currently traversed subset of charge sources and all subsets of symmetric charge sources are read synchronously.

7. The method for calculating the potential of the space charge effect according to claim 4, characterized in that, The step of using the same set of distance coefficients to multiply and accumulate the charge data of all synchronously read subsets of charge sources includes: The charge data of the currently traversed subset of charge sources and all symmetrical charge source subsets read synchronously are merged to obtain merged charge data. The merged charge data is multiplied and accumulated with the distance coefficient set.

8. The method for calculating the potential of the space charge effect according to any one of claims 1 to 7, characterized in that, The pre-stored distance coefficient table is constructed in the following way: Create a coefficient calculation grid with the same three-dimensional grid structure as the charge distribution grid, wherein the coefficient calculation grid contains multiple coefficient grid points; Using the first coefficient grid point in the coefficient calculation grid as the reference grid point, for any second coefficient grid point other than the first coefficient grid point, calculate the distance coefficient of the second coefficient grid point relative to the first coefficient grid point; The distance coefficients of all the second coefficient grid points relative to the first coefficient grid points are stored in a three-dimensional array according to the index of the second coefficient grid points in the coefficient calculation grid to form the pre-stored distance coefficient table.

9. The method for calculating the potential of the space charge effect according to claim 8, characterized in that, The calculation of the distance coefficient between the second coefficient grid point and the first coefficient grid point includes: A diffuse grid is established with the second coefficient grid point as the center, and the diffuse grid is divided into multiple diffuse sub-grids; Multiple GPU thread blocks are launched on the GPU, each GPU thread block corresponding to a second coefficient grid point; Within each GPU thread block, multiple threads are started, and each thread is used to calculate the distance between a diffuse subgrid and the first coefficient grid point to obtain the distance coefficient of each subgrid. Summing up all the sub-grid distance coefficients and dividing the sum by the total volume of the diffuse grid, we obtain the distance coefficient of the second coefficient grid point relative to the first coefficient grid point.

10. A potential calculation device for the space charge effect, characterized in that, include: A data providing module is used to provide a charge distribution grid and a potential distribution grid with the same three-dimensional grid structure, wherein the charge distribution grid contains multiple charge grid points and the potential distribution grid contains multiple potential grid points; A mesh partitioning module is used to divide the potential distribution mesh into multiple potential calculation subsets along a first dimension, each potential calculation subset including multiple target potential mesh points arranged along the first dimension, and to allocate a GPU thread block to each potential calculation subset; and to divide the charge distribution mesh into multiple charge source subsets along the first dimension, each charge source subset including multiple charge mesh points arranged along the first dimension. The parallel computing module is used to control each GPU thread block to traverse all the charge source subsets. For each traversed charge source subset, the following operations are performed: based on the charge data of the read charge source subset and the corresponding distance coefficient set obtained from the pre-stored distance coefficient table, the potential contribution of the charge source subset to each target potential grid point in the potential calculation subset is calculated. The calculated potential contribution is added to the total potential of the potential calculation subset; The result synthesis module is used to obtain the potential calculation result of the potential distribution grid based on the total potential of the potential calculation subset with corresponding relationships calculated by all the GPU thread blocks.

11. An electronic device, characterized in that, It includes a processor and a memory, the memory storing a program or instructions that run on the processor, the program or instructions being executed by the processor to implement the steps of the potential calculation method for the space charge effect as described in any one of claims 1 to 9.

12. A readable storage medium having a program or instructions stored thereon, characterized in that, When the program or instructions are executed by the processor, they implement the steps of the potential calculation method for the space charge effect as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • PIC (Peripheral Interface Controller)-model-based accelerator simulation method implemented by using GPU (Graphic Processing Unit) in parallel

    CN103440163A

  • Self-adaptive efficient simulation method and system for electric propulsion plasma oscillation

    CN120706284A