Genetic algorithm-based high-power klystron electron gun surface electric field gradient optimization method
By optimizing the focusing pole geometric parameters of the electron gun through genetic algorithms, the problems of poor electric field gradient and beam current characteristics in high-power klystron tubes were solved, multi-objective optimization of the electron gun was achieved, and the stability and life of the klystron tube were improved.
Patent Information
- Application Number
- CN202511018719.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-23
- Publication Date
- 2025-10-17
AI Technical Summary
Traditional electron gun designs find it difficult to achieve multi-objective optimization under high-power conditions, especially due to the poor laminar flow characteristics and clustering effect of the electron beam, which leads to distorted electric field distribution and increased risk of vacuum breakdown, affecting the reliability and life of the klystron.
A multi-objective optimization method based on genetic algorithm is adopted to optimize the focusing pole geometric parameters of the electron gun using the NSGA-Ⅱ algorithm. Combined with DGUN and CST simulation software, the electron beam current, beam waist radius and surface electric field gradient are optimized to achieve the Pareto optimal solution set.
Significantly reduce the electric field gradient on the electron gun surface, improve the electron beam forming effect, reduce the risk of vacuum breakdown, improve device stability and life, and achieve coordinated optimization of electrical and thermal performance.
Smart Images

Figure CN120805481A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of microwave vacuum tube design, and particularly relates to a high-power klystron electron gun surface electric field gradient optimization method based on a genetic algorithm. BACKGROUND
[0002] A high-power klystron is a microwave vacuum electron device widely used in radar, communication and particle accelerator fields, and its performance is crucially dependent on the design quality of the electron gun. The electron gun emits electrons through a hot cathode and forms a high-energy electron beam under the action of an electric field. The laminar flow characteristics and bunching effect of the electron beam directly affect the output power and stability of the klystron. Traditional electron gun design is mainly based on Pierce theory, which realizes the preliminary shaping of the electron beam by optimizing the geometric parameters of the cathode and anode. However, with the continuous improvement of the power level and operating voltage of the klystron, the spatial charge effect and anode aperture effect of the electron beam are intensified, leading to distortion of the electric field distribution and complication of the electron trajectory, making it difficult for traditional design methods to meet the performance requirements under high-power conditions.
[0003] As a key component of the electron gun, the focusing electrode is used to compensate for the edge electric field distortion and improve the focusing effect of the electron beam. However, there is a complex nonlinear relationship between the geometric parameters of the focusing electrode (such as the included angle, fillet radius, and distance from the anode) and performance indicators such as the current, beam waist radius, and surface electric field gradient of the electron beam. Traditional trial-and-error methods or single-objective optimization methods cannot achieve the coordinated optimization of multiple objectives. In addition, a high surface electric field gradient of the electron gun under high power can cause local discharge, increasing the risk of vacuum breakdown, further limiting the reliability and life of the klystron.
[0004] In recent years, the development of computational simulation technology and intelligent optimization algorithms has provided new solutions for electron gun design. Multi-objective genetic algorithms (such as NSGA-II) can efficiently handle multi-variable and multi-objective optimization problems, making them suitable for complex geometric parameter optimization of the electron gun. However, existing researches mostly focus on the improvement of a single performance indicator, lacking comprehensive optimization of the electric field gradient, beam current characteristics, and thermal effects. Therefore, there is an urgent need for an efficient and automated multi-objective optimization method that takes into account both the electrical performance and thermal stability of the electron gun to meet the design requirements of high-power klystrons. SUMMARY
[0005] To solve the above technical problems, the application provides a high-power klystron electron gun surface electric field gradient optimization method based on a genetic algorithm, which solves the problems of difficulty in constructing an electron trajectory model, complex relationship between design variables and design targets, and difficulty in balancing multiple design requirements due to poor laminar flow characteristics and bunching effect of the electron beam under high-power design requirements, improves design efficiency, and obtains a design scheme that meets performance indicators.
[0006] To achieve the above-mentioned purposes, the application adopts the following technical solutions:
[0007] A high-power klystron electron gun surface electric field gradient optimization method based on genetic algorithm, the method comprises:
[0008] Step 1, determine the basic structure parameters of the klystron electron gun cathode and anode according to Pierce electron gun design theory;
[0009] Step 2, parameterize the focusing electrode, and represent the geometric structure as four coordinate parameters;
[0010] Step 3, call the DGUN software to perform two-dimensional beam simulation calculation, and obtain electron beam shaping characteristic parameters, including electron beam current, beam waist radius and surface electric field gradient;
[0011] Step 4, based on the NSGA-II multi-objective genetic algorithm, taking the focusing electrode coordinate parameters as the design variables, taking the electron beam current, the beam waist radius and the surface electric field gradient as the optimization objectives, obtaining the Pareto optimal solution set through multi-objective optimization, and finally verifying the optimization result by using the CST three-dimensional calculation.
[0012] In a second aspect, the present application provides an electronic device, comprising: one or more processors;Memory for storing one or more programs;Wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the foregoing method for optimizing the surface electric field gradient of the high-power klystron electron gun based on the genetic algorithm.
[0013] In a third aspect, the present application provides a computer readable storage medium having stored thereon executable instructions that, when executed by a processor, can cause the processor to implement the foregoing method for optimizing the surface electric field gradient of the high-power klystron electron gun based on the genetic algorithm.
[0014] The present application has the following advantages:
[0015] Improve optimization efficiency and automation level: through the Python-based automated optimization program, call the DGUN software to perform simulation calculation, and integrate the NSGA-II multi-objective genetic algorithm, realize the rapid iterative optimization of the electron gun parameters, and greatly reduce the calculation time and cost of traditional manual trial and error.
[0016] Multi-objective collaborative optimization: taking the electron beam current, the beam waist radius and the surface electric field gradient as the optimization objectives, effectively balancing multiple performance indicators through the improved NSGA-II algorithm (such as hierarchical initial population selection, elite reservation mechanism), avoiding falling into local optimum, and obtaining the Pareto optimal solution set satisfying the design requirements.
[0017] Significant reduction of electric field gradient: the maximum electric field gradient of the optimized electron gun surface is reduced from 31 kV / mm of the traditional design to 20.08 kV / mm, making the electric field distribution more uniform, reducing the risk of vacuum breakdown, and improving the working stability and life of the device.
[0018] Design reliability verification: through CST three-dimensional electromagnetic simulation and particle tracking simulation, the accuracy of the optimization scheme is verified, the electron beam shaping effect is good, the flow coefficient meets the design requirements, and the high field strength area is significantly reduced.
[0019] Thermal design and optimization: after completing the electric field optimization, further adjust the support structure through ANSYS thermal analysis to ensure the geometric stability of the electron gun under high temperature working conditions, so that the flow coefficient remains within a reasonable range, realizing the synergistic optimization of electrical performance and thermal performance. BRIEF DESCRIPTION OF DRAWINGS
[0020] Figure 1 A flowchart of the present application, a high-power klystron electron gun surface electric field gradient optimization method based on genetic algorithm;
[0021] Figure 2 A schematic diagram of the focusing pole parameterization process;
[0022] Figure 3 A schematic diagram of the multi-objective genetic algorithm;
[0023] Figure 4 A cross-sectional view of the complete thermal design model of the optimized electron gun. DETAILED DESCRIPTION
[0024] The present application will be further described below in conjunction with the drawings and examples.
[0025] As shown in the drawings, Figure 1 The present application provides a high-power klystron electron gun surface electric field gradient optimization method based on genetic algorithm, which comprises the following steps:
[0026] Step 1: Determine the klystron electron gun design index by taking the Stanford Linear Accelerator Center (SLAC) 5045 klystron as a reference, and determine the basic structure parameters of the electron gun cathode and anode according to the Pierce electron gun classical design theory;
[0027] The klystron electron gun is a spherical diode capacitor. Electrons generated by the hot cathode are accelerated and clustered under the action of the electric field between the electrodes to form an electron beam. The beam induces a space charge in the inner wall of the electron gun, forming a self-consistent electric field, which causes the total electric field distribution to change. The existence of the space charge field makes the space potential no longer uniform, producing longitudinal and transverse potential drops, affecting the transit angle of the electrons (static space charge effect). Longitudinal potential drop helps the electron beam to cluster.
[0028] With the increase of klystron power, the beam current density and the beam guiding factor increase, the Coulomb force and the oscillation between electrons increase, which destroys the laminar flow and the bunching characteristics of the electron beam, and the electron trajectory tends to be complex. At high power, the electron trajectory is difficult to accurately describe by an analytical expression, and the electric field of the electron gun is distorted due to the complexity of the space charge distribution, so the electric field of the electron gun surface needs to be analyzed.
[0029] One of the reasons for the distortion of the electric field of the electron gun surface is the anode hole effect. The increase of power and current causes the anode hole to become larger, and the electric field is distorted near the anode hole. The electric lines of force penetrate into the anode hole, which causes the electric field near the anode to have a radial component, which has a deconcentration effect on the electron beam, causing the divergence of electrons and affecting the performance. The introduction of a focusing electrode at a suitable position can effectively compensate for the anode hole effect.
[0030] The present application sets the design index of the electron gun according to the working parameters of the SLAC5045 klystron. The parameters of the cathode and the anode of the electron gun are designed according to the Pierce theory, and the Pierce angle is temporarily used as the parameter of the focusing electrode, and the focusing electrode and the anode are rounded.
[0031] Table 1
[0032] Table 2
[0033] Step 2, parameterize the focusing electrode and study the influence on the electron beam and the electric field, and then represent the two-dimensional geometric structure as four coordinate parameters;
[0034] As shown in Figure 2 , the geometric structure of the focusing electrode is: a circular arc tangent to the horizontal outer edge of the focusing electrode and the internal straight line of the focusing electrode, and the internal and external straight lines; the geometric characteristics can be summarized as three parameters:
[0035] the focusing electrode angle , the focusing electrode-anode distance , and the focusing electrode rounding radius . Among them, the focusing electrode angle refers to the positive angle between the straight line segment of the focusing electrode and the axis, the focusing electrode-anode distance refers to the minimum distance between the focusing electrode and the anode axis direction, and the focusing electrode rounding radius refers to the radius at the focusing and arc. Using DGUN, the influence of each parameter on the beam current and the surface electric field gradient is studied by the control variable method, and the results are as follows:
[0036] The focusing electrode angle varies in the range of 0°~42.5°, (gradient °);Focusing pole angle increase caused the electron gun current increase, current loss increased. The reason is that the increase of the angle makes the cathode near the electric field potential line arc small, density increases, cathode emission electron increases, current density increases; the influence of anode electric field and the maximum electric field strength is not significant.
[0037] Focusing pole-anode distance In the range of 10.64 mm~25.64 mm (gradient 1 mm);The distance increases also cause the current to increase but the loss increases, the bunching effect is poor, the reason is similar to the increase of the focusing pole angle (the electric field potential line distribution near the cathode is more dense);The influence of the maximum electric field strength is not significant.
[0038] Focusing pole fillet radius In the range of 6 mm~13 mm (gradient 0.5 mm);The increase of the fillet radius will make the cathode field strength decrease, the emission electron decreases, the current density decreases, but the focusing pole field strength increases, the anode field strength decreases.
[0039] To obtain the beam current, beam waist radius, electric field strength and other multi-targets, it is necessary to comprehensively analyze the correlation between the focusing pole parameters and the electron gun performance, and to adjust the three parameters coordinately. The electron beam current is the core parameter of the electron gun. The correlation analysis (such as MATLAB correlation coefficient matrix analysis) of the three parameters of the focusing pole and the current and current loss in the acceleration zone shows that:
[0040] Focusing pole-anode distance Strong positive correlation with the electron gun current (correlation coefficient>0.95).
[0041] Focusing pole fillet radius Negative correlation with the electron gun current (correlation coefficient~-0.95).
[0042] Focusing pole angle Also shows a strong positive correlation with the electron gun current.
[0043] The three parameters have significant and complex interactive effects on the electron beam shaping: there are contradictions between the parameters (such as increasing the focusing pole-anode distance to improve the current but may cause the electron beam divergence to increase; increasing the focusing pole fillet radius to suppress the current loss but weaken the focusing effect);There is a nonlinear synergistic effect between the parameters (such as the change of the focusing pole angle will affect the correlation between other parameters and the current characteristics). The subsequent optimization design needs to be based on this analysis, through adjusting the geometric parameter combination of the focusing pole, to realize the dual optimization goals of maximizing the beam current and minimizing the current loss.
[0044] Before calling DGUN to participate in the NSGA-Ⅱ algorithm optimization, the focusing pole geometry needs to be parameterized into four coordinate variables ( ), written into the DGUN input file as optimization parameters. The three geometric parameters of the focusing pole can be The calculation can be obtained:
[0045] ,
[0046] ,
[0047] ,
[0048] In the coordinate variables, (e, f) represents the coordinates of the first point of the focusing pole geometric curve in the two-dimensional plane, R represents the radius of the arc, and C represents the central angle of the arc from the coordinates (e, f) to the center height of the focusing pole arc.
[0049] Step 3: Use DGUN two-dimensional beam simulation software to obtain key characteristic parameters of electron injection molding, including beam current, beam waist radius and surface electric field gradient;
[0050] The DGUN two-dimensional calculation software constructs a model by inputting the endpoints and center coordinates of the line segments on the surface of each electrode of the electron gun.
[0051] Step 4: Build a NSGA-Ⅱ (non-dominated sorting genetic algorithm Ⅱ) multi-objective optimization program based on Python, take the focusing polar coordinate parameters as design variables, and use the electron beam current, beam waist radius and surface electric field gradient as optimization targets, and obtain the Pareto optimal solution set through the multi-objective genetic algorithm; Figure 3 Shown, including:
[0052] Step 4.1: Determine the number of objective functions, the number of decision variables and their boundaries, and randomly generate the initial population;
[0053] Latin hypercube sampling (LHS) was used to select 100 individuals from the initial population within the parameter range to more comprehensively cover the variable range. The number of iterations was set to 30.
[0054] The maximum electric field gradient on the electron gun surface is set to no more than 22 kV / mm. The following three key indicators are selected as optimization targets:
[0055] Electron gun beam current : Target constraint range 410 A ~ 415 A.
[0056] Waist radius : Target constraint range 13.5 mm ~ 13.6 mm.
[0057] Maximum electric field gradient on the surface of the electron gun : Target value < 22 kV / mm (minimize).
[0058] According to the focusing pole parameter influence and geometric relationship restriction, set the focusing pole geometric parameter variation range:
[0059] ,
[0060] Further determine the coordinate variable value range:
[0061] ;
[0062] Step 4.2, calculate the objective function value of each individual, and arrange non-dominated;
[0063] Step 4.3, adopt the bidding race selection method to select the arranged sequence objects in step 4.2 (preferentially select those with high ranking, and select those with large crowding degree when the ranking is the same); generate offspring using the simulated binary crossover algorithm (according to the crossover probability); perform polynomial mutation on the offspring (adjust the decision variables according to the mutation probability); combine the parent and offspring populations; perform non-dominated sorting and crowding calculation on the combined population, and select the first N individuals to form a new population according to the ranking and crowding degree;
[0064] Generate offspring using simulated binary crossover (probability 0.6) and polynomial mutation (probability 0.2). After merging the parent and offspring, perform non-dominated sorting and crowding calculation, and select the first 100 individuals to form a new population. The number of elite individuals is set to 5.
[0065] Step 4.4, judge the termination condition: if satisfied, output the result, otherwise return to step 4.3.
[0066] Set the threshold and penalty mechanism of the fitness function. According to the priority of the optimization target (beam current > beam waist radius > electric field gradient), set the weight and different degrees of punishment:
[0067] When the actual value is within the target threshold range, the fitness value = (actual value - target value) 2 ;
[0068] When the actual value exceeds the acceptable range, return a larger penalty value. The specific settings are shown in Table 3. The remaining program parameters of NSGA-II are set as shown in Table 4.
[0069] Table 3
[0070] Table 4
[0071] According to the iteration results of the NSGA-II program, the beam waist radius and the maximum electric field gradient gradually converge with the increase of the algebra: the beam waist radius is concentrated near 13.6 mm, and the electric field gradient is concentrated near 20 kV / mm. The calculation results in the current range of 412-414 A are preferentially selected, and in the scheme in which the beam waist radius meets the requirements, the scheme with the minimum surface electric field gradient is selected. Finally, the scheme parameters are selected as: the beam current = 412 A, the beam waist radius = 13.6 mm, and the maximum electric field gradient = 20.08 kV / mm. The results calculated by using the DGUN show that the equipotential lines are uniformly distributed in the acceleration region; the beam current has no wall-punching phenomenon, and the anode has no abnormal thermal load, which meets the design requirements.
[0072] The CST particle studio is used to verify the optimization results in three dimensions:
[0073] The optimized two-dimensional geometric model is constructed into a three-dimensional model by rotating along the axis in SolidWorks, and is imported into CST, and the front 125 mm part of the electron gun core is reserved.
[0074] The vacuum working environment is set to (the relative dielectric constant is 1, and the relative magnetic permeability is 1). The electrode material is a perfect electric conductor (PEC). The boundary conditions are: the radial direction-electric boundary (the tangential electric field component is 0); the axial negative direction-magnetic boundary (the tangential magnetic field component is 0); and the axial positive direction-open boundary. The electric potential is: the anode is 0 V, and the cathode and focusing electrode potential are-350 kV. The particle source is the hot cathode surface, and the emission model is selected as the space charge limited current.
[0075] The hexahedral mesh is used, the mesh near the cathode and the anode is refined, and the total number of meshes is about 1.4 million. The particle tracking is iterated for 30 generations.
[0076] The CST calculation results show that the beam current conduction coefficient converges to 2 μP, which meets the design requirements.
[0077] When the optimized scheme is compared with the SLAC5045 electron gun and the initial scheme without optimization, the maximum electric field gradient of the SLAC5045 electron gun (CST simulation) is 31 kV / mm. Under the same electric field cloud color, the high field strength area of the optimized scheme is significantly smaller than that of the SLAC5045 scheme, and the field strength distribution between the cathode and the focusing electrode is more uniform, which indicates that the electric field gradient is effectively reduced. The beam shaping effect of the initial scheme without optimization is poor, the anode head has a wall-punching phenomenon, and the beam current conduction coefficient is too large, which does not meet the requirements. The comparison results verify the effectiveness of the optimization algorithm.
[0078] As Figure 4The optimized electron gun support, heat shield and sleeve part are designed completely as shown. The complete three-dimensional model is imported into ANSYS for thermal analysis:
[0079] Global tetrahedral meshing is used, and local encryption is added.
[0080] Material properties are set: tungsten for the cathode and filament part, copper for the anode head, molybdenum for the heat shield part and electron gun support, high-voltage insulating ceramic cylinder for porcelain, and the rest for stainless steel.
[0081] Boundary conditions are set: define the ambient temperature as 25℃, and the heat source makes the cathode surface temperature reach 1000℃. Thermal conduction and thermal radiation in vacuum environment are considered.
[0082] Temperature distribution analysis shows that high temperature is concentrated in the cathode and focusing pole, and there is no temperature change in the anode part.
[0083] Thermal deformation analysis shows that the maximum displacement is located in the area near the anode outside the focusing pole and the cathode. After deformation, the electron gun flow guide coefficient is reduced to 1.89 μP, which does not meet the requirements.
[0084] Adjust the position of the electron gun support so that the cathode and anode can deform to the expected size in the working state, and generate an electron beam that meets the design requirements, thereby completing the optimization design and complete thermal design of the electron gun.
[0085] In a second aspect, the present application provides an electronic device, comprising: one or more processors; a memory for storing one or more programs; wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the aforementioned genetic algorithm-based high-power klystron electron gun surface electric field gradient optimization method.
[0086] In a third aspect, the present application provides a computer-readable storage medium having executable instructions stored thereon, which when executed by a processor, can enable the processor to implement the aforementioned genetic algorithm-based high-power klystron electron gun surface electric field gradient optimization method.
[0087] The above specific embodiments further illustrate the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application and is not intended to limit the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm, characterized in that: The method comprises: Step 1: Determine the basic structural parameters of the cathode and anode of the klystron electron gun according to the Pierce electron gun design theory; Step 2: parameterize the focusing pole and express its geometric structure as four coordinate parameters; Step 3: Use DGUN software to perform two-dimensional beam simulation calculations to obtain electron injection molding characteristic parameters, including electron beam current, beam waist radius, and surface electric field gradient; Step 4: Based on the NSGA-Ⅱ multi-objective genetic algorithm, with the focusing polar coordinate parameters as the design variables and the electron beam current, beam waist radius and surface electric field gradient as the optimization targets, the Pareto optimal solution set is obtained through multi-objective optimization, and finally the CST three-dimensional calculation is used to verify the optimization results.
2. The method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm according to claim 1, characterized in that: The basic structural parameters in step 1 include the cathode radius , cathode disk radius , anode radius , anode hole radius , cathode-anode distance , anode coordinates , waist radius , waist coordinates .
3. The method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm according to claim 2, characterized in that: The two-dimensional geometric structure of the focusing pole in step 2 includes an arc tangent to the horizontal outer edge of the focusing pole and the inner straight line of the focusing pole, as well as the inner and outer straight lines; the parameterization is reduced to the focusing pole angle , focusing electrode-anode distance , Focusing pole corner radius .
4. The method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm according to claim 3, characterized in that: The focusing angle Refers to the angle between the focusing electrode straight line segment and the positive axis, the focusing electrode-anode distance Refers to the minimum distance between the focusing electrode and the anode axis, the radius of the focusing electrode corner Refers to the radius of the focus and arc.
5. The method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm according to claim 3, characterized in that: The step 2 comprises: parameterizing the two-dimensional geometric shape of the focusing pole into four coordinate variables ( ): , , , In the coordinate variables, (e, f) represents the coordinates of the first point of the focusing pole geometric curve in the two-dimensional plane, R represents the radius of the arc, and C represents the central angle of the arc from the coordinates (e, f) to the center height of the focusing pole arc.
6. The method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm according to claim 1, characterized in that: The step 4 comprises: Step 4.1: Determine the number of objective functions, the number of decision variables, and their boundaries, and use hypercube sampling to generate the initialization population in layers within the parameter value range. Step 4.2: Calculate the objective function value of each individual and perform non-dominated permutation; Step 4.3: Use the tournament selection method to select the permutation sequence object in step 4.2, use the simulated binary crossover algorithm to generate offspring, perform polynomial mutation on the offspring, merge the parent and offspring populations, perform non-dominated sorting and crowding calculation on the merged population, and select the top N individuals according to the sorting rank and crowding degree to form a new population; Step 4.4: Determine the termination condition: if it is met, output the Pareto solution; otherwise, return to step 4.
3.
7. The method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm according to claim 6, characterized in that: In step 4.1, the maximum electric field gradient on the electron gun surface is set to no more than 22 kV / mm, and the following three key indicators are selected as optimization targets: Electron gun beam current : Target constraint range 410 A ~ 415 A; Waist radius : Target constraint range 13.5 mm ~ 13.6 mm; Maximum electric field gradient on the electron gun surface : Target value is less than 22 kV / mm.
8. The method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm according to claim 6, wherein: In step 4.1, the range of focus pole geometric parameters is set according to the influence of focus pole parameters and geometric relationship restrictions: , This determines the range of coordinate variables: 。 9. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more programs; When one or more programs are executed by the one or more processors, the one or more processors implement the method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm as described in any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor can implement the method for optimizing the surface electric field gradient of a high-power klystron electron gun based on a genetic algorithm as described in any one of claims 1 to 8.