Time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration and corresponding product

By employing coordinate pre-calculation, a circular buffer, and a kernel design without atomic operations, the problems of memory management and thread conflicts in existing technologies are solved, enabling efficient GPU parallel electromagnetic field simulation calculations and improving computational efficiency and stability.

CN122154154APending Publication Date: 2026-06-05ROCKET FORCE UNIV OF ENG

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
ROCKET FORCE UNIV OF ENG
Filing Date
2026-01-22
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

Existing GPU-based time-domain electromagnetic field simulation methods suffer from problems such as fragmented memory management leading to low data transmission efficiency, atomic operations in the computation kernel causing thread conflicts, and redundant coordinate calculations, making it difficult to meet the real-time requirements of large-scale three-dimensional electromagnetic field simulations.

Method used

The coordinate pre-computation mechanism is used to separate the grid point coordinates from the GPU kernel. A circular buffer and asynchronous update mechanism are used, combined with a kernel design without atomic operations, to optimize memory access and thread-parallel computation by accumulating field contribution values ​​through local variables.

Benefits of technology

It significantly improves computational efficiency, stability, and resource utilization, achieving efficient GPU parallel computing and meeting the real-time requirements of large-scale three-dimensional electromagnetic field simulation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122154154A_ABST
    Figure CN122154154A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of electromagnetic simulation, and provides a time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration and a corresponding product.The method comprises the following steps: setting simulation parameters; precalculating physical coordinates of all grid points, generating an observation point coordinate array and a source point coordinate array, and transmitting the arrays to GPU device memory; initializing a GPU solver, allocating GPU memory resources, and configuring a CUDA thread block and a grid structure, so that the number of threads matches the number of observation points; for each time step corresponding to a time step, source field data of the current time step is asynchronously updated into a ring buffer; when the simulation time exceeds the time required for electromagnetic waves to propagate from a source area to an observation area, a GPU kernel function without atomic operation is started, the electromagnetic field values of each observation point are calculated in parallel based on the precalculated coordinate array and the source field data in the ring buffer; and the calculation results are transmitted from the GPU device back to the host end for storage and post-processing verification.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of electromagnetic simulation technology, and in particular to a time-domain electromagnetic field simulation calculation method and corresponding products based on GPU parallel acceleration. Background Technology

[0002] Time-domain electromagnetic field simulation has significant application value in the field of computational electromagnetics, especially the exact integration method based on the Jefimenko equations, which can accurately describe the electromagnetic field behavior generated by time-varying charges and currents. As the scale of electromagnetic simulation problems continues to expand, traditional CPU (Central Processing Unit) serial computing methods face the challenge of low computational efficiency when processing large-scale 3D meshes. Therefore, utilizing GPU (Graphics Processing Unit) parallel computing technology to improve simulation speed has become a current research hotspot.

[0003] Currently, several GPU-accelerated time-domain electromagnetic field calculation methods have been proposed, such as the JefiGPU approach. This type of approach improves computational performance to some extent by porting the calculation process of the Jefimenko equations to the GPU platform and utilizing parallel threads to accelerate integration calculations.

[0004] However, existing technical solutions have the following obvious drawbacks: 1) Dispersed memory management leads to low data transmission efficiency and increases communication overhead between the host and the device; 2) Atomic operations exist in the computing kernel, causing thread conflicts and limiting parallel computing efficiency; 3) Redundant operations such as coordinate calculations are repeatedly executed in the kernel, further affecting overall performance. These drawbacks make it difficult for existing technologies to meet real-time requirements when handling large-scale three-dimensional electromagnetic field simulations. Summary of the Invention

[0005] Based on this, it is necessary to address the shortcomings of the existing technologies, such as scattered memory management, low computational efficiency, and thread conflicts caused by kernel atomic operations, and propose a time-domain electromagnetic field simulation calculation method and corresponding products based on GPU parallel acceleration.

[0006] Firstly, a method for time-domain electromagnetic field simulation calculation based on GPU parallel acceleration is provided, the method comprising: Set simulation parameters, including the grid size, physical extent, and time step Δt of the observation and source regions; The physical coordinates of all grid points are pre-calculated, generating arrays of observation point coordinates and source point coordinates, and then transferred to the GPU device memory to provide the coordinate data foundation for subsequent GPU kernel calculations. Initialize the GPU solver, allocate GPU memory resources, and configure CUDA thread blocks and mesh structure to match the number of threads with the number of observation points. The GPU memory resources include a circular buffer and a result array. For each time step Δt, the source field data of the current time step is asynchronously updated to the circular buffer. When the simulation time exceeds the time required for the electromagnetic wave to propagate from the source region to the observation region, the GPU kernel function without atomic operations is started. Based on the pre-computed coordinate array and the source field data in the circular buffer, the electromagnetic field value of each observation point is calculated in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables. The calculated electromagnetic field values ​​are transmitted from the GPU device back to the host for storage and post-processing verification.

[0007] Secondly, a time-domain electromagnetic field simulation computing device based on GPU parallel acceleration is provided, the device comprising: The settings module is used to set simulation parameters, including the grid size, physical extent, and time step Δt of the observation and source regions. The generation module is used to pre-calculate the physical coordinates of all grid points, generate the coordinate arrays of observation points and source points, and transfer them to the GPU device memory to provide the coordinate data foundation for subsequent GPU kernel calculations; The configuration module is used to initialize the GPU solver, allocate GPU memory resources, and configure CUDA thread blocks and mesh structure to match the number of threads with the number of observation points. The GPU memory resources include a circular buffer and a result array. The update module is used to asynchronously update the source field data of the current time step to the circular buffer for each time step Δt. The computation module is used to start a GPU kernel function without atomic operations when the simulation time exceeds the time required for the electromagnetic wave to propagate from the source region to the observation region. Based on the pre-computed coordinate array and the source field data in the circular buffer, it calculates the electromagnetic field value of each observation point in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables. The return module is used to transmit the calculated electromagnetic field values ​​from the GPU device back to the host for storage and post-processing verification.

[0008] Thirdly, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the above-described GPU-based parallel acceleration time-domain electromagnetic field simulation calculation method.

[0009] Fourthly, a computer-readable storage medium is provided, which stores a computer program that, when executed by a processor, implements the steps of the above-described GPU-based parallel-accelerated time-domain electromagnetic field simulation calculation method.

[0010] As can be seen from the technical solutions provided in this application: Firstly, the coordinate pre-computation mechanism decouples the calculation of grid point coordinates from the GPU kernel, which not only reduces the computational burden of kernel functions but, more importantly, changes the traditional data access mode of parallel computing, enabling GPU threads to directly access pre-stored coordinate data and optimizing memory access efficiency. Secondly, by allocating independent observation points to each thread and using the method of accumulating field contribution values ​​using local variables, the thread contention problem caused by atomic operations in the prior art is solved, enabling a large number of threads to truly achieve parallel computing and improving the utilization rate of GPU computing units. Thirdly, the combination of a circular buffer and an asynchronous update mechanism achieves efficient overlap between data transmission and computation. The circular buffer not only solves the problem of storing historical source field data, but its circular overlay characteristic also ensures the rationality of memory usage. Combined with asynchronous update technology, it effectively hides data transmission latency, allowing for full utilization of computing resources. In summary, the technical solutions in this application, through coordinate pre-computation, atomic-free kernel design, and circular buffer optimization, significantly improve computational efficiency, stability, and resource utilization. Attached Figure Description

[0011] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort. Wherein: Figure 1 This is a flowchart of a time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration in one embodiment; Figure 2 A schematic diagram of an integrated EMSolver class provided for one embodiment; Figure 3 The runtime of JefiGPU and the method of this application under constant source and sinusoidal source conditions provided in one embodiment shows that the computation time growth trend of the method provided in this application is more gradual; Figure 4 A detailed comparison of a constant source and a sinusoidal source is provided for one embodiment; Figure 5A detailed performance comparison on a large grid (e.g., 50³ grids) is presented in the form of a bar chart for one embodiment. Figure 6 This is a block diagram of a GPU-based parallel-accelerated time-domain electromagnetic field simulation computing device in one embodiment. Figure 7 This is a structural block diagram of a computer device in one embodiment. Detailed Implementation

[0012] The technical solutions of the embodiments of the present invention will be clearly and completely described below 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.

[0013] Currently, several GPU-accelerated time-domain electromagnetic field calculation methods have been proposed, such as the JefiGPU approach. This type of approach improves computational performance to some extent by porting the calculation process of the Jefimenko equations to the GPU platform and utilizing parallel threads to accelerate integration calculations. However, existing technologies suffer from the following significant drawbacks: 1) Dispersed memory management leads to inefficient data transfer and increases communication overhead between the host and the device; 2) Atomic operations within the computation kernel cause thread conflicts, limiting parallel computing efficiency; 3) Redundant operations such as coordinate calculations are repeatedly executed within the kernel, further impacting overall performance. These shortcomings make it difficult for existing technologies to meet real-time requirements when handling large-scale three-dimensional electromagnetic field simulations.

[0014] To address the aforementioned problems in existing technologies, this application proposes a time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration, the main process of which is as follows: Figure 1 As shown, the main steps include S101 to S106, which are detailed below: Step S101: Set simulation parameters, including the grid size, physical range, and time step Δt of the observation and source regions.

[0015] Before starting the simulation, the physical and numerical parameters of the computational domain can be determined first. These simulation parameters include the grid size, physical extent, and time step Δt of the observation and source regions. Specifically, the observation region is the spatial extent from which the electromagnetic field distribution needs to be obtained, such as a cuboid region. The source region is the spatial extent where the charge and current distributions that generate the electromagnetic field are located; the two can overlap or separate spatially. The grid size of the observation region is... The number of discrete grid points in the observation region along the three coordinate directions is defined, and the grid size of the source region is... The number of discrete grid points in the source region along the three coordinate directions is defined, and the grid spacing of the observation region is... The grid spacing of the source region is The choice of time step Δt must satisfy numerical stability conditions (e.g., the CFL condition) and consider the highest frequency of the source signal variation to ensure the accuracy of the time-domain integration. ,in, c The speed of light. The physical extent is defined by the coordinates of the starting points in space between the observation region and the source region. , and its physical dimensions , These parameters collectively form the basic framework of the simulation and provide a basis for subsequent coordinate pre-calculation and memory allocation. For example, for a cubic observation area with a side length of 1 meter, if each direction is divided into 50 grids, then the grid size is... = (50, 50, 50), corresponding to the grid spacing It is 0.02 meters.

[0016] The CFL condition, Courant-Friedrichs-Lewy, is an important stability condition in numerical analysis.

[0017] Step S102: Pre-calculate the physical coordinates of all grid points, generate an array of observation point coordinates and an array of source point coordinates, and transfer them to the GPU device memory to provide coordinate data for subsequent GPU kernel calculations.

[0018] To address the redundant computation issue caused by real-time coordinate calculation within the GPU kernel in existing GPU acceleration solutions (e.g., JefiGPU), current techniques dynamically calculate the coordinates of each observation and source point within the GPU kernel. For example, when each thread processes an observation point, the coordinate value is converted in real-time using the grid index and physical range. However, this dynamic calculation method leads to a large amount of redundant computation because the same coordinate value may be repeatedly calculated by multiple threads (especially when traversing source points), wasting GPU computing resources. Furthermore, coordinate calculation consumes kernel time, preventing the kernel from focusing on core electromagnetic field integration calculations, thus slowing down the overall simulation speed. Therefore, this application adopts a solution that pre-calculates the physical coordinates of all grid points, generates arrays of observation point coordinates and source point coordinates, and transmits them to the GPU device memory, providing the coordinate data foundation for subsequent GPU kernel calculations. By pre-calculating the coordinates and transmitting them to the GPU all at once, this application decouples coordinate calculation from the kernel, reducing the complexity of the GPU kernel and allowing it to focus more on field value calculations. This approach improves memory access efficiency (coordinate data is stored contiguously in the GPU's global memory) and reduces kernel execution time, thereby significantly improving computational efficiency and decoupling the computational process.

[0019] As one embodiment of this application, the pre-calculation of the physical coordinates of all grid points, the generation of an array of observation point coordinates and an array of source point coordinates, and the transfer of these to the GPU device memory to provide the coordinate data foundation for subsequent GPU kernel calculations can be achieved through steps S1021 and S1022, as detailed below: Step S1021: Based on the grid size and physical range, generate the three-dimensional coordinates of each grid point through linear interpolation, and organize them into an array of observation point coordinates and an array of source point coordinates respectively.

[0020] Specifically, for the observation area, the physical coordinates of any grid point (i, j, k) are ( , , It can be calculated using the following formula: in, , and The calculation method is as described above. Traverse all observation grid points and store the calculated 3D coordinates sequentially in one-dimensional arrays obs_x[], obs_y[], and obs_z[], with the array length equal to the total number of observation points. .

[0021] Perform the exact same operation on the source region, i.e., obtain the physical coordinates of any grid point (i,j,k). It can be calculated using the following formula: in, , and The calculation method is as described above. The calculated three-dimensional coordinates are stored sequentially in one-dimensional arrays src_x[], src_y[], and src_z[], with the array length being the total number of observation points. In this way, the calculation of the three-dimensional coordinates of all grid points is decoupled from the GPU core and completed in advance on the CPU (host side).

[0022] Step S1022: Copy the observation point coordinate array and the source point coordinate array as a contiguous memory block to the GPU global memory at once to optimize memory access efficiency.

[0023] After the coordinate arrays are generated on the host side, the observation point coordinate arrays and source point coordinate arrays are copied as contiguous blocks to the GPU's global memory in one go by calling CUDA's (Compute Unified Device Architecture, NVIDIA's general-purpose parallel computing platform and programming model) cudaMemcpy or similar efficient data transfer APIs (e.g., the cuda.to_device function in Numba CUDA in a Python environment). This one-time transfer strategy avoids repeated data transfers between the host and the device during the simulation time loop, greatly reducing communication overhead. The coordinate data is stored contiguously and in an aligned manner in the GPU's global memory, ensuring that subsequent GPU kernel functions can efficiently and coalescedly access this read-only data during execution, thereby maximizing memory bandwidth utilization. This step is the foundation for data preparation for all subsequent GPU parallel computing.

[0024] cudaMemcpy is a core function in CUDA programming used to synchronously transfer data between host (CPU) memory and device (GPU) memory. It supports one-dimensional data copying, including host-to-device and device-to-host methods.

[0025] Step S103: Initialize the GPU solver, allocate GPU memory resources, and configure CUDA thread blocks and mesh structure to match the number of threads with the number of observation points. The GPU memory resources include a circular buffer and a result array.

[0026] To efficiently manage the entire computing process and GPU resources, this application designs an integrated EMSolver class. For example... Figure 2 As shown, this class encapsulates simulation parameters, device memory pointers, and core methods. The initialization process is crucial for building this efficient computing engine. As an embodiment of this application, the GPU solver can be initialized via steps S1031 and S1032, as detailed below: Step S1031: Calculate the size of the ring buffer by dynamically allocating it based on the maximum signal propagation time and time step Δt.

[0027] A circular buffer is used to store source field data (charge density) for historical time steps on the GPU. ρ (and the various components of the current density J), this is crucial for calculating the time-domain delay field, its capacity It is not fixed, but can be calculated based on the buffer capacity, the maximum signal propagation time, and the time step Δt. Maximum signal propagation time... The maximum distance between the observation region and the source region Divide by the speed of light c get: To ensure that data with arbitrary delays can be indexed, the buffer length must meet the following requirements: The `__init__` method of the `EMSolver` (electromagnetic field simulation solver) class calls the private method `_get_arrival_time()` to calculate this time and uses it for... , , and Memory is allocated to arrays of devices. These arrays are logically connected end-to-end, forming a ring. To achieve efficient memory management, this application employs a circular overwrite strategy in the ring buffer allocation. In practice, unified memory management technologies (e.g., CUDA's Unified Memory) can be used to automatically manage data transfer between the host and devices. By calling APIs such as cudaMallocManaged to allocate buffer memory, the system automatically migrates data pages between the host and devices, simplifying the programming model. The buffer's time index rotation is achieved through a modulo operation: write_index = ... This mechanism automatically returns to the beginning of the buffer to overwrite old data once the write position reaches the end of the buffer, thus achieving buffer overwriting and preventing memory overflow. `write_index` represents the current time step, indicating the cumulative number of "time steps" elapsed since the start of the simulation. It is an integer index that increments from 0. In the implementation, a modulo operation is used to manage the current write position: `write_index=` When the buffer is full, new data will overwrite the oldest data, thus achieving infinite-duration circular storage of data within a fixed memory space and avoiding memory overflow. The % operator is the modulo operator.

[0028] This represents the charge density data in GPU memory. Charge density describes the distribution of charge per unit volume and is one of the source terms in electromagnetic field simulations.

[0029] , and These represent the components of current density in GPU memory along the x, y, and z spatial directions, respectively. Current density describes the flow of charge and is another key source term in electromagnetic field simulation. These three variables are also defined as arrays of shape [len_time_snapshots, total_grid_size], used to store the current density vector components at each grid point at different time steps.

[0030] Step S1032: After allocating the circular buffer, configure the CUDA thread block size and grid dimension so that each thread block can process multiple observations to improve parallel efficiency.

[0031] Configuring GPU execution parameters primarily involves configuring the CUDA thread block size and mesh dimension, enabling each thread block to process multiple observations. Typically, a thread block contains... The number of threads (e.g., 256 or 512). The grid dimensions are based on the total number of observation points. and number of threads calculate: This configuration ensures that the total number of threads started is at least equal to the number of observation points, matching the number of threads with the number of observation points and achieving a parallel granularity of "one thread primarily responsible for one observation point." Simultaneously, the configuration of each thread block handling multiple observation points helps hide memory access latency and improves the utilization of the GPU streaming multiprocessor (SM). Furthermore, the EMSolver class allocates device memory (Ex_gpu, Ey_gpu, Ez_gpu, Bx_gpu, By_gpu, and Bz_gpu) for the calculation results (components of the electric field E and magnetic field B). The arrays Ex_gpu, Ey_gpu, and Ez_gpu store the x, y, and z components of the electric field intensity vector E at each observation point within the simulation region in a three-dimensional Cartesian coordinate system, respectively. Similarly, the arrays Bx_gpu, By_gpu, and Bz_gpu store the x, y, and z components of the magnetic field intensity vector B at each observation point within the simulation region in a three-dimensional Cartesian coordinate system, respectively.

[0032] Step S104: For each time step Δt, asynchronously update the source field data of the current time step to the circular buffer.

[0033] To address the issues of fragmented memory management and low data transfer efficiency in existing technologies, current solutions either synchronously update source field data (i.e., wait for data transfer to complete before computation) or process source field data directly in the GPU kernel without using a buffer. However, synchronous updates lead to idle GPU computing units waiting for data transfer, reducing resource utilization. On the other hand, not using a buffer makes it difficult to manage source field data from historical time steps (the Jefimenko equation requires delayed data), potentially leading to data loss or duplicate transfers and increased memory overhead. Therefore, the technical solution proposed in this application is to asynchronously update the source field data of the current time step to a circular buffer for each time step Δt. Through the circular buffer and asynchronous update mechanism, data transfer and computation are overlapped, hiding the data transfer latency. The circular buffer ensures efficient cyclic use of historical source field data, avoids memory overflow, and thus improves the stability of data flow management and overall computational efficiency.

[0034] As an embodiment of this application, for each time step Δt, asynchronously updating the source field data of the current time step to the circular buffer can be achieved through steps S1041 and S1042, as detailed below: Step S1041: Call the dedicated CUDA kernel function to copy the source field data from the CPU to the current time index position of the circular buffer.

[0035] At each time step, the host generates or provides an array of source field data for the current moment. The dedicated CUDA kernel function `update_src_kernel` is called to copy the source field data from the Central Processing Unit (CPU) to the current time index position in the circular buffer. This kernel function is extremely lightweight; its sole task is to efficiently move data from host memory to a specified "slot" in the GPU's circular buffer. This "slot" is indexed by the current time step. Regarding the buffer length Modulus determination, i.e. in, This represents the index of the current time step. A simple parallel loop is used, with each thread responsible for copying a portion of the data, thus quickly updating the entire array.

[0036] Before copying the source field data to the GPU, the source field data can be preprocessed. For example, the values ​​at the edges of the source array can be zeroed or mirrored according to the boundary conditions of the simulation region (e.g., perfect electrical conductor PEC), and the data format can be standardized (e.g., converting double precision to single precision to improve computation speed). This preprocessing step can ensure that the data format is compatible with the GPU kernel and improve computational stability.

[0037] Step S1042: A double buffering mechanism is used during the copying process. By switching the buffer pointer, read and write conflicts are eliminated, ensuring the integrity of data updates.

[0038] In concurrent computing scenarios, a potential problem is that when the `jefimenko_kernel` (the core GPU kernel implementing parallel computation of the Jefimenko equations, where each GPU thread is responsible for one observation point, traversing all source points to calculate the electromagnetic field contribution) is reading data from a specific time index in the circular buffer for computation, the `update_src_kernel` might attempt to write new data to the same or adjacent memory locations, causing read-write conflicts. To avoid this problem, this application employs a double-buffering mechanism in its implementation. Specifically, two logical circular buffers can be maintained (or implemented through finer-grained pointer and index management). In one time step, the computation kernel reads data from the "read-only buffer," while the update kernel writes new data to the "write-only buffer." At the start of the next time step, the roles are reversed by switching the buffer pointers. This ensures complete isolation between the computation and update processes in terms of memory access, eliminating read-write conflicts and thus ensuring the integrity of data updates and the correctness of computation results. This is a crucial step in achieving stable and efficient pipelined computation.

[0039] Step S105: When the simulation time exceeds the time required for the electromagnetic wave to propagate from the source region to the observation region, the GPU kernel function without atomic operations is started. Based on the pre-computed coordinate array and the source field data in the circular buffer, the electromagnetic field value of each observation point is calculated in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables.

[0040] In existing technologies, although atomic operations can be used to accumulate field contribution values, i.e., multiple threads directly update the field value of the same observation point in global memory, such atomic operations lead to thread serialization. This is because when multiple threads access the same memory address simultaneously, the GPU must serialize these operations, causing thread blocking and computational latency, significantly reducing parallel performance. To address the thread conflict problem caused by kernel atomic operations in existing technologies, this application adopts the following technical solution: when the simulation time exceeds the time required for electromagnetic waves to propagate from the source region to the observation region, a GPU kernel function without atomic operations is started. Based on the pre-calculated coordinate array and source field data in the circular buffer, the electromagnetic field value of each observation point is calculated in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables. Specifically, as an embodiment of this application, starting a GPU kernel function without atomic operations and calculating the electromagnetic field value of each observation point in parallel based on the pre-calculated coordinate array and source field data in the circular buffer can be achieved through steps S1051 to S1055, as detailed below: Step S1051: Each thread loads the coordinates of its assigned observation point.

[0041] When satisfied When the conditions are met, the `solve` method of `EMSolver` (a public method of the `EMSolver` class used to control the timing and execution flow of electromagnetic field calculations) will launch a GPU kernel named `jefimenko_kernel`. Each thread is assigned a unique observation point index. The thread first checks Is it less than the total number of observation points? If the value exceeds the limit, return immediately. The active thread then loads its allocated observation point coordinates, i.e., from the pre-computed coordinate arrays obs_x_gpu[], obs_y_gpu[], obs_z_gpu[] in global memory using indices. Read coordinate values ​​directly This method of directly reading pre-calculated data avoids redundant coordinate conversions within the thread.

[0042] Step S1052: Traverse all source points and calculate the Euclidean distance between the observation point and the source points.

[0043] Subsequently, the thread needs to traverse all source points (indexes). From 0 to For each source point, the thread reads its coordinates from the pre-computed source point coordinate arrays src_x_gpu[], src_y_gpu[], and src_z_gpu[]. Next, the Euclidean distance between the observation point and the source point is calculated.r : This distance r These are key parameters for subsequent calculations of delay time and field contribution.

[0044] Step S1053: If the distance is less than the preset threshold, skip the source point to avoid numerical singularities.

[0045] Before calculating the field contribution, a validity check is required. If the distance... r Less than the preset threshold (For example, If the grid spacing is set to one-tenth of the original grid spacing, it is considered that the observation point and the source point are too close, and directly calculating the Jefimenko equation would lead to numerical instability (singularity). In this case, the thread skips the source point to avoid numerical singularities and directly processes the next source point. This ensures the robustness of the calculation. In the above embodiment, the signal propagation time threshold is dynamically determined by calculating the maximum Euclidean distance between the observation point and the source point. And based on the speed of light c, the minimum signal propagation time is derived. Add a safety margin based on the minimum signal propagation time. Generate threshold = + This safety margin is to ensure the accuracy of the delay time calculation. The margin can be dynamically adjusted according to the mesh density and simulation accuracy requirements. For example, a smaller margin (e.g., 0.1*Δt) can be set for dense meshes or high accuracy requirements; conversely, it can be increased appropriately for less dense meshes. One optimization strategy is to optimize the margin size through an error feedback mechanism: after the initial simulation, the result error is compared, and if the error is large, it is automatically increased. To balance computational efficiency while ensuring accuracy.

[0046] Step S1054: Calculate the signal propagation delay time and obtain the source field data for the corresponding time step from the circular buffer through linear interpolation.

[0047] For a valid source point, the thread calculates the time required for the signal to propagate from the source point to the observation point, i.e., the delay time. ,in, c It is the speed of light. The key issue is that... It might not be the time step. Δt The source data corresponding to the integer multiples of the delay time is not directly stored. This application uses interpolation to solve this problem. First, the floating-point index idx_float corresponding to this delay time in the circular buffer is calculated. Take its integer part idx_prev = floor( The fractional part, frac = idx_float - idx_prev. idx_prev and idx_next = idx_prev + 1 are the two time indices in the circular buffer. The thread obtains the source field data for the corresponding time step from the circular buffer through linear interpolation. For example, for charge density... ρ : The same operation is performed on each component of the current density J. Linear interpolation can be performed using bilinear interpolation to improve accuracy. Specifically, when interpolating based on the preceding and following time indices idx_prev and idx_next, not only is the time dimension weighted (with a weight of...) α and 1- α If the source field data itself is spatially discrete, interpolation can be performed in the spatial dimension to improve the temporal resolution and reduce errors caused by discrete sampling.

[0048] Step S1055: Based on the acquired source field data, accumulate the contributions of the electric and magnetic fields using local variables, and finally write the accumulated results into the global memory result array.

[0049] In step S1055, instead of directly adding the calculated field contribution value atomically to the result array in global memory, the thread creates six local variables (register variables) for each thread, for example, , , , , and This is used as a local variable accumulator. During the traversal of each source point, the acquired delayed source field data is used according to the Jefimenko equation. and distance r Calculate the electric and magnetic field contributions of the source point to the current observation point, and accumulate these contributions to the corresponding local variables. Continue this process until all sources have been traversed. After identifying the source points, the total field value at that observation point has been fully accumulated across these six local variables. Only then does the thread write the accumulated result to the corresponding location in global memory. (etc.). Because each thread only writes to the global memory address corresponding to its own observation point, and this address is unique, write conflicts are completely avoided, and no atomic operations are required. This allows thousands of threads to execute in true parallelism, greatly improving parallel efficiency.

[0050] Step S106: The calculated electromagnetic field value is transmitted from the GPU device back to the host for storage and post-processing verification.

[0051] After `jefimenko_kernel` completes execution, the electromagnetic field distribution at the current time step is stored in the GPU's `E_gpu`, `B_gpu`, and other result arrays. The results are copied back to host memory via asynchronous data transfer (e.g., `cudaMemcpyAsync`). These time-domain data can then be stored in the file system for subsequent analysis or visualization. Post-processing verification is crucial for ensuring simulation reliability. This includes comparing the simulation results with analytical solutions (if available) or results from other reliable numerical methods, calculating metrics such as mean absolute error, and ensuring the error is within an acceptable range (e.g., 0.001). Visualization libraries (e.g., Matplotlib) are used to generate electromagnetic field distribution plots and performance reports, visually displaying the simulation results and computational efficiency for subsequent engineering analysis and verification.

[0052] Figures 3 to 5 The performance comparison results also indirectly prove that the method provided in this application can maintain stability and efficiency under different grid sizes.

[0053] Figure 1 The example method encapsulates the entire process through an integrated solver class (e.g., EMSolver). Figure 2 As shown, this class pre-calculates coordinates and allocates memory during initialization; updates source field data and controls kernel startup conditions at each time step; and verifies result accuracy and handles exceptions after calculation. Furthermore, this class implements performance monitoring functionality: it tracks GPU kernel execution time in real-time via CUDA Events to optimize GPU resource utilization. From the above appendix Figure 1 The example of a GPU-accelerated time-domain electromagnetic field simulation method demonstrates several advantages: First, the coordinate pre-calculation mechanism decouples grid point coordinate calculation from the GPU kernel, reducing the computational burden on kernel functions and, more importantly, altering the traditional parallel computing data access model. This allows GPU threads to directly access pre-stored coordinate data, optimizing memory access efficiency. Second, by allocating independent observation points to each thread and using local variable accumulation of field contribution values, the thread contention problem caused by atomic operations in existing technologies is resolved, enabling a large number of threads to achieve true parallel computing and improving the utilization of GPU computing units. Third, the combination of a circular buffer and an asynchronous update mechanism achieves efficient overlap between data transmission and computation. The circular buffer not only solves the storage problem of historical source field data but also ensures the rationality of memory usage through its cyclic overlay characteristic. Combined with asynchronous update technology, it effectively hides data transmission latency, allowing for full utilization of computing resources. In summary, the technical solution of this application significantly improves computational efficiency, stability, and resource utilization through coordinate pre-calculation, atomic-free kernel design, and circular buffer optimization.

[0054] Please see Figure 6 As shown, in one embodiment, a time-domain electromagnetic field simulation computing device based on GPU parallel acceleration is provided. This device may include a setting module 601, a generation module 602, a configuration module 603, an update module 604, a calculation module 605, and a feedback module 606, as detailed below: The setting module 601 is used to set simulation parameters, including the grid size, physical extent, and time step Δt of the observation and source regions. The generation module 602 is used to pre-calculate the physical coordinates of all grid points, generate an array of observation point coordinates and an array of source point coordinates, and transfer them to the GPU device memory to provide the coordinate data basis for subsequent GPU kernel calculations; Configuration module 603 is used to initialize the GPU solver, allocate GPU memory resources, and configure CUDA thread blocks and mesh structure to match the number of threads with the number of observation points. The GPU memory resources include a circular buffer and a result array. The update module 604 is used to asynchronously update the source field data of the current time step to the circular buffer for each time step Δt. The calculation module 605 is used to start a GPU kernel function without atomic operations when the simulation time exceeds the time required for the electromagnetic wave to propagate from the source region to the observation region. Based on the pre-calculated coordinate array and the source field data in the circular buffer, it calculates the electromagnetic field value of each observation point in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables. The return module 606 is used to transmit the calculated electromagnetic field values ​​from the GPU device back to the host for storage and post-processing verification.

[0055] From the above appendix Figure 6As illustrated by the GPU-accelerated time-domain electromagnetic field simulation device, on the one hand, the coordinate pre-calculation mechanism decouples the calculation of grid point coordinates from the GPU kernel, reducing the computational burden on kernel functions and, more importantly, changing the traditional data access mode of parallel computing. This allows GPU threads to directly access pre-stored coordinate data, optimizing memory access efficiency. On the other hand, by allocating independent observation points to each thread and using a local variable-accumulated field contribution value method, the thread contention problem caused by atomic operations in existing technologies is solved, enabling a large number of threads to truly achieve parallel computing and improving the utilization of GPU computing units. Thirdly, the combination of a circular buffer and an asynchronous update mechanism achieves efficient overlap between data transmission and computation. The circular buffer not only solves the storage problem of historical source field data, but its circular overlay characteristic also ensures the rationality of memory usage. Combined with asynchronous update technology, it effectively hides data transmission latency, allowing for full utilization of computing resources. In summary, the technical solution of this application significantly improves computational efficiency, stability, and resource utilization through coordinate pre-calculation, atomic-operation-free kernel design, and circular buffer optimization.

[0056] Optionally, the above Figure 6 The example generation module 602 may also include interpolation units and replication units, wherein: Interpolation units are used to generate the three-dimensional coordinates of each grid point through linear interpolation based on the grid size and physical extent, and organize them into an array of observation point coordinates and an array of source point coordinates, respectively. The copy unit is used to copy the observation point coordinate array and the source point coordinate array as a contiguous memory block to the GPU global memory at once to optimize memory access efficiency.

[0057] Optionally, the interpolation unit may also include a normalization unit for normalizing the generated coordinate array to optimize GPU memory access efficiency and reduce computational overhead in kernel functions.

[0058] Optionally, the above Figure 6 Example configuration module 603 may include an allocation unit and a thread block configuration unit, wherein: The allocation unit is used to dynamically allocate the size of the circular buffer based on the number of observation points; The thread block configuration unit is used to configure the CUDA thread block size and grid dimension after allocating the circular buffer, so that each thread block can process multiple observations to improve parallel efficiency.

[0059] Optionally, the circular buffer allocation in the above example adopts a circular overlay strategy, including: using unified memory management technology to automatically manage data transmission between the host and the device, and using time indexing to achieve buffer overlay to avoid memory overflow.

[0060] Optionally, the above Figure 6 Example update module 604 may include a calling unit and a switching unit, wherein: The calling unit is used to call a dedicated CUDA kernel function to copy source field data from the CPU to the current time index position of the circular buffer; The switching unit is used to employ a double buffering mechanism during the replication process. It eliminates read-write conflicts by switching buffer pointers, ensuring the integrity of data updates.

[0061] Optionally, the aforementioned calling unit is also used to perform boundary condition processing and format conversion on the source field data before copying, to ensure that the data format is compatible with the GPU kernel.

[0062] In one embodiment, a computer device is provided, the internal structure of which can be shown as follows: Figure 7 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computational and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. When the computer program is executed by the processor, it implements the functions or steps of a GPU-based parallel acceleration method for time-domain electromagnetic field simulation.

[0063] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, performs the following steps: Set simulation parameters, including the grid size, physical extent, and time step Δt of the observation and source regions; The physical coordinates of all grid points are pre-calculated, generating arrays of observation point coordinates and source point coordinates, and then transferred to the GPU device memory to provide the coordinate data foundation for subsequent GPU kernel calculations. Initialize the GPU solver, allocate GPU memory resources, and configure the CUDA thread block and mesh structure to match the number of threads with the number of observation points. The GPU memory resources include a circular buffer and a result array. For each time step Δt, the source field data of the current time step is asynchronously updated to the circular buffer. When the simulation time exceeds the time required for the electromagnetic wave to propagate from the source region to the observation region, the GPU kernel function without atomic operations is started. Based on the pre-computed coordinate array and the source field data in the circular buffer, the electromagnetic field value of each observation point is calculated in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables. The calculated electromagnetic field values ​​are transmitted from the GPU device back to the host for storage and post-processing verification.

[0064] The aforementioned computer program significantly improves computational efficiency, stability, and resource utilization through coordinate pre-calculation, atomic-free kernel design, and circular buffer optimization.

[0065] In one embodiment, a computer-readable storage medium is provided that stores a computer program, which, when executed by a processor, performs the following steps: Set simulation parameters, including the grid size, physical extent, and time step Δt of the observation and source regions; The physical coordinates of all grid points are pre-calculated, generating arrays of observation point coordinates and source point coordinates, and then transferred to the GPU device memory to provide the coordinate data foundation for subsequent GPU kernel calculations. Initialize the GPU solver, allocate GPU memory resources, and configure the CUDA thread block and mesh structure to match the number of threads with the number of observation points. The GPU memory resources include a circular buffer and a result array. For each time step Δt, the source field data of the current time step is asynchronously updated to the circular buffer. When the simulation time exceeds the time required for the electromagnetic wave to propagate from the source region to the observation region, the GPU kernel function without atomic operations is started. Based on the pre-computed coordinate array and the source field data in the circular buffer, the electromagnetic field value of each observation point is calculated in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables. The calculated electromagnetic field values ​​are transmitted from the GPU device back to the host for storage and post-processing verification.

[0066] The aforementioned computer program significantly improves computational efficiency, stability, and resource utilization through coordinate pre-calculation, atomic-free kernel design, and circular buffer optimization.

[0067] The steps described above, implemented when the computer program is executed by the processor, significantly improve computational efficiency, stability, and resource utilization through coordinate pre-calculation, atomic-free kernel design, and circular buffer optimization.

[0068] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or computer device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0069] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.

[0070] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.

[0071] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. 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 of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.

Claims

1. A time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration, characterized in that, The method includes: Set simulation parameters, including the grid size, physical extent, and time step Δt of the observation and source regions; The physical coordinates of all grid points are pre-calculated, generating arrays of observation point coordinates and source point coordinates, and then transferred to the GPU device memory to provide the coordinate data foundation for subsequent GPU kernel calculations. Initialize the GPU solver, allocate GPU memory resources, and configure CUDA thread blocks and mesh structure to match the number of threads with the number of observation points. The GPU memory resources include a circular buffer and a result array. For each time step Δt, the source field data of the current time step is asynchronously updated to the circular buffer. When the simulation time exceeds the time required for the electromagnetic wave to propagate from the source region to the observation region, the GPU kernel function without atomic operations is started. Based on the pre-computed coordinate array and the source field data in the circular buffer, the electromagnetic field value of each observation point is calculated in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables. The calculated electromagnetic field values ​​are transmitted from the GPU device back to the host for storage and post-processing verification.

2. The time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration as described in claim 1, characterized in that, The pre-calculated physical coordinates of the grid points include: Based on the grid size and physical extent, the three-dimensional coordinates of each grid point are generated by linear interpolation and organized into an array of observation point coordinates and an array of source point coordinates, respectively. The observation point coordinate array and the source point coordinate array are copied to the GPU global memory as a contiguous memory block at once to optimize memory access efficiency.

3. The time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration as described in claim 2, characterized in that, The process of generating the 3D coordinates of each grid point through linear interpolation based on the grid size and physical extent, and organizing them into an array of observation point coordinates and an array of source point coordinates, also includes: The generated coordinate array is normalized to optimize GPU memory access efficiency and reduce computational overhead in kernel functions.

4. The time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration as described in claim 1, characterized in that, The initialization GPU solver includes: The size of the ring buffer is dynamically allocated based on the maximum signal propagation time and time step Δt. After allocating the circular buffer, configure the CUDA thread block size and grid dimension so that each thread block can process multiple observations, thereby improving parallel efficiency.

5. The time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration as described in claim 4, characterized in that, The circular buffer allocation employs a circular overlay strategy, including: Unified memory management technology is used to automatically manage data transfer between the host and devices, and buffer overwriting is achieved through time-indexed rotation to avoid memory overflow.

6. The time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration as described in claim 1, characterized in that, The step of asynchronously updating the source field data to the circular buffer for each time step Δt includes: Call a dedicated CUDA kernel function to copy the source field data from the CPU to the current time index position of the circular buffer; A double buffering mechanism is used during the replication process. By switching the buffer pointer, read and write conflicts are eliminated, ensuring the integrity of data updates.

7. The time-domain electromagnetic field simulation calculation method based on GPU parallel acceleration as described in claim 6, characterized in that, The step of calling a dedicated CUDA kernel function to copy the source field data from the host to the current time index position of the circular buffer also includes: Before copying, the source data undergoes boundary condition processing and format conversion to ensure that the data format is compatible with the GPU kernel.

8. A time-domain electromagnetic field simulation computing device based on GPU parallel acceleration, characterized in that, The device includes: The settings module is used to set simulation parameters, including the grid size, physical extent, and time step Δt of the observation and source regions. The generation module is used to pre-calculate the physical coordinates of all grid points, generate the coordinate arrays of observation points and source points, and transfer them to the GPU device memory to provide the coordinate data foundation for subsequent GPU kernel calculations; The configuration module is used to initialize the GPU solver, allocate GPU memory resources, and configure CUDA thread blocks and mesh structure to match the number of threads with the number of observation points. The GPU memory resources include a circular buffer and a result array. The update module is used to asynchronously update the source field data of the current time step to the circular buffer for each time step Δt. The computation module is used to start a GPU kernel function without atomic operations when the simulation time exceeds the time required for the electromagnetic wave to propagate from the source region to the observation region. Based on the pre-computed coordinate array and the source field data in the circular buffer, it calculates the electromagnetic field value of each observation point in parallel. Each GPU thread independently processes one observation point and traverses all source points, accumulating the field contribution value through local variables. The return module is used to transmit the calculated electromagnetic field values ​​from the GPU device back to the host for storage and post-processing verification.

9. An apparatus comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 7.

10. A storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 7.