Geant4-based solar flare x-ray full chain simulation method and system

A high-performance hybrid parallel computing platform was built using the Geant4 platform to construct a hierarchical magnetized solar atmosphere model, track X-ray photon transport and polarization, and perform pixelated imaging. This solved the problems of mismatched multi-view observation data and low computational efficiency in existing simulation methods, and achieved high-precision full-link simulation of flare X-rays.

CN122085326BActive Publication Date: 2026-07-24SHANDONG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHANDONG UNIV
Filing Date
2026-04-08
Publication Date
2026-07-24

AI Technical Summary

Technical Problem

Existing X-ray flare simulation methods cannot systematically describe the differences in energy spectrum, intensity, and imaging with varying viewing angles in multi-satellite observations. They neglect the Compton scattering effect and polarization information, resulting in simulation results that cannot truly reflect the characteristics of multi-view observations, low computational efficiency, and difficulty in meeting the needs of multi-view stereoscopic observations.

Method used

A high-performance hybrid parallel computing platform was built using the Geant4 platform. A hierarchical magnetized solar atmosphere model was constructed, a list of physical processes was configured, and X-ray photon transmission, scattering, and polarization evolution were tracked using a ray tracing algorithm. Pixelated imaging was then performed to generate multi-view images, energy spectra, and polarization data.

Benefits of technology

It achieves high-fidelity and high-efficiency numerical simulation of the entire process from electron injection to multi-view detection, improves the accuracy of energy spectrum morphology prediction and polarization information generation capability, solves the problem of computational resource limitation in existing technologies, and provides high-precision numerical simulation support.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122085326B_ABST
    Figure CN122085326B_ABST
Patent Text Reader

Abstract

The application discloses a kind of solar flare X-ray full-link simulation method and system based on Geant4, belong to space satellite detection and numerical simulation technical field.The method includes: build high-performance hybrid parallel computing platform based on Geant4;Based on the platform, construct layered magnetized solar atmosphere model, configure physical process list and generate high-energy electron particle source;Through light tracing algorithm and self-defined step action module, the transmission, scattering and polarization evolution of X-ray in layered magnetized solar atmosphere are tracked and simulated;Through pixelated imaging and data output module, photon information is mapped to multiple virtual detector imaging planes, and X-ray imaging, energy spectrum and polarization degree data of different observation angles are output.The application solves the problems of existing model and multi-satellite stereoscopic observation data mismatch, Compton scattering details missing, polarization information deficiency and low computing efficiency, and provides an effective tool for analysis and simulation of multi-satellite joint observation data.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of space satellite exploration and numerical simulation technology, and in particular relates to a method and system for full-link simulation of solar flare X-rays based on Geant4. Background Technology

[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.

[0003] Solar flares are violent energy release phenomena in the solar atmosphere. During this process, high-energy electrons produce hard X-rays with significant anisotropy through bremsstrahlung. Accurately simulating the physical information of these X-rays, such as their energy, direction, and polarization state, is a key technical means to reveal the high-energy particle acceleration mechanism of solar flares and support multi-satellite stereoscopic observations.

[0004] In recent years, multiple solar probes, including ASO-S and the Solar Orbiter (SolO), have conducted joint observations, enabling humanity to conduct three-dimensional detection of hard X-rays from solar flares from different spatial perspectives for the first time. These multi-satellite joint observations have provided unprecedented observational data support for revealing the magnetic energy release process and particle acceleration mechanism of solar flares. However, existing simulation methods still have many key shortcomings and are insufficient to meet the requirements of multi-perspective joint observations.

[0005] Existing X-ray flare radiation models often assume isotropic radiation or are designed only for a single viewpoint, failing to systematically describe the differences in energy spectrum, intensity, and imaging variations with viewpoint in multi-satellite observations. Compton scattering, which occurs when hard X-rays propagate through the solar atmosphere, alters photon energy and propagation direction, but existing simulation methods often ignore or simplify this effect, making the simulation results unable to accurately reflect the multi-view observation characteristics of hard X-ray flares.

[0006] Polarization, as an important characterization of radiation anisotropy, plays a crucial role in improving radiation models and enhancing inversion accuracy. However, historical observation payloads have limited ability to detect the polarization of solar X-rays, resulting in significant errors. Furthermore, the physical processes related to polarization are often neglected in modeling, leaving this critical diagnostic tool of X-ray polarization from solar flares without effective observational and model support for a long time.

[0007] In summary, the core of multi-satellite stereoscopic numerical simulation of X-ray flares lies in constructing a complete physical model that encompasses complex physical processes such as charged particle transport, bremsstrahlung, photon Compton scattering, and polarization evolution. This approach is characterized by high computational dimensionality and significant resource consumption. Existing numerical methods often simplify physical processes or geometric models, making it difficult to complete multi-view, multi-physical quantity numerical simulations within a reasonable timescale. This severely restricts their application in practical observations and consequently hinders a deeper understanding of the X-ray radiation mechanism of flares. Summary of the Invention

[0008] To overcome the shortcomings of the existing technologies, this invention provides a Geant4-based end-to-end simulation method and system for solar flare X-rays, applicable to data simulation and analysis for multi-satellite stereo observation missions. It aims to address the technical problems of mismatch between existing models and multi-view stereo observation data, incomplete description of Compton scattering physics, lack of polarization information simulation capabilities, and low computational efficiency in high-precision end-to-end simulations, achieving high-fidelity and high-efficiency numerical simulation of the entire process from electron injection to multi-view detection.

[0009] To achieve the above objectives, one or more embodiments of the present invention provide the following technical solutions:

[0010] The first aspect of this invention provides a method for full-link simulation of solar flare X-rays based on Geant4;

[0011] A Geant4-based method for full-link X-ray simulation of solar flares includes:

[0012] Build a high-performance hybrid parallel computing platform based on Geant4;

[0013] Based on the high-performance hybrid parallel computing platform, a hierarchical magnetized solar atmosphere model is constructed, a list of physical processes is configured, and a high-energy electron particle source is generated.

[0014] Using ray tracing algorithms and a custom stepping motion module, the transmission, scattering, and polarization evolution of X-ray photons in the layered magnetized solar atmosphere are tracked in real time.

[0015] The pixelated imaging and data output module maps the tracked photon information onto multiple preset virtual detector imaging planes, generating and outputting X-ray images, energy spectra, and polarization data corresponding to different observation angles.

[0016] As a further technical solution, the construction of a high-performance hybrid parallel computing platform based on Geant4 includes:

[0017] Initialize the MPI parallel environment using G4MPImanager;

[0018] Based on available computing resources, G4MTRunManager instances are adaptively created to enable multi-threaded parallelism within each MPI process.

[0019] As a further technical solution, the construction of the solar atmospheric geometric model includes:

[0020] Based on the Geant4 detector construction module, with hydrogen and helium as the main components, and according to the measured solar atmospheric density profile, the atmosphere is divided into the photosphere, chromosphere, transition zone and corona in the vertical direction. By dynamically adjusting the density of each layer, the exponential decay trend of solar atmospheric density with altitude is reproduced.

[0021] A magnetic field configuration was introduced into the model, set along the Z-axis, and the influence of the magnetic field on the trajectory of high-energy electrons and the directionality of bremsstrahlung was simulated by a field manager.

[0022] As a further technical solution, the configuration physical process list includes:

[0023] Construct a list of X-ray radiation and transport physical processes that support both polarized and unpolarized physical modes, and enable bremsstrahlung and Compton scattering, or the corresponding standard physical processes, by switching parameters respectively.

[0024] A module for calculating the transformation of photon polarization vectors from the particle coordinate system to the world coordinate system is established to unify the photon polarization state under different particle coordinate systems.

[0025] As a further technical solution, the generation of high-energy electron particle source specifically includes:

[0026] Data isolation and output management at the process and thread levels are achieved through a custom action initialization class. A dedicated output directory is created for each MPI process, and an independent output file is generated for each worker thread.

[0027] High-energy electron particle sources are defined and generated based on the G4GeneralParticleSource framework, supporting flexible configuration of particle type, energy, position, orientation and time distribution, and ensuring that each process uses an independent random number seed for MPI multi-process parallel environment.

[0028] As a further technical solution, a ray tracing algorithm and a custom stepping motion module are used to track the transmission, scattering, and polarization evolution of X-ray photons in the layered magnetized solar atmosphere in real time, including:

[0029] Build a custom step action module and override the BeginOfEventAction method to reset event-related variables and ensure that data is independent between events;

[0030] During the stepping process, the particle's three-dimensional position, kinetic energy, momentum direction, polarization state in the world coordinate system are extracted in real time, and the particle type, event number, trajectory number, and physical process name are recorded.

[0031] The gamma photons generated by primary injected electrons and bremsstrahlung are recorded, and a source-tracing identifier is added to the photons so that they can still be traced back to the source term after multiple scatterings.

[0032] Based on the orbital parameters of multi-satellite joint observations, multiple virtual detector imaging planes are preset, and each detector is assigned an independent identification number and configured with spatial position and observation direction;

[0033] After each photon step, the line segment-plane intersection algorithm is called to calculate the intersection point of the photon trajectory line segment with each detector plane, and to determine whether the incident direction meets the preset viewing angle threshold. The photon physical state, detector identifier, and intersection point coordinates corresponding to the effective intersection event are recorded.

[0034] As a further technical solution, the pixelated imaging and data output module generates X-ray images, energy spectrum data and polarization data from different observation perspectives by solving the effective intersection events between the photon trajectory and the imaging plane of each virtual detector, mapping the pixel index and statistically analyzing the photon physical parameters. The data is also classified and output in a structured format and supports multi-process conflict-free storage.

[0035] The second aspect of this invention provides a full-link simulation system for solar flare X-rays based on Geant4.

[0036] A Geant4-based end-to-end X-ray simulation system for solar flares includes:

[0037] The platform building module is configured to: build a high-performance hybrid parallel computing platform based on Geant4;

[0038] The structural configuration module is configured to: construct a hierarchical magnetized solar atmosphere model based on the high-performance hybrid parallel computing platform, configure a list of physical processes, and generate a high-energy electron particle source;

[0039] The ray tracing and simulation module is configured to: track the transmission, scattering process and polarization evolution of X-ray photons in the layered magnetized solar atmosphere in real time through ray tracing algorithms and a custom stepping action module;

[0040] The pixelated imaging and data output module is configured to: map the tracked photon information onto multiple preset virtual detector imaging planes through the pixelated imaging and data output module, and generate and output X-ray images, energy spectra and polarization data corresponding to different observation angles.

[0041] A third aspect of the present invention provides a computer-readable storage medium having a program stored thereon that, when executed by a processor, implements the steps in the Geant4-based full-link simulation method for solar flares as described in the first aspect of the present invention.

[0042] A fourth aspect of the present invention provides an electronic device including a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps in the Geant4-based full-link simulation method for solar flares as described in the first aspect of the present invention.

[0043] The above one or more technical solutions have the following beneficial effects:

[0044] (1) This invention constructs a full-link radiative transfer model covering electron injection, bremsstrahlung, atmospheric transport scattering to multi-view detection, which self-consistently describes the anisotropic characteristics of hard X-ray radiation. It can be directly compared with multi-satellite stereoscopic observation data such as ASO-S and SolO, providing a reliable physical interpretation of the observation results. At the same time, it builds a high-precision numerical experimental platform for quantitative diagnosis of radiative anisotropy and inversion of high-energy electron spectra and spatial distribution. By fully coupling the Compton scattering process in ray tracing, the energy attenuation and direction change law of hard X-rays in the solar atmosphere are accurately restored, effectively solving the problem of scattering effects being ignored or simplified in the prior art. This significantly improves the model's prediction accuracy for differences in energy spectrum morphology and light source structure characteristics in multi-view observations, making the simulated data more consistent with the actual radiation propagation process and ensuring the reliability of the inversion results.

[0045] (2) This invention self-consistently integrates polarization-sensitive bremsstrahlung and Compton scattering mechanisms during radiation and scattering processes, generating X-ray polarization distribution data of solar flares from different perspectives. This provides a key simulation foundation for the planning, signal extraction, and physical inversion of future polarization observation instruments, making up for the shortcomings of missing polarization information in existing modeling, significantly enhancing the ability to constrain electron throwing angle distribution and magnetic field geometry, and expanding the simulation and analysis dimensions of solar flares. Employing a multi-path parallel hybrid high-performance computing architecture, combined with customized ray tracing algorithms and efficient data management strategies, it significantly improves the end-to-end simulation efficiency while ensuring the physical completeness of complex magnetic fields, multiple scattering, and multi-physical quantity simulations. It solves the problem of existing technologies being forced to simplify physical processes or geometric models due to computational resource limitations, realizing the practical application of large-scale, high-precision numerical simulations and providing efficient simulation support for solar flare research.

[0046] Advantages of additional aspects of the invention will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. Attached Figure Description

[0047] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an improper limitation of the invention.

[0048] Figure 1 This is a flowchart of the method in the first embodiment.

[0049] Figure 2 This is a schematic diagram of the layered magnetized solar atmosphere model and density changes constructed in the first embodiment.

[0050] Figure 3 This is a schematic diagram of the imaging morphology of the simulated X-ray flare radiation obtained in the first embodiment from different satellite perspectives.

[0051] Figure 4 This is a schematic diagram of the energy spectrum characteristics of the X-ray flare obtained from the simulation of the first embodiment under different satellite views.

[0052] Figure 5 This is a schematic diagram of the polarization state of X-ray flare radiation obtained from simulation in the first embodiment under different satellite views.

[0053] Figure 6 This is a system structure diagram of the second embodiment. Detailed Implementation

[0054] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0055] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations of the present invention.

[0056] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0057] Example 1

[0058] This embodiment discloses a Geant4-based full-link X-ray simulation method for solar flares. By building a hybrid parallel computing platform, a hierarchical magnetized solar atmosphere model and a configurable list of physical processes are constructed to achieve full-link simulation from electron injection, radiation generation, atmospheric transport and scattering to multi-view detection. Using ray tracing algorithms, the motion state of photons is accurately captured and mapped to virtual detector observation data after pixelation. X-ray imaging, energy spectrum, and polarization results from different viewpoints are output simultaneously. This effectively solves the problems of poor data matching, incomplete scattering effect simulation, missing polarization information, and low computational efficiency in existing simulation methods for multi-view observation applications, providing reliable numerical support for the study of the physical mechanisms of solar flares.

[0059] Specifically, such as Figure 1As shown, the Geant4-based full-link X-ray simulation method for solar flares includes:

[0060] Step 1: Build a high-performance hybrid parallel computing platform based on Geant4.

[0061] First, the Geant4 G4MPImanager toolkit is called to initialize the MPI parallel environment, configure the cross-node communication protocol and data transmission parameters, and establish a stable foundation for cross-node process communication. The platform automatically detects hardware resources such as the number of CPU cores and memory capacity, and adaptively creates G4MTRunManager instances to form a hybrid architecture of "MPI inter-process parallelism + intra-process multi-threaded parallelism". Inter-process parallelism is responsible for task splitting and result aggregation, while intra-process multi-threaded execution performs specific simulation calculations.

[0062] Secondly, a unified management module is built on this parallel framework, integrating functions such as detector geometry initialization, physical process list customization, particle source configuration, and data acquisition and visualization interface integration. Specifically, the detector geometry supports parametric configuration or CAD model import, the physical process list can be customized as needed, and the data interface is compatible with common visualization tools, ensuring the platform efficiently adapts to subsequent simulation processes and provides efficient computing power support for high-precision simulation of solar flare X-ray radiation and transmission.

[0063] Step 2: Based on the high-performance hybrid parallel computing platform, construct a hierarchical magnetized solar atmosphere model, configure a list of physical processes, and generate a high-energy electron particle source.

[0064] Step 2.1: A layered magnetized solar atmosphere model was constructed within the Geant4 detector's construction module. This model uses hydrogen (H) and helium (He) as the main components, with hydrogen and helium particle abundances set to 90% and 10%, respectively. Based on measured solar atmospheric density profiles, the model vertically divides the atmosphere into the photosphere, chromosphere, transition zone, and corona. Each layer is continuously stacked along the height in a flat plate form, and the model accurately reproduces the exponential decay trend of solar atmospheric density with altitude by dynamically adjusting the density of each layer. Figure 2 As shown, this layered structure clearly demonstrates the vertical stacking of the atmosphere and its density gradient, ensuring the geometric and physical consistency of subsequent X-ray transmission simulations. The photosphere layer covers an altitude range of 0 to 500 km, with its density decreasing with increasing altitude, and the bottom layer being... It descends to the top where it meets the chromosphere. The density varies approximately fivefold. The chromosphere, located at an altitude of 500 km to 2200 km, has a density that increases from the bottom... As the height decreases exponentially, it drops to approximately [missing information] at the top. This spans nearly six orders of magnitude. In the transition zone and corona region above 2200 km, the density further decreases to... Below this point, the material in this region is sparse, and the scattering effect on photons is negligible. By stratifying the solar atmosphere into photosphere, chromosphere, transition region, and corona, and adjusting material properties in real time based on density data at each altitude, this model can self-consistently simulate the energy attenuation, direction change, and polarization evolution of hard X-rays in a density gradient atmosphere. Furthermore, the model introduces a magnetic field configuration, set along the Z-axis with an intensity of 100 Gauss. The magnetic field is implemented using a G4UniformMagField and correlated to a global field manager to simulate the influence of the magnetic field on the trajectory of high-energy electrons and the resulting bremsstrahlung directionality. This solar atmospheric model features structure, adjustable stratification, and configurable magnetization environment, providing a reliable geometric and physical foundation for subsequent simulations of hard X-ray radiation propagation, Compton scattering, and polarization evolution.

[0065] Step 2.2 constructs a flexibly configurable list of X-ray radiation and transport physics processes and establishes a module for calculating the transformation of photon polarization vectors from the particle coordinate system to the world coordinate system. This provides a self-consistent simulation foundation for multi-view, stereoscopic X-ray imaging, energy spectrum, and polarization simulation. This module supports both polarized and non-polarized physics modes, which can be enabled via switching parameters, considering polarization: bremsstrahlung (G4PolarizedBremsstrahlung) and Compton scattering (G4PolarizedCompton), or standard corresponding processes (G4eBremsstrahlung, G4ComptonScattering). The photon process manager within the module has been cleaned up, removing unnecessary processes to ensure the purity and controllability of the physics processes. This design not only accurately simulates the energy attenuation, direction change, and polarization evolution of hard X-rays in the solar atmosphere but also provides crucial physical support for the inversion and diagnosis of anisotropic radiation characteristics in multi-satellite joint observations. It is a core component for conducting multi-physical (imaging / energy spectrum / polarization) and multi-view collaborative simulations of flare hard X-ray radiation. The Klein-Nishina formula for the Compton scattering cross section of polarized light is:

[0066]

[0067] in, It is the classical electron radius. and These are the energies of the scattered and incident photons, respectively (both derived from the Compton energy formula). (related) It is the linear polarization degree of the incident light. , It is the scattering angle. It is the azimuth angle between the scattering plane and the polarization direction of the incident light. This is the solid angle element. This formula shows that the scattering probability depends not only on the energy and scattering angle, but also significantly on the azimuth angle. The formula describing the degree of polarization of the scattered photon is:

[0068]

[0069] in It represents the polarization degree of the scattered photon, and this formula quantitatively describes the change in the degree of polarization of the photon before and after scattering.

[0070] In Geant4, the polarization state of a photon is determined by the Stokes vector in particle coordinates. Description, in which yes Directional polarization intensity minus Directional polarization intensity, yes Directional polarization intensity minus Directional polarization intensity, It is the right-hand circular polarization intensity minus the left-hand circular polarization intensity. For bremsstrahlung and Compton scattering processes, the scattered photons do not produce a circular polarization component, therefore... It is always equal to 0. For linearly polarized light, its polarization angle in the particle coordinate system can be determined by... Sure, .

[0071] To conduct statistical analysis of the polarization states of a large number of photons, the aforementioned polarization vectors need to be transformed to a unified world coordinate system. Specifically, the basis vectors of the particle coordinate system are first defined: let the unit momentum direction vectors of the photons before and after scattering be respectively... and The three coordinate axes of the particle coordinate system are constructed as follows:

[0072] The axis is along the direction of the scattered momentum, i.e. ; The axis is perpendicular to the scattering plane. ,in Normalization factor ; The axis is determined by the right-hand rule, that is .

[0073] Based on this, the photon polarization vector in the world coordinate system can be expressed as a basis vector. and Linear combination: , It is the photon polarization vector and The included angle of the axes. and Substituting the components into the above equation, we obtain the three components of the polarization vector in the world coordinate system:

[0074]

[0075]

[0076]

[0077] This coordinate transformation unifies the photon polarization vectors from different particle coordinate systems to the world coordinate system, laying a standardized foundation for the statistical analysis, output, and multi-view comparison of polarization states in step 3 (X-ray tracing) and step 4 (pixelation output module). This ensures the consistency and comparability of polarization data throughout the entire simulation. The self-consistent and unified set of formulas is a key aspect of the full-link simulation of flare X-rays.

[0078] Step 2.3 innovatively implements process-level and thread-level data isolation and output management through a custom action initialization class, solving key technical problems of data organization and resource contention in large-scale simulations, and providing a reliable foundation for data organization and collaborative management for large-scale parallel simulations. This module inherits from G4VUserActionInitialization and is responsible for uniformly scheduling user actions such as event generation, particle tracking, and data acquisition in the simulation process. The specific implementation process is as follows:

[0079] First, the constructor receives the MPI process identifier rank and saves it as a member variable fRank. The Build() method is overridden, and within this method, PrimaryGeneratorAction (which configures the energy spectrum, position, and orientation of the high-energy electron beam based on G4GeneralParticleSource) and SteppingAction (which is responsible for tracking particle stepping information and recording physical states) are instantiated respectively. fRank is explicitly passed to the SteppingAction constructor to ensure that the stepping recorder of each worker thread carries the MPI process identifier of its own. At the same time, BuildForMaster() is overridden and set to null, so that the main thread only performs management tasks such as geometry construction and physics list assembly, avoiding the creation of redundant action instances and resource contention.

[0080] In SteppingAction, the received fRank is used to build the process-specific output directory output / rank_ <frank> / , and uses std::call_once to ensure that directory initialization is performed only once per MPI process; each worker thread obtains its thread ID through G4Threading::G4GetThreadId() and appends it to all output filenames (e.g., view1_thread_ <threadid>(.txt), to achieve process-level directory isolation and thread-level file separation.

[0081] The action initialization module is seamlessly integrated with the upper-level parallel control layer (G4MPImanager initializes the MPI environment, and G4MTRunManager creates the thread pool). Within each MPI process, user action instances are independently assembled for multiple worker threads, ultimately forming a highly efficient hybrid architecture of "coarse-grained parallelism between MPI processes + fine-grained parallelism at the event level within the process". This provides a stable and reliable foundation for action scheduling and data collaborative management for large-scale simulations of hard X-ray radiation from solar flares from multiple perspectives and multiple physical quantities (imaging / energy spectrum / polarization).

[0082] Step 2.4: Define and generate a high-energy electron particle source. The initial particle source is defined and generated using the PrimaryGeneratorAction class. This module is based on the G4GeneralParticleSource (GPS) framework, supporting flexible configuration of particle type, energy, position, direction, polarization, and temporal distribution. It is optimized for MPI multi-process parallel environments, ensuring that each process uses an independent random number seed to avoid duplicate sampling.

[0083] In the specific settings, the particle type is selected as electron (e.g., electron). - The energy spectrum adopts a power-law distribution, covering an energy range of 20 keV to 1000 keV; the particle emission position is fixed at (0, 0, 3000 km), and the emission direction is along the negative Z-axis, simulating the vertical injection of an electron beam into the solar atmosphere. Furthermore, the module achieves batch event generation through GPS command scripts, with a single simulation run capable of generating up to [number missing] events. This allows the particle generation module to meet the needs of large-scale statistical simulations. It provides a self-consistent, repeatable, and high-performance parallel initial particle source for subsequent radiative transport, scattering, and detection simulations, and is a key input for constructing hard X-ray radiation simulations of flares.

[0084] Step 3 involves using a ray tracing algorithm and a custom stepping motion module to track the transmission, scattering, and polarization evolution of X-ray photons in the layered magnetized solar atmosphere in real time. This step, based on the solar atmosphere model and high-energy electron particle source constructed in Step 2, provides precise physical input for the pixelated imaging and data output in the subsequent Step 4. Specifically, it includes the following sub-steps:

[0085] Step 3.1: Based on Geant4's SteppingAction class, a custom stepping action module is constructed, overriding the UserSteppingAction core method to embed photon tracking, physical state recording, and multi-view imaging logic into each step of particle transport. Simultaneously, the BeginOfEventAction method is overridden to automatically reset the Compton scattering count, initial particle recording flag, and initial energy, direction, and other member variables at the start of each event, ensuring strict data independence between events. During the stepping process, G4Step and G4Track are used to extract the particle's 3D position, kinetic energy, momentum direction, and polarization state in the world coordinate system in real time. Particle type, event number, trajectory number, parent particle number, step number, physical process name, and preceding and following volume names are also recorded. All parameters are temporarily stored in thread-local variables. When the parent particle number is 0 and it is the first electron in the first step, it is determined to be a primary injected electron, and its position, energy, direction, and polarization state in the world coordinate system are written to the initial_particles_thread_ directory in the process's dedicated directory. <id>The .txt file serves as the source reference for bremsstrahlung photons. This innovative design solves the data aliasing problem in multi-event parallel simulations, providing an unbroken data starting point for subsequent accurate inversion of the electron beam spatial distribution.

[0086] Step 3.2: When electrons undergo bremsstrahlung, traverse the secondary particles and record the generation location, initial energy, direction of gamma photons with energies higher than 20 keV, and the electron incident direction in secondary_gamma_thread_. <id>The module generates a .txt file and immediately terminates electron transport, preserving key radiation information while improving computational efficiency. For Compton scattering of gamma photons, the direction before scattering is recorded, the scattering count of the photon is dynamically updated and persistently stored, providing direct data support for analyzing the impact of multiple scatterings on the energy spectrum and polarization. Simultaneously, at the initial generation of X-ray photons, a unique identifier is attached to them using Geant4's G4UserInformation mechanism to record the source information of the injected electrons; this identifier is transmitted throughout the photon's G4Track object, allowing it to be traced back to the source term even after multiple scatterings. When a photon triggers a valid detection event, the module automatically outputs complete link data (including source electron parameters, states before and after each scattering, and the current polarization state in the world coordinate system) along with the identifier, ensuring accurate tracking of the entire link from radiation generation to detection, providing uninterrupted data support for anisotropic radiation mechanisms and electron beam inversion.

[0087] Step 3.3: Based on the actual orbital parameters from joint observations by multiple satellites such as ASO-S and SolO, multiple virtual detector imaging planes are preset during the module initialization phase. Each detector is assigned an independent identifier and configured with geometric parameters such as spatial position and observation direction (normal vector). After each photon step, a self-developed line segment-plane intersection algorithm is invoked (the specific implementation and mathematical derivation of this algorithm will be explained in detail in step 4) to calculate the intersection point between the photon trajectory line segment and the detector plane, while simultaneously determining whether the angle between the incident direction and the plane normal meets the preset viewing angle threshold. For valid intersection events, the intersection point coordinates are accurately calculated, and the physical state of the photon (including position, energy, direction, polarization, source identification, etc.) and its corresponding detector identifier and intersection point coordinates are recorded in real time. This innovation maps the continuous photon transport dynamics into multi-view discrete sampling events and passes the original intersection data as input to the subsequent step 4. Step 4 further completes the pixel index mapping and imaging data generation, providing accurate geometric input and data foundation for generating multi-view X-ray images, energy spectra, and polarization degree data.

[0088] Step 3.4: To ensure the feasibility of large-scale parallel simulation, the module presets a photon energy threshold of 10 keV (corresponding to the lower limit of the low-energy response of the hard X-ray load). During step tracking, photon energy is monitored in real time: when the energy falls below the threshold, the photon's scattering history is cleared and its trajectory is immediately terminated; simultaneously, all secondary electrons generated during bremsstrahlung, Compton scattering, etc., are identified as non-simulated targets and killed instantly upon generation. This multi-level termination strategy significantly reduces unnecessary computational overhead and improves event throughput while ensuring physical completeness. For valid detection events that meet the detector intersection conditions, the photon physical state (including position, energy, direction, polarization, and source identification) corresponding to the event is transmitted in real time to the pixelated imaging and data output module in Step 4 via the inter-process data communication interface. This ensures a complete link from physical simulation to observation data generation, providing efficient computing power and accurate input for subsequent large-scale data generation.

[0089] Step 4: Through the pixelation imaging and data output module, the tracked photon information is mapped onto the imaging planes of multiple preset virtual detectors to generate and output X-ray images, energy spectra, and polarization data corresponding to different observation angles.

[0090] Building upon the ray tracing and custom stepping motion modules, the pixelated imaging and data output module is responsible for pixelating and structuring the generated physical information, a crucial step in generating multi-view observation data. This module employs rigorous mathematical methods to map continuous photon trajectories into discrete detector pixelated observation data. The position and viewpoint of each detector define the imaging plane, which is shaped by a reference point in space. (Detector position) and a normal vector The plane equation is determined jointly by the detector's observation direction and is as follows: ,in Let be the position vector of any point in space. At each step of the photon's motion, its trajectory can be considered as starting from the step's origin. To the end of the step A line segment. By parameterizing the line segment as ,time By substituting these parameters into the plane equation, the intersection parameters between the line segment and the plane can be solved. The algorithm then filters events that effectively intersect with the detector's imaging plane, requiring the parameters to satisfy... (The intersection point is within the current step segment), and the angle between the incident direction and the plane normal is less than a certain threshold (collimator in front of the detector).

[0091] For valid intersection events, calculate the precise coordinates of the intersection points. Assume the imaging plane is located in the local coordinate system, and the coordinates of its center point are... The coordinates of the intersection points are converted into discrete pixel indices through pixel mapping: , .in, For the set pixel size, The number of pixels on a single side of the imaging plane is , therefore the total number of pixels in the imaging plane is . It records the cumulative statistical count, energy, and polarization degree of arriving photons within each pixel.

[0092] Based on particle type, physical process, and detection conditions, the module dynamically classifies and outputs the data generated during the simulation to different structured files, enabling efficient organization and management of massive simulation results. In an MPI-based multi-process parallel computing environment, a hierarchical and independent output directory is constructed using process rank and thread ID to ensure conflict-free data storage between parallel tasks. Data writing employs a strategy combining real-time incremental saving and staged batch processing, significantly improving output efficiency and system stability under large-scale simulations while ensuring real-time data integrity.

[0093] This module, through precise mathematical mapping and efficient data management, constructs a complete output process from particle simulation to discrete multi-view observations. Ultimately, the module directly outputs data products suitable for physical analysis, including but not limited to: flare hard X-ray imaging, energy spectra, and polarization degrees from different observation perspectives. Figure 3 , Figure 4 and Figure 5 As shown, these results intuitively demonstrate the imaging morphology, energy spectrum characteristics, and polarization state of the simulated solar flare X-ray radiation under different satellite perspectives, providing a direct and reliable data basis for quantitative analysis of the anisotropy, radiation mechanism, and polarization characteristics of solar flare hard X-rays.

[0094] Example 2

[0095] This embodiment discloses a full-link simulation system for solar flare X-rays based on Geant4;

[0096] like Figure 6 As shown, the Geant4-based solar flare X-ray end-to-end simulation system includes:

[0097] The platform building module is configured to: build a high-performance hybrid parallel computing platform based on Geant4;

[0098] The structural configuration module is configured to: construct a hierarchical magnetized solar atmosphere model based on the high-performance hybrid parallel computing platform, configure a list of physical processes, and generate a high-energy electron particle source;

[0099] The ray tracing and simulation module is configured to: track the transmission, scattering process and polarization evolution of X-ray photons in the layered magnetized solar atmosphere in real time through ray tracing algorithms and a custom stepping action module;

[0100] The pixelated imaging and data output module is configured to: map the tracked photon information onto multiple preset virtual detector imaging planes through the pixelated imaging and data output module, and generate and output X-ray images, energy spectra and polarization data corresponding to different observation angles.

[0101] Example 3

[0102] The purpose of this embodiment is to provide a computer-readable storage medium.

[0103] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the Geant4-based full-link simulation method for solar flares X-rays as described in Example 1.

[0104] Example 4

[0105] The purpose of this embodiment is to provide an electronic device.

[0106] An electronic device includes a memory, a processor, and a program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps in the Geant4-based full-link simulation method for solar flares as described in Example 1.

[0107] The steps and methods involved in the apparatuses of Embodiments 2, 3, and 4 above correspond to those in Embodiment 1. For specific implementation details, please refer to the relevant description section of Embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood as including any medium capable of storing, encoding, or carrying an instruction set for execution by a processor and enabling the processor to perform any of the methods in this invention.

[0108] Those skilled in the art will understand that the modules or steps of the present invention described above can be implemented using general-purpose computer devices. Optionally, they can be implemented using computer-executable program code, thereby allowing them to be stored in a storage device for execution by a computer device, or they can be fabricated as separate integrated circuit modules, or multiple modules or steps can be fabricated as a single integrated circuit module. The present invention is not limited to any particular combination of hardware and software.

[0109] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.< / id> < / id> < / threadid> < / frank>

Claims

1. A Geant4-based method for full-link X-ray simulation of solar flares, characterized in that, include: Build a high-performance hybrid parallel computing platform based on Geant4; Based on the high-performance hybrid parallel computing platform, a hierarchical magnetized solar atmosphere model is constructed, a list of physical processes is configured, and a high-energy electron particle source is generated. Using ray tracing algorithms and a custom stepping motion module, the transmission, scattering, and polarization evolution of X-ray photons in the layered magnetized solar atmosphere are tracked in real time. The pixelated imaging and data output module maps the tracked photon information onto multiple preset virtual detector imaging planes, generating and outputting X-ray images, energy spectra, and polarization data corresponding to different observation angles.

2. The end-to-end X-ray simulation method for solar flares based on Geant4 as described in claim 1, characterized in that, The construction of the high-performance hybrid parallel computing platform based on Geant4 includes: Initialize the MPI parallel environment using G4MPImanager; Based on available computing resources, G4MTRunManager instances are adaptively created to enable multi-threaded parallelism within each MPI process.

3. The end-to-end X-ray simulation method for solar flares based on Geant4 as described in claim 1, characterized in that, The construction of the hierarchical magnetized solar atmosphere model includes: Based on the Geant4 detector construction module, with hydrogen and helium as the main components, and according to the measured solar atmospheric density profile, the atmosphere is divided into the photosphere, chromosphere, transition zone and corona in the vertical direction. By dynamically adjusting the density of each layer, the exponential decay trend of solar atmospheric density with altitude is reproduced. A magnetic field configuration is introduced into the model, setting the magnetic field direction and intensity parameters, and the influence of the magnetic field on the trajectory of high-energy electrons and the directionality of bremsstrahlung is simulated by a field manager.

4. The end-to-end X-ray simulation method for solar flares based on Geant4 as described in claim 1, characterized in that, The list of configured physical processes includes: Construct a list of X-ray radiation and transport physical processes that support both polarized and unpolarized physical modes, and enable bremsstrahlung and Compton scattering, or the corresponding standard physical processes, by switching parameters respectively. A module for calculating the transformation of photon polarization vectors from the particle coordinate system to the world coordinate system is established to unify the photon polarization state under different particle coordinate systems.

5. The end-to-end X-ray simulation method for solar flares based on Geant4 as described in claim 1, characterized in that, The source for generating high-energy electron particles specifically includes: Data isolation and output management at the process and thread levels are achieved through a custom action initialization class. A dedicated output directory is created for each MPI process, and an independent output file is generated for each worker thread. High-energy electron particle sources are defined and generated based on the G4GeneralParticleSource framework, supporting flexible configuration of particle type, energy, position, orientation and time distribution, and ensuring that each process uses an independent random number seed for MPI multi-process parallel environment.

6. The end-to-end X-ray simulation method for solar flares based on Geant4 as described in claim 1, characterized in that, Using ray tracing algorithms and a custom stepping motion module, the transmission, scattering, and polarization evolution of X-ray photons in the layered magnetized solar atmosphere are tracked in real time, including: Build a custom step action module and override the BeginOfEventAction method to reset event-related variables and ensure that data is independent between events; During the stepping process, the particle's three-dimensional position, kinetic energy, momentum direction, polarization state in the world coordinate system are extracted in real time, and the particle type, event number, trajectory number, and physical process name are recorded. The gamma photons generated by primary injected electrons and bremsstrahlung are recorded, and a source-tracing identifier is added to the photons so that they can still be traced back to the source term after multiple scatterings. Based on the orbital parameters of multi-satellite joint observations, multiple virtual detector imaging planes are preset, and each detector is assigned an independent identification number and configured with spatial position and observation direction; After each photon step, the line segment-plane intersection algorithm is called to calculate the intersection point of the photon trajectory line segment with each detector plane, and to determine whether the incident direction meets the preset viewing angle threshold. The photon physical state, detector identifier, and intersection point coordinates corresponding to the effective intersection event are recorded.

7. The end-to-end X-ray simulation method for solar flares based on Geant4 as described in claim 1, characterized in that, The pixelated imaging and data output module generates X-ray images, energy spectrum data, and polarization data from different observation perspectives by solving the effective intersection events between photon trajectories and the imaging planes of each virtual detector, mapping pixel indices, and statistically analyzing photon physical parameters. The data is also classified and output in a structured format and supports multi-process conflict-free storage.

8. A full-link simulation system for solar flares X-rays based on Geant4, characterized in that, include: The platform building module is configured to: build a high-performance hybrid parallel computing platform based on Geant4; The structural configuration module is configured to: construct a hierarchical magnetized solar atmosphere model based on the high-performance hybrid parallel computing platform, configure a list of physical processes, and generate a high-energy electron particle source; The ray tracing and simulation module is configured to: track the transmission, scattering process and polarization evolution of X-ray photons in the layered magnetized solar atmosphere in real time through ray tracing algorithms and a custom stepping action module; The pixelated imaging and data output module is configured to: map the tracked photon information onto multiple preset virtual detector imaging planes through the pixelated imaging and data output module, and generate and output X-ray images, energy spectra and polarization data corresponding to different observation angles.

9. A computer-readable storage medium having a program stored thereon, characterized in that, When executed by the processor, the program implements the steps in the Geant4-based full-link simulation method for solar flares as described in any one of claims 1-7.

10. An electronic device comprising a memory, a processor, and a program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps in the Geant4-based full-link simulation method for solar flares as described in any one of claims 1-7.