# Inversion of a Thunderstorm Cloud Charging Model Based on a 3D Atmospheric Electric Field
## Materials and Methods
### Nonlinear Inversion Method for Thunderstorm Cloud Charge Parameters
Therefore, the particle swarm optimization (PSO) algorithm is suitable to inverse the charge structure of thunderstorm cloud. The \(D\)-dimensional search space of the function randomly generates solid particles. These particles determine their movement direction by comparing the current best position and the historical best position of themselves or other particles. They approach the target by a constant updating cycle of their own speed and position, and finally find the optimal solution of the objective function as a whole [19]. The steps of using particle swarm optimization to retrieve the structural parameters of the thunderstorm cloud were as follows:  
1. Initialization of the charge structure parameters In order to avoid blind searching of structural parameters in the inversion process, the velocity and position of structural parameters need to be initialized. Combined with the classical charged structural parameters of thunderstorm clouds, the inversion parameters are limited to a certain range \([-V_{\max},V_{\max}]\) and \([-X_{\max},X_{\max}]\), the initial velocity of charge parameter \(Q_{k}\) should be \([-5,5]\), the relative distance between the thunderstorm clouds and three-dimensional atmospheric electric field meter should be assumed. The initial speed of the parameter \((|x-x_{0}|,\,|y-y_{0}|,\,z_{0})\) is \([-100,\,100]\). The initial location of the charge parameter is \([-30,\,30]\), and the initial location of the relative distance is \([-10,\)000, 10,000]. 2. Fitness function of the three-dimensional electric field The difference between the measured value \(E\) of the ground electric field and the inverted ground electric field value \(E^{*}\) is defined as a fitness function. When value \(Y\) of the fitness function approaches zero, the optimal solution of the parameters can be obtained: \[E=\left\{E_{x},E_{y},E_{z}\right\}\] (21)  
Figure 3: Schematic diagram of the thunderstorm cloud charge differentiation layer. \[E^{*}=\left\{E^{*}{}_{x},E^{*}{}_{y},E^{*}{}_{z}\right\} \tag{22}\] \[Y(Q_{1},Q_{2},\ldots,Q_{k},x-x_{0},y-y_{0},z_{0})=\left\{E_{x}-E_{x}{}^{*},E_{ y}-E_{y}{}^{*},E_{z}-E_{z}{}^{*}\right\} \tag{23}\]
3. Find the initial extremum of the inversion parameter set Assuming the population size \(i\) of the charged structure parameter is 5 and the dimension of search space \(D\) is the number of inversion variables, and assuming the thunderstorm cloud is a classical three-layer charged structure, then \(D=9\). That is, the inversion parameter set is \(\left\{Q_{1},Q_{2},\ldots,Q_{k},Q_{1}{}^{\prime},Q_{2}{}^{\prime}\ldots,Q_{k}{ }^{\prime},|x-x_{0}|,|y-y_{0}|,z_{0}|\right\}\). If it is a two-layer charged structure, then \(D=5\), that is, the set of inversion parameters is \(\left\{Q_{1},Q_{2},\ldots,Q_{k},|x-x_{0}|,|y-y_{0}|,z_{0}|\right\}\). The initial extremum \(P_{best}\) of each parameter of the charged structure is the position of the individual when the initial fitness is optimal, and the global initial extremum \(G_{best}\) is the position with the best fitness searched in the \(i\) parameter sets. Let the initial velocity of the \(i\) structural parameters be \(V_{i}=\left[V_{i1},V_{i2},\ldots,V_{iD}\right]^{T}\), the individual initial extremum \(P_{i}\) is \(P_{i}=\left[P_{i1},P_{i2},\ldots,P_{iD}\right]^{T}\), and the population initial global extremum \(G_{i}\) is \(G_{i}=\left[G_{i1},G_{i2},\ldots,G_{iD}\right]^{T}\). 4. Update of inversion parameters The velocity and position of the structural parameters in the \(k+1\) iteration are obtained by updating the individual extremum \(P_{best}\) and the global extremum \(G_{best}\) of the \(k\)th iteration.