Drift-kinetic PIC model for simulations of longitudinal plasma confinement in mirror traps V.V. Glinskiy, I.V. Timofeev, V.V. Prikhodko Abstract The paper presents a 1D2V electrostatic PIC model with a drift-kinetic description of all particle types aiming at simulating classical longitudinal plasma transport in axially symmetric open traps. The model generalizes the semi-implicit particle-in-cell method with exact conservation of energy and charge to the case of collisional plasma and adapts it to boundary conditions on perfectly conducting walls with a floating potential. Implementation of Coulomb collisions is tested on the problem of temperature relaxation in a two-component plasma and demonstrates good agreement with the analytical theory. Since quasi-neutrality of plasma is not strictly determined, the model is able to correctly reproduce the ambipolar electric potential profile up to the walls. At the same time, the main advantage of implicit PIC simulations — the ability to use large grid steps, many times larger than the Debye radius — does not prevent the correct modeling of the near-wall electric potential jump. The model satisfactorily reproduces the known results of the Debye sheath theory and the Bohm criterion. A comparison of stationary plasma profiles formed in a mirror trap in the presence of a constant particle source with the results of simulations using the hybrid code MIDAS showed that self-consistent consideration of electron kinetics in expanders leads to noticeable (at the level of 15%) differences in the electron temperature, potential, and density of the confined plasma. I Introduction Modeling the processes of plasma confinement in magnetic traps is one of the most pressing and computationally challenging problems in plasma physics. Growing interest in magnetic traps with open field lines has recently stimulated the development of numerical models capable of taking into account the main feature of these systems — direct contact of the plasma with the material walls. To weaken such contact, open traps use expanders in which the magnetic field is reduced by tens and hundreds of times. The challenge in modeling such systems lies in the need to kinetically describe not only the ions but also the electrons, which is extremely expensive due to the huge gap in the characteristic spatial and temporal scales determined by these types of particles. To overcome this difficulty, a hybrid approach is often used in simulations. While ions are described kinetically, electrons are replaced by a quasi-neutral fluid with a Boltzmann distribution and a uniform temperature along the whole system 16 ; 3 ; 6 . This simplification may be justified in the central region between magnetic mirrors, where the electron component is close to thermodynamic equilibrium, but it becomes inapplicable in the expander where electrons are weakly collisional, meaning that their distribution function can deviate significantly from the Maxwellian 24 ; 8 ; 23 . This does not allow the hybrid approach to correctly describe the physics of the expander and reliably predict the profile of the ambipolar potential which arises due to the escape of fast electrons from the trap and leads to the locking of the energy losses of the hot plasma on the wall 17 ; 11 ; 21 . In the recent paper 9 , we have proposed a collisionless version of the one-dimensional drift-kinetic model based on the energy-conserving semi-implicit particle-in-cell (PIC) method 14 ; 2 . The main advantage of this semi-implicit model is its ability to kinetically describe all plasma components at large spatial steps (many times greater than the Debye radius \lambda_{D} ) without the nonlinear iterations inherent in fully implicit schemes 12 ; 4 . Conservation of energy in such a numerical scheme is achieved because the electric field is found not from the Poisson equation (as usual for electrostatic models), but from the Ampere’s law. In this case, for automatic implementation of the Gauss law (local conservation of charge), the current is corrected in the model in order to accurately satisfy the continuity equation. Accurate local charge conservation provides lower noise levels, allowing for savings in the number of particles per cell. Energy conservation is also important for modeling long-term processes such as plasma confinement in real experimental setups. However, to carry out a realistic numerical experiment aimed at studying classical longitudinal losses in experimental facilities such as GDT, GOL-NB or GDMT 1 ; 19 ; 18 , it is necessary to add at least two key elements to the developed model: (i) Coulomb collisions between particles and (ii) a correct description of the interaction of plasma with the conducting walls limiting the plasma volume. Coulomb collisions are responsible for the scattering of ions into the loss cone and determine the plasma confinement time, while realistic boundary conditions allow the ambipolar potential and edge plasma to be correctly reproduced in the model. Thus, taking these two elements into account simultaneously is a necessary step to create a self-consistent model capable of quantitatively predicting the parameters of the confined plasma. This paper presents the results of testing two modules that have been added to the drift-kinetic PIC code ADEPT (Axial Drift-kinetic Electrostatic code for Plasma Transport). The first module implements a Monte Carlo algorithm for energy-conserving binary Coulomb collisions based on the Takizuka-Abe method 22 . The second module describes the absorption of particles by perfectly conducting walls, inside which the electric field must become zero. Similar boundary conditions have already been used in the previous paper 9 , but a detailed recipe for their implementation without violating the law of conservation of energy will be discussed for the first time. To demonstrate the capabilities of the extended code, we simulate the problem of continuous injection of particles into a mirror trap with conductive end walls. Stationary profiles of density, temperature and other plasma parameters are compared with similar calculations using the hybrid code MIDAS 16 . This made it possible to determine the differences that the kinetic description of electrons leads to in this problem. II 1D drift-kinetic PIC code The numerical code ADEPT presented in this paper is based on the 1D2V PIC model 9 , in which the semi-implicit particle-in-cell method with exact conservation of energy and local charge is generalized to drift-kinetic equations that track the motions of not the particles themselves, but their Larmor centers. Unlike most electrostatic models, the electrostatic version of Ampère’s law is used here instead of Poisson’s equation to determine the electric field. In this paper, we show how to include Coulomb collisions in this model and implement perfectly conducting walls at the boundary of the region without violating the law of energy conservation. A key improvement to the code, which made it possible to conduct numerical experiments on a realistic scale, was the porting of the parallel CPU version of the code to graphics accelerators (GPUs). This resulted in significant performance gains. For example, testing on an NVIDIA Tesla V100 GPU demonstrated a 3-5x acceleration compared to performance on an AMD EPYC 7773X. The achieved computational speed made it possible to carry out simulations with the real mass of ions in a reasonable time. Next, we describe in detail the main modules of the improved code. Section II.1 is devoted to the basic algorithm described in 9 . Section II.2 presents the implementation of Coulomb collisions. Finally, section II.3 discusses the algorithm for particle interactions with conducting walls. II.1 The kernel of the code In the drift-kinetic approximation, the longitudinal motion of the guiding centers of particles inside a thin magnetic field tube is described by the equations: \displaystyle\frac{dz_{p}}{dt}=v_{\|p}, (1) \displaystyle m_{p}\frac{dv_{\|p}}{dt}=q_{p}E(t,z_{p}(t))-\mu_{p}\left(\frac{dB}{dz}\right)_{z=z_{p}}, (2) \displaystyle\mu_{p}=\frac{m_{p}v_{\bot p}^{2}(t)}{2B(z_{p}(t))}=\rm{const}, (3) where \mu_{p} is the magnetic moment of a particle that is conserved during its motion, B(z) is the stationary magnetic field inside the tube, v_{\parallel} and v_{\perp} are longitudinal and transverse to the magnetic field components of the particle velocity. Further in this section we will omit the index \parallel and use dimensionless quantities that are measured in the following units: masses in the mass of an electron m_{e} , charges in the charge of an electron e , velocities in the speed of light c , time in the reciprocal plasma frequency \omega_{pe}=\sqrt{4\pi e^{2}n_{0}/m_{e}} , spatial coordinates in c/\omega_{pe} , electric and magnetic fields in m_{e}c\omega_{pe}/e , current densities in en_{0}c . All particles of the same type, regardless of their position on the field line, have the same mass and charge m_{p}=q_{p}=n_{0}V_{0}/N_{0} , where n_{0} is the plasma density at the center of the system, V_{0} is the volume of the central cell, and N_{0} is the number of macroparticles in this cell. Thus, to set a uniform density in cells with a different grid coordinate z_{g}=gh and a different volume V_{g} , we change the number of macroparticles N_{g}=N_{0}V_{g}/V_{0} . The shape of macroparticles is described in our model by the linear PIC kernel W(z-z_{p}) . Using this shape function, the grid values of the electric field E_{g} are interpolated onto a particle with coordinate z_{p} according to the rule E_{p}=\sum\limits_{g}E_{g}W(z_{g}-z_{p}), (4) and the current from the particle with number p is distributed among the grid nodes according to the formula J_{g}^{p}=q_{p}v_{p}W(z_{g}-z_{p})/V_{g}. (5) In our method, each time step consists of a prediction stage and a correction stage. The prediction stage begins with a shift of a particle with the known velocity, v_{p}^{n} , by half a time step, \tau/2 : z_{p}^{n+1/2}=z_{p}^{n}+\tau v_{p}^{n}/2, (6) then the field values at the new time step E_{g}^{n+1} are predicted by solving a system of linear algebraic equations 9 : \displaystyle E_{g}^{n+1}+\sum\limits_{g^{\prime}}\mathcal{L}_{gg^{\prime}}E_{g^{\prime}}^{n+1}=F_{g}, (7) \displaystyle\mathcal{L}_{gg^{\prime}}=\frac{\tau^{2}}{4V_{g}}\sum\limits_{p}\frac{q_{p}^{2}}{m_{p}}W(z_{g}-z_{p}^{n+1/2})W(z_{g^{\prime}}-z_{p}^{n+1/2}), (8) \displaystyle F_{g}=E_{g}^{n}-\frac{\tau}{V_{g}}\sum\limits_{p}q_{p}\times \displaystyle\times\left[v_{p}^{n}+\frac{\tau}{2m_{p}}\left(\frac{q_{p}}{2}E_{p}^{n}-\mu_{p}B_{p}^{\prime}\right)\right]W(z_{g}-z_{p}^{n+1/2}). (9) The predicted field is used to find the new coordinate of the particle: z_{p}^{n+1}=z_{p}^{n+1/2}+\tau v_{p}^{n+1}/2, (10) where the velocities v_{p}^{n+1} at a new time step are determined from the equation of motion \displaystyle m_{p}\frac{v_{p}^{n+1}-v_{p}^{n}}{\tau}=q_{p}E_{p}^{n+1/2}-\mu_{p}B_{p}^{\prime}, (11) \displaystyle E_{p}^{n+1/2}=\sum\limits_{g}\frac{\left(E_{g}^{n+1}+E_{g}^{n}\right)}{2}W(z_{g}-z_{p}^{n+1/2}), (12) \displaystyle B_{p}^{\prime}=\sum\limits_{g}\frac{B_{g+1}-B_{g-1}}{2h}W(z_{g}-z_{p}^{n+1/2}). (13) Figure 1: Time dependence of the (a) electron and (b) ion temperatures averaged over the entire system for different numbers of particles in the cell. In (b), the solid curves show the longitudinal ion temperature T_{i\parallel} , while the dotted curves show the transverse T_{i\perp} . T_{i\parallel} is the average doubled longitudinal kinetic energy of ions, and T_{i\perp} is their average transverse energy . The red curve is the theoretical dependence of T_{e} on time ( 17 ). Since the current \tilde{J}_{g}^{n+1/2} calculated from the particle shape does not satisfy the continuity equation exactly (or, equivalently, slightly violates the Gauss’s law), and the chosen method of approximating the magnetic field gradient leads to a small error in the energy conservation law Q , Q=\sum\limits_{p\in s}\mu_{p}\sum\limits_{g}\left\{\tau\tilde{v}_{p}^{n+1/2}\left(\frac{B_{g+1}-B_{g-1}}{2h}\right)W(z_{g}-z_{p}^{n+1/2})-B_{g}\left[W(z_{g}-z_{p}^{n+1})-W(z_{g}-z_{p}^{n})\right]\right\}, (14) a correction step is required in which the conservation of energy and charge will be restored. For this purpose, using the known positions of the particles z_{p}^{n} and z_{p}^{n+1} , the current J_{g}^{n+1/2} is calculated directly from the continuity equation using the density decomposition method 7 . The electric field is then corrected E_{g}^{n+1}-\tilde{E}_{g}^{n+1}=-\tau\left(J_{g}^{n+1/2}-\tilde{J}_{g}^{n+1/2}\right), (15) which creates an additional error in energy. To restore the law of global energy conservation, the particle velocities \tilde{v}_{p}^{n+1} obtained at the prediction stage are multiplied by a correction coefficient, v_{p}^{n+1}=\lambda\tilde{v}_{p}^{n+1} , \lambda^{2}=1+\\ \frac{Q+\frac{\tau}{2}\sum\limits_{g}V_{g}\left(E_{g}^{n+1}+\tilde{E}_{g}^{n+1}\right)\left[J_{g}^{n+1/2}-\tilde{J}_{g}^{n+1/2}\right]}{\sum\limits_{p}m_{p}\left(\tilde{v}_{p}^{n+1}\right)^{2}/2}. (16) II.2 Coulomb collisions To account for Coulomb collisions, a Monte Carlo algorithm was added to the code, in which the well-known Takizuka-Abe method 22 is adapted to the two-dimensional velocity space (v_{\bot},v_{\|}) used in the drift-kinetic model. The collision algorithm is executed either at every time step or several steps before the prediction stage of the main computational algorithm II.1 , ensuring correct energy conservation in the system. The collision procedure is organized as follows. The particles are sorted into cells, then paired within each cell. A sequence of transformations is then performed on each pair: • transition to three-dimensional Cartesian velocities \displaystyle v_{x} \displaystyle=-\text{sgn}(q_{p})v_{\perp}\cos\varphi, \displaystyle v_{y} \displaystyle=\text{sgn}(q_{p})v_{\perp}\sin\varphi, \displaystyle v_{z} \displaystyle=v_{\parallel}, where sgn(q_{p}) is the sign of the charge of the colliding particle, \varphi is a random angle; • implementation of collisions using the Takizuka-Abe method 22 ; • inverse transformation of Cartesian velocities into polar coordinates: \displaystyle v_{\parallel}=v_{z},\quad v_{\perp}=\sqrt{v_{x}^{2}+v_{y}^{2}}. To verify the correct operation of Coulomb collisions, the problem of temperature equalization between electrons and ions in a two-component plasma was simulated. According to the analytical solution of this problem 13 , the electron heating time from the initial temperature T_{e}(0) to the current value T_{e}(t) is determined by the expression: t=\tau_{col}\int\limits^{T_{e}(t)/T_{\infty}}_{T_{e}(0)/T_{\infty}}\frac{[2/M+y(1-1/M)]^{3/2}}{1-y}dy, (17) where \displaystyle\tau_{col}=\frac{3}{4}\frac{(2\pi)^{3/2}}{\Lambda}\frac{n_{e}c^{3}}{\omega_{pe}^{3}}M\left(\frac{T_{\infty}}{m_{e}c^{2}}\right)^{3/2}, (18) \displaystyle T_{\infty}=\frac{T_{e}(0)+T_{i}(0)}{2},\quad M=\frac{m_{i}}{m_{e}}, (19) \omega_{pe}=\sqrt{4\pi n_{e}e^{2}/m_{e}} , m_{e} , n_{e} are the mass and density of electrons, and m_{i} is the ion mass (from here on, ions mean protons). In simulations carried out with periodic boundary conditions, at the initial moment of time, electrons and ions are uniformly distributed over a spatial grid with a size of 57 cells and have a Maxwellian velocity distribution with temperatures of T_{e}(0)=10 eV and T_{i}(0)=200 eV. The following parameters are fixed: Coulomb logarithm \Lambda=15 , plasma density n=5\cdot 10^{13} cm -3 , temporal and spatial grid step h=0.17 cm, \tau=2.25\cdot 10^{-11} s (with collisions occurring once every 25 time steps). The magnetic field is set uniform throughout the computational domain. Analysis of the simulation results revealed a noticeable influence of numerical noise on relaxation processes. As can be seen from Fig. 1 , in the case of using 1000 particles per cell, an acceleration of energy exchange between plasma components is observed compared to the theoretical prediction ( 17 ). This effect is associated with the numerical collisions caused by the presence of electric field noise. Since in the collisionless case such parasitic energy exchange occurs only between the longitudinal degrees of freedom of the particles, the transverse velocities are affected by this noise only indirectly through Coulomb collisions. For this reason, the main effect of the numerical collisions in our model is the ion temperature anisotropy observed in Fig. 1 (b). Increasing the number of macroparticles in the cell to 5000 and higher makes it possible to significantly suppress this effect, which confirms its numerical nature. In this case, the distribution of ion temperature becomes isotropic, and the rate of energy exchange between electrons and ions agrees well with the prediction of analytical theory. This does not mean, however, that in all simulations the number of macroparticles in a cell should not fall below 5000. In systems with open boundary conditions, which are used to model mirror traps, the lifetime of particles can be much shorter than the time of energy exchange between components, so the integral effect of noise fields on these particles will remain small even at higher noise levels. II.3 Boundary conditions To correctly describe the formation of an ambipolar potential in a magnetic trap, we implement boundary conditions that simulate perfectly conducting walls located at the ends of the computational domain. The wall’s position relative to the spatial grid nodes and the particle removal method are schematically depicted in Fig. 2 . Figure 2: Implementation of open boundary conditions. The numerical implementation of such boundaries requires the following conditions to be met. First, each particle that reaches any wall located at a distance of h/2 from the boundaries of the computational domain at each half-step in time is removed. Secondly, no current correction is performed at the two outermost nodes on each side of the system, which avoids taking into account the current contributions from the removed particles. Thirdly, the electric field at grid nodes inside the wall is set to zero. Fourthly, the magnetic field at the three outermost nodes on each side of the system is assumed to be uniform. Since the direct zeroing of the electric field at the boundaries of the system after its determination from the equation ( 7 ) leads to a violation of energy conservation in finite-difference form, we achieve the conversion of this field to zero by zeroing all local currents from particles in Ampere’s law, that is, by the following change of the matrix \mathcal{L}_{gg^{\prime}} and the vector F_{g} : \displaystyle\mathcal{L}_{0\;0}=\mathcal{L}_{0\;1}=\mathcal{L}_{1\;0}=\mathcal{L}_{N-1\;N-1}=\mathcal{L}_{N-1\;N-2}= \displaystyle=\mathcal{L}_{N-2\;N-1}=F_{0}=F_{N-1}=0, (20) where N is a full number of grid nodes. As simulations show, this method of specifying boundary conditions leaves the matrix \mathcal{L} symmetrical and does not violate the law of energy conservation in the system throughout the entire simulation time (Fig. 3 ). Figure 3: The energy of the system E_{system}=E_{p}+E_{field}+E_{deleted\;p}-E_{added\;p} in the simulation with h=0.01 cm shown in Fig. 4 in units of its initial value E_{system\;0} ( E_{p} is the energy of particles located inside the calculation region, E_{field} is the energy of the electric field, E_{deleted\;p} and E_{added\;p} are the energies of the removed and injected particles). We tested the correctness of the implemented boundary conditions by considering the formation of a charged layer near a wall with a floating potential. Similar to the work 10 , for comparison with the Debye sheath theory, a stationary plasma with cold ions and hot electrons is maintained by continuously injecting new particles into a region bounded by two conducting walls. An anomalously high frequency of electron-electron collisions is used to maintain a Maxwellian electron velocity distribution. Figure 4: Results of PIC simulations with different spatial steps h=0.000145 cm (blue curve) and h=0.01 cm (orange curve): (a) dependence of the electric potential jump between the system center and the wall on time in units of the central electron temperature T_{center}/e ; (b) time behavior of the electric potential jump in electron volts, (c) spatial distribution of the potential e\phi/T_{center} in the steady state ( t=100 ns); (d) electron temperature profiles. All graphs are time averaged. In our simulations, at the initial moment of time, the plasma with density n_{0}=10^{13} cm -3 is set to be uniform along the entire system, and the electrons and ions have temperatures T_{e0}=150 eV and T_{i0}=0.1 eV. At subsequent times, electron-ion pairs are injected into the system at a rate of dn_{\rm inject}/dt=4.04\cdot 10^{20} cm {}^{-3}/ s and the same temperatures. Anomalous electron scattering is achieved by incorporating Coulomb collisions with a greatly increased Coulomb logarithm \Lambda=15\cdot 10^{5} . These collisions are performed exclusively for electron-electron pairs. Since the simulation of plasma confinement on the real scale of plasma experiments will have to be carried out with grid steps significantly exceeding the Debye radius \lambda_{D} , and the drop in electric potential in the charged Debye sheath by several electron temperatures 17 ; 20 is an important factor in electron confinement, it is necessary to find out how strongly the spatial resolution affects the formation of the potential jump in the near-wall layer. Two simulations of the same physical system are carried out for different h : in the first simulation, the spatial step h=0.000145 cm ( \tau=2.2\cdot 10^{-14} s, 3000 particles per cell) resolves well the Debye radius \lambda_{D}\sim 0.0014 cm, while in the second, the grid step h=0.01 cm ( \tau=1.5\cdot 10^{-12} s, 3000 particles per cell) does not allow for a detailed description of the spatial structure of the potential inside the near-wall layer. In theory, the electric potential of an undisturbed plasma relative to a floating wall is given by the expression: e\phi_{plasma}=\frac{T_{e\;plasma}}{2}\left[1+\ln\left(\frac{m_{i}}{2\pi m_{e}}\right)\right], (21) where T_{e\;plasma} is the electron temperature in an undisturbed plasma, and e is the absolute value of the electron charge. The first term here describes the potential difference between the undisturbed plasma and the beginning of the charged layer (quasineutral pre-sheath), and the second one describes the potential jump inside the charged layer (see 15 ). The electric potential profiles, as well as the time behavior of its jump between the wall and the plasma center in PIC simulations with different spatial resolutions, are shown in Figure 4 . From Fig. 4 (b) it is clear that the total potential jump is practically independent of whether the Debye scale is resolved or not. This agreement indicates that the losses of fast (above-barrier) electrons in both simulations are the same. If, for comparison with theory, we consider this potential jump in units of the central electron temperature, as shown in Fig. 4 (a), then we find not only a fairly significant (30%) difference from the theoretical prediction ( 21 ), but also a small (5%) difference between PIC simulations with different spatial grids. The reason for the first difference is the non-uniformity of the electron temperature observed in the simulations (Fig. 4 (d)), which contradicts the assumption of the Debye sheath theory, where an isothermal ( T_{e}= const) Boltzmann distribution is assumed for electrons. Figure 5: Near-wall plasma parameters for PIC simulations with h=0.000145 cm (solid curve) and h=0.01 cm (dotted curve) in the steady state ( t=100 ns): (a) potential in units of the electron temperature at the center of the system T_{center} ; (b) longitudinal ion velocity in units of the speed of sound c_{s}=\sqrt{T_{center}/m_{i}} . Red curves on both plots correspond to the relative density difference (n_{e}-n_{i})/n_{i} and show where the quasi-neutrality is violated (orange stripes). All graphs are time averaged. The second difference is explained by the fact that in simulations with different grids, different central electron temperatures are established, which is seen from the spatial profiles presented in Fig. 4 (d). The difference in temperature indicates a difference in energy losses and is explained by the influence of numerical noise, which hinders the transport of slow particles while having little effect on the transport of fast particles. For this reason, the central electron temperature in the coarse-grid, higher-noise simulation is slightly lower than the temperature in the less noisy simulation with Debye-radius resolution. Despite the contradictory nature of the formulation of the problem in the theory and quantitative disagreements of 30%, the model correctly reproduces the main features of the spatial structure of the sheath. In particular, in front of the charged sheath (Fig. 5 (a)), a quasi-neutral pre-sheath is observed, in which the potential drop from the plasma center to the beginning of the near-wall charged layer is e\Delta\phi/T_{center}=0.7 in the simulation with the resolution of the Debye radius and e\Delta\phi/T_{center}=0.6 in the simulation with a coarse grid. This is somewhat higher than the well-known Bohm criterion, in which a jump of e\Delta\phi/T_{center}=0.5 should ensure the acceleration of ions to the speed of sound at the entrance to the charged layer (see, for example, 15 ). However, as can be seen from the graphs of the average flux velocity of ions (Fig. 5 (b)), the transition through the sonic threshold v_{i\|}=c_{s} in both PIC simulations actually occurs at the boundary of the charged layer. Thus, the potential jump in the pre-sheath, as before, performs the function of accelerating ions to the average sonic velocity, and its higher value is explained by the fact that a significant portion of the ions injected between the center of the system and the wall is affected by only a part of the full drop in accelerating potential. Comparing the calculations with a fine and coarse grid, we can conclude that the model correctly reproduces the near-wall jump in electric potential even without resolving the fine structure of the Debye sheath. III Modeling of longitudinal classical losses in mirror traps To find out the role played by electron kinetics in the problem of plasma confinement in a mirror magnetic field, we consider formation of stationary plasma profiles in the presence of a constant source of particles in the central part of the trap and compare the results of fully kinetic simulations using the ADEPT code with the results of hybrid simulations performed by the MIDAS code 16 . In the hybrid code, a kinetic equation with a collision term is solved for ions, while a simplified fluid model is used for electrons. In this model, the electron distribution is assumed to be Maxwellian, their density is everywhere equal to the ion density, their temperature is assumed to be constant in space and determined by the balance of energy gained from the ions and lost to the walls. The longitudinal force balance in this massless fluid plays the role of equation for the electric potential. Moreover, solutions in the hybrid model are sought only between magnetic mirrors, while the expanders and walls are taken into account through specific boundary conditions 16 . Figure 6: Comparison of the results obtained in the PIC simulation with anomalous e-e collisionality (blue curves), PIC simulation with the real e-e collision rate (orange curves) and the hybrid MIDAS simulation (green curves): (a) magnetic field profile; (b) plasma potentials relative to the conducting wall; (c) ion density profiles; (d) - (f) average longitudinal T_{\parallel} and transverse T_{\perp} energies of electrons and ions; (g) average energy carried away by one particle; (h) electron temperature at the center of the system. All spatial profiles are given for a steady state, all graphs (except for the MIDAS curves) are time averaged. By T_{\parallel} we mean the average doubled longitudinal kinetic energy of particles of a given type, by T_{\perp} we mean the average transverse energy of these same particles. Since in the kinetic plasma confinement regime the Maxwellian nature of the distribution is not guaranteed even for electrons, the comparison with the hybrid model will be carried out not only in the case of real collisions between electrons, but also in a regime where the frequency of electron-electron collisions will be artificially increased. It will allow us to ensure the equilibrium of electrons and to fulfill at least one of the assumptions of the hybrid model. Both models solve the problem in the following formulation: in a starting plasma uniformly occupying the space between mirrors with the initial density n=10^{13} cm -3 and temperatures T_{e0}=T_{i0}=150 , we inject electron-ion pairs with Maxwellian velocity distributions, the same temperatures and a constant rate of density increase dn_{\rm inject}/dt=1.17\cdot 10^{17} cm -3 /s. The injection region is located in the center of the trap, and its boundaries are shown in the figure 6 (a). All types of collisions (e-e, e-i, i-i) are taken into account, and PIC simulations are carried out using both real electron collisionality and an anomalously high frequency of e-e collisions, which is implemented in the model by increasing the Coulomb logarithm by 4 orders of magnitude ( \Lambda_{\rm anomal}=10^{4}\Lambda_{ee} ). Unlike previous simulations, in this problem the Coulomb logarithm is calculated for each pair of particles based on their individual relative velocity u \Lambda_{s_{1}s_{2}}=\ln\left|\frac{\lambda_{D}mu^{2}}{q_{s_{1}}q_{s_{2}}}\right|, (22) where \lambda_{D} is the Debye radius calculated from the average particle density and temperature in the cell, m=m_{s_{1}}m_{s_{2}}/(m_{s_{1}}+m_{s_{2}}) . In PIC simulations, a unit density (chosen as n=10^{13} cm {}^{-}3 ) corresponds to 500 particles in the cell at the magnetic mirror location and \approx 5000 at the center of the trap. The results of all simulations are presented in Fig. 6 . Let us first compare the PIC simulations with the real (orange curves) and anomalous (blue curves) e-e collision frequencies and assess the significance of electron nonequilibrium in the problem. It can be seen that there is a small difference in the plasma and electric potential profiles between the magnetic mirrors. This is due to the large jump in the ambipolar potential between the plasma center and the wall ( e\Delta\phi\sim 300 eV), which corresponds to 4-5 electron temperatures at the plasma center T_{e\;center} (graphs (b), (d)). This potential drop confines most of the electrons within the open trap, thereby allowing them to undergo Maxwellization. However, in the region of the expander, where there is no magnetic field confinement and the density is low, all plasma components can be considered collisionless. This leads to anisotropy of the electron distribution function and a strong local difference in the longitudinal and transverse electron temperature profiles (Fig. 6 (d)). This anisotropy arises due to the conservation of the electron magnetic moment, which causes almost all of their transverse energy to be transformed into longitudinal energy as they flow out of the magnetic mirror. An increase in the longitudinal temperature of electrons in expanders in the case of real collisions leads to a slower drop in the potential between the mirror and the wall (Fig. 6 (b)) and a less intense acceleration of ions in this gap, which can be seen from the profile of the total longitudinal energy of ions (Fig. 6 (e)) including the energy of directed motion. Comparison with the results obtained by the MIDAS code (green curves) shows that the hybrid simulations reproduce the same longitudinal and transverse ion energy profiles, but predict a 15%-20% lower electron temperature, lower plasma potential and lower density. We attribute these differences to a violation of the hybrid model’s assumption of isothermal Boltzmann electron distribution, since in the PIC simulation the electron temperature drops sharply in the expanders. Based on PIC simulations, we can also determine the energy carried out of the trap by an electron-ion pair. Dividing the energy of particles removed over several time steps by their number, we find that, in a steady state, each escaping ion has an energy of \approx 6.5T_{e\;center} , and each electron has an energy of T_{e\;center} (Fig. 6 (g), (h)). Thus, the energy loss per electron-ion pair is \approx 7.5T_{e\;center} , which is consistent with experimental measurements at the GDT facility 21 . The plasma lifetime in PIC simulations is determined by the steady-state value of the density n_{\infty} : \tau_{\rm simul}=\frac{n_{\infty}}{dn_{\rm inject}/dt}=185\;\text{$\mu$s}. (23) Since the effective path length of the ion turns out to be significantly greater than the distance between the plugs L \frac{\lambda_{\rm eff}}{L}=\frac{v_{Ti}\tau_{ii}}{L}\frac{\ln R}{R}\sim 10, (24) our simulations reproduce the kinetic confinement regime (here R=B_{plug}/B_{center}=9.4 is the mirror ratio, \tau_{ii} is the time of ion-ion collisions calculated based on the average temperature T_{i}=\frac{2}{3}\left(\frac{T_{i\parallel}}{2}+T_{i\perp}\right)=202\;\text{eV}, v_{Ti}=\sqrt{T_{i\|}/m_{i}} is the average longitudinal ion velocity, the average Coulomb logarithm is estimated as \Lambda=13 ). A rough theoretical estimate for the plasma lifetime in this regime (not accounting for the ambipolar effect) is given by the Budker formula \tau_{\rm theory}^{B}=0.4\tau_{ii}\ln R=0.4\frac{\sqrt{2}}{\pi}\frac{\sqrt{m_{i}T_{i}^{3}}}{e^{4}\Lambda n_{i}}\ln R\approx 200\,\mbox{\rm$\mu$s} (25) and agrees well with the simulation result. In a steady state, the same retention time should be achieved for electrons. The well-known formula of Pastukhov, generalized by Cohen 5 , \tau_{\rm theory}^{PC}=\frac{\sqrt{\pi}}{4}\tau_{ee}\sqrt{1+\frac{1}{R}}\ln\left(\frac{\sqrt{1+1/R}+1}{\sqrt{1+1/R}-1}\right)\frac{\xi e^{\xi}}{\displaystyle 1+\frac{e^{\xi}}{2}\sqrt{\frac{\pi}{\xi}}{\rm erfc}\sqrt{\xi}} (26) for the observed potential jump \xi=e\Delta\phi/T_{e}\approx 4.8 , overestimates the retention time by several times \tau_{\rm theory}^{PC}\approx 746 \mu s. The alternative Chernin-Rosenbluth-Cohen formula 5 \tau_{\rm theory}^{CRC}=\frac{\sqrt{\pi}}{4}\tau_{ee}\xi e^{\xi}\frac{\left[\ln\left(4R\xi/\delta\right)-2\right]^{2}}{\ln\left(4R\xi/\delta\right)-2+\ln\left(0.85\xi\right)},\qquad\delta=\sqrt{\frac{\delta_{p}}{\ln(R\xi)}}, (27) where \delta_{p} is a solution of the equation \delta_{p}=\ln\left\{1-\delta_{p}\left(1+\frac{\delta_{p}}{\xi}\right)\left[1-\xi\ln\left(\frac{e^{2}\delta_{p}}{4R(\xi+\delta_{p})}\right)\right]\ln\left(\frac{e^{2}\delta_{p}}{4R(\xi+\delta_{p})}\right)\right\}, (28) reduces the retention time to the value \tau_{\rm theory}^{CRC}\approx 428 \mu s, but also does not provide good quantitative agreement with the modeling. Thus, theoretical estimates claiming to describe the ambipolar effect predict particle lifetimes only to an order of magnitude. IV Summary This paper presents an extended version of the 1D2V semi-implicit drift-kinetic PIC code ADEPT, which incorporates the Takizuka-Abe binary Coulomb collision algorithm and implements new boundary conditions in the form of perfectly conducting walls with a floating potential. In this form, the model can be used to study classical longitudinal losses from open traps. To verify the correctness of the collision module, we simulated the problem of relaxation to equilibrium in a plasma with different ion and electron temperatures and showed good quantitative agreement with the analytical theory if the number of macroparticles per cell exceeds 5000. It is shown that the boundary conditions requiring the absorption of particles at the walls and the zeroing of the electric field inside them can be realized without violating the law of energy conservation, and the jump of the ambipolar potential in the near-wall Debye layer is correctly reproduced even without the resolution of the Debye scale. This makes it possible to use a large grid in drift-kinetic PIC simulations without fear of markedly affecting the electron confinement. To demonstrate the importance of taking electron kinetics into account in the problem of plasma confinement in an open trap, steady-state profiles of various plasma parameters were calculated in the presence of a constant Maxwellian particle source. A comparison of the fully kinetic PIC simulations with the hybrid ones (kinetic ions — fluid electrons) revealed significant differences (at the 15% level) in the electron temperature, potential jump, and confined plasma density. The reason for this is that the concept of the isothermal Boltzmann electrons does not work in expanders. Acknowledgements. The work is supported by the Russian Science Foundation (project 24-12-00309). Simulations were performed using the computing resources of the Information and Computing Center in Novosibirsk State University.