Synergism of Radio-Frequency Current Drive with the Bootstrap Current by BARKF' MASSACHUSETTS INSTITUTE OF TECHNOLOGY Joan Decker JUL 3 1 2002 Ingenieur Dipl6m6 de l'Ecole Polytechnique Ecole Polytechnique, Palaiseau, France (2000) LIBRARIES Submitted to the Department of Electrical Engineering and Computer Science in partial fulfillment of the requirements for the degree of Master of Science in Electrical Engineering and Computer Science at the MASSACHUSETTS INSTITUTE OF TECHNOLOGY June 2002 © Massachusetts Institute of Technology 2002. All rights reserved. ............................................... Author ....... Department of Electrical Engineering and Computer Science May 10, 2002 7;1 Certified by........ . .. .. . . . . . . . . . . . . . . . . Abraham Bers Professor of Electrical Engineering & Computer Science Thesis Supervisor Accepted by ........... Arthur C. Smith Chairman, Department Committee on Graduate Students Synergism of Radio-Frequency Current Drive with the Bootstrap Current by Joan Decker Submitted to the Department of Electrical Engineering and Computer Science on May 10, 2002, in partial fulfillment of the requirements for the degree of Master of Science in Electrical Engineering and Computer Science Abstract The presence of a large, non inductive toroidal current is necessary for confining the plasma during steady-state tokamak operation. A substantial fraction of this current is expected to be provided by the bootstrap current, which is driven by temperature and density gradients inside the plasma. The supplementary current would be generated by radio-frequency (RF) waves that are coupled to the plasma [9]. Therefore, a self-consistent kinetic calculation of the bootstrap current and the RF-driven current is of interest so as to measure and understand the effects of the bootstrap current on RF current drive (RFCD), and vice versa. A synergistic effect between the bootstrap current and the current driven by lower-hybrid (LH) waves and by electron-cyclotron (EC) waves has been demonstrated earlier [27]. This work extends these studies on the synergism, in order to understand the physics of this effect. For this purpose, A 2-D quasilinear relativistic Fokker-Planck code was developed, which solves the drift-kinetic equation and gives the steady-state electron distribution function. In contrast to the code used in [27], this code uses an implicit method for the particle flux conservation at the trapped-passing boundary, so that convergence to a steady-state is much faster. As a consequence, a more extensive numerical study of the synergism is made possible. Numerical simulations relevant to future experiments in C-Mod [9] are carried out, and find that the synergistic current can be up to 10% of the LH driven current. However, with EC current drive (ECCD) for the same scenarios, a larger synergistic current is found, which can reach up to 25% of the EC driven current. In all simulations, the synergistic current is proportional to the bootstrap current, which could be interesting for high bootstrap current configurations. The physics of the synergism between the bootstrap current and RFCD is investigated using a kinetic model. It is found that the synergistic current can be explained by considering the effect of RF quasilinear diffusion on the perturbed distribution function due to radial drifts, which leads to an enhanced bootstrap current. Conversely, this perturbed distribution function, which drives the bootstrap current, leads to a larger number of particles in the RF diffusion region, thereby increasing the RF driven current. The synergism is found to be the largest when the RF diffusion domain, in momentum space, coincides with the maximum of the perturbed distribution due to radial drifts, where most of the bootstrap current is generated. Thesis Supervisor: Abraham Bers Title: Professor of Electrical Engineering & Computer Science 3 4 Acknowledgments I would like to thank my supervisors Pr. Abraham Bers and Pr. Ronald Parker for their advice, support and interest in this research. I am also very grateful to Dr. Yves Peysson for his large contribution to the present work, particularly concerning the development of the code. I would also like to thank him for the warm welcome I received in Cadarache last summer, and for our pleasant and fruitful collaboration on this research. 5 6 Contents List of Figures. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 List of Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1 Introduction 19 2 Theoretical Model 21 2.1 2.2 3 . . . . . . . . . . . . . . . . . . . . . . . . 21 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 Single Particle Motion in a Tokamak 2.1.1 Toroidal geometry 2.1.2 Particle motion in a tokamak . . . . . . . . . . . . . . . . . . . . . . . . 23 Kinetic Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.2.1 Drift Kinetic Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 2.2.2 Time scales and ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 2.2.3 Expansion of the DKE . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 2.2.4 Set of Equations to be Solved . . . . . . . . . . . . . . . . . . . . . . . . 34 2.2.5 Moments of the Distribution Function 35 . . . . . . . . . . . . . . . . . . . Computational Method 39 3.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39 3.2 Fokker-Planck Equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.2.1 Flux Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.2.2 Finite-Difference Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 3.2.3 Trapped-Passing Boundary . . . . . . . . . . . . . . . . . . . . . . . . . . 44 First-Order Neoclassical Calculations . . . . . . . . . . . . . . . . . . . . . . . . 45 3.3 f) 3.3.1 Radial Derivatives (calculation of . . . . . . . . . . . . . . . . . . . . 45 3.3.2 Calculation of g . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 3.3.3 Treatment of Trapped Particles in g . . . . . . . . . . . . . . . . . . . . . 47 7 4 4.1 General Considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 4.2 Lower-Hybrid Current Drive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.2.1 Lower-Hybrid Waves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 4.2.2 Simplified 1-D Analytical Model for LHCD . . . . . . . . . . . . . . . . . 52 4.2.3 Numerical Calculation of LHCD . . . . . . . . . . . . . . . . . . . . . . . 54 Electron Cyclotron Current Drive . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.3 5 Electron Cyclotron Waves . . . . . . . . . . . . . . . . . . . . . . . . . . 55 4.3.2 Mechanisms for Current Generation . . . . . . . . . . . . . . . . . . . . . 61 4.3.3 Numerical Calculation of ECCD and Benchmarking . . . . . . . . . . . . 66 70 5.1 Simplified Picture of the Bootstrap Current . . . . . . . . . . . . . . . . . . . . 70 5.2 Numerical Calculation of the Bootstrap Current . . . . . . . . . . . . . . . . . . 72 5.2.1 Characteristics of the Distribution Function . . . . . . . . . . . . . . . . 72 5.2.2 Benchmarking Calculation of the Bootstrap Current . . . . . . . . . . . . 74 . . . . . . . . . . . . . . . . . . . . . . . . . 75 Analysis in the Lorentz Model [13] Self-Consistent Calculation of RFCD and the Bootstrap current 6.1 6.2 7 4.3.1 Bootstrap Current in a Maxwellian Plasma 5.3 6 48 Radio-Frequency Current Drive Bootstrap Current in LHCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 . . . . . . . . . . . . 77 . . . . . . . . . . . . . . . . . . . . . . 78 6.1.1 Estimation of the synergism for a realistic scenario 6.1.2 Physical picture of the synergism 6.1.3 Prediction of the synergism in the Lorentz model . . . . . . . . . . . . . 81 6.1.4 Test of the Predictive Model . . . . . . . . . . . . . . . . . . . . . . . . . 81 6.1.5 D iscussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82 Bootstrap Current in ECCD . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87 6.2.1 ECCD with Bootstrap Current in DIII-D . . . . . . . . . . . . . . . . . . 89 6.2.2 ECCD with Bootstrap Current in C-Mod . . . . . . . . . . . . . . . . . . 92 96 Conclusion 99 A Profiles for Tokamak parameters A .1 77 Alcator C-M od . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99 A .2 D III-D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 100 8 B Collision Operator B.1 102 Differential term Cee(f, fM) + Ce(f,f) . . . . . . . . . . . . . . . . . . . . . . . 102 B.1.1 Detailed Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 B.1.2 Expression in the Limit of a Lorentz Gaz . . . . . . . . . . . . . . . . . . 104 B.1.3 Expression as the Divergence of a Flux and Bounce-Averaged Operator . 104 B.2 Integral term Cee(fM, f) . . . . . . . . . . . . . . . . . . . . . . . .. . . . . 105 B.2.1 Detailed Expression . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 B.2.2 Bounce-Averaged Operator 106 . . . . . . . . . . . . . . . . . . . . . . . . . 107 C Quasilinear Operators C.1 General Expression as the Divergence of a Flux . . . . . . . . . . . . . . . . . . 107 C.2 Bounce Averaging of the Quasilinear Operator . . . . . . . . . . . . . . . . . . . 108 C.3 Lower-Hybrid Diffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 C.3.1 General Expression for the LH Diffusion Coefficient . . . . . . . . . . . . 109 C.3.2 Flat E 12 (kii) Spectrum . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 C.3.3 Expression for the Fluxes due to LH Diffusion . . . . . . . . . . . . . . . 110 C.4 Electron-Cyclotron Diffusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 C.4.1 General Expression for the EC-X2 Diffusion Coefficient . . . . . . . . . . 112 C.4.2 Gaussian E12 (kii) Spectrum . . . . . . . . . . . . . . . . . . . . . . . . . 112 C.4.3 Expression for the Fluxes due to EC Diffusion . . . . . . . . . . . . . . . 113 D Flux-Surface Averaging D .1 D efinition 116 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 D.2 Electron Distribution f(p, ,0) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 D.2.1 Implicit 9-Dependence: case of fo and g. D.2.2 Explicit 0-Dependence:f . . . . . . . . . . . . . . . . . . 117 . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 D.3 Flux-Surface Averaged Moment of f(p, ,0) . . . . . . . . . . . . . . . . . . . . 118 D.3.1 Flux-Surface Averaged Density . . . . . . . . . . . . . . . . . . . . . . . 120 D.3.2 Flux-Surface Averaged Current Density . . . . . . . . . . . . . . . . . . . 120 D.3.3 Flux-Surface Averaged Density of Power Absorbed . . . . . . . . . . . . 121 D.3.4 Expression as a Moment of Particle Fluxes . . . . . . . . . . . . . . . . . 121 D.3.5 Flux-Surface Averaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 E Calculation of Bounce Average Coefficients E.1 Calculation of A(o) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 123 123 E.1.1 Series Expansion E.1.2 Calculation of the Integrals J 2m 124 E.1.3 Truncated Expression . . . . . . 126 . . . . . . . . E.2 Calculation of s* E.3 Calculation of *. . . . . . . . . . . .. E.4 Calculation of A E.5 Calculation of . . . . . . . . . . . . 126 127 . . . . . . . . . . . . Z(o) 123 . . . . . . . . . . . F Listing of testfp2d9yp and fp2d9yp 128 130 132 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158 F.1 testfp2d9yp F.2 fp2d9yp 10 11 List of Figures 2-1 Toroidal coordinates system (r,0, ). 2-2 Velocity space coordinates (v, ,<b). . . . . . . . . . . . . . . . . . . . . . . . . 22 . . . . . . . . . . . . . . . . . . . . . . . . . 23 2-3 Banana orbit projected onto the poloidal plane. . . . . . . . . . . . . . . . . . . 25 2-4 Trapping domain 3-1 Positioning of the discrete particle distribution and fluxes on the (pl, pi) grid. . 41 3-2 Nine-points differentiation scheme . . . . . . . . . . . . . . . . . . . . . . . . . . 42 3-3 Structure of the 9-diagonals differential operator matrix M. 43 3-4 Structure of the 15-diagonals differential operator matrix M. The index I(o| <cot. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 _T_1 refers to the pitch-angle position in the counter-passing region which is closest to the trapped-counterpassing boundary. The index T refers to the pitch-angle position in the trapping region which is closest to the trapped-copassing boundary. 45 3-5 Particle fluxes conservation at the trapped-passing boundary. . . . . . . . . . . . 4-1 Distribution function calculated for C-Mod (vl = 3.5, v2 = 6, Do = 1). 2D contour plot of fo(above) and logarithmic plot of the parallel distribution FO (below). . . 46 56 4-2 Launching angles and propagation for ECW. (a) top view, (b) poloidal cross-section 58 4-3 Radial frequency profiles in the plane 0 = 0 for ECW propagation in C-Mod (Appendix A). ECW propagation is represented by a horizontal arrow (fEcw is fixed by launching) from either the low-field side (top graphs (a),(b)) or the high-field side (bottom graphs (c),(d)). The propagation of both the X-mode (left graphs (a),(c)) and the 0-mode (right graphs (b),(d)) is considered. The two first cyclotron harmonics fce and 2 fce are displayed. The shaded areas represent the regions of frequencies unaccessible to the given mode, due to cut-offs (right-hand cut-off f, for the X-mode, plasma frequency fpe for the O-mode) and resonances (upper-hybrid resonance fuh, affecting the X-mode). . . . . . . . . . . . . . . . . 12 60 4-4 Resonance curves for C-mod parameters and varying Nil at fixed 2Q/w (above) and for varying 2Q/w at fixed N (below). 4-5 . . . . . . . . . . . . . . . . . . . . . 63 Normalized particle fluxes due to EC quasilinear diffusion, as calculated in (C.49). The length of the arrows is proportional to S/fo. The solid lines are a contour plot of the steady-state distribution function and the dashed lines are a contour plot of the diffusion coefficient DEC exp [-(kI,res - k1 ,o) 2 /Ak]. 4-6 . . . . . . . . . . 65 Steady-state normalized particle fluxes due to EC quasilinear diffusion and collisions, as calculated in (C.49) and (B.18). The length of the arrows is proportional to S/fo. The solid lines are a contour plot of the steady-state distribution function and the dashed lines are a contour plot of the diffusion coefficient DEC exp[-(i,res 4-7 - kll, 0) 2 /Ak 1 ].......... .. Resonance curves with C-mod parameters versus ... 6 b, ... .. ... ... .. 66 which is the poloidal angle at the position where the EC beam crosses the flux-surface under consideration (C .47). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-8 67 Graph above: Steady-state ECCD distribution function (solid lines) and Maxwellian distribution at the same temperature (dotted lines). The dashed lines are a contour plot of the magnitude of the diffusion coefficient DEC. Graph below: Anti. . . . . . . . . . . . . . . . . . . 69 5-1 Characteristics of trapped electron motion in the poloidal plane. . . . . . . . . . 71 5-2 Electron distribution function to first order in the neoclassical corrections. Top symmetric (part in p1l) of the distribution FO. graph: Maxwellian foM (solid) and corrected foM + flM (dashed) distributions. Bottom graph: parallel first-order distribution FM, calculated from fiM using (5.7). 73 5-3 Bootstrap current calculated from the transport coefficients by [30] (dotted line), [18] (dashed line) and the code (solid line) for C-Mod parameters (Appendix A). 5-4 74 Bootstrap current calculated from the transport coefficients by [30] (dotted line), [18] (dashed line) and the result in the Lorenz limit (2.67) (solid line) for C-Mod parameters (Appendix A). 6-1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 parallel projection of the first order distribution function, with (dashed line) and without LHCD (solid line). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 79 6-2 The bottom graph is a zoom of the top graph in the region of the quasilinear plateau. The dashed line represents the parallel electron distribution function for LHCD only F0 (2.76). The dotted-dashed line is the first order, "bootstrap only" distribution function FiM. The dotted line is associated with the total distribution calculated non self-consistently Fnsc = Fo +FiM. The solid line represents the total distribution function calculated self-consistently F = Fo + F1 (2.71). The "steps" in the line contain no physics and are simply due to the numerical change of variable (p, ) -- (pgp ). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80 6-3 Current densities in LHCD (top) and synergistic fraction (bottom) versus V1min . 83 6-4 Current densities in LHCD (top) and synergistic fraction (bottom) versus vimaC . 84 6-5 Current densities in LHCD (top) and synergistic fraction (bottom) versus the bootstrap current in a case of high LH current . . . . . . . . . . . . . . . . . . . 6-6 Current densities in LHCD (top) and synergistic fraction (bottom) versus the bootstrap current in a case of low LH current . . . . . . . . . . . . . . . . . . . . 6-7 85 86 ECCD in C-Mod at r = 0.15 m versus NI, > 0 and 2Q/w. Where N11 and 2Q/w are too small (lower left corner), the resonance curve (4.48) is too far away in the tail and very few electrons are resonant with the ECW so that no current is generated. On the other hand, where NiI and 2Q/w are too large (upper right corner), the resonance curve is too close to the trapped-passing boundary and the Ohkawa effect reduces the current generated and eventually becomes predominant. Between those limits, ECCD can be optimized, including when one parameter (NiI or 2Q/w) is fixed. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 6-8 Current Densities for ECCD in DIII-D at r = 0.3 m. 89 6-9 Synergistic current for ECCD with bootstrap in DIII-D at r = 0.3 m. . . . . . . . . . . . . . . . . . . . . . . 90 6-10 Parallel first order distribution without (FIM, solid line), and with ECCD (F 1 , dashed line), and also for the case without ECCD but with an enhanced temperature (6.11) derived from fo in ECCD . . . . . . . . . . . 91 0.15 m. . . . . . . . . . . . . . . . 92 (FM,AT, 6-11 Current Densities for ECCD in C-Mod at r = dotted line). 6-12 Synergistic current for ECCD with bootstrap in C-Mod at r = 0.15 m. . . . . . 93 6-13 Parallel first order distribution without (F1M, solid line), and with ECCD (F 1 , dashed line), and also for the case without ECCD but with an enhanced temperature (6.11) derived from fo in ECCD (FIM,AT, dotted line). 14 . . . . . . . . . . . 94 6-14 2-D contour plot of the first order distribution fi. The dotted line (flM) is the case of a maxwellian plasma (no ECCD); the solid line (fi) is the case with ECCD. The dashed line is a contour plot of the EC diffusion coefficient. . . . . . . . . . 95 Temperature, density and toroidal B field profiles in C-Mod [23] . . . . . . . . . 100 A-2 Temperature, density and toroidal B field profiles in DIII-D [19] . . . . . . . . . 101 E-i Bounce averaging coefficient A . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 E-2 Bounce averaging coefficient . . . . . . . . . . . . . . . . . . . . . . . . . . . 129 E-3 Bounce averaging coefficient A . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 E-4 Flux-surface averaging coefficient \ . . . . . . . . . . . . . . . . . . . . . . . . . 131 A-i * 15 16 List of Tables 4.1 LHCD calculations (current density j and density of power absorbed Pabs normalized respectively to enevTe and nemeV4eve) by M. Shoucri and I Shkarofsky [28] (1) and from the present code (2). . . . . . . . . . . . . . . . . . . . . . . . . . . 57 A.1 On-axis parameters in C-Mod [23] . . . . . . . . . . . . . . . . . . . . . . . . . . 99 A.2 On-axis parameters in C-Mod [19] . . . . . . . . . . . . . . . . . . . . . . . . . . 101 17 18 Chapter 1 Introduction The plasma confinement in a Tokamak requires the presence of a toroidal current in order to create a poloidal magnetic field. The non-inductive generation of the toroidal current is of great importance in the prospect of a steady-state reactor, since inductive methods, such as varying magnetic fields, are by definition transient. Launching radio-frequency waves into the plasma has been suggested as a possible means to transfer a parallel momentum to particles, thus driving a current. This method, called Radio-frequency Current Drive (RFCD), has been successfully used to generate a toroidal current, and steady-state operation with total non-inductive current drive has been achieved experimentally with lower hybrid waves (Tore-Supra, [22]) and, more recently, with electron cyclotron waves (TCV, [7],[8]). Unfortunately, a significant amount of toroidal current is required to run a reactor-scale tokamak (10 - 15 MA) such that a large fraction (100 to 500 MW) of the power generated by fusion (1 GW) would have to be recycled in RFCD, critically reducing the power effectively available. Fortunately, in hot, dense plasmas with relatively high inverse aspect ratio, a large toroidal current, called bootstrap current, is driven by the pressure gradient, and requires no additional supply of energy. This current can eventually represent a large fraction of the required current. However, the bootstrap current can not supply the entire amount of current necessary to confine the plasma. In particular, the bootstrap current vanishes at the plasma center. Moreover, a control of the current profile is needed for stability, and this may not be possible with bootstrap current only. Many recent steady-state scenarios rely on a large bootstrap current with the additional current being driven by RFCD. In C-Mod, where the bootstrap current is particularly large, advanced scenarios relate on a bootstrap fraction fBs up to 70% of the total current ([9]). Lower-hybrid current drive (LHCD) would supply the remaining 30%. 19 Although the mechanisms of both the bootstrap current and RFCD have been extensively studied and are well understood, no self-consistent kinetic calculation of the bootstrap current in the presence of RFCD had been carried until recently [27], where a synergism was found between the bootstrap current and both Lower-Hybrid and Electron Cyclotron current drive. Given that bootstrap current and RFCD are the two most often considered method to generate non-inductive current, the study of this synergism is of great interest. This is the aim of the present work, which extends the work done in [27]. A new code has been developed, which solves for the bootstrap current and the RF driven current self-consistently in a much shorter time than the code used in [27], with a more accurate treatment of the interaction between passing and trapped particles. This code allows a more extensive investigation of the synergism. In chapter 2, general considerations about particle motion in a tokamak are given and the kinetic model used in this study is developed. Then, the new features of the code are described to highlight the differences with the code used and described in [27]. In the next two chapters (4 and 5), the problems of RFCD and bootstrap current are investigated separately to give an understanding of their mechanism. The last chapter presents the study of the synergism between the bootstrap current and both lower hybrid current drive (section 6.1) and electron cyclotron current drive (section 6.2). 20 Chapter 2 Theoretical Model Single Particle Motion in a Tokamak 2.1 2.1.1 Toroidal geometry Magnetic Confinement The confinement of the very energetic particles constituting the plasma is a major problem in the attempt of achieving nuclear fusion. Particles in the plasma carry an electronic charge and are subject to a gyromotion in a magnetic field due to the Lorentz force. The motion of a particle with mass m and charge q in a plane perpendicular to a uniform magnetic field of magnitude B = IBI is then forced to be circular, with a radius (2.1) PL _= Awhere v = JiY is the velocity of the particle and Q qB/-ym is the relativistic gyro-frequency; -y = is the relativistic factor 1 1 -v 2 /c 2 =(2.2) In a C-Mod like tokamak (description in Appendix A) with a magnetic field B = 4 T and a temperature T = 7.5 keV, an electron with thermal velocity frequency VTe = /TIme would have a gyro- e = 7 x 10" rad/s and a cyclotron radius, called Larmor radius PLe = 50 pm. For protons at the same temperature, the respective quantities are Qi = 3.8 108 rad/s and PLi = 2.2 mm. Therefore, ions and electrons can be well confined in the two dimensions perpendicular to a magnetic field. The particle motion in the parallel direction is made quasi-periodic by closing the magnetic field lines on themselves. Thus the particle motion can be decomposed into the 21 R Ro a Figure 2-1: Toroidal coordinates system (r,0,). fast rotation around the field line, with a cyclotron frequency Q and the slower motion of the guiding center around the axis of the torus. In the toroidal geometry (Fig. 2-1), positions are defined in the toroidal coordinate system (r,6, (). The distance from the torus axis is given by R = Ro + r cos 0 = Ro(1 + e cos 6) where E = r/Ro is the local inverse aspect ratio. In the entire study, axisymmetry is assumed (effects resulting from the finite number of toroidal magnetic coils are neglected) and therefore (-dependencies will always be omitted. Velocities (v, , 0) are calculated in spherical coordinates with respect to the local magnetic field (Fig. 2-2) with V = V Vii V = coslV±X Vj (2.3) Guiding Center Drifts Unfortunately, the bending of the magnetic field lines is responsible for a alteration of the cyclotron motion resulting in a drift of the guiding center. VD - (v+vi/2) 1Q I 22 B x V(B 2 B (2.4) z // B V/ Cos E y x Figure 2-2: Velocity space coordinates (v, , D). In this expression, there is a contribution due to the parallel motion (vii) of the particle, which experiences a centrifugal force due to the curvature of the field lines. The drift resulting from the association of this force and the Lorentz force is called curvature drift. Moreover, the external generation of a curved magnetic field creates a perpendicular variation of the magnitude of the field. The cyclotron motion (v±) in this inhomogeneous magnetic field generates a drift called VB drift which adds to the curvature drift in (2.4). The magnitude of the guiding center drift (2.4) of thermal particles is of the order of pLIV In BIvT. The spatial scale for the curvature of the magnetic field is the torus major radius Ro; thus the guiding center drift is smaller than the particle velocity by a factor 6D - PLIRo 2.1.2 (2.5) Particle motion in a tokamak Poloidal Motion The guiding center drift (2.4) is charge sensitive, so that electrons and ions are drifting in opposite directions in the poloidal cross-section . This charge separation generates an electric field, which creates a E x B drift. This drift is oriented in the same direction for both electrons and ions, leading to a general loss of confinement. In a tokamak, a poloidal component B9 is added to the magnetic field by the generation of a toroidal current, so that the motion of the guiding center along the field line is now a 23 superposition of a toroidal rotation around the torus vertical axis and a poloidal rotation around the toroidal axis. The motion of the particle along the field line is then confined in a given flux surface. The effect of this poloidal motion is that the guiding center drift is directed alternately outside and inside the flux surface. Therefore, the drift averaged over a poloidal (or bounce) period vanishes, leading to an enhanced confinement of the particles. Magnetic Trapping Another important consequence of the poloidal motion of the particles is that the magnetic field strength varies along the field line. It is maximum when the particle is closest to the torus vertical axis (high field side, 0 = 7r) and minimum when the particle is farthest away from this axis (low field side, 0 = 0). Besides, the energy of the particle is a constant of the motion, since there is no work produced by a constant magnetic field, and the periodicity of the cyclotron motion results in the conservation of the magnetic moment 2 p (2.6) = 2B/-y which is an adiabatic invariant, in the case of a slowly varying magnetic field. According to (2.6), a particle moving along a magnetic field with increasing intensity will experience an increase in its perpendicular velocity in order to keep p constant. As a consequence, the parallel velocity of the particle will be reduced because of the conservation of energy, by what is called an effective mirrorforce. Eventually, a particle with insufficient parallel energy will be reflected back toward the low field region before completing a poloidal rotation. Such a particle is said to be trapped in the magnetic field. Its trajectory projected onto the poloidal or the toroidal plane is called a banana orbit (Fig. 2-3). Using the pitch-angle coordinate system defined in (2.3) and adding a subscript 0 to the quantities evaluated at 0 = 0 (low field side), v2(1 _ 2mB/ and the pitch-angle cosine = _ V2(1 _ g) (2.7) 2mBo/y can be evaluated according to its value at the midplane 0 = a [ with o- 2) - T (r, 0) (1 - 02) = 0: (2.8) sgn( o) and I(r, 0) = B(r,9)/Bo(r). In the case of circular flux surfaces, which will always be considered in this study, the flux surface can be parameterized by its radial position r. Moreover, the magnetic field at a given 24 particle flux surface grad B Figure 2-3: Banana orbit projected onto the poloidal plane. position can be easily evaluated from its central value BC = B(R = Ro): B(r,6) = R/Ro = (2.9) 1+ecos( The magnetic field ratio T now takes the simple expression T (r, 0) = c (2.10) 1 + ECos 0 ( Using (2.10) and (2.8), the condition for particle trapping = 0 at 0 = 7r) becomes: V2_6 6O <0OT (2.11) +6 = The trapping domain in the (vII, v±) plane is shown on fig. 2-4 Poloidal motion * Passing particles The circulation of passing (untrapped) particles in the poloidal cross-section defines a transit time 27rr 27rr 27rq(r)Ro vO vIlBo/B VII (2.12) where q(r) r B RO Bo 25 r B Ro Bo (2.13) Trapped Particles V O OT 7 OT V 0 Figure 2-4: Trapping domain 16o <tot. is the safety factor. Since the parallel velocity is of the order of the thermal velocity for passing particles, the transit time can be estimated as 27q(r)Ro (2.14) VT Now, it is possible to estimate the maximum drift off a flux surface along a passing particle orbit. It is of the order of Art ~ VD VD- , 7rq(r)PL - 2 PL (2.15) since the safety factor q(r) is usually of the order of unity. Therefore, the excursion off a flux surface is of the order of a Larmor radius for a passing particle. Trapped particles A characteristic time for the poloidal motion of trapped particle can be defined as the time between two reflections (at 0 > 0 and 0 < 0), called bounce time The bounce time is also of the order of (2.12) 2-rqRo Tb - (2.16) Vil According to (2.11),the typical parallel velocity of trapped particles is smaller than the thermal velocity by a factor fE. Thus the bounce time is Trb 26 ~ Tt (2.17) and the maximum drift off a flux surface along a trapped particle orbit is of the order of Arb ~ (2.18) PL Tb 2 -,e which is no more than a few Larmor radii. For electrons, the excursion off the flux surface is therefore rather small (Ar < (V In B)- 1 , (V In T)'). Electrons remains on the same flux surface to the leading order in 6D (2.5), thus the along the trajectory (2.8). Changes dependence upon r can be neglected in the evolution of in are mainly due to the poloidal motion. The poloidal angle at which a trapped electron is reflected is then given by: cos- 1 (1 - 2 O7 where the value of r in OT, 2 (2.19) 2T) given in (2.11), is considered as a fixed parameter for a given electron. The electron transit or bounce time can be calculated more accurately: f Oc fOc Tbt where 0, = 7r = -rd9 JoI vo | B B r r = lvilI B0 J-oC (2.20) for passing electrons for trapped electrons OT Since the excursion of an electron off its flux surface is small, r can be considered as a parameter in (2.20), independent of 0. Using B/Bo ~ Roq(r)/r, the bounce or transit time becomes: Tb,- 2irRoq(r) fC dO0 2wrRoq(r)A ~ 27r _0,v | 1 (2.21) 0|v where A is a normalized quantity defined as A= c! dO o (2.22) -0c 27r Bounce averaging Finally, dependencies upon the poloidal angle can be removed by integration along the electron orbit over a bounce or circulation period. This process is called bounce averaging {A}= In this expression, the symbol [1/2 - Tb,t I- Za=±1ib - d I 2=±1JT A lviii Bo e (2.23) applies to trapped electrons only and means that the integration must be made over both the forward and the backward motion. According to (2.21) and (2.22), the bounce averaging (2.23) is equivalent to A =O 2 . 0-=il- T 27 rA (2.24) 2.2 2.2.1 Kinetic Description Drift Kinetic Equation Boltzmann Equation In the kinetic description, particles are described by a distribution function the probability for a particle of the species a to be at the position ±' f,(CF, V', t) which gives and with a velocity V' at time t. The particle conservation in the phase space is expressed by the Boltzmann equation: af at + - afa ax- af -%-Q(fl(A, t) + v- x B(Y, t)) -- afI apt 1C (2.25) where af /Ot~c describes collisions between particles and (2.26) S= 'ymav is the momentum. The relativistic factor y is given in (2.2) In the range of wave frequencies considered in this study: lower hybrid waves GHz) and electron cyclotron waves (fEC - (fLH 1 100 GHz), only the electrons are subject to resonant interaction with the waves. Therefore, ions remain mainly unaffected and their distribution can be taken as a maxwellian. Unless explicitly specified, the distribution functions in the following study will always refer to electrons. Drift Kinetic Equation Under the assumption of axisymmetry, and after averaging over the shortest periodic fluctuations, namely the gyromotion and the RF wave oscillation, the Boltzmann equation (2.25) for electrons reduces to the drift kinetic equation [27] Of + &9c - Vf where f = = C(f) + Q(f) (2.27) (fe),w is the gyro-averaged, wave period-averaged electron distribution function. The guiding center motion can be decomposed into the fast parallel motion and the slower drift off the field lines given by 2.4 -+VD S (2.28) |BI Any radial component VDO can be neglected compared to the fast poloidal motion since VDO v1 Bo/B ~Dq(r) PLq(r) <1 r c 28 (2.29) where the estimation (2.5) has been used to estimate the magnitude of the guiding center drift. Under the assumption of axisymmetry, the variations of f along the field line depends upon the poloidal angle only: B 1 Bo 1 .V = 0' r B |B| , (2.30) The radial drift can be evaluated by conservation of the canonical momentum, which gives [10] v11 0 V (2.31) V r 0(!1 Finally, the steady-state form of the drift kinetic equation is vrj Bo af vjj o9 Of =OC(f) + Q(f) (2.32) where the electron distribution f is function of the two real space variables (r, 9) and the two velocity-space variables (p, (). Collision Operator The collisions are described by a Fokker-Planck operator, under the assumption that only elastic binary collisions matter and that small angle collisions prevail. The electron distribution function can be divided into its Maxwellian part fm at the electron temperature T and density ne, and the contribution fp describing the perturbation from the Maxwellian: f = fM + fp. Assuming that the perturbation is small, the non-linear term Cee (f,, f,) describing the collisions of the perturbed part with itself can be neglected and a linearized collision operator can be used. Using Cee(fM, fm) = 0, the collision operator is reduced to C(f) = Cee(f, fM) + Cee(fM, f) + Cei(f, fi) (2.33) where Cei describes collisions with ions. Such a linearized, relativistic collision operator has been derived by Braams and Karney [15] and is given by: ( f) [2A(p)-'+ = + B(p) 1 F (1- F(p)f f1 )--I + I1(fM, fl=1) (2.34) with the collision frequency Ve = 4 rie In A 47re2m2ve 29 (2.35) In (2.34), 1 is an integral term describing the evolution of the bulk distribution due to collisions with the perturbed distribution fp. In this operator, only the first order term f1=1 = 31 -_1 of the expansion in Legendre harmonics of Cee(fM, f) fd (2.36) has been kept (the zero-order term fi=o ~ fM(p) gives no contribution). This choice for the collision operator (called truncated operator [16] [28]) ensures momentum conservation but not energy conservation. Therefore, it is not necessary to add a energy loss term (radiation or radial diffusion) to reach a steady-state. Detailed expressions for the integral 11, for the drag term F(p) and for the diffusion coefficient A(p) and Bt(p) are given in Appendix B. For a more general description of the different collision operators and their properties, see [16]. Quasilinear Operator Since the model is intended for studying current drive, RF fields should be considered that can modify significantly the distribution function. Then, a quasi-linear operator is necessary to take into account the deviations from an equilibrium Maxwellian distribution engendered by the RF fields. A quasilinear operator has been derived by Kennel and Engelmann [5] for arbitrary field polarizations and propagation, and extended by Lerche [17] for relativistic plasmas: lim Qf) = V-+oo 1 f V d3 k (27) 3 E- p2(1 _ g2) Dk 6(w - k og - nQ)L(f)] L (2.37) L... where 6(w - k 1v11 - nQ) (2.38) is the resonance condition with vi = p11/mY L(A) =1 ) +- (2.39) IA is a momentum space differential operator and 2 Dk = qe Ek,+e-ln- + Ek,-eaJn+l + PEkiiJn (2.40) is the quasi-linear diffusion coefficient. The electric field is decomposed into its Fourier components E(Y, t) = Re [J (2)3 e 30 -)Ek] (2.41) which are expressed in the rotating fields coordinates system defined by E+, 1 Ek,I1 = Ek,z iEk,y), 2 (2.42) The transverse component of k is projected onto the x and y axes according to kx = k_ cos a and k. = k1 sin a. The argument of the Bessel function is the cyclotron radius normalized to the perpendicular wave number kv_/Q and gives the scaling of the interaction between electrons and the wave. Time scales and ordering 2.2.2 Time scales " The operator terms in the drift kinetic equation (2.32) represent various time scales. A quantitative evaluation of these time scales is given for a C-Mod plasma, with typical parameters given in Appendix A. The first term v11 Bo 0 r B 90 is associated with the poloidal motion of the particles and its characteristic times are clearly the bounce rb (2.17) and transit -r (2.14) times. In C-Mod at r = 0.15 m, their values are typically of the order of: '~~ 2irq(r)Ro Tt Trb~ - 0.6 ps, - 1.2 ps (2.43) VTe " The second term V 11 (V9V11 r& ( Q Or describes the radial drift of particles. It applies mainly to particles whose parallel velocity varies significantly in the poloidal motion, namely the trapped and barely passing particles. Those particles are responsible for the so-called neoclassicaleffects, including the bootstrap current. The characteristic time of the radial drift is given by rD= a/vD; this is the time it takes for a particle with a drift velocity VD to travel a distance equivalent of the torus minor radius a. Using (2.5), the characteristic drift time can be estimated for C-Mod at r = 0.15 m: TD ~ a aR0 SDVTe PLVTe 31 R ~ 0.3 ms (2.44) e The characteristic time associated with the collision operator is simply the thermal electron- electron collision time obtained from (2.35), given by: 7e I 472 Ve e M 2eT n- (2.45) lnIA In C-Mod at r = 0.15 m, the e/e collision time is Te = 34 Ms. Trapped particles are also concerned with the characteristic detrapping time which is the time for a trapped particle to be scattered out the trapped region. Since the angle of the trapping region in the (pil,j p) scattering by an angle adt - v ', plan is sin- 1 OT Detrapping requires pitch-angle collision V . Since the collision results from a random walk process, the time requires for a scattering by an angle a evolves like 1a2 and therefore the detrapping time is shorter than the transverse collision diffusion time r- by a factor: 'Tdt S T1 adt ~.,' 7r/2 2 ~ (2.46) The transverse diffusion time is of the order of the electron collision time (2.45) [14]. Therefore, the detrapping time is shorter than the electron collision time by a factor h ~t (2.47) Te and its value in C-Mod at r = 0.15 m is typically -rdt~ 7.5 Ms. * The quasi-linear diffusion due to RF fields can be characterized by a diffusion coefficient DRF = Dovepre where ve (2.35) is the collision frequency and PTe = mvTe is the ther- mal momentum. With the RF fields under interest for experiments (with powers in the MegaWatt range), the normalized diffusion coefficient Do is of the order of unity, as calculated for LHCD and for ECCD in Appendix C. Therefore, the quasi- linear time 7q, = 7e/Do can be taken to be of the same order as the collision time. Small Drift Expansion Ordering the time scales allows solving the drift kinetic equation by using an expansion f = fo + 6fi + -- - (following [27]). The small parameter in this expansion is the ration of the drift time to the bounce time 6t= t/TD 27rq(r)pL/a for passing electrons (2.48) 6b = Trb/TD - 27rq(r)PL/fEa for trapped electrons This expansion parameter would be 6 t ~_2.1 x 10- 3 , 6b ~ 4.5 x 10-3 in C-Mod at r = 0.15 m. 32 Banana Regime Ordering Moreover, the domain of collisionality in which the drift kinetic equation is expanded has to be specified. This study aims to consider situations in which the neoclassical effects - including the bootstrap current - are important. Those effects are intimately related to the existence of trapped and barely passing particles. The presence of banana orbits is therefore required. Those orbits are defined only if a given particle can bounce many times before being subject to detrapping by collisions. The domain to be considered is therefore the low collisionality regime - or banana regime - in which the detrapping time is much longer than the trapped particle bounce time. This condition is expressed by b Tdt where lmrfp rt/Te ~ = 1.6 VTere 27rq(r)- 3 /2 R o ~ 6- 3 / 2 T t Te < (2.49) lmfp is the electron mean-free path length. In C-Mod at r = 0.15 m, we find x 10-2 and Tb/rdt - 0.15. Then, except at the edge of the plasma, where the temperature usually drops faster than the density and the collisionality increases, and in the center of the plasma, where c --> 0, the banana regime holds. The ordering used to expand the drift kinetic equation, called banana regime ordering is then given by [27] 2.2.3 Ttb < < T 6PT -(2.50) TD Te < 1( < Tdt Expansion of the DKE The electron distribution function is expanded in 6 ~ p /a: fo + 6fi +.- f (2.51) Zero-order equation The drift term is first order in the expansion and does not appear in the zero- order equation: = C(fo) + Q(fo) r B 00 (2.52) A sub-ordering can be performed by applying the banana regime ordering re,dt < rt,b (2.50). The only term in (2.52) remaining on the bounce time scale is B0 ~fo0 r B O9 v- 33 (2.53) Therefore, the zero-order distribution fo is independent of 9. Then, fo can be evaluated by performing the bounce averaging of (2.52) defined in (2.23), which removes the term related to the bounce motion. (2.54) {C(fO)} + {Q(fo)} = 0 This equation is the bounce averaged Fokker-Planck equation with quasilineardiffusion solved in so-called bounce averaged Fokker-Planck codes [28] [6], which include some neoclassical effects (trapping of particles) but neglect the effects of radial drift, responsible for the bootstrap current. First order equation v1 B 0 96f 1 e0 rjBo + r B 00 roi9 V1 GQ Ogfo_ r -=11(a C(fi) + Q(fi) Or (2.55) In this equation, the two first terms are of the same order J. Again, the contributions from collisions and quasilinear diffusion are smaller by a ratio Te,dt/rt,b < 1. Using the banana regime ordering therefore gives v- B -f r B 90 -- - -(VK'-fo r Ok Qi Or (2.56) This equation can be integrated over 9 which gives 6 fi = f+ g (2.57) with f ~1 (9fo and g constant (in 9) Again, performing a bounce averaging of (2.55) removes the 9 derivatives in (2.55). (2.58) Then, using the linearity of the quasilinear operator (2.37), and taking a linearized form of the collision operator (2.33), an equation for the 9-independent function g is obtained: {C(g)} + {Q(g)} = -{C(f)} - {Q(f)} 2.2.4 (2.59) Set of Equations to be Solved The problem that will be solved by the code can be condensed in a set of three equations that must be solved in sequence: * Zero-order bounce averaged radio-frequency current drive problem: {C(fo)} + {Q(fo)} = 0 34 (2.60) * First order radial dependence of the RFCD problem solution: ~vil (9fo (2.61) f = -fQ0 ar * First order neoclassical corrections to the distribution function {C(g)} + {Q(g)} = -{C(f)} - {Q(f)} (2.62) The total distribution is then obtained as f = fo + f +g (2.63) Since fo is the homogeneous solution of the equation (2.62), g, = g + cfo is another solution for (2.62). The particular solution for g, is found by using an equation imposing the conservation of the density: (2.64) J(hf+ j + ge)d'p = ne 2.2.5 Moments of the Distribution Function Current Densities The total parallel electron current density at the position (r,9) is calculated from the distribution function by integration in velocity space: j(E) qed3vIjf(p-) = 27rqej 1f JO p 2dP f-1 'Ye P Ofd (2.65) This current density can be separated into different contributions according to (2.63). - RF driven current density only (RFCD problem, neglecting radial drift corrections) j(RF) = 11 22rqe j/fo p j --1 'Y e f 2 dp e 0d< (2.66) - Bootstrap current density in absence of RFCD J(BS) _ j(BSe) + (2.67) j(BSi) where J BSe) -2 n +-d gdf is the electron contribution and JS) (2-6) is the ion contribution, calculated from the fluid model by Hirshman f30], and recalled in [27] p.91. The subscripts M denote that f and g have been evaluated by taking fo = fM, maxwellian at temperature Te. 35 - Total current density, which includes the ion bootstrap contribution. J(TOT) j(E) + j(RF) - j(BSi) (2.69) - Synergistic current density J(S) - (TOT) _ j(BS) - j(E) - j(BSe) - j(RF) (2.70) Parallel distribution functions The gyro-averaged relativistic distribution function f is a function of the momentum space variables (pi , p 1 ). A 1-D representation is obtained by integrating over the perpendicular momentum p1: F(pi) 27r J (2.71) f(pii ,p)p± dpi When the important features of the distribution functions are dependent mostly upon the parallel momentum pil (which is the case for LHCD), the representation of the parallel distribution function F(p1 ) is useful and often more physically understandable than the 2-D plot of f. The density can be calculated using F(p1i): IMC 0 (2.72) F(pjj)dpgj = ne In the non-relativistic limit (-y -- + 1), the asymmetry of F in voj = p 1l/me gives the parallel electron current density (2.65): j(E)nr 11 qe j dpvlf (p = qe JLF(pjj)dpij fJ 0 0 me, (2.73) where the superscript nr stands for non-relativistic The expansion of f in the drift parameter 6 (2.63) f =fo+fi withfi=f+g (2.74) F = Fo + F (2.75) holds for F as well: with Fo(p) = 27r j 36 fo(pi1 , p 1 )pidp± (2.76) F1 (pjj) = 27r fi(p 1 , pi)pidpi (2.77) Then, the electron current density, calculated from the parallel distribution function in the non-relativistic limit (2.73) , can be divided into the contributions from RFCD, with (2.66) becoming j(RF)nr = qe Fo (p j)dpjj f (2.78) and the electron bootstrap current, with (2.68) becoming BSe)nr =qe j "Fi(p)dpj (2.79) The synergistic current is then given by (2.70) j(S)nr j(E)nr _ (BSe)nr L(F 1(p1 ) _ j(RF)nr = ge - FM(p||))dp|\ (2.80) Densities of Power Absorbed and Dissipated The power densities can also be calculated by taking a moment of the distribution function. If a differential operator can be expressed under the form of a divergence, S= --V . S (2.81) which is the case for the collision and the quasilinear operators, as shown in Appendices B and C, then the density of power absorbed by the plasma due to the action of this operator 0is given by (D.47) P ymS /o2rjcdg (2.82) Note that the power depends only upon fluxes in the p direction, since pitch-angle scattering is a process without energy transfer and does not contribute to the power dissipated. The expression for the fluxes associated with collisions and quasilinear diffusions are given respectively by (B.16) and (C.13), leading to explicit formulations of the power densities: - Density of power dissipated by collisions The dissipation of energy occurs through diffusion in the momentum magnitude p, and slowing down. PCOn = 2,T d -- 1 j f0 37 dp pm (A(p)-'f + F(p)f Iye ap (2.83) - Density of power absorbed from RF waves Pabs = -27r -1 1 dK-f(11d2\p3Fp'IcJ2( -( dp dj Y e 0 RF 0F (2.84) where DRF(p, ) is the RF diffusion coefficient given by (C.11) and L (f) is the differential operator (C.10). In steady-state, the density of power dissipated should equal the density of power absorbed. Current Drive Internal Figure of Merit The current drive internal figure of merit on a given flux-surface can be defined as the ratio of the RF current density plus the synergistic current density, divided by the total absorbed power density: j(RF) + j(S) 1(TOT)_ - (TOT (2.85) p(TOT) abs which must be compared to the internal figure of merit for the RFCD problem only j(RF) 77 (RF) - (2.86) F p (RF) abs where p(TOT) is calculated from (2.84) with (2.84) with f f = fo + f + g, while p(RF) is calculated from = fo only. Flux-Surface Averaging It is common to present current densities and absorbed power as averaged over the flux surface, so that they are a function of r only. The flux-surface element is dS that, using R = = Rd( rd9 so Ro(1 + e cos 0), the flux surface average of a quantity A is becomes f7 _ rdO f (A(r)) Rd(A(r, 0) rdO f Rd (1 + e cos O)A(r, 0) = (2.87) The flux-surface averaged expressions for current and power densities are derived in Appendix D. 38 Chapter 3 Computational Method 3.1 Background A code (Listed in Appendix F) has been developed to solve the the drift kinetic equation for the total distribution function f as formulated in Section 2.2.4. It is based on the neoclassical Fokker-Planck FORTRAN code fastfp-nc written by S. Schultz [27], and on the Fokker-Planck MATLAB code fp2dyp written by Y. Peysson [26]. Both codes contain initially the Fokker-Planck solver FP2D created by M. Shoucri and I. Shkarovsky [28]. The further development of fp2dyp, which is the major contribution of the present study, consists of two major extensions. First, the resolution of the Fokker-Planck equation (Section 3.2) has been improved with a proper treatment of boundary conditions on particle fluxes (Section 3.2.2) including at the trappedpassing boundary (Section 3.2.3). Then, the neoclassical treatment developed in fastfp-nc has been carried to fp2dyp allowing this code to solve the drift kinetic equation and calculate the bootstrap current consistently with radio-frequency current drive. Modifications have also been made on the neoclassical development that allow a more consistent numerical evaluation of the radial derivatives (Section 3.3). Furthermore, the new code is implemented in MATLAB which is a matrix form code well-suited for the inversion of sparse multi-dimensional matrices. Another advantage of MATLAB is that new modules or modifications are easily added. 39 3.2 3.2.1 Fokker-Planck Equation Flux Formulation The first step in solving the drift kinetic equation (Section 2.2.4) is to solve the equation for fo, solution of the RFCD problem without first order corrections (2.54). (3.1) {C(fo)} + {Q(fo)} = 0 This Fokker-Planck equation is bounce averaged and therefore solved in the (p, o) space. It is not fully implicit, because of the presence of an integral term in (2.34). Several iterations are therefore needed to obtain the steady-state solution, by demanding that the time-dependent Fokker-Planck equation Of - {C(fo)} - {Q(fo)} = 0 (3.2) converges to a steady-state. The bounce averaged collision and quasilinear diffusion operators can be expressed as the divergence of a flux in the momentum space (see Appendix B and C) , so that (3.2) becomes + .(AS()(f 0 )) = {I(fMf0,=1)0 (3-3) where A is the normalized bounce time (2.22). The first-order term I, of the Legendre series, kept to take into account the evolution of the bulk due to collisions with the perturbed distribution (See Section 2.2.1), is an integral term that therefore cannot be expressed under the form of a divergence and must be kept explicitly. In spherical momentum coordinates (p, o) this equation becomes + (p2 O)(o)) _ 1 _ o (fo)) = (3.4) {II(fUM, fo,1=)o} where collisions and quasilinear diffusion contribute to particle fluxes: S(0)(yo) =SCO (yo) + SF,(O) (fo S (f) = (fo)+ The expression for the fluxes §C,(0 ) and 3.2.2 S §RF,(o) SRF(o)(fo) (3.5) are respectively given by (B.18) and (C.16). Finite-Difference Method Differential Operator in Momentum Space The Fokker-Planck equation (3.4) contains second order derivatives in momentum space. It is a boundary value problem that can be solved by finite difference methods. The momentum space 40 p 1 4+ l+1/2, j-1/2 Ei+11 A M S 10 S~~ +J/,1j1/ /2 A-1/+1/2 ++ j+1 jj+3/2 P/ Figure 3-1: Positioning of the discrete particle distribution and fluxes on the (ps,p1 ) grid. is discretized on a (p, o) grid of size (N x M) with p=(i-)1)AP with AP= " +(j-1)A o with A~o- M o,=-1 andi=1,...,N 2 and j=1,...,M (3.6) Unlike the scheme used in previous codes [27] [28], the distribution function f is calculated on the half grid (Pi+1/2, Oj+1/2) so that the fluxes, which are first order derivatives of the distribution function, are defined on the (pi, o j) grid (Fig. 3-1). This scheme is advantageous since the boundary conditions are then automatically satisfied at p = 0 and o = +1, since there is no particle flux through those boundaries according to (3.4). In its discrete form, the expression for the differential operator V - S in spherical coordinates, explicitly written in (3.4), becomes: {V - S}i+1/2,j+1/2 = 2 (P+±Zi+,j+1/2 (P pi+1/2 A+1/2Pi+1/2 7 ji+1/2,j+1 O (A j . i 1/2,j (3.7) The particle fluxes, calculated in Appendices B and C.13, are function of fo and its derivatives with respect to (p, to). The discrete form of these fluxes is obtained by using the following rules 41 p1-112 pi -1/2 j - 1 /2 Pi - 1/ 2 j+1/2 i -1/2 j+3/2 1/2 i+1/2 j+3/2 I Pi+1/2 j -1/2 R+2 i+ 3 / 2 j -1/2 Pi+3/ + ri+3/2 40+/2 1j+1/2 Figure 3-2: Nine-points differentiation scheme for the spatial derivatives: Of fi+1/2,j+1/2 - fi-1/2j+1/2 AP ij+1/2 af fi+1/2, 3 -1/2 +1/2,+1/2 - A O '9~+1/2j Of fi-1/2,j 2Ap f+3/2,j i+1/2,j Of fij+3/2 - fij-1/2 2A~o ij+1/2 and for the distribution function: (1 fij+1/2= +1/2 (1 = - 6 ij+1/2)fi+1/2,j+1/2 -i+1/2,j)fi+1/2,j+1/2 + 6 + 6 ij+1/2fi-1/2,+1/2 i+1/2,jfi+1/2,j-1/2 (3.8) where the coefficients 6ij are introduced in order to account for the exponential decrease of the distribution function. They have been calculated by Chang and Cooper in [4]. With this discretization scheme, the bounce averaged collision and quasilinear operators (3.7) are represented by a 9-diagonal square (NM x NM) matrix M connecting each point (fi+1/2,j+1/2) to its 8 neighboring points in velocity space, represented on Fig.3-2. {V .Si+1/2,j+1/2 = (M. The structure of the matrix M is shown on Fig.3-3. 42 f)i+1/2,j+1/2 (3.9) (PI 1 ,Fi) (pi,4 Figure 3-3: Structure of the 9-diagonals differential operator matrix M. Convergence The time dependence is discretized using an implicit (backward Euler) form Of (f t (t + At) - f(t) (3.10) At so that, using (3.9), the discrete (matrix) form of the equation (3.3) becomes M+ where S(t) = f(t+ At) = hf(t) +S(t) (3.11) {I,(fm, f=1(t)) o} acts as a source term, and I is the identity tensor. Without an integral term {Ii (fM, fl=1) o} in the equation above (for example, when this term is omitted [161), a solution could be found in only one iteration with a time step At >> 1 sufficient to reach steady-state. Fortunately, the steady-state solution of the full equation, including the first-order term I, in the Legendre expansion, can still be found within a few iterations (typically 5 to 30 iterations) with a time step much larger than the collision time (At > 1). The convergence to a steady-state is checked by calculating the norm of the residue Of/Ot from (3.10), as done in [25] and [16] f (Of /at) 2 fdp c f fd3p 1/2 <Rf A good convergence was obtained with a convergence parameter Rfo = 10-10. 43 (3.12) 3.2.3 Trapped-Passing Boundary The accurate treatment of the trapped particles is particularly important in the resolution of the drift kinetic equation since those particles are responsible for most of the neoclassical effects including the bootstrap current. Furthermore, the determination of the driven current (in the abscence of bootstrap current) by solving the Fokker-Planck equation (3.2) requires a proper treatment of the trapped particles because their fast bounce motion generates an enhanced pitch-angle scattering that can affect the current drive efficiency (See Section 4.2.3). Indeed, since the bounce frequency of the trapped particles is much larger than their collision or detrapping frequency (rbT < -rt, Te), any asymmetry in the trapped region is immediately flattened by the bounce motion, and within the trapped domain (16oI < 6oT), the position of the same electron is equally split between (p, -60) and (p, 6o). Therefore, the distribution function fo is intrinsically symmetric in the trapped region. Nevertheless, it may be useful to note that neoclassical corrections generate asymmetry in the trapped region due to the finite radial drift of trapped particles off the flux-surface associated with a radial non-uniformity. These effects enter the first order distribution f. In most Fokker-Planck codes ([26], [27], [6]), the symmetrization of the distribution function, due to the fast bounce motion, is forced explicitly at each time step in (3.11). However, because the distribution function is not symmetric in 6o outside the trapped region, a large time step in (3.11) would lead to a discontinuity in the distribution function, which is not satisfactory. A different method, following [20], has been successfully implemented in the code. The symmetry in the trapped region is obtained by shrinking half of the trapped domain (-6oT < 6O < 0) for the calculation. Then, the particle fluxes between the counter-passing region (6o < -oT) and the trapped region are treated by connecting the first point in the counter-passing region ( o = -6-T) to the last point in the trapped region ( o = oT). This connection has a physical sense since the particle at (6o = -JT) and ( o = -- ) are intrinsically the same. the flux conservation is therefore implicitly included in the discrete scheme by inserting 6 extra non-zero diagonals for the additional flux connections. The structure of the Matrix M is displayed on Fig.3-4. Beyond its consistency in the fluxes conservation, the main advantage of this fully implicit method is that the trapped region is properly treated in an implicit manner, allowing large time step At > 1000 while the former explicit method [27] required a much smaller time step (At < 0.1). A considerable reduction of the calculation time, by orders of magnitude, is thus obtained. Details of the fluxes exchanges at the trapped-passing boundary are shown on Fig. 44 (PN-T-1) (PN' T) 9 Diagonals Figure 3-4: Structure of the 15-diagonals differential operator matrix M. The index (_-1 refers to the pitch-angle position in the counter-passing region which is closest to the trappedcounterpassing boundary. The index CT refers to the pitch-angle position in the trapping region which is closest to the trapped-copassing boundary. 3-5. 3.3 3.3.1 First-Order Neoclassical Calculations Radial Derivatives (calculation of f) The zero-order distribution fo is calculated from the Fokker-Planck equation solved on a given flux-surface, at a specific radial position r. However, the first-order neoclassical corrections to fo are related to the radial variations of the distribution function. This radial dependence appears in the calculation of f (2.61) ffo (3.13) The radial derivative is performed numerically by taking the difference between the distribution function calculated on three neighboring flux-surfaces. However, the consistency of such a process must be checked, considering that the radial variations of the distribution function can have at least four different origins: * The effects of the RF field on the distribution function fo depend upon the local parameters of the RF field (magnitude, spectrum and poloidal localization of the power) that can vary 45 0O ad., -o -OT O OT % S2 in In % s3out %\ %% '1 I out I X p// Figure 3-5: Particle fluxes conservation at the trapped-passing boundary. along the propagation and depend upon r. The accurate determination of these variations requires ray-tracing techniques and are omitted in this work. Taking the three flux-surfaces very close to each other reduces the effect of these variations. " The effects of RF field on the distribution function fo also depends upon the local temperature and density (absorption, normalization of the diffusion coefficient). The RF parameters must therefore be normalized to the density and temperature specific to each neighboring flux-surface. " The radial variation of the electron density must be taken into account in the calculation of f with a consistent normalization of the distribution functions fo. " The radial variation of the temperature has to be handled carefully. Indeed, the three distribution functions required for the calculation of f (3.13) must be defined on the same momentum grid for consistency. Since the temperature is different at each flux surface, it is necessary that the Fokker-Planck code be able to solve (3.11) on a given reference grid independently from the electron and ion temperatures. In particular, the calculation of the collision integrals must take into account the temperature dependence of the Maxwellian distribution. This calculation has been carried out in [29 and has been used in our code. 46 3.3.2 Calculation of g Equation Formulation It is interesting to note that the equation for g (2.62) has the same structure as (3.2), from which it differs only by the presence of a source term. {C(g)} + {Q(g)} = -{C(f)} - {Q(f)} (3.14) Consequently, the flux formulation in (3.2.1) can be reused for solving (3.14). A discrete form analogous to (3.11) can be implemented, with a modified right-hand side source term S = {I1(fM, fl=1)o} - {Cf) - {Q()}1 (3-15) However, the treatment of trapped particle for g and fo are different. 3.3.3 Treatment of Trapped Particles in g fo being symmetric in the trapped region, depends upon particles (Tb < -, according to (2.8)). Te, TQL), f (defined in 3.13) is antisymmetric since vij = v However, because of the fast bounce motion of trapped the collisions and quasilinear diffusion operators are symmetric in the trapped region. Averaged over a bounce period (2.23), the collisions and quasilinear diffusion operators applied to the antisymmetric distribution f vanish and the source term S (3.15) is zero in the trapped region. The solution for g in (3.14) can then be fixed to zero in the trapped region. 47 Chapter 4 Radio-Frequency Current Drive 4.1 General Considerations Among the most widely used techniques to generate a non-inductive toroidal current in a Tokamak is the Radio-frequency current drive (RFCD), which refers to a variety of scenarios for driving a current through the damping and momentum deposition of externally launched waves . For now, lower hybrid waves (LHW) and electron cyclotron waves (ECW) are both serious candidates for large-scale current drive in the future scenarios for steady-state tokamak operations; therefore, both are considered in this study. The radio-frequency current drive problem consists of determining the flux-surface averaged current density (j(RF)) (r) and power dissipated (Pabs)(r) resulting from the presence of given fields E(, t) on the flux surface at radius r. These quantities can be evaluated by taking specific moments of the electron distribution function. When the effects of radial drifts are not taken into account, the distribution function to be considered in fo, solution of the bounce averaged Fokker-Planck equation (3.2) (4.1) 0 {C(f 0 )} + {Q(fo)} Then, the flux-averaged moments are given by (See Appendix D): (J(RF)) _ 27rq, I (Pabs) j P TMe fo 27r 0 dp P 7 e jf J where A is the normalized bounce time (2.22) and do0o(1 + e)fo(p, o) (4.2) -1i _1 df 0(1 +E)A{S 1 F} (43) { } denotes the bounce averaging operation (2.23). Expressions for the bounce averaged RF fluxes are given by (C.31) for LHCD and (C.49) for ECCD. 48 Then, an internal current drive figure-of merit, for the flux-surface under consideration, can be calculated from (4.2) and (4.3): (J(RF)) 11 (4.4) (Pabs) The quasilinear operator Q(f),which describes the kinetic resonance between waves and particles, is given in (2.37). The poloidal field Bp is neglected in the study of RFCD (Bo ~ BT). For electrons, the resonance condition (2.38) can then be rewritten as w - kjjvjj + =0 (4.5) ~jq~IBTT (4.6) with Wce where QT Me = qeBT/yme is the relativistic gyrofrequency associated to BT. The case n = 0 is called Landau resonance. A large absorption of the wave can be expected when a the significant number of electrons have a parallel velocity v 1 of the order of the wave parallel phase velocity w/kjj = c/N 1 . Therefore, a wave with a sufficiently large N is required, which is the case of lower hybrid waves. The damping at n = 0 of a unidirectional NgI spectrum is indeed the mechanism of absorption required for LHCD (Section 4.2). The cases n = ±1, ±2, ... correspond to the electron cyclotron resonance and its harmonics. Absorption now occurs when a the significant number of electrons have a parallel velocity v 1 of the order of the wave parallel doppler-shifted phase velocity (w - nQ)/kll. This condition is fulfilled in the neighborhood of the electron cyclotron frequency (and its harmonics). Such waves are called electron cyclotron waves and this resonance is the mechanism of absorption required for ECCD (Section 4.3). The study of RFCD will be illustrated using the advanced operation scenarios for C-Mod ([23], [9]), which require a narrow RF driven current profile peaked around r = 0.15 m or r/a = 0.7 . Since the present code solves the RFCD problem only on a single flux surface, the specific radius r = 0.15 m will be considered primarily. The C-Mod plasma parameters at this radius are given in (A.1). 49 4.2 4.2.1 Lower-Hybrid Current Drive Lower-Hybrid Waves Cold plasma dispersion relation We consider modes propagating mainly across the magnetic field between the ion and electron cyclotron frequencies (Qi < w < Qce). They are given by the cold plasma dispersion relation [32] Do(x, k, w) = P4 nI + P2 ri + Po = 0 (4.7) where the coefficients (4.8) P 4 = 61 P2 = (Ell + Ec)(n Po = El [(n 4.9) e1 ) + e - e2_] - 6)- (4.10) are function of the parallel refractive index nil and the elements of the cold plasma dielectric tensor which in this range of frequencies are 2 U2 e ~ 1± + , - ~ EXY - (4.11) The dispersion relation (4.7) gives two modes in terms of nI: n (-P2 k VP 2 2 _ 4P 4 Po) (4.12) which are called slow wave and fast wave, respectively for the + and - signs, according to their perpendicular phase velocity c/n 1 . The slow wave is usually referred as the lower hybrid wave since it presents a resonance in propagation (ni - oo) at the lower-hybrid frequency EI -- 0 WLH (4.13) ~1 + W21Qc Accessibility The value of nil for which the square root in (4.12) vanishes defines the accessibility condition. In the case w > Wh = VQceQci, which holds for C-mod (A.2) (Wh,max/27r = 3.8 GHz, w/27r = 4.6 GHz), the accessibility condition derived from (4.12) is given by ng = wp + I+ ce + ce 50 (4.14) W At a given position (ne, ni, B fixed), modes with nil < n are evanescent (n 1 imaginary). Launched slow waves are then reflected back as fast waves. Consequently, lower hybrid waves must be launched with a refractive index nl larger than the maximum value of na along its propagation path. plasma is nax = In C-Mod, the maximum value of the accessibility limit (4.14) over the 3.0 Launching In the range of frequencies under consideration (wavelength of the order of a few centimeters), the antenna structure is an array of waveguides. With an appropriate relative phasing of the waveguides, it is possible to choose the refractive index nil so that the launched waves are unidirectional and with nil > njj. [24] However, close to the plasma edge, the density vanishes and the limiting form of ni1 for the LHW is ni ~- (1 - ni) + In - (4.15) showing that there is a cut-off (n 1 -* 0) at the edge for nl ;> 1, which occurs at the plasma frequency (wp = w) LHW must therefore be launched very close to the plasma edge so that a significant fraction of the power can be transmitted through the cut-off by tunnel effect. Consequently, the launching of LHW requires that the antenna be close to the plasma, which is an issue for reactor-scale tokamaks (antenna deterioration). LH resonance Lower-hybrid waves are subject to the lower-hybrid resonance where w -* WLH. However, in a hot plasma, LHW would not reach the resonance layer but be rather mode converted to a kinetic ion plasma wave (IPW) and eventually a ion Bernstein wave (IBW) [31]. These waves would in fact be damped on ions, which would be a process for ion heating [3]. In order to avoid such a mode conversion, LHW in LHCD are launched with a frequency sensibly greater than the lower hybrid frequency everywhere in the plasma (in C-mod, WLH,max/7 = 2.2 GHz so that w > 2 WLH everywhere in the plasma). Landau damping and spectral gap problem LHW can be subject to a significant wave-particle interaction if the Landau resonance condition w = kllv 11 is satisfied for a large number of electrons. 51 Indeed, a condition for significant linear electron Landau damping (ELD) can be derived from the imaginary part of the dielectric dispersion relation (see [1]) and leads to an energy damping condition 2/ where AXD minjj iX3ee me c 2e eAxD 1 is the radial extent of the expected deposition profile and XOe C-Mod at r = 0.15 m (see Appendix A), (4.16) with AXD (4.16) = C/(V"fnlIVTe). 1 mm gives nii In 3.35. However, the experimental refractive index at launching, nr1 = 2.75 (A.2), is below the spectrum peak as calculated above and even below the accessibility condition at r = 0.15 m (na = 2.9). Therefore, an unexplained upshift of the refractive index must occur along the propagation, referred to as the spectral gap problem. Quasilinear operator for LHCD With frequencies w < Q, LHW are only affected by the Landau resonance n = 0 in (2.37). The LHCD power spectrum presents complicated features that are determined by the launching structures and the wave propagation. For instance, there is always a fraction of the power launched in the opposite direction from the desired one, because the phase shifting of the waveguides is unable to produce a purely unidirectional spectrum. To simplify the problem, it is assumed that the spectrum can be considered as being flat between two limits, with a lower bound ngI,min of the n11 spectrum is given by the accessibility condition (4.14), and the upper bound njma is determined by the damping condition (4.16). Another approximation made to simplify the problem is to assume that the LH power has a uniform poloidal repartition. In fact, a realistic poloidal repartition of the power requires ray-tracing techniques not available for this study. These two assumptions are clearly questionable in the prospect of considering the global current drive problem. However, there are acceptable for the study of the LHCD mechanisms at a given flux-surface. The derivation of the quasilinear operator for LHCD is detailed in the Section C.3. 4.2.2 Simplified 1-D Analytical Model for LHCD In the case of LHCD and in the non-relativistic limit, the quasi-linear diffusion operator 2.37 can be rewritten as Q(f) = ( Di (nr) 09vI (V 52 09f (4.17) where the dependence upon vjj in the non-relativistic diffusion coefficient D (jnr is kept to treat accurately the case of weak diffusion Do < 1: (4.18) DLH(vII) = m2D H VTe Vil with DLH given by (C.21). We introduce the assumption that the dependence of the electron distribution upon the perpendicular velocity is a maxwellian at temperature T. This approximation is very questionable because it neglects the increase in perpendicular temperature due to pitch-angle scattering, which can be a dominant process, especially at high Zi. fe = (4.19) fN(v±-) f(vII) the collision operator is greatly simplified and reads [33] C(f) = v(vI1) Ef +V2 (4.20) e f where (4.21) v(vii) = ve(2+ Zi) V'3 Introducing the dimensionless velocity =V = V(1ma V2 =min V,1 4.22) VTe VTe VTe the Fokker-Planck Equation (3.2) for the electron distribution function becomes vfD(jdo + _f (2 + Zi + 1 -f = 0 dv (4.23) and can be integrated: j V f(v) = f(0) exp Idv' [01 + Do/(2 + Z,)V'2 (4.24) For v < v, Do = 0 (C.20) and the integration reduces to v'dv' = v 2 /2 (4.25) For v, < v < v 2 , Do / 0 so that J (2 + Zj) + Dov2 dv'_ V11min 1 + Do/(2 + Zi)v' 2 (2+Z )/2DO (2 + Z2 ) + Dov2 For v > v 2 , Do = 0 and the integration reduces again to v'dv' = v 2 /2 oVImax 53 - Vm /2 (4.27) Using (4.25)-(4.27), the electron distribution function becomes Sf(0) exp(-v 2 for v < vi /2) Dov 2 ])(2 +zi)/2 Do f(0) exp(-v /2)([(2 + Zj) + Dov2]/[(2 + Zj) + f f(0) exp[(vi for v, i v v1)/2]([(2 + Z) + Dovf1/[(2 + Zi) + Dov ])( 2 +zi)/2 Do exp(-v - which in the case of strong RF fields Do f = for v < v, f(0) exp(-v'/2) for v, - /2) for v2 ! V (4.28) > (2 + Zi)/2 reduces to f(0) exp(-v 2 /2) f(0) exp[(v2 2 2 v2)/2] exp(-v /2) for V2 (4.29) < 5 v2 < V In the case of strong RF fields (f given by (4.29)), the normalized current density and the normalized density of power dissipated by collisions (which in steady-state equals the density of power absorbed from the waves) can be estimated: fM fV V2 eneVTe e- P 2V2 neMeVreVe (2 ±zi)Ji 1 V2 - CQf ) fMv)~ V 2 _2 dv (.0 (2±Zi)fm(v)In(V2 V1 dv +(dv (430 V- 2 V1 J 2ve vdv fM(Vl) f fIVJ(v~dv (4.31) An analytical formula for the LHCD internal figure of merit can therefore be derived from this ID model: g(1D) _ e ITI/D 2 mevTeve V ) 2(2 + Z )ln(v2 /v1) A more accurate calculation, using the adjoint technique [11], gives a similar expression for 77 with a different multiplicative factor: Ad mevieve/e 2 - (4.33) 5 + Zi ln(v 2 /v1) This expression for the internal figure of merit, larger than the 1D result by a factor 4(2 + Zi)/(5 + Zi), increases with Zi from 2 for Zi = 1 to 4 for Zi -> oo. This difference confirms the importance of the T 1 increase due to pitch angle scattering, which is neglected in the ID model. The higher efficiency is explained by the fact that the resonant electrons with higher TL are more energetic and therefore less collisional. The pitch-angle scattering of electrons increase with Zi, which explains the dependence upon Zi in the factor q Adj / 4.2.3 7 (1D) Numerical Calculation of LHCD LHCD distribution function The distribution fo has been calculated for the case of LHCD in C-Mod at r = 15 cm (Appendix A). The conditions for accessibility (4.14) and strong damping (4.16) give the spectrum limits 54 2 nlfmin= 2.8 and nfjm.a = 4, which correspond in velocity space to Volma = 6 VTe and Vomi = 3 .5VTe according to (C.22). The normalized diffusion coefficient (C.21) is taken to be DLH = 1. The distribution is plotted on Fig 4-1. The graph above is a 2D contour plot of the distribution. The contour lines represent the values of a relativistic maxwellian at p = 1/4, 1/2, 3/4, -... The graph below shows the parallel distribution function FO, defined in (2.76). The features of LHCD seem to be well described by the consideration of the LHCD plateau between pi = vi/'y(vi) and P2 = v 2 /y(v in the parallel distribution Fo. This plateau creates 2 ), an asymmetry in parallel direction and drives the current. The flux surface averaged LH driven current calculated by the code is (j RF)) = 10.9 MA/M 2 . The normalized internal current drive figure of merit calculated from the code (4.4) is / e = 17.5 e/ (MeV2ve ) (4.34) while the normalized current drive efficiency calculated from the adjoint technique (4.33) applied to the present case gives 7Adj = 14.6. The adjoint technique, although it is closer to the numerical result than the simpler ID model, remains somewhat smaller than the 2D numerical result. The difference can be explained by the fact that the adjoint technique assumes a small perturbation of the distribution, with respect to the maxwellian, which is not true for high-power LHCD. Benchmarking of LHCD calculations LHCD calculations from the present code have been benchmarked using the results presented by M. Shoucri and I Shkarofsky in [28] and obtained with a 2-D code based on the same model. Using the LH parameters VI1min = 4 VTe, V11ma = 7 VTe (4.35) the results for the normalized current densities and the density of power absorbed are in good agreement (Table 4.1) 4.3 4.3.1 Electron Cyclotron Current Drive Electron Cyclotron Waves Launching The terminology Electron Cyclotron Waves (ECW) refers to electromagnetic waves with frequencies in the range of the electron cyclotron frequency and its harmonics. In C-Mod at R = RO, 55 Electron Distribution Function in LHCD 12 8 .............. .................................................. CD CL CL 4 .................................. .. ................. .............. 0 -12 -8 -4 0 ...... ......... ............. .. .. . 12 8 4 Parallel Electron Distribution .................. ... .. .. .... ... .. ..... .. .... .. .. ... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . .. .. .. .. .. . .. .. .. .. .. .. .. .. .. .. ... ....... .. . .I. .. .. . .. . .. . .. .. .-. .. .. .... . .. . . . .. .. .. .. .. .. .. . .. . .. ... .. .. .. .. .. .. ... .... .. .. . . ... .. .. .. . . . . . .. . . . . . .... ... I....................................... ..................... 10-1 .. .. .. .. .. ..................... . . . . . . . . .. .. . . . .. ... .. .. .. .... ... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .... .. .. .. .. .. .. .. .. ... ... .. .. .. .. .. .. .. .. ................... . . . . . . . . . . . .................. . . .. .......... . . .. . . . . . . . . . . . . . . . . . . 10-2 ... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .................... .. .. .. .. .. .. .. .. .. ... .... .. .......................... .. . .. .. . . ......................... . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . * . . . . . . . . . .. . . . . . . . .. .. .. .. .. .. .... ... .. . . . .. ...................................... ........ ..............I...... ............................ ............... LL 10-3 .. .............. .. .. .. .. .. .. .. .. .. .. .............................. ........ -I. .. ....... .. ... .. .. .. .. I. .. .. .. .. .. .. .. .. . . . . . .. .. .. ......... .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . . .. .. .. .. .. .. .. *. .. .. .. .. . . .................. .. .. .. .. .. .. .. .... ... .. .. .. .. ... . . .. ... .. .. .. .. ... ....... ............ .... 10-4 . .. . . .. . . . ..... .................. . .. .. .. . .. .. .. .. .. ... .. .. .. . ... ... .I. .. .. .. . .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. .. . .. .. .. . ;. .. .. .. .. .. .. . .. .. .. .. .. .. .. .. .. .. .. .. .. ... I.. ... .. .. ............. ........ :...................... 5........... ......................... 10 . . . . ............ ....... .. ... ... ... ... .. ... ... .. .. .. .. .. .. .. .. .. .. .. .. .. ..:..... .. .. .. .. .. .. .. .. .. .. ....... .......... ...................................................... ......................................... ........... ......... 10 0 10-6 -10 0 -5 5 10 PI/pTe Figure 4-1: Distribution function calculated for C-Mod (vI = 3.5, v2 - 6, Do = 1). 2D contour plot of fo(above) and logarithmic plot of the parallel distribution FO (below). 56 DLH T' -(2) J\ 3 x10- DLH Te Ve2e keV x10- 1 1.5 5.0 0.3 1.5 1 0.3 (1) (2) Pabs Pabs x10- 4 x10- 4 4.7 1.4 1.8 3.2 3.0 1.2 1.2 5.1 3.3 3.2 1.3 1.3 5.1 1.8 1.8 0.8 0.8 3 Table 4.1: LHCD calculations (current density j and density of power absorbed Pabs normalized respectively to enevTe and nemevreve) by M. Shoucri and I Shkarofsky [28 (1) and from the present code (2). where B = BC = 4 T, the electron cyclotron frequency (4.6) is fce = Wce/27r = 112 GHz. Elec- tromagnetic waves in this range of frequency have a wavelength on the millimetric scale and can be directed and focused with mirrors like optic beams. ECW are right-circularly polarized electromagnetic waves, and as long as they remain far from cut-offs and resonances, they propagate in the plasma essentially unchanged from their launching in free space (k ~- klaunch., N = kc/w ~ 1). As a consequence, the launching of ECW does not require any specific coupling structure (no waveguide array as for LHW) and their propagation is easily predicted, and well controllable with mirrors. Even with a fixed frequency w, the launching of ECW has many degrees of freedom (see figure 4-2) allowing simultaneously the control of the damping radial position (adjusting the poloidal launching angle #/T). #p) and the parallel refraction index N (adjusting the toroidal launching angle Mirrors can be reoriented in a short time (less than a millisecond) for a dynamic profile control. Under appropriate conditions (see Section 4.3.3), the wave power can be absorbed in a single path, over a short distance. The easy control of the wave propagation, along with a narrow deposition profile, makes ECW well suited for current profile control [12]. the generation of high-power ECW at these high frequencies (e.g. f - However, 200 GHz for second harmonic in C-Mod) poses challenging technical problems that have not yet been solved. Hence, the calculations for ECCD in advanced scenarios of C-Mod are not presently realizable. Polarization Electromagnetic waves propagating perpendicular to the magnetic field are in two different modes according to their polarizations [32]. 57 R OT , /0 (a) (b) Figure 4-2: Launching angles and propagation for ECW. (a) top view, (b) poloidal cross-section " The ordinary (0-)mode is linearly polarized, with the electric field in the direction of the constant magnetic field (E(s, t) 11So(i)). The 0-mode must propagate at a frequency higher that the electron plasma frequency Wpe = 2 ne rome (4.36) which is a cut-off for this mode. " The extraordinary (X-)mode is in general elliptically polarized in the plane perpendicular to the constant magnetic field (E(5, t) 1 Bo(X)). The X-mode is subject to the right-hand cut-off W,- 1 + J+ (2J)2(4.37) and encounters a mode resonance (k1 -+ oc in a cold plasma) at the upper-hybrid (UH) frequency 2 Wuh e W2e (4.38) where it is partly converted to electrostatic Electron Bernstein Waves (EBW). In oblique propagation (N11 4 0), polarizations are mixed and 0- and X-modes cannot be separated. However, modes showing a predominant 0 or X type of polarization can be approxi58 mately called 0 or X, respectively. Propagation in a tokamak On Fig. 4-3 are displayed the radial frequency profiles in the plane 0 = 0 for ECW propagation in C-Mod (ne and BT profiles in Appendix A). Both the X-mode (left graphs (a),(c)) and the O-mode (right graphs (b),(d)) are considered, with launching from either the low-field side (LFS)(top graphs (a),(b)) or the high-field side (HFS)(bottom graphs (c),(d)). Since ECCD occurs near the cyclotron harmonics (w ~~nwce), ECW propagation must be considered from the edge of the plasma to the location of these harmonics. The electron cyclotron resonance f = fce cannot be reached from the LFS by the X-mode in C-Mod (Fig. 4-3, graph (a)), because of the right-hand cut-off. With the O-mode (graph (b)), only two narrow low-density layers at the edges (where fpe < fe or fe, > max,(fpe) is satisfied) are accessible from the LFS. On the other hand, from the HFS, all radii are accessible with the X-mode (graph (c)), and a large layer on the HFS (where fce > f,e) can be reached with the O-mode (graph (d)). However, launching from the HFS can be technically problematic because of the lack of room on this side. The first harmonic (fEcw ~ 2fce) and higher harmonics are accessible for all radii from the low field side with both the X-mode and the O-mode. Absorption and choice of EM mode The resonance condition (4.5) being satisfied, the diffusion coefficient (2.40), which determines the absorbtion magnitude (through (2.84)), can be rewritten as 2 1 Jjnj+ 1 + Ek,_ ei(--)n+1Jan_1 + ELEk,II(-_1)nJni Dk = q2 Ek,+e-a(-)n- e ~P1 (4.39) since the condition for having a significant number of resonant electrons (4.5) requires n < 0. The Bessel function property J-n = (-1)nJn was used in (4.39). It has been shown above that only the harmonics InI > 2 are accessible from the LFS, which for a compact tokamak like C-Mod is the only technically acceptable launching option. The argument of the Bessel Function in (4.39) is kjv 1 = -N_ (4.40) MC Wce where (2.26) and (4.5) have been used. Since ECW remain mostly unchanged from their characteristics in free-space, N ~ 1, then N 1 ,< 1. In C-Mod at r 59 = 0.15 m (A.1), resonant electrons Xo ic 0-mode in C-Mod. Launching from LFS X-mode in C-Mod. Launching from LFS 350 .2fce 300 2t- 300 250 250 r ECW (X-mode) 200 a 200 150 150 100 100 50 50 0-. -0.5 0.5 ra ECW. (0-mode) ffuh 0-_ 1 0.5 (b) (a) X-mode in C-Mod. Launching from HFS 300 N E 300 2t 250 250 200 N 200 ECW (0-mode 1:. 150 150 foe 100 ECW (X-mode) 100 -ce- * pe.-- 50 50 0.. I-- 0-mode in C-Mod. Launching from HFS 350 -0.5 r9a 0_. 0.5 -0.5 ra 0.5 1 (d) (C) Figure 4-3: Radial frequency profiles in the plane 6 = 0 for ECW propagation in C-Mod (Appendix A). ECW propagation is represented by a horizontal arrow (fEcw is fixed by launching) from either the low-field side (top graphs (a),(b)) or the high-field side (bottom graphs (c),(d)). The propagation of both the X-mode (left graphs (a),(c)) and the 0-mode (right graphs (b),(d)) is considered. The two first cyclotron harmonics fce and 2 fce are displayed. The shaded areas represent the regions of frequencies unaccessible to the given mode, due to cut-offs (right-hand cut-off f, for the X-mode, plasma frequency fpe for the O-mode) and resonances (upper-hybrid resonance fuh, affecting the X-mode). 60 have pi/mc < 0.25 so that up to the fourth harmonic Inj = w/wee = 4, the argument of the Bessel functions (4.40) is kiv±/LQI < 1 and therefore the Bessel functions are accurately approximated by (4.41) Jn(z) ~ (z/2)"/n! The 0-mode is characterized by an E-field polarization parallel to the magnetic field so that the dominant term in (4.39) is Ek,1I. The 0-mode diffusion coefficient therefore reads D(On) = -k 21 P / 2 21 qe2e qe j 1Jn~iiOE~i2 (|n|!)2 p2 LL) N 21nI W~n~_v_/) , |11i Ek,11 1 (4.42) mc2wce The X-mode has an F-field polarization perpendicular to the magnetic field. The electrons are resonant with the X-mode is the wave is circularly polarized in the same direction as the electron gyro-motion, which is right-hand polarized. This condition appears in the expression for the diffusion coefficient (4.39), where the dominant term, for a given harmonic n, is Ek,_ Jin 1because of the fast decrease of the Bessel function with Inj for small arguments (4.41). With such a polarization, the X-mode diffusion coefficient is /2(InI-1) 2 D(Xn) = q,|Jinll(kiv/E 2 [(Inj - e_ 1)!]2 w(4.43) N mc 24c3 ) (4. Comparing (4.42) and (4.43) with kIvi/Wcel < 1, the X-mode diffusion coefficient is larger the one for the 0-mode at a given harmonic. In conclusion, the X-mode at the first harmonic (X2-mode) seems to be the most appropriate choice in the case of C-mod. Quasilinear operator for ECCD Assuming a gaussian transverse extent for the magnitude of the ECW beam E-field is convenient, since it implies a gaussian spectrum in the Fourier space. However, ray-tracing techniques would be required for a more realistic spectrum, for the prospect of solving the global ECCD problem. Such a study is beyond the aim of the present work, which focuses on the ECCD mechanisms at a kinetic level. The derivation and bounce averaging of the quasilinear operator for ECCD are detailed in Section C.4. 4.3.2 Mechanisms for Current Generation EC resonance curves The resonance curves, that give the region in (pu, pi) space where the resonance condition (4.5) is fulfilled, can be studied as a first step in the analysis of quasilinear diffusion due to ECW. The 61 resonance condition is recalled: w - kvll + (4.44) 0 Wce -y with PH =Y + = 2 (4.45) Defining the parallel refractive index and the ratio of the harmonic frequency to the wave frequency as kgc Ni = nQee y= (4.46) leads to the following equation for the resonance condition in (pl1, p±) space: 2 = (NI, '+ y) (4.47) which can be rewritten as (1 - N-1) MC) N1 y PH y2 ___+ mc 1 -1N 1 - (4.48) 11 This equation gives an ellipse centered in pil/mc = Ny/(1 - N ) and p' = 0. A significant wave absorbtion can be expected when a large enough number of electrons are positioned on this resonance curve, which occurs when the resonance curve is sufficiently close to the thermal bulk. As seen on Fig. 4-4, the absorbtion should be enhanced by larger N11 (fixed by the launching angle OT) and should increase as the wave approaches a cyclotron harmonics (y = nWce/w - 1. Particle fluxes and current generation The differential operator (2.39) + m) 1ggymew k 11p0pi1 + -- -0 - (4.49) P can be rewritten in (pll, p±) variables as I(f) = P1 ymew - 1 ) (4.If (.50 The direction of diffusion is derived from (4.50) using (4.5): Ap=_ p' Api- klp 1 /(-ymeW) pii kl 11 /(ymeW) - 1 _ p_ N11 mc nwce/w (451) In the case of ECCD in C-Mod at a radius r = 0.15 m, resonant electrons have pi/mc < 0.25; N11 - 0.3 is an optimal choice for ECCD (see Fig. 6-7) and w/2wce ~1 for the X2-mode. Therefore, less than 10% of the momentum increase of an electron due to EC diffusion is in 62 EC Resonance curve (C-Mod, 2WJw = 0.9 7 , r=0.15rr 1- I =0.26 =0.28= 0.30 = 0.32 H= 0.34 =0.36 10 0.38 5 0 P Pte 10 15 EC Resonance curve (C-Mod, r=0.15m, N1 =0.34) 15 2..= 0.965 2Uo= 0.970 2Qo= 0.975 2W= 0.98) 2'w= 0.985 10k0 5k SL. -5 . 0 5 10 15 14/PTe Figure 4-4: Resonance curves for C-mod parameters and varying NiI at fixed 2Q/w (above) and for varying 2Q/w at fixed NII (below). 63 the parallel direction. The current drive by direct transfer of parallel momentum is therefore negligible. The particle fluxes generated by quasilinear diffusion (C.49) are displayed on Fig. 4-5. As expected, the diffusion is mainly perpendicular. Moreover, a contour plot of the diffusion coefficient (dashed lines) shows the finite width of the resonant region, according to (C.42). Another visible characteristic of the EC quasilinear diffusion is that its magnitude increases with p1, as it is also seen in (4.43). In particular, there is no diffusion at p± = 0. While the distribution function is affected by the EC quasilinear diffusion, collisions tend to bring it back to a Maxwellian . The competition between steady Quasilinear diffusion, collisions, and an energy loss process (radiation, radial diffusion) eventually defines a steady-state. Note that in the present code, energy is not conserved as a truncated, linearized collision operator is used (section 2.2.1). Therefore, no energy loss term is necessary to reach a steady-state. The bounce averaged particle fluxes in steady-state, due to EC quasilinear diffusion and collisions, are given respectively by (C.49) and (B.18). Adding them gives the total steady-state fluxes, displayed on Fig. 4-6. It is interesting to see that the quasilinear diffusion itself does not generate any current, since it is essentially in the perpendicular direction. However, it creates an anisotropy in the distribution function that generates an asymmetry in collisional fluxes. Those asymmetric collisional fluxes are eventually driving a current. Then, two processes affecting particle fluxes are competing in the generation of current: " The first effect is that the perpendicular quasilinear diffusion transport resonant particles to a region in the (p11,pi) plane with higher pi. There is therefore a depletion region under the resonant curve, which is quickly filled collisionally by surrounding electrons (with lower pi)) since lower energy particle are rather collisional. On the other hand, there is an accumulation region above the resonant curve from which particles are only slowly diffusing toward lower (p1j, pI) region because they are more energetic and therefore less collisional. In steady state, there is a resulting accumulation of particles at higher pi, which generates a current due to a change in resistivity. This effect is called Fisch-Boozer effect [2]. " A second effect opposite to the Fisch-Boozer effect is due to the presence of trapped particles. Because of their fast bounce motion, trapped particle can transfer almost instantaneously (on the time scale rb < 0 = -(-. Te,QL) particles from the region (o = (fr to the region As a result, there is a sort of short-circuit across the trapped region, which 64 RF driven normalized fluxes in ECCD 4 -5 3 2 a) 1 0 -1 tokamak = C-Mod r=0.68 2n /w =O97 - N ,,=0.34, -2 -4 -3 -2 0 -1 1 2 3 4 P//PTe Figure 4-5: Normalized particle fluxes due to EC quasilinear diffusion, as calculated in (C.49). The length of the arrows is proportional to S/fo. The solid lines are a contour plot of the steadystate distribution function and the dashed lines are a contour plot of the diffusion coefficient DEC exp [- (kji,res - 022 65 Total normalized fluxes in ECCD 5 4 3 .. .. . .. .. . . .~. 0) I0~ H 0~ .. .... ..- 2 1 .... 0 '.. .. -1 .. tokamak = C-Mod rla = 0.68 2Q o 0.97 21 0 =0 B -2 -4 NJ/I -3 -2 -1 0 P//PTe 0.34 1 2 3 4 Figure 4-6: Steady-state normalized particle fluxes due to EC quasilinear diffusion and collisions, as calculated in (C.49) and (B.18). The length of the arrows is proportional to S/fo. The solid lines are a contour plot of the steady-state distribution function and the dashed lines are a contour plot of the diffusion coefficient DEC exp[-(kli,res - k-,o)2 accelerates the diffusion of particles out of the accumulating region described above, therefore reducing the current. When particles are diffused to become trapped in only one side of v11, the current thus generated is called Ohkawa current[21]. It can be larger than the Fisch-Boozer effect and drives a current in the opposite direction. 4.3.3 Numerical Calculation of ECCD and Benchmarking ECCD calculation parameters For comparison, the tokamak parameters (density, temperature and magnetic field profiles) are chosen to be close to the experimental conditions for LHCD in C-Mod (Appendix (A). Without the help of ray-tracing, local wave parameters have to be assumed from launching parameters. Far away from cut-off and resonances, the wave vector k can be assumed to be roughly conserved along the propagation. Then, the local parallel index N11 can be geometrically 66 EC Resonance curve at midplane (C-Mod, r=0.15m , [4= 0.34, 2UO= 0.97) 10 =0 = 45 8 - 90 6 180 .b -5 0 10 Figure 4-7: Resonance curves with C-mod parameters versus 6 b, 15 which is the poloidal angle at the position where the EC beam crosses the flux-surface under consideration (C.47). calculated from rT,Op and R. The ratio nQ/w is directly related to the local major radius R through the profile of Bo (2.9). In order to simplify their interpretation, all ECCD calculations presented in this study are considering that the wave is absorbed on the LFS midplane (Ob = 0, See Fig. 4-2). However, ECCD in experiments occurs at various poloidal angles (this is necessary for reaching different radial positions with the same wave frequency). The poloidal deposition angle does not influence the absorbtion from well-passing particles since their parallel velocity is almost constant in 0. However, it can affect significantly the absorbtion by barely passing particles, since their parallel velocity - which appears in the resonance condition - largely varies with the poloidal angle. Therefore, it is possible to account for poloidal angles 9 b $ 0 by considering a deformation of the resonance curve, as seen on Fig. (4-7). ECCD distribution function Figure (4-8) shows a contour plot (solid lines) of the steady state distribution obtained by numerical simulation of ECCD in C-Mod, as well as the antisymmetric part of the parallel distribution FO, which is given by (2.76). The C-Mod tokamak parameters are given in Appendix (A). The wave parameters are N11 = 0.28 and 2wce/w = 0.97. They have been taken so that the driven current is maximum (with a positive N11). The dotted line represents the relativistic 67 maxwellian at temperature T, (Appendix A). Each contour lines represents the value of the maxwellian at a half-integer values of p. The accumulation of particles above and on the right of the resonance curve appears clearly as well as the depletion below the curve. The enhanced pitch-angle scattering due to the presence of trapped particles is also visible. 68 Effect of ECCD on fo 7 6 5 4 CL72 1 0 -6 -4 6 x 1U 0 .. . . .. . . . . . . . .. . . . .. . -2 ........ -4 -6 .. . .. . . . .. . . . .. . . .. . . . .. . . . . .. . . . .. . . .. . ........ .... 6 4 2 6 Antisymmetric Part of the Distribution 4 2 6 -2 -4 4 : . .. . . . . . . . .. . . . . . . .. . . . .... . . .. . .. . ... . .. . : . .. . . . .. .. . . .. . . . . .. ..... .... . .. . . . . .. . . . .. ... . .. . . . . .. . . . .. . . . . . . .. . . . I. ............ .... ......... ......... ...... . ... ........................... 2 -2 4 6 // Pe Figure 4-8: Graph above: Steady-state ECCD distribution function (solid lines) and Maxwellian distribution at the same temperature (dotted lines). The dashed lines are a contour plot of the magnitude of the diffusion coefficient DEC. Graph below: Antisymmetric (part in pgj) of the distribution FO. 69 Chapter 5 Bootstrap Current in a Maxwellian Plasma 5.1 Simplified Picture of the Bootstrap Current A simple physical picture of the bootstrap current can be obtained by considering the motion of particles in the vicinity of a given flux surface located at a radius r (See Figure 5-1). At zero order in the expansion (2.51) (considering no radial drift of electrons), particles are staying on the same flux surface along their orbit. This flux surface being characterized by a given temperature T(r) and a density ne(r), the electron distribution on this flux surface is a Maxwellian fom(r) = exp )7 / ne(r) exp(-#- 2 ) 2 3 47r(me 2) ,3tK 2 (/3# ) 47r(Me C2 )3 tK2(O where £ = 'ymec 2 Te 2 )) (5.1) meTe(r)(1 + is the total energy of an electron, K 2 is the modified Bessel function of the second kind, and with 3 th (5.2) e2 me c = To first order in the expansion, trapped particles and barely passing particles are drifting out of their (mean) flux-surface. As shown on Fig. 5-1, particles that belong to the neighboring flux-surfaces r- and r+can be found now on the flux-surface of radius r. Let us assume that the toroidal magnetic field BT is directed clockwise around the torus vertical axis, and that the toroidal current I (generated by RFCD, neutral beams or inductive methods) is directed in the same direction(Fig. 5-1). Therefore, following Ampere's law, the 70 -- BP VD r- r+ V// < 0 ' BT,1 V//> 0 Figure 5-1: Characteristics of trapped electron motion in the poloidal plane. poloidal field Bp is directed counter-clockwise in the poloidal plane (direction 9). Moreover, the direction of particle drift for electrons is given by (sign(qe)B x VB) and therefore is directed upward on Fig. 5-1. Hence, on the low field side (0 = 0), poloidal field and electron drift are in the same direction. This property is true as well if the direction of BT and I are both inverted. Therefore, to perform a banana orbit, an electron on the inside of its banana orbit must be going in the direction of Bp and then has vj1 > 0, while an electron on the outside of its banana orbit must be going in the opposite direction and has vil < 0 (as shown on Fig. 5-1). As a consequence, on the given flux surface at radius r, electrons having drifted from the more dense and hot inbound flux-surface r- have vjj < 0 while those having drifted from the less dense and hot flux surface r+ have vj1 > 0. These electrons collide with passing electrons at radius r and because of the asymmetry between the pressures at r- and r+, there is a net transfer of momentum to passing electrons at radius r in the negative direction vjj < 0. Carrying a negative charge, those electrons drive a current in the same direction than BT and I, called the bootstrap current. If the toroidal current I is in the direction opposite to the toroidal field BT, the direction of the poloidal field Bp is inverted and so are the signs of vj1 in the banana orbits. The bootstrap current is then in the direction opposite to BT and therefore also adds to I. in conclusion, the bootstrap current is always a positive contribution to the toroidal current I. According to this simple physical picture, the bootstrap current can be expected to increase 71 with the plasma pressure gradient. A larger drift excursion of the particles off their flux surface should also enhance the bootstrap current. According to (2.15), this drift is proportional to the bounce time and therefore increases if the poloidal field Bp is reduced. It is also clear that the bootstrap current should be proportional to the number of trapped particles, which fraction is of the order of E (2.11). This simple physical picture predicts a bootstrap current (5.3) dc 1 dr ~"Bp 5.2 5.2.1 Numerical Calculation of the Bootstrap Current Characteristics of the Distribution Function The bootstrap current in the absence of RF fields can be calculated using the simplified set of equations (2.2.4): {C(gM)} = (5.4) -{C(fM)} where f is derived from the zero-order, maxwellian distribution function fo = foM (5.1). fM -- Vil (5.5) rfom The total distribution is fm = foM + fim = foM fm + gm (5.6) and the electron bootstrap current density is given by (2.68). A contour plot of the total distribution function fM including effects from radial drifts is shown of Fig. 5-2 (top). The solid line is simply the maxwellian distribution foM and the dashed line is the total distribution fM including the first order correction flM due to radial drifts. As described by the physical picture in section 5.1, there are more particles with a velocity vil > 0 than with a velocity vil < 0, and this asymmetry concerns mostly the barely trapped and barely passing particles, which experience the largest drift off their flux-surface. The parallel first order distribution F1M = 27r j flM(pjipI)p± dp 1 (5.7) is shown on Fig. 5-2 as well (bottom). It is antisymmetric in pl1 as expected, and this asymmetry generates the bootstrap current, according to (2.79). The case shown on Fig. 5-2 refers to the distribution in C-Mod at radius r = 15 cm (r/a = 0.68). The flux-surface averaged electron bootstrap current density calculated from this distribution is 3.7 MA/m 72 2 tokamak = C-Mod r/a = 0.68 Neoclassical Correction to the Maxwellian ........ 4 2)3 . . .. . .. .. .. ... .. 1 . .. .. .... .... .. 0- -4 x 10-3 1 0.5 L:_ .. . .. .. .. . . . .. .. .. . .. . ... ... ... .. .... .... .... .. .. . ... ... ...... .. ...... ..... ..... .... .... ... ..... . ... .... .. .... 4 2 0 P//re Parallel First Order Distribution .............................. .......-2 . .. . .. .. . .. .. . . .. .. . ..... ...... .... .. ......... .... ... . . .. a .... ........ 0 . . .. .. . .. .. . .. .. . . ... . . . . .. . -0.5 -1 ......... ............... ..... . .. .. .......... -4 .. .. .. -2 . . .. . . . . .. . . .. .. . .. . .. . . .. . .. .. . . ...... . . .. . .. .. . .. .. . .. . .. .. . .. .. . .. . .. .. .... . . .. .. .. . .. .. ..... .... ............. Pire 2 4 Figure 5-2: Electron distribution function to first order in the neoclassical corrections. Top graph: Maxwellian foM (solid) and corrected f0M + f1M (dashed) distributions. Bottom graph: parallel first-order distribution F1M, calculated from flM using (5.7). 73 Bootstrap current in CMod without RFCD 7 6 - - - - - .. . - DKE code - Sauter Hirshman E 5 0 0.2 0.4 0.6 0.81 Normalized radius: r/a Figure 5-3: Bootstrap current calculated from the transport coefficients by [30] (dotted line), [181 (dashed line) and the code (solid line) for C-Mod parameters (Appendix A). It is interesting to note that the neoclassical corrections to the maxwellian is not described entirely by their projection on the parallel direction. Indeed, the correction affects mainly particles with a significant perpendicular velocity, in the vicinity of the trapped region. The perpendicular velocity affects only slightly the value of bootstrap current (reduced because of relativistic effects) but can be of great importance in the study of the synergism with RE fields, particularly in the case of ECCD where a 2D description is necessary. 5.2.2 Benchmarking Calculation of the Bootstrap Current The numerical calculation of the bootstrap current can be compared to the analytic result from the transport calculations by Hirshman and Sigmar [30] and Sauter et. al [18]. Using those models, the bootstrap can be derived from the temperature and density profiles assumed for C-Mod (See Appendix A). The same profiles have been used with the code and the results are shown on Fig. 5-3. The current calculated from the code agrees well with the predictions of the fluid models. Note that the contribution of ions to the bootstrap current, coming from the transport calculations [30], is added (2.67). According to the analytical result derived in the Lorentz limit (Section 5.3), 74 the bootstrap current is maximum around r/a ~ 0.3 - 0.4, where the pressure is high and the profiles are steep (since the bootstrap current is driven by temperature and density gradients). Analysis in the Lorentz Model [13] 5.3 oo), pitch-angle scattering on ions is the dominant collision In the Lorentz gaz model (limit Zi -* process and electron/electron collisions are neglected. The collision operator is then simply given by (B.12), which in the non-relativistic limit reduces to: C(f)= 2 aa(1 [ - - (5.8) Zive (5.9) 2) with the electon/ion collision frequency Ze 4 ni ln A 3 4rm2v Vei = being much larger than the electron/electron collision frequency ve, given in (2.35). This simplification allows the derivation of an analytical expression for the bootstrap current even in the kinetic description. Starting from the zero-order, non-relativistic maxwellian, which is the limit of (5.1) for 3 Ith -+ 1, -+ 0: n oM 3/2 (5.10) 7) exp( we can calculate f: fM Vr dInn, ~ &fo ag Q - r o - dr + ( MeV22 v 2Te 3 dInT~ _)_ 2 dr AM (5.11) I The bounce averaged Lorentz collision operator (5.8) applied to fm and g have been derived in [27] and reads {C(fM) {C(g veiH(o I= - O) 1 '9 [(1 - + (V, OfoM) (5.12) 02)A (1 where the bounce average coefficients A and A are given respectively by (E.18) and (E.38). As explained in Section 3.3.3, gM to be finite at = 0 for trapped particles. If we require in addition O = ±1, the solution of (5.4) becomes 0 'o (27] 91 = -- HV(|0| - GT)(G - GT)(1 + IfM 4 OT 75 '9M/ QO,min or (5.13) Bootstrap Current in C-Mod Lorentz - -- - Sauter Hirshman 6 -- E5 -... 0 0.2 -.. 0.4 0.6 Normalized Radius r/a 0.8 1 Figure 5-4: Bootstrap current calculated from the transport coefficients by [30] (dotted line), [18] (dashed line) and the result in the Lorenz limit (2.67) (solid line) for C-Mod parameters (Appendix A). The electron contribution to the bootstrap current can then be evaluated from (2.67): _ 1.46. J..s nfeTe (dln ne dr or.By + dln Te (5.14) dr/ Confirming the simple physical picture (5.1), the bootstrap current increases with the fraction of trapped particles fi and the pressure gradient dpe/dr. It is reduced if the poloidal field is made stronger. A comparison of the bootstrap current calculations for C-Mod (at Ze = 1), between the results from Hirshman, Sauter and the analytical result (2.67), is presented on Fig. 5-4. It shows that in spite of the limit Z,>> 1 and the approximations made in the derivation of (2.67), the profiles for the bootstrap current are similar. However, the current predicted in the Lorenz limit is about 15% too large. 76 Chapter 6 Self-Consistent Calculation of RFCD and the Bootstrap current In this section, RFCD and bootstrap current are calculated self-consistently, in the sense that the modification of the radial drift corrections fi due to RF fields is taken into account, by solving the full set of equations (Section 2.2.4). However, there is no self-consistent calculation of the global currents and power dissipated, which requires ray-tracing and absorption codes to calculate the evolution of RF fields. In addition, a self consistent calculation of the plasma equilibrium is not carried out, since the poloidal field is determined by a toroidal current that is not calculated by the code but taken from tokamak operation scenarios (e.g. [9] for C-Mod). Bootstrap Current in LHCD 6.1 6.1.1 Estimation of the synergism for a realistic scenario The calculations presented in this section describe LHCD in C-Mod at r = 0.15 m (r/a = 0.68), as proposed by an advanced operation scenarios [9]. As explained in Section 4.2.3, the LHCD parameters are chosen to match the conditions for accessibility and strong Landau damping (4.16). They are also consistent with the launched power spectrum (A.2), when an upshift in nil, found by ray-tracing techniques, is considered. These parameters are Vilmin = 3 .5VTe, Vlmax = 6 VTe and Do = 1. All values displayed for the current densities are flux-surface averaged (Appendix D.2). The bootstrap current calculated without LHCD (Section 5.2.1) is (J,(s)) = 3.7 MA/M 2 . The current calculated for LHCD without first order corrections (Section 4.2.3) is (J(LH)) = 10.9 MA/m 2 . These values agree with the results obtained by S. Schultz [27] ((JLH)) = 10.6 MA/M 77 2 and (J 1"e)) - 2.9 MA/m 2 ). Note that the results presented by [27] for the bootstrap current do not include the ion contribution (J BSi)) - 0.8/ MA/M 2 . The self consistent calculation of LHCD with the bootstrap current gives a total current (J,(O')) = 15.2 MA/M 2 . We can thus evaluate the synergistic current (J(S)) _ (BS)) (LH) J(TOT) 2 0.6 MA/m = (6.1) which is slightly larger than the result found in [27] ((J s)) = 0.44 MA/M 2 ) The fraction of LHCD current supplied by the synergistic current remain small in this case (J(s)) (6.2) 5.3% (OT _(BS) More relevant for the LHCD problem is the synergistic effect on the internal figure of merit, given by the difference between (2.85) and (2.86). The densities of power absorbed found in the numerical simulations are respectively (p(LH)) = 6.2 MW/M 3 (p(OT)) = 6.9 MW/m 3 (6.3) for the LHCD problem only, and for the self-consistent LHCD+BC calculation. It is found that the density of power absorbed is larger when the bootstrap current is present, so that the internal figure of merit is unchanged: 7(TO) = 1.7 Am/W ((LH)) Therefore, in the present case, relevant to future experiments in Alcator C-Mod, there is no synergistic effect on the internal figure of merit. 6.1.2 Physical picture of the synergism On Fig. 6-1 is shown the parallel first order distribution (2.77) F1 = 22r j f(pl, pi)pidpi (6.5) in the case of a Maxwellian distribution (fiM, solid line) and in case of LHCD (dashed line). The asymmetry in F determines the bootstrap current (2.79) in the non relativistic limit. With LHCD, a plateau is raised in F in the region of quasilinear diffusion. This observation leads to a first interpretation of the synergism: From the 'bootstrap current' point of view, the synergism is due to the LH quasilinear diffusion affecting the first order distribution function which therefore drives an enhanced bootstrap current. 78 fi 1.5 63 1 - First order parallel distribution Bootstrap only Bootstrap with LHCD 0.5- LC' -0.5 -1 -1.5 -10 5 0 -5 10 T//e/Pe Figure 6-1: parallel projection of the first order distribution function, with (dashed line) and without LHCD (solid line). On the other hand, it can be interesting to consider the synergism as the effect of fi (first order distribution in the drift expansion, which generates the bootstrap current) on LHCD. In Fig.6-2, the dashed line represents the parallel electron distribution function for LHCD only F (2.76). The dotted line is associated with the total distribution calculated non self-consistently. It is the sum F + FM of the distribution for LHCD only F and the first order distribution "bootstrap only" F1M (2.77). At last, the solid line represents the total distribution function F = Fo + F (2.71) calculated self-consistently. According to (2.80), the synergism is then given by the shaded area between the solid and the dotted line. This leads to another interpretation for the synergism: The asymmetric first order distribution function fi brings more electrons to the maxwellian at velocity v 1 . Since the height of the quasilinear plateau is fixed by this value of the distribution fm at velocity vi, there is an enhancement in the height of the plateau, which corresponds exactly to the amount of additional electrons brought by flM, as seen on Fig. 6-2. In fact, the shaded area of Fig.6-2 is exactly the same as the area between the solid and the dashed lines on Fig. 6-1, which confirms that the two interpretations for the synergism (from the bootstrap or from the LHCD point of view) are equivalent. 79 Parallel Electron Distribution 5 x 10.4.5- ElM 4- a, 3.53- N 2.50 -I ~~~--- 2- 1M - - - 1.51 0.5% U 9 3 4 x 10 -3 5 Parallel 7 /P6 8 P///pTe lectron Distribution F=+ 1.9 ---- F= nsc 0 + 1M 1 .8 .7 NO .6 .5 011 .4 . ..... C 01 .3 1 .2 -. 3 3.5 4 45 p 5.5 6 6.5 7 Figure 6-2: The bottom graph is a zoom of the top graph in the region of the quasilinear plateau. The dashed line represents the parallel electron distribution function for LHCD only Fo (2.76). The dotted-dashed line is the first order, "bootstrap only" distribution function FM. The dotted line is associated with the total distribution calculated non self-consistently Fnsc = Fo + F1M. The solid line represents the total distribution function calculated self-consistently F = FO + F (2.71). The "steps" in the line contain no physics and are simply due to the numerical change of variable (p,) -* (p, pi). 80 This ID picture of the synergism is consistent with the fact that no enhancement of the internal figure of merit is observed, because the synergistic current, associated with an increase in the height of the plateau (Fig.6-2), is generated at the same localization in p1l as the LH current. 6.1.3 Prediction of the synergism in the Lorentz model As seen on Fig. 6-2, the synergistic fraction of current seems to be given by the extra elevation of the plateau due to the additional electrons brought at v = vi by fiM. Therefore, S. Schultz sug- gested in his thesis [27] that the synergistic contribution to the LHCD current can be estimated by the fraction j(S) 11 - F1M(Plmin) - PImn (6.6) FOM(PlImin) j(LH) using the "bootstrap only" parallel distribution function FM given by (2.77) pi(fm -- gM)dpL Fim(pgj) = 27r (6.7) where fm and gm have been evaluated in the Lorentz model (5.11) (5.13), so that (6.6) becomes F(plimin) FM(||min) dlnTe 1 ~- VCpo 2 P11min 3 dr If the temperature variations dominate (d in Te/dr (6.8) PTe ) > d In ne/dr), then the synergistic frac- tion predicted takes the following form: 6.1.4 (S) j(B) J(LH) en,3VTe 1 3 VT, Test of the Predictive Model According to the approximate model described above, the synergistic current is expected to increase proportionally to the bootstrap current, and with a factor (vllmin/vTe) 3 having two origins according to the expression (5.11) of fM: a contribution (VII VTe) 2 derivative of a Maxwellian (term mev 2 /2T in (5.11)), and another (VII comes from the radial /VTe) is present in the 3 expression of the drift (2.2.2) and thus in im (2.58). The resulting factor (vjjmin/vTe) at v11 = vI1min, since the elevation of the plateau is fixed by as seen on Fig. 6-2. In FM(VIjmin), is evaluated other words, the first-order distribution flM decreases more slowly than the maxwellian, so that the synergism is larger when LH current is driven further in the tail. However, if the resonant electrons are far in the tail, only a little current is driven. 81 In this section, a test of this predictive model is performed in various situations by modifying the LHCD parameters. All situations are related to LHCD with C-Mod plasma parameters at radius r = 0.15 m. (Appendix A) First is considered the dependence upon Keeping all other parameters fixed (VIjmin/VTe). according to the operation scenarios for LHCD in C-Mod (vmax = 6, Do = 1, 1p = 0.7 MA), Vj1min is let free to vary. Results are reproduced on Fig. 6-3. Currents are displayed on the top graph and the dependence of the synergistic current upon (VIlmin/VTe) is shown on the bottom graph. It is not surprising to see that the LH driven current decreases rapidly with higher (VIImin/VTe) since the number of resonant electrons drops according to the maxwellian distribution. The synergistic fraction of the LH current is shown on the bottom graph of Fig. 6-3. It increases with and fits nicely an increase rate (Vjjmin/VTe), (VIjmin/VTe) 3 , as predicted. However, the actual value of the synergism predicted by our simple model (6.9), not shown on this graph for clarity, is larger than the numerical result by a factor 2. The influence of (VIlmax/VTe) (VIjmax/VTe) is considered in Fig. 6-4. with a parabolic evolution as expected (4.30). current is independent of (V11max/VTe) The LH current increases with The synergistic fraction of the LH as expected from (6.9), but is lower than the predicted value (6.9) by a factor of 2. According to the predictions, the synergistic current should increase linearly with the bootstrap current. This dependence can be tested numerically by modifying the bootstrap current independently from LHCD. This variations can be obtained by changing the total toroidal current Ip which affects the poloidal field Bp and thus directly the bootstrap current but not the LH driven current. The currents and synergism are calculated both in the cases of high (Fig. 6-5) and low (Fig. 6-6) LH current compared to the bootstrap current. In all cases, the predictions from (6.9) concerning the dependencies upon the LHCD parameters hold, whatever the relative scaling of the LH driven and the bootstrap current. However,there is always a factor of 2 to 3 between the analytical and the numerical results, present in all the simulations carried in this study. Possible reasons for such a difference are discussed below. 6.1.5 Discussion It has been shown in the previous section that the parametric dependencies of the synergistic current predicted analytically are well confirmed by the numerical calculations. In particular, the synergistic fraction of the LH driven current increase linearly with the bootstrap current and with (VIjmin/VTe) 3 . This is true also when the bootstrap current is larger than the LH driven 82 r/a = 0.7 V//max = 6 Current Densities vs V//i /VT lp = A0.7 MA 7 < (RF) 60 . . -. . .. . . .. .-.. - -<Jr > -. <J IO)> -.....-... . - 50 . . . .. . .. . - .-. C~.J E . . .. . -. .. ..- ... ... .. .-.. -.- --. 40 A30 - .- - .-.. .. . . .- . . . ... .. .-.. . . . . . . .. . .-. V 20 -.- . - . . -.. -.. . . .. . . -. 10 ..~ ~~~~~ ~~ ~ . -- - 0, 4 3.5 V /min /V 4.5 5 Te Synergistic fraction of LH current vs v.min /vTe 0.5 S>/jRF) - 0.45 0.4 0.35 (H -. -. 0.3 0.25 / -.. -............. .-.-.- .... .....-........- ........-........-... 0.2 - . . .. . ... .. -. ..- -. .. . .. . -.. . .. . .. .-.. -- 0.15 0.1 0.05 ffII 3 3.5 4.5 4 V//min 5 Te Figure 6-3: Current densities in LHCD (top) and synergistic fraction (bottom) versus vin . 83 r/a = 0.7 3.5 0.7 MA V//min = lp = Current Densities vs V/I/vT 9R;, <j (RF)> 20 -<jterOT)> HI C~j E 15 .. ..ma == - -. - - - - - - - .'.. .. ....... . - - - - - .... .. .... ... ......... .... ... - - .. - .. - . - ..- ..- ..- ... - - .. - .. - .. V 5 4 4.5 5 5.5 6 6.5 7 Te //smax t Synergistic fraction of LH current vs v Hmx/V 0.: 2 <JS >/<j(RF)> 0.18-- -.. ,..,,,. ).. J B)>/(3 e n v ) (V/. .... H e VTe) (//min/VTe) ... 0.16- 0.14 - -.. . . .. . . .. . . ... . .. .... .. .... .. . ...- 0.12 - -. - -......... 0.1 -... ....... -. .. ............. - 0.08 . . . . -... . . .- . . . . . 0.06 .. ~~~~~~~~~ ~~ ~ . 0.04 - -.. ..- . . 0.02 4 4.5 5 5.5 /max 6 6.5 7 Te Figure 6-4: Current densities in LHCD (top) and synergistic fraction (bottom) versus vlmax . 84 r/a = 0.7 V//mi n =3.5 x= 6 Current Densities vs I p 20 J(RF) 18 - J 16 . . . . . .-. . > <I -. T) 14 - -~~< ->- E12 ) -( .......... : ......... e................ 210 - ... V 6 4 2 0. 0. 3 0.5 0.4 0.7 0.6 1 0.9 0.8 P Synergistic fraction of LH current vs <J HI 0.5 .-- (S).><(RF)> 0.45 - -- - - 0.4 ,,,, >/(3 ~ fl en v )V ~ ~ / - -~e- - -mn/~ .. .... .... ... ... ... ... . ... ... .... ...... .... ... ..... . ... 0.35 . .- -..-.. .. -.. .. .- . . ... . . .-.. . .. . . . .. . 0.3 .. . .-. .-.. .. . . . ... . .. . -.. . -.. -.. -.. .. 0.25 ..... I ......... . ... .... . ... .... ... ...... ....I 0.2 ........... ... ... .... . . .... ... ..- 0.15 0.1 ..- -..- ........ -... - -. -.-. ..... . . . .... - -. - 0.05 0 3.5 4 4.5 5.5 ( 5 6 6.5 7 7.5 // Figure 6-5: Current densities in LHCD (top) and synergistic fraction (bottom) versus the bootstrap current in a case of high LH current . 85 r/a. = 0.7 V// min = 4.0 V// nax = 6 Current Densities vs I P 10 (RF), Jes 9 > -J 8 -. 7 E - --..- . . ...-.-. .. -.-. -- -- -- -. -s " -- ---.......-...--...-...-.--........--rT -~~~< - - -. - 6 5 :4 - - --> > V 3 2 1 3 0.5 0.4 0.6 0.7 0.8 0.9 1 P Synergistic fraction of LH current vs J(B) 0.5 <j(S)>/<j(RF)> 0.45 -- - <J$) <J >/(3 (RF e n VT) //miV )3 0.4 0.35 - 0.3 -~e - - -....- .. .. . - . -. 0.25 -. -.. .. . . .- 0.2 0.15 55 0.1 0.05 3.5 4 4.5 5 5.5 6 6.5 7 7.5 J(B) // Figure 6-6: Current densities in LHCD (top) and synergistic fraction (bottom) versus the bootstrap current in a case of low LH current . 86 current. In fact, in the case of C-Mod with LHCD as described by operation scenarios [27] [9] (r = 0.15 m, VIjmin/VTe = 3.5, Vjmax/VTe = 6), a synergism of 6%, calculated numerically, is expected. The analytical model predicts up to 12%, higher with a the factor 2 that is present in all simulations. The origin for this discrepancy is due to either the ID interpretation of the synergism (6.6) or the analytical approximations (5.11), (5.13) for the calculation of flM = M -- gm in (6.7). The ID approximation consists of saying that the synergistic fraction of the LH driven current is given by j(S) ______ J(LH) Fim - lmin) (6.10) FOM(PIfmin)' The error made then can be evaluated numerically. In the case of C-Mod described above, the numerical calculation gives F1M(Pjjmin)/FM(PIImin) = 8%. In this particular case, one third of the discrepancy can then be related to the approximation of a 1-D interpretation of the synergism. Indeed, the mechanisms of both LHCD (high Ti) and the bootstrap current (see Section 5.2.1) are affected by 2-D effects not accounted for in this simplified picture of the synergism. The remaining factor 5/3 is related to the analytical evaluation of the bootstrap current and of FM(plImin). A first correction can be brought in by adding the contribution of the logarithmic density gradient in (5.14). In the case of C-Mod Te and ne profiles, this leads to a factor 4/15 instead of 1/3 in (6.9) and therefore the error factor 5/3 is reduced to 4/3. The the bootstrap current calculated from the code for C-Mod at r = 0.15 m is (J BS)) - 3.7 MA/M 2 , close to the predictions by Sauter, et. al [18] (J sSaut)) = 3.8 MA/M 2 . The analytical prediction in the Lorentz limit (5.14) gives (JBSLor.)) = 4.6 MA/M 2 . (See Fig. 5-4). The calculations in the Lorentz limit therefore give a bootstrap current too high by a factor 4.6/3.7 ~ 4/3 which explains the remaining difference factor. 6.2 Bootstrap Current in ECCD The simulations presented here assume that EC driven current is expected to occur at a specific, given radial position r (for example, for profile control). The poloidal deposition angle 9 b clearly has a strong effect on ECCD, since the fraction of trapped electrons strongly depends upon 6, and vanishes on the hight-field side. We choose a deposition on the mid-plane (Ob = 0), which is where the fraction of trapped particles is maximum, and therefore where the most significant interaction between ECCD and bootstrap is expected. Moreover, only the X2-mode is considered (see discussion Section 4.3.1). 87 Density of EC Driven Current MA/m 2 1 2 0.995 1.8 1.6 J< 0 0.99 (Negative Ohkawa current dominant) 1.4 0.985 11.2 3 CS 6 0.98 0.8 0.975 J ~0 . (No absorption) 0.97 -0.4 0.965 0.9G , 0.2 1 0.3 0.2 0.4 0 N/ Figure 6-7: ECCD in C-Mod at r = 0.15 m versus N11 > 0 and 2Q/w. Where N11 and 22/w are too small (lower left corner), the resonance curve (4.48) is too far away in the tail and very few electrons are resonant with the ECW so that no current is generated. On the other hand, where Nil and 2Q/w are too large (upper right corner), the resonance curve is too close to the trappedpassing boundary and the Ohkawa effect reduces the current generated and eventually becomes predominant. Between those limits, ECCD can be optimized, including when one parameter (NiI or 2Q/w) is fixed. Then, only two launching parameters (OT and w) can be adjusted to deposit the current at the expected radius r. They are fixing respectively the parallel refractive index N11 and the ratio y = 2Q/w. By defining the resonance region in momentum space (Section 4.3.2), these two parameters are affecting both the absorption magnitude and the competition between the Fisch-Boozer and the Ohkawa effects. Since those parameters have comparable effects on ECCD, one can be fixed and the other varied without loss of generality. Indeed, this statement can be verified on Fig. 6-7 where it can be seen that current can still be optimized with one parameter being fixed. Then, the choice of fixing w is natural since it is experimentally much easier to modify the launching angle (by rotating mirrors) than changing the frequency. Simulations are therefore done with N11 as the only free parameter. Simulations have been carried for the cases of C-Mod and DIII-D (See Appendix A). 88 Current Densities for ECCD in DIII-D 1.4 1 .2 RF 1.2 - -- .... .... E ... ..... 0 .8 -..... A V 0 .6 -..... BS -- -------------- 0.4L 0 .4--- BS> 4#< 0B2 0.2 - S .-. -.-- .. r/a= 0.44 ni0=0 00 0.3 - 0-.96 B 0.32 0.34 N, 0.36 0.38 Figure 6-8: Current Densities for ECCD in DIII-D at r = 0.3 m. 6.2.1 ECCD with Bootstrap Current in DIII-D On Fig. 6-8 are displayed the EC driven current (J 1 RF)) (dashed line), the (Nil independent) bootstrap current without ECCD ((J ergistic current ((J BS)) BS)) solid line), and the bootstrap current with the syn- + (AS)), dotted line). The total current is then the sum of the dotted and the dashed lines, and the synergistic current is the small difference between the dotted and the solid line. Concerning the EC driven current, it can be observed that it increases with N because the resonance curve moves towards more populated regions (See Fig. 4-4), but only until a certain point where the Ohkawa effect becomes important (as the diffusion region gets closer to the trapped region). Besides, the synergistic current increases with N 1 , but remains a very small fraction of the EC driven current for these experimental DIII-D parameters. The synergistic current is plotted again on Fig. 6-9 (dashed line) where the solid line represents the increase AT in the bootstrap current due to the enhancement of temperature generated by ECCD, and calculated by taking the second moment of the distribution function, as defined in [16]: AT= f 3n b 2 1mev e 2 2 (fo--fm)d 3p (6.11) Where both curves superpose could suggest that the synergism between ECCD and the 89 Synergistic current for ECCD in DIII-D 0.035 0.03 - 0.025 - - 0.02--- rla =0.44 ?0.015 nQ 0 /o 0.96 4 0 =0 0.015-B 0 0.3 0.32 0.34 N/1 0.36 0.38 Figure 6-9: Synergistic current for ECCD with bootstrap in DIII-D at r = 0.3 m. Bootstrap current is simply due to an enhancement of the bootstrap current due to electron heating, at least for low N 11's. The difference between (J(S)) and (J S) increases with N11, as the resonance curve gets closer to the trapped region. This suggests that the synergistic current would be also subject to the Ohkawa effect. On Fig. 6-10 is displayed the parallel first order distribution (2.77) without (FiM, solid line), and with ECCD (F1 , dashed line). The dotted line represents FM,AT, first order distribution without ECCD, but with an enhanced temperature derived from (6.11). It becomes clear that the synergism is not only due to an increase in the temperature, which would lead to a uniform increase (solid to dotted line) of F and therefore of the bootstrap current. On the contrary, the synergism (solid to dashed line), is generated mostly by electrons in the tail. In the case of DIII-D studied above, for which the bootstrap current is small compared to the ECCD, the synergistic current is not a significant fraction of the EC driven current (less than 1% at the ECCD peak N11 = 0.35). A larger synergism can be expected for a high-bootstrap current scenario, like in Alcator C-Mod, which is the case considered next. 90 Parallel First Order Distribution x 104 -- I 3.5 - ... .... . N6 RF withRF with A T =0.62 keV 3 2.5 LL- 2 .. . . . . . . . 1.5 1 0.5 . . . . .-. . . ..... . . . . . . tokamak= DIII-D rla =O0.44nni/o =n:0.96 , - I. . . . . . ..-. 00 - 0 /B- 0.5 N . .. 1 = 0.35 1.5 2 p/p II Te 2.5 3 3.5 4 Figure 6-10: Parallel first order distribution without (F1M, solid line), and with ECCD (F, dashed line), and also for the case without ECCD but with an enhanced temperature (6.11) derived from fo in ECCD (FM,AT, dotted line). 91 Current Densities for ECCD in C-Mod 5 45 - RE __ -- Is BS 4 - . !. < jB >+ JS 3 5. . .... ...... .... .......... ... ... ............... ...... ...... A -, V - - B 0.5 %.25 ....... ...... a2.5 .r= 0.68 2 n9 0/w=O.97 0= 1.5- ................. ......... 0.26 0.27 0.28 0.29 N// d.3 0.31 0.3 Figure 6-11: Current Densities for ECCD in C-Mod at r = 0.15 m. 6.2.2 ECCD with Bootstrap Current in C-Mod New scenarios for C-Mod [9] entail a large bootstrap fraction, up to 70% of the total current, the remaining 30% being driven by RFCD. It would be interesting to determine if the synergism between RFCD and the bootstrap can become more significant for these high-bootstrap scenarios, eventually reducing the necessary amount of current to be driven. The simulations are carried at r = 0.15 m, which is the location for RFCD in this scenario. On Fig. 6-11 are displayed the EC driven current (J RF)) (dashed line), the (NI, independent) bootstrap current without ECCD ((J(BS)), solid line), and the bootstrap current with the synergistic current ((JBS)) (S) dotted line). Again, the total current is the sum of the dotted and the dashed lines, and the synergistic current is the difference between the dotted and the solid line. Unlike the previous case on DIII-D, the bootstrap current is larger than the RF driven current. For the EC wave parameters leading to the highest EC current (NI = 0.28, 2Wce/W = 0.97, according to Fig.6-11) and a hypothetical EC power on the flux surface of 10 MW, we find JEC) = 1.7 MA/M2 BS) = 3.4 MA/M _ (EC) 2 jr(O) = 5.5 MA/M2 (6.12) which gives a synergistic current (J(S) ((TOT)) 92 BS)) = 0.4 MA/M 2 (6.13) Synergistic current for ECCD in C-Mod 1.4 -- jJ 1.2 - r = 0.15m S nQ/o = 0.97 A0=0 B E S0.8 0.4 - 0.2 .25 ------------0.26 ---- .27 028 0.29 N,, 0. 0.31 0.3: Figure 6-12: Synergistic current for ECCD with bootstrap in C-Mod at r = 0.15 m. The synergistic fraction of the driven current (J(s) ) 20% (6.14) ( S) (J EC ) is much larger than for the case of DIII-D. The density of power absorbed is large in the present case, because of the strong Ohkawa effect, but does not vary much when the effects of radial drifts are included: (P(LH)) = 14.0 MW/M 3 (pTOT)) = 14.2 MW/m 3 (6.15) so that there is a net synergism on the ECCD internal figure of merit, given by the difference between (2.85) and (2.86): 77TOT) = 0.15 Am/W 7(LH) = 0.12 Am/W (6.16) On Fig. 6-12 are plotted the synergistic current (solid line) and the increase in the bootstrap current due to the enhancement of temperature generated by ECCD (dashed line), calculated by taking the second moment of the distribution function (6.11). The argument of a synergism being due only to a temperature increase due to ECCD, which seemed to hold in DIII-D, fails completely in the case of C-Mod where the increase in T can explain only 10% of the synergism. 93 1.5 ,x 10-3 -No Parallel First Order Distribution RF with RF with A T= 0.10 keV 1 .. ..... tokamak =C-Mod r/a - 0.68 -- nQ ho = 0.97 0 0=0 B N =0.28 -- u-- 0.5 k . .- 4-- 0C - 1 2 p/p HI Te 3 4 5 Figure 6-13: Parallel first order distribution without (FM, solid line), and with ECCD (F1 , dashed line), and also for the case without ECCD but with an enhanced temperature (6.11) derived from fo in ECCD (FM,AT, dotted line). 94 Effect of ECCD on First Order Distribution A 3.5 3 tokamak =:C-Mod r/a = 0.68: ngoco =0:97 N ttrapped passing .28. 2.5 0 2 = 0 1.5 1 0.5 04 ) 1 3 I 4 // Te Figure 6-14: 2-D contour plot of the first order distribution fi. The dotted line (flM) is the case of a maxwellian plasma (no ECCD); the solid line (fi) is the case with ECCD. The dashed line is a contour plot of the EC diffusion coefficient. Considering the parallel first order distribution on Fig. 6-13, it can be seen that unlike the case of a simple increase in temperature (dotted line), the extra current due to the presence of ECCD (dashed line) is driven mainly in the tail of the distribution fi. Indeed, the origin of the synergism can be understood better by considering the 2D plot of fi (Fig. 6-14). The dotted line (fiM) represents the first-order distribution, due to radial drifts, for a maxwellian plasma (no ECCD), while the solid line (fi) is the case when ECCD is on. It appears that the electrons described by this first order distribution are subject to EC quasilinear diffusion, in a way similar to the Fisch-Boozer effect on the zero-order maxwellian (Fig.4-8). The resonant region in momentum space (dashed contours) almost coincides with the maximum of the first order distribution fi, leading to a large synergism. The synergism clearly results from a 2-D interaction between ECCD and the radial-drift perturbed distribution fi. 95 Chapter 7 Conclusion * General Considerations A new two-dimensional code allows fast calculations of the steady-state solution of the drift kinetic equation with quasi-linear diffusion and Fokker-Planck collisions. The trapped/passing boundary conditions and the symmetrization in the trapped region, which are important for neoclassical effects, are treated in a new way. It has been shown in this study that the synergism between the bootstrap current and both LHCD and ECCD could be a large fraction of the RF driven current, under the condition of a large bootstrap current. In the case of off axis current drive in C-Mod [9], which has been chosen for most scenarios used in this study because of the large bootstrap current associated, a synergism of 6% has been found with LHCD, and up to 25% with some hypothetic ECCD, which so far remains technically impossible because of the lack of high power generators for 200GHz EC waves. The mechanisms for the synergism have been investigated. In both the case of LHCD and ECCD, the synergism can be understood as the effect of RF quasilinear diffusion on the asymmetrically drifting particles (first order distribution fi). * LHCD and Bootstrap Current In the case of LHCD, a simpler, 1D interpretation has been found to explain the synergism. Indeed, the synergism can be related to the enhancement of the LH quasilinear plateau thanks to the additional electrons with velocity v1 ..in, which are brought by the asymmetrical radial drift. A estimation of the synergism, based on this 1-D interpretation and on the bootstrap current evaluated in the limit of a Lorentz gas, leads to a synergistic fraction 96 of the RF driven current given by J(S) 111 j(BS) i ( V11min J(RF) enevTe 3 3 (7.1) VTe This estimation has been found to predict the numerical calculation with good accuracy. The dependence upon the bootstrap current and upon V1lmin have been tested with an excellent agreement. However, the prediction is constantly larger than the numerical calculation by a factor of 2. Several approaches have be considered to explain this difference, which seems to be the accumulation of approximations due to both the 1D model for the synergism and the Lorentz model for the distributions. It is interesting to note that the synergism between LHCD and the bootstrap current concerns the driven current and not the CD efficiency: the increase in the driven current goes along with an increase in the power dissipated. The physical picture of the synergism suggests an interpretation for this observation: if the synergism is due to an increase in the number of electrons at v = Vlmin, it is equivalent to an overall increase in the density. Since the CD efficiency does not depend upon the density, it remains constant with the synergism. " ECCD and Bootstrap Current Although most of the features of LHCD and its synergism with the bootstrap current can be well described considering the ID representation F(pj) only, the mechanism of ECCD is essentially two-dimensional since the diffusion coefficient depends upon pi. However, since the corrections fi due to particle drifts have a strong component in the perpendicular direction as well, there can be a strong synergism between ECCD and the bootstrap current. Contrary to the case of LHCD, the synergism in EC driven current is not associated with a significant increase in the power absorbed. In ECCD, the current is not driven by a specific portion of the distribution function as in LHCD (there is no plateau). However, the synergism occurs well in the tail of the distribution (See Fig. 6-12) where electrons are less collisional. The efficiency of the synergistic current is therefore higher than the overall efficiency of ECCD. * Suggestions for Future Work This study can be extended to other tokamaks and scenarios. It would also be interesting to use this code with results from ray-tracing calculations, in order to consider cases that 97 are closer to the experimental situation. Moreover, coupling to ray-tracing would allow a global study of the synergism in the figure of merit, and therefore an estimation of the actual additional synergistic current that could be driven for a given amount of input power. The last developments of the code allow the self-consistent study of RFCD, bootstrap current and radial transport, which also suggests to extend this work. Moreover, it appears in the latest simulations that a strong positive current can be driven by the Ohkawa method (OKCD), described in Section 4.3.2. It would be interesting to compare the synergism with the bootstrap current for this case. Concerning the off-axis RFCD problem, a comparison between OKCD on the low-field side (large fraction of trapped particles) and ECCD on the high-field side (no trapped particles) can also be suggested. 98 Appendix A Profiles for Tokamak parameters A.1 Alcator C-Mod The parameters chosen to simulate experimental conditions in C-Mod [23] are given by Table A.1. The radial profiles for the temperature, the density and the toroidal magnetic field on the midplane are shown on Fig. A-1 The most recent advanced tokamak operation scenarios for C-Mod [9] rely on heating by ICRF, and current drive with high bootstrap fraction, supplemented by LHCD peaked far from the axis, around r = 0.15 m. At this location (r/a= 0.68), the plasma parameters are Te(r) = 2.1 keV, ne(r) = 1.8 x 1020 m- 3, q(r) = 2.6 (A.1) The parameters for LHCD are fLHW = 4.6 GHz, PLH = 2.4 MW, no = 2.75, C-MOD Ro 0.68 m a 0.22 m Te0 7.5 keV Tio 4.0 keV neo 2.5 1020 m-3 BT 4T Table A.1: On-axis parameters in C-Mod [23] 99 An= 0.25 (A.2) Profiles in C-Mod (on midplane 0 = 0,n) 8 T (keV) 7- 6 B. (T) 5 3 -.--... 0 -1 (......-. -0.5 0 0.5 Normalized Radius r/a 1 Figure A-1: Temperature, density and toroidal B field profiles in C-Mod [23] A.2 DIII-D The parameters chosen to simulate experimental conditions in DIII-D [19] are given by Table A.2. The radial profiles for the temperature, the density and the toroidal magnetic field on the midplane are shown on Fig. A-2 We consider off-axis RFCD at r = 0.3 m. At this location (r/a = 0.44), the plasma parameters are Te(r) = 6.1 keV, ne(r) = 3.5 x 1019 m-, 100 q(r) = 1.5 (A.3) DIII-D 1.67 m a 0.67 m Teo 7.8 keV To 6.2 keV neo 4.3 1019 m-3 Bt 2 T Table A.2: On-axis parameters in C-Mod [19] Profiles in DIll--D (on midplane 0 = 0,n) 8 7 -..... T '(kWV -.... 6 T (keV) 5 4 e- 3 2 BT(T)- 1 0 -1 -0.5 0.5 0 Normalized Radius r/a 1 Figure A-2: Temperature, density and toroidal B field profiles in DIII-D [19] 101 Appendix B Collision Operator The collision operator C(f) = Cee(f, f) (B.1) + Cee(fM, f) + Cei(f, fi) includes a differential term that describes the collisions with the Maxwellian bulk and with ions (Section B.1), and a integral term describing the effect on the bulk resulting of collisions with the perturbed distribution function (Section B.2). Differential term Cee(f, fM) + Cei(f, fi) B.1 The collision operator describing collisions of the electron distribution f with the maxwellian bulk electron distribution fM and with ions fi is given by (2.34) Cee(f, fM) + Cei(f, fi) B.1.1 = 2 (A(p) ' + F(p)f)1 + [(1 - 2) (B.2) Detailed Expression The expression (B.2) shows that collisions affect the electron distribution f through three dif- ferent physical processes: 9 Slowing Down, described by the force term F(p) = F(e)(p) + F()(p), which includes effects of collisions with electrons and with ions. The expression for this force, normalized to VePTe, is given by - Collisions with electrons F(e)(p) = F1 + F 2 102 (B.3) with F1 = 47rf fm(p')%- F2 4 I -Y z v ( = dp' [ (B.4) ) f p"p fM(p')dp' and where p is normalized to the thermal momentum PTe, and where the following definitions have been introduced PTe p -y - = sinh- 1 z V F(')(p) v-2 Zi-'M = mec 2 V1+ z I= (B.5) - Collisions with ions (B.6) * Diffusion in Momentum p, described by the diffusion coefficient A(p) - A(e)(p)+A()(p), which also includes a contribution from collisions with electrons and with ions. A(p) is normalized to the thermal diffusion coefficient vep - Collisions with electrons (B.7) F1 + F2 A(e)(p) - e Collisions with ions Ti A(')(p) = 1Zime 3 V (B.8) mi Te * Pitch-angle Scattering (Diffusion in c), described by the diffusion coefficient Bt(p) = Bte)(p) + Btk )(p), normalized to - with ep2 Collisions with electrons (p) = Bt B1 + (B.9) B2 with B1 = 4,7r pfm (P') p21 v 10 (' 2 4z 'y B2 = 47r p'fM(p - - 2 1 8y'y2 z2 I'z/2 Z* - -'72 + 8'y''z I -r 4z 2 2 pf2 6p 2 z _ -z2) 3 V' 4 + (-2 [ ' (4 + 2z')1 01 dp' 3-y2+ a 3 -Z+ 2z) -... 2 -yp 2 z dp' (B.10) Collisions with ions Bt) (p) = -Z 2v 103 1- 1 me T V 2 mi Te (B.11) It is interesting to note that collisions with ions bring only a very small contribution (ratio me/mi) to the slowing down and diffusion in p processes. However, the contribution of ions for pitch-angle scattering is of the same order as the contribution from electrons. B.1.2 Expression in the Limit of a Lorentz Gaz > 1), pitch-angle scattering over ions becomes the dominant In the limit of a Lorentz gas (Zi collision process and the collision operator then reduces from (B.2) to: C( (f) = Z 12 a ~_2) 2v Va [ p _ -y2 (B.12) 2)! q2 with e 4 Zi 2 ni In A 1 'ei B.1.3 4 23(B.13) 47re 2m2V3 Expression as the Divergence of a Flux and Bounce-Averaged Operator The differential part of the collision operator can also be expressed as the divergence of a flux: (B.14) Cee(f, fM) + Cei(f, fi) = -V ' §C where the expression of the divergence operator in spherical coordinates is V-. S 1_(p2 p2 ap 1P _ (B.15) (V -- Therefore, the expressions for the collisions-related fluxes are S = SC - p (p) p + F(p)fl Bt p) of (3 6 A bounce-averaging of the collision operator is required in order to remove the dependence upon the poloidal angle 6 and reduce the Fokker-Planck equation to a 2-D momentum space equation. This operation is described in (2.23), and has been derived for the collision operator in [27], for the case of fo, g and f, which gives: e For fo or g {V - C( = o()) 2S 104 - 1- d2,A0O)) (B.17) where + F(p)f(0) (p,o) (p) A SCO ) (B.18) 1 1 - 9 For f 1025C'( ) I ( ( - 2A5 C'(4)) (B.19) where 5f' (0) c,(0) > A(1±E) H( oj A(H+±E) A (p) G) ' ± F(p)f( 0 )(pjo)] 1 O) (p, > OT) B ) 0 1()(p,_o) (1+ E) o (o o 2/2) 2 0) (B.20) The normalized bounce time A is defined in (2.22) and the bounce-average coefficient A is defined as: (B.21) Both coefficients are described in Appendix E. B.2 B.2.1 Integral term Cee(fM, f) Detailed Expression This term is included to ensure momentum conservation in the collision operator. For this purpose, only collisions with the first, dominant term in the Legendre polynomials expansion need to be considered. Cee(fMf) = U1(fM, fl) (B.22) with I1(fM, f) Ve fM(P) 14 7 fi = j 105 ) + I1,1(fi) + I1,2(f1)] d (B.23) (B.24) and Ii,i(fi) [ P3 47 o f T(P)Y P2 2 + Im'2 1' + 5 3~Yy~y +2 P2 0fi(P') 1 z - +2z 2 B.2.2 -I 15 + + - - 1iz'] 7'P2 + -3 5) 2z ) +3 7F 15 +6) dp' (B.25) ] z I.. 3+ 2z [-3+- +22 } 15 z .. -.-. 7 -0 z 12zot2 + 2z' ) ] Z/ _2 + 3+ z - + z') ... + o'l ( 2z' 2 I-3 h 1' 3'z ( + Z/ 15 +6 12z -- 3 6z' + - 1)- yU 47r I1,2(fl) + - 3y-'' z- 5) + - Py/2 .z] ... dp' (B.26) Bounce-Averaged Operator The bounce-averaging of the integral term is derived in [27] for fo, g and I, which gives: " For fo or g {Cee(fM, f)}fo,g {U1(fM, fi)}og - oI1(fI , fI)) (B.27) where f "o = 3 j 2 _ (of (0)d~o (B.28) {i (B.29) s* is defined as s* = H(J(oj > 'T) This bounce-averaging coefficient is described in Appendix E. " For f {Cee(fM, f)}y = {U1(fM, fi)}j = H(oI > GoT)oI1(fM, f1(o)) (B.30) where fIo) 1= 3() 2 o9_1~ )~ (B.31) * is defined as s* = H(IoI> o) and is described in Appendix E. 106 {} (B.32) Appendix C Quasilinear C.1 Operators General Expression as the Divergence of a Flux The quasilinear operator is defined as (2.37): Q(f) = lim I I d3 k +0 (27r) 3 ~ 2 2[ 1-~) Dk 6(w-k 1 v -Q)f) (C.1) where £ is a momentum-space differential operator: L(A) (k9i 1&A -09 + ± 12 = = 0 (pA) P2 YMeU mA -( - - (C.2) A) + (C.3) 1(p Let us consider a particular cyclotron frequency n. Using the second formulation (C.3) of the diffusion operator, (C.1) becomes Q(f) V[lim Sp + 1 lim d k 2(1 d3 k (27r)3 ( k11p 2) _ -( Dk 6(w - kjvil - nQ)12(f) ... p2(1 _ 2) Dk 6(W - kjjvjj - nQ) L(f)]) (C.4) The resonance condition is expressed by the delta function 6(w - kiivil - nQ) (C.5) Using 'yme Yme (C.6) the resonance condition (C.5) gives klw - nQ VII wyrne (1 Wpy( 107 (C.7) Then, the quasilinear operator can be rewritten as Q(f) = L' [p2 (I _ 2 )DRF(p, (C-8) )(f)] with the differential operators L'(A) = L(A) = nQ0A I a(pA) + (I 1 l18A 1 ( -2 + - - 2 (C.9) _] (C.10) and the RF quasilinear diffusion coefficient DRF (P = V--+oo 1 V 3 (2) (C.11) J(w - ki vj - nQ) D Clearly, the operator L' (C.9) has the form of the divergence of a flux (B.15), so that the quasilinear operator can be expressed as: V. SF (9 = F _1~~ V/ 2(2RF) (C. 12) with SRF = _p(l _ SCRF C.2 2 )DRF(p, 2 1 2 C(f) DRF(p, - W )L(f) (C -13) Bounce Averaging of the Quasilinear Operator The quasilinear operator must be bounce-averaged in order to reduce the equation to a 2-D momentum space equation. The bounce averaging operation, described in (2.23), removes the dependence upon the poloidal coordinate. However, the effects resulting from the poloidal localization of the waves on the flux-surface under consideration must eventually be taken into account during this operation. First, a transformation is required for commuting the bounce-averaging operation with the divergence operator. From (B.15) one finds 2 P~ ji(PtSPj) 1 1P 2 a(p2SP) a Ap0I 2 p2 - ~(p2{SI) - Ap8_o ( 1- V1 -T2 108 [ o dO aG V1 _T2S )) J dO ar S _0C27 /-6SC (C.14) The bounce-averaged quasilinear operator can therefore be rewritten as {V. SF} 1 a(p2RF,(O)\ -2RF, (0)) 0A o 19SR~O Ap aIol P P2 ap (C.15) with SRF,(o) isF = SRF,(O) C.3 C.3.1 {S1 F (C-16) Nq SRF Lower-Hybrid Diffusion General Expression for the LH Diffusion Coefficient In the case of LHCD, the wave power is absorbed through Landau damping n = 0. The perpendicular wavelength 27r/k± is much larger than the Larmor radius of electrons, so that 1 k v) JO (C.17) and (2.40) becomes DL DP (C.18) 2I2~~j~ Therefore, the diffusion coefficient becomes 2 DpLH p C.3.2 1 3 V-+00 V (27)3 V-o V q21Ek, 1I 2 6(w - kiloj - nrQ) (C.19) Flat E12 (kii) Spectrum It is common to approximate the k11 LH power spectrum as being flat between two limits ki,min and k 1l,ma, respectively determined by the accessibility condition and the linear Landau damping of the waves (See Section 4.2). Then, the LH diffusion coefficient (C.19) takes the simple form: p2 DLH(p,) = DLH( 2 IVH(v, 1 - Vmin)H(Vma - V11) pi lvii| (C.20) where D LH(0) 0 = rn m -V-+oo V (27)3 q|Ek'1,0|2 e (C.21) VTe and wLU Vmin = k ,Vm= kl,max 109 max (C.22) k,min Note that the dependence in (C.20) is often omitted using the argument that D VTe/vpI > 1 so that the distribution is flattened anyway [28], [27]. This argument is not satisfactory in general and this dependence should be kept in a numerical 2-D code. A dependence of DLH(0) upon 0 is also necessary in order to take into account the poloidal repartition of the LH power. C.3.3 Expression for the Fluxes due to LH Diffusion General Expression Using (1 - 2) = XIJ(1 ), inserting (C.13) and (C.20) in (C.16) gives - 2 _ {p(1 _ SLH,(O) = 2 - 12 _2 p 2 q e D(L)()H {|D(LH)(O)H =-pTe SLH,(0) )DLH(p, )Lf)} _I 1-02 61 ) DLH 2 1- 0{D LH)(6)H YPTe Vminl H - 16 [ Vin] H Evmax L(f) (C.23) I L(f) - t\ L -D in] H D LH)(0)H [ 0 'Yme 'm _ 2 - p|'{ vminl H e - 7YMe [vmax - 7e V Lm f)} me / L(f) (C.24) /Me Approximation of Well-Passing Resonant Electrons If the LH resonant region and the trapped region are far from each other in the momentum space, which is often the case, especially for highly relativistic plasmas, the LH quasilinear diffusion concerns only well passing particles. If those particles verify to= - 6 < I (C.25) then = Vr (0) (1 - 02) ~ &p-6 (C.26) so that the ratio 1- 6(' - 1) can be taken as 1 at zero-order in 6. 110 J (C.27) However, the ratios 1 - (C.28) 20- and 1- d (C.29) _ are not equal to 1 at zeros order and must be transformed according to (C.28) and (C.29). Bounce-Averaged LH Quasilinear Operator With this approximation, the bounce-averaging operation reduces to an average over 0 and the bounce-averaged operator becomes: e For fo or g -10a H)= 2 10 {gVLH P(p2SLH,(O)) VI-72LH,(O) a(\ (C-30) where _ SLH,(O) SLH,(O) 6 af(0)(P, G) + YPTe ID (LH)(O)(p,0) AP _ \0Op }PTe sgn(Go) 1- p Do(p, f 0)(AG -(2 P0 f () (p, + (0) Ap )) (.1 0 (C.31) The LH diffusion coefficient is simply averaged over 9: D(LH),)(0) 0 LH)H -- Vmin] H [max 7me (C.32) ] - -Ymej with D(LH) =j OD (C.33) LH) * For f {V. LH} 2 10LH,() LH,(O) (C.34) where 5vLH,(0) _ _ YPTe Ap 0 ;(LH),(0)(P 0 YPTesgn(O) SLH,(O) 0) op X0 LH),() Ap0 op 2 G 2 0 ((C c35 (C.35) 111 The 6 dependence of f in (D.9): f(0)(p, Pp,(, ) 1 f(O)(P, o) 0) (C.36) now results in a weighting factor 1/Q as the LH diffusion is averaged over 0: 0)(p, ) = f (LH) H [ 0 0 m H [umax -min] yme - 6 ] YMe (C.37) with 0 b(LH) j 7r _7r (C.38) ) D(LH)(O) 0 Note that with the assumption of a uniform poloidal repartition of the power, this flux-surface averaged diffusion coefficient reduces to D0LH) C.4 C.4.1 Electron-Cyclotron Diffusion General Expression for the EC-X2 Diffusion Coefficient We consider here the EC resonance of the X-Mode at second harmonic (X2-Mode); this mode is chosen in many experimental situation because it allows the highest absorption with launching from the low field side, when the 01-Mode is inaccessible because of a too high density wpe > w,, . For the X2-Mode, (4.43) is DEC-X 2 q2 Pe 2w mec Wee _ (N 1 Pe \ 2 (C.39) IEk,_ 12 Therefore, the diffusion coefficient (C.11) becomes DEC-X2 C.4.2 P2 r P2' V--*ac V I d 3k (27r)3 q2 )2 (N± PTe 2w IEk,-_1 2 6(w - k1vjj - nQ) mec Wce (C.40) Gaussian JE12 (k 1 ) Spectrum If the EC beam has a gaussian transverse extent, its power spectrum in k11 space is gaussian as well, and can be expressed as IEk,_1 2 = IEk,_,ol2 exp (k- kilo)2) (C.41) Then, the EC diffusion coefficient (C.40) takes the simple form: DEC-X2(P, D EC-X2 VTe PDe VI I 112 (k,res- k Ak2 2 (C.42) where D EC-X2(0) =(Ni PTe2w and kil,res d 2 k 1 q2Ek,_,O12 (27r)3 Ve im 1- V-OO V MeC ce (C.43) is given by (C.7): _ 1 km,res = (C.44) Note that the 0 dependence in (C.43) takes into account the poloidal localization of the EC beam. C.4.3 Expression for the Fluxes due to EC Diffusion General Expression Using (1 SEC,(0) ( = T(1 - 2) 2 {_p(1 = ), inserting )DEC(p, (C.13) and (C.42) in (C.16) gives )I2(f)I (- -)2D("EC)(0) exp EC, (0) = - PTe kol1 ,resk 2 r j~ (1 - 2)2 p21 _ PTe f k1 ,0 kres- 2 (C.45) L(f) 2 k1 2)EC ko (- 0 PTe 1- ( D(EC)(0)eXp ) -p(1 - ( 2 )DPTeD(EC)(0) exp 0I PO~ ! D(EC) (0) exp J1 I] (kll,res ( kil 0 )2 Ak ~~ 00 i0 k,)res- - ICf)j (4) Approximation of Well-Collimated EC Beam The EC beams are in general well collimated. It is then justified to assume that the interaction between electrons and the beam occur at a single, given poloidal position Ob on the flux-surface considered. The EC diffusion coefficient (C.43) is then rewritten as D0EC-X2(9) = A06(0 _ f)DC-X 2 (C.47) where AO is the poloidal extent of the beam on the flux-surface under consideration. Note also that the beam has a finite extent in the toroidal direction, over which the bounce averaging process implicitly averages under the assumption of axisymmetry. In fact, this equivalence is valid only for passing particles, which follow circular orbits in the toroidal direction, but 113 not for trapped particles. Strictly speaking, with the present model, we should restrict ourselves to situations where EC diffusion concerns only passing particles. Bounce-Averaged EC Quasilinear Operator With this approximation, the bounce-averaging operation becomes trivial and the bounceaveraged operator becomes: * For fo or g V- S.EC 10a a p26p = V1 2EC,(0) 0) -7,ASC,M( P (C.48) with _y P (1 SEC,(O) ~ 02 b| b 27 A PTe (k-Ires,b 0 AO(EC) eXp 1 |,o)2 - Ak2 0 Of(0)(p, a) 1( f( 0)(p, 0) a6 0 + ap p _ SEC,(0) 1 _ (1 1 0 O '1b1b 27r 22 60 APTe O(0)(p, w (EC) exp 0 - ko) 2 Ak2 I X0 OP -(kjires,b (C.49) where the following definitions have been introduced: 1 + Ecos(b) Xb= I +- CO(S (C.50) () (C.51) kii,res,b = W7me 2Wce) I (C.52) e For f {V . SEC a 1 2 Vj_ 25EC,( )) - EC,(O) (C.53) 0 As o Ap with - A PTe ( 1 afb)(p, ap 5EC,(0) _YP I2 I OP 0) 1 - 27r 2 j(b)p, po 114 kll, 0) 2 Ak 2 )1 0 AOD(EC) exp 0b b 0 (kI,res,b - I O 2) of(b)(p, (p, -a(b) Po __--_ APTe 0 Ao(EC)eXp, 02)2*2 1 ako 0 ] ( k, 0) 2 (kI,res,b - Ak 2 ) (C.54) where 4)p -(o) 115 (C.55) Appendix D Flux-Surface Averaging We consider a single flux surface, which is taken to be at a constant normalized radius E = r/RO, under the assumption of a circular cross-section. Moreover, it is assumed that the electrons mostly remain on this flux surface along their trajectory, which is an acceptable approximation when the radial drift of electrons along their trajectories is much smaller that the characteristic lengths of the radial dependence of macroscopic quantities like temperature, density, etc. This condition is satisfied when (2.18) < (V In B)-1 , (V In T)- 1 (D.1) which holds in general, except at the plasma center where E -+ 0. Under the assumption (D.1), the dependence upon the radial coordinate can be omitted in the following calculations. D.1 Definition The flux-surface averaging is the determination of the value of a quantity M(r, 0) averaged over the volume between two adjacent flux surfaces of radius r and r + Ar, with Ar < r. The volume element in toroidal geometry is dV = dr rdO Rd( so that the flux surface averaging operation is: dr f7 rdO f *R 0 (1 +c cos(9))dCM(9) fr+srd r d6 f rR(1 + c cos(9))dC fr+r {M) co(9))o(O) rAr f_rrrd1 dR 70 (1 + --cos(9))M(6) rAr f" 17 dRo(I + Ecos((0)) O(1 + 'E Cos (0)) M(0) 116 (D.2) D.2 D.2.1 Electron Distribution f(p, , 0) Implicit 9-Dependence: case of fo and g. The zero order distribution function fo and the first order distribution g have no explicit dependence upon the poloidal coordinate 9 (2.53), (2.58). However, the distribution function fo has an implicit dependence upon 0 since an electron does not conserve the same pitch angle along its trajectory. Indeed, the relation between the pitch angle of an electron at a poloidal angle 0 and its pitch angle as it crosses the midplane 9 = 0 is given by the conservation of the magnetic moment (See (2.6) and (2.8)) recalled here ( 1 = (r, 0) (1 - (D.3) 0) with 'T(r,0) given by (2.10) and a being the sign of o. Therefore, the electrons within the infinitesimal volume d 3r d 3p located at the midplane position (r,9 = 0) and with a momentum (p, o) will be later within a volume d 3r' d'p' at a position (r,0) with the momentum (p, ), with given by (2.8). Since the number of particles within this volume is conserved (f(r,6, p, )dar' d3 p' = f(r, 9 = 0, p, o)d'r d 3 p), and given the incompressibility of phase space (d 3r' d3 p' = d 3r d 3 p), we get: fo(p, , ) = fo(pdo,6 = 0) = fo (p,G0 ) (D.4) and g(p,,6) = g(po, = (D.5) 0) = g(O)(p, 0) with 1 0-=o (D.6) 2 and feo) (p, o) being the function calculated by the bounced-averaged Fokker-Planck code. D.2.2 Explicit -Dependence:f The 9-dependent first-order correction to the distribution function is expressed as (2.58) f(p, ) (D.7) fo( V Q Or 0 The parallel velocity and the poloidal gyrofrequency are _ p' = - qeBo() me 117 _qeIF(0)Bo(0 - = 0) (D.8) In the expression of f(p, , 0), we can take fo(p, given by (D.6). Then, we can express , 0) = fo(')(p, o) according to (D.4) with o f as the product of a explicitly 0 dependent term and the value of f at 0 = 0: f (p,(, 0) =1(0) (D.9) (P, ) where f(O) (P o) = f(0 = 0) po _ qeBo(0 = 0) af O(p,fo) Or (D.10) is the function calculated by the code. D.3 Flux-Surface Averaged Moment of f(p, , 0) We consider a moment M(0) of the distribution function. p2 dp f 1 d h(p, , 0)f(p, ,0) Mf(0) = 27r Applying the flux surface averaging (D.2) to (D.11) gives cos(0))27r j (Mf) = 27r I (1 +E P2dP , d h(p, , O)f(p, , ) P2dP cos(0)) r27r (D.11) (D.12) f We have from (D.3) (D.13) d = 'F(0) od~o and the integration domain transform as S: -1 -0 4-> : 0 -1 <-> o :-l-+- o: 1- 1- (D.14) so that (D.12) can be rewritten as: (Mf)= 27r P2dP I~d( 1+ d~o H (02 > 1 S ECos(0))f 1) Lh(p, , )f(p, , 0) (D.15) where H is the Heaviside unit step function. Note that the integration domain can be rewritten as 02 > - cos(0) > 1 - 21. = <OT (D.16) 118 where 0, is defined in (2.20). Since o is independent of 0, (D.12) can be transformed as follows: (Mf) = 27r j p 2 dp jdko = 2w j p 2 dp jdo h(p, ( + Ecos())H(II < 0c) (1 +) j O)f(p, ,) Gh(p, 0)f(p, , , 0) (D.17) where the expression (2.10) for T has been used. Now, recalling the definition of the bounce averaging (2.23): {A} 2b,t 2- - T dO r B A (D.18) lI B9 |V we note that if hf is symmetric in the trapped region, the sum over a can be removed. In the cases where hf is antisymmetric in the trapped region, the sum over 0- would give zero. Nicely, the integration over o in (D.17) would also give zero if hf is antisymmetric in the trapped region. As a consequence, under the assumption that hf is either symmetric or antisymmetric in the trapped region, we can rewrite (D.17) as p 2 dp (Mf) = 27r ] The total distribution function is (2.63) d~o (1 + E)A{h(p, f = , 6)f(p, , 0)} (D.19) fo + f + g so that we have (D.20) (M) = (MfO) + (M1 ) + (Mg) " For fo or g fo and g are symmetric in the trapped region. Assuming that the moment h is either symmetric or antisymmetric in the trapped region, which is always the case in this study (quasilinear diffusion in the trapped region is nor allowed in our model, as discussed in Section C.4.3), and using (D.4) and (D.5), we get: (Mfo) = 27r j P2 dp do fo0 (p, o) (1 + E)A{h(p, ,0)} (D.21) (Mg) = 27r p2 dP d o g(O)(p, o) (1 + E)A{h(p, ,09)} (D.22) " For f f is antisymmetric in the trapped region. Again, assuming that the moment h is either symmetric or antisymmetric in the trapped region, and using (D.9), we get: (M1 ) = 27r P 2 dp j d~o f1()(p, o) (1 + E)A 119 h(p, , 0) (D.23) D.3.1 Flux-Surface Averaged Density The electron density is the zero order moment of the distribution ne = 27r j p 2 dp d f(p, (D.24) , ) so that the weighting function is simply hn(p, ,O) = 1 (D.25) {1} = 1 (D.26) We have by definition and it is easy to show that { which can be taken as 1/[A (1 1+ f sin(0c)/7r '(O) OJ (D.27) A (1 + c) + E)] since the electrons in the trapped region give no contribution, because of the antisymmetry of fO) in the trapped region. Thus, using (D.21), (D.22) and (D.23), we get: = 27r jP2dP do f ) (p, o) (1 + E)A (ne)1 9 = 27r jp2dp do 9 0)(p, o) (I1+ (n.e)y 27r (ne)Ifo = j p 2 dp j e) A d<o f(O)(p, o) (D.28) (D.29) (D.30) (D.31) D.3.2 Flux-Surface Averaged Current Density The electron current density is a first order moment of the distribution J1 = 27r qef p 2 dp jd v ff(p, , 0) (D.32) with the weighting function given by hn (A, , 0) = %eV1= q, X IyMe (D.33) It is straightforward to show (D.34) for passing electrons, and {{} = 0 for trapped electrons. 120 Moreover, we define 2 6 = T (0) 02 (D.35) G- A where A is given by (E.40). Then, using (D.21), (D.22) and (D.23): (ne) Io = =27 q, 00 27r q, ej 1 3 d 3dp 1 27r q P 0 (D.36) do og(o)(p, o) (1 + c)H(I|oI > COT) (D.37) do of(0)(p, o)(1 + e)1 (D.38) 3 00 (ne) g (ne) I do ofo")(p, o) (1 + e)H(I oI > 'OT) LI dp e - (D.39) D.3.3 Flux-Surface Averaged Density of Power Absorbed D.3.4 Expression as a Moment of Particle Fluxes The kinetic energy associated with a relativistic electron of momentum p is E = mec2 (7- 1) (D.40) Then, the local energy density of electrons is (D.41) S= Jd3p mec2 (Y - 1)f(p The density of power absorbed from RF waves is defined as Pabs - aRF d 3 p mec 2 (y-1) - at f (D.42) RF The effect of RF waves is described by a quasilinear operator, which can be expressed as the divergence of a flux according to (C.12): Of at 1 P2 RF p \ P 2RF) OR) _ (D.43) so that the density of power absorbed (D.42) becomes Pabs -mec 22r The integration of the dp p 2 (y SRF - dIdi 1) 0- (p P10 F 1_ 2SRF)] (D.44) term gives no contribution, since the particle energy is function of p only: da ( V/1 - [ (g, 121 _SR RF (D.45) and (D.44) reduces to Pabs = -mec22 - -mec221r = mec227rf / dp (-y - 1) d d 1 -1 RF dp j o2 /MP2 2 o F 2dp XP2SRF ( [P2 d (P2 SRF 7me (D.46) where (2.2) was used. Finally, the density of power absorbed is = 27r fd Pabs o -1 D.3.5 dp P3 SRF 7e (D.47) Flux-Surface Averaging Using (D.19), (D.47) becomes (Pabs) = 27r dp I -l l do (1 + E)A{SRF} (D.48) The flux-surface averaged particle fluxes due to RF diffusion are given in Appendix C. 122 Appendix E Calculation of Bounce Average Coefficients E.1 Calculation of A( o) Series Expansion E.1.1 The bounce-averaging normalization coefficient is defined in (2.22) c(E.1) A(Go) = with for circulating particles fir OT = We use the expression of cos- 1 (1 - 2 for trapped particles 2T) 2/ from (2.8): (E.2) -2) -W( (=o where T has a simple expression for the case of circular flux-surface, given in (2.10): P (0) = 1 + + e(E.3) 1 + 6Cos (9) Defining a = 0/2, we have cos(9) = 1 - 2 sin 2 (a) and then (E.3) becomes , (0) 1 = e 1 + e - 2esin 2 (a) 1 2(E.4) 1 where GOT - 2T sin(a) is the pitch-angle at the trapped passing boundary, defined in (2.11). 123 Then, with a,c 0,/2, (E.1) becomes t '*C d6 A( o) -c27r o-/1- (o)(1 - dO afc~ /1- fr o 21 _ 7r da Q)(1 2 VolI / - 1 1 0o (E.5) 02 sin2(a 02T/ We have the following series expansion, valid for sin2(a)) 02 sTin2(a) 2r - V/ 02) lxi < 1: 00 V1- XmX M X =E (E.6) m=O with Xo Applying (E.6) to V/1 - 1, = Xm = 2m - 3 2m Xm-i (E.7) o'T sin2(a), (E.5) becomes: A( o) = (E.8) J2m EZXm m=O with j0 J 2m = E.1.2 da sin 2 m (a) Calculation of the Integrals (E.9) sin 2 (a) V/1 - gT/ J 2m The integrals J2m can be expressed in terms of complete ellipstic integrals of the first and second kind [20]: K(k 2 ) = da r/2 Jo E(k2 ) 2) = dx _ /(1 - x 2 )(1 k 2 X2 ) V~~i2()jx (1 -k 2 X22 ) (1 x ) 1- k2 sin2(a)Jo 7r/2 da - k2 sin2(a)1 O 0/( - (E.10) -X2) * For Trapped particles (Io1 < oT), we have from (E.2): sin(ac) = sin(OT/2) cos() = (E.11) V2 Gor so that JO= da f(" o /1 - OT/ /sin(ac) 1 sin 2 (a) x o1 -T/o dx OTJo 1 K -O/ OT 2 1x2 (E.12) 124 and da jo J sin 2 (a) dac S 01 - (T/ 2 sin (a) /sin(ac) dx 1 -~ x2 VTT I--- I - O X2 / dx G0T Jo IoI _ 1 (f'd -L dx dx 6T (2 K 6 ) GRT I 2 2T 0/ 1 _ 1_ )] -E' ) 2) (E.13) E 2T 'OT * For Circulating particles (1ol > To), we have ac = (E.14) = so that r/ 2 da Jo 2 1 OT4 O = sin (ai) dx 2 2 V1-X2 (TIOT'X Ko =K ( (E.15) and /2 =2 L0 1 d g02 sin 2 (a) / O sin (a) da f 2 Vo - 1 dx 1-- dx 2 2/ 1T- x /0 S 02 - 1dx d K (02T" OT O 1 VTT~ E ( j - OX2 1-OT4 0o dx 41 2TO2 X2 X 2T EOT.6O (E.16) 20 * For all particles, the integrals J2m, m > 1 can be derived from JO and J 2 from the following recursive relation [20]: (2m - 2) (2m - 1) (1+ 2 f 125 J2m-2 - (2m - 3) 0 (2m - 1) 'COT J2m-4 (E.17) Bounce Averaging Coefficient X - 1.8 -- M = 100 1.6 - - M = 2. -- . -.. -2 1.4 .~~ ... .. 1.2 ..... ............ -.. ..... 0.6 - ...-.. . . ... .. 1 0.8 -.. . -.. -..... --...... .... -............... ..............-. ....................... -. -.. . -.. . ......... ............ - 0.4 0.2 -0.5 -1 0 0.5 1 Figure B-i: Bounce averaging coefficient A E.1.3 Truncated Expression It can be shown (See Figure E-1) that keeping only the two first terms in the expansion is sufficient. Therefore A( o) can be evaluated with an excellent accuracy using: A( o) =- 2 1 2j JO - -dr2 7r ( 2 E 8 (E.18 with JO and J 2 calculated above. E.2 Calculation of s* The coefficient s* is defined in (B.29). It is zero for trapped particles. For passing particles, it is expressed by s* d * f o1 + e _, 27r I + c cos(O) (E.19) Defining (E.20) z = eiO we get d6 = 1 dz, ZZ cos(0) = 126 2 (Z + 1/z) (E.21) and (E.19) becomes s** 2(1 +e) E 27ri dz f (E.22) z2 + 2z/E + 1 where the contour -y is the unity circle in the complex plane. The two roots of the denominator in (E.22) are 1 z -- (1 ~ 1- (E.23) 2) Only the greater root z+ lies inside the contour y, so that (E.22) becomes 1 )(27ri)Res s* = 2 (1 e 2rz Z2 + 2z/e +1V = ) Z+ (E.24) where 1 Res ( =+ z+ 2z/E + 1' Z2 + 2/c /1 - 2 (E.25) is the residue of the integral in (E.22) at z = z+. Finally, inserting (E.25) in (E.24), we find (E.26) s*-:= E.3 Calculation of 9* The bounce averaging coefficient *('o) is defined in (B.32). It is zero for trapped particles. Its expression for passing particles can be rearranged as: 5*(60 ,- = (2 rd6 -*7 f 2 76 6 20 -62) rd 6 o 1 - T (1 A(~ 0 0 21r J- ' (o = 06- (I 20 (2 (E.27) - 02){,}) where the definition of A in (E.1)was used. The expression for T is given by (E.4). Then, following the same derivation as for A from (E.1) to (E.8), we get f 'I f_, 27r 2 7r/2 12 7,/2 A 1 = ( da da sin (a) s1 /1-T 1- 9/1 -_ 2T/c2 127 sin2(a)/1 -%T sin2() (E.28) We have the following series expansion, valid for lxi < 1: CY0 1 Y"m" M = - /1 (E.29) = with XO = 1, Applying (E.29) to l//1 Xm 2m 2m = 1 (E.30) Xm-1 - Q sin(a), (E.28) becomes: 00 {O}(0 = A12 7 ~momJ (E.31) 2m m=O where J 2 m is defined in (E.9). Then, combining the results from (E.8) and (E.31), we get * [Xm - () %m-1(1 - O)] ' (E.32) jJ2m m=O The series expansion (E.29) converging less rapidly than (E.6), the three first terms from the two series are now required for a good accuracy (see Fig. E-2). The truncation to third order gives: s*()=- 2 ~ 7r I E.4 JO + 2 ( I) + O j2 O (8 04TJ 4 2) (E.33) Calculation of A The bounce-averaging coefficient A appears in the bounce averaging of the pitch-angle scattering operator(B.18). It is defined as (B.21) A =1 (E.34) XFJ(0)} Using 1 1 - cos(0) = 1+ T2 2 (E.35) and the bounce averaging expression from (2.24), (E.34) becomes A=1 A 1 2 U± ] I 2 J o(o2OT 1-- cos(0) 2dO (E.36) The sum over o-, which holds for trapped particles, can be removed since the function to be integrated in independent of o-. 128 Bounce Averaging Coefficient s* 1.4 . 1.2 ...- -- m = 100 m=2 - - m =3 . - 1 0.8 -' 0.6 0.4- -... . ..... -. ..... 0.2OL -1 - 0.5 0 0.5 1 0 Figure E-2: Bounce averaging coefficient s* This integral is very similar to the integral carried for A. Noting that 1 - cos(9) = 2 sin 2 (a) with a = 6/2, and following the same derivation as for A from (E.1) to (E.8), we get 1 fOe d o 2 1 - cos() A f-oc 2-7r ( 72 1 2 f acl Tsin2 (a)/I - A ir J0 E 41 Xmd+ 2 - COT sinT(a) sin(a) (E.37) J2m+2 m=O Once again, we can see (Fig. E-3) that only the two first terms of the expansion need to be kept. The truncated form of A therefore becomes: A =j 1 (J02T2 + 1 129 4\ /QTJ4 (E.38) Bounce Averaging Coefficient A 0.25 M = 100 m=2 -- 0.2 - -. - ....... ........ -a -... 0.15 - --.. .. .-. .... . ...... -.. -.. - 0.1 -.-.-.-.- 0.05| 1~ -i ' -0.5 0 0.5 1 O Figure E-3: Bounce averaging coefficient A E.5 Calculation of 1( o) The flux-surface averaging coefficient A( 0) is defined in (D.35). It can be evaluated using the calculations of the previous coefficients. A can be rearranged according to: J oce dO 21r T(0) 0 o SdO X@(0) Sc27r f 2 dO o I - T(I IF (0) J-0C 27r dO G 27r -ec = A( 0 ) (1 02) 0 -10 '- ,1fI- 1 (E.39) where the definitions of A in (E.1) and A in (E.34) were used. Then, combining the results from (E.8) and (E.37), we get 00 2 JO + I: (AM 7r I M=1 Xmn-i) 02TJ2m (E.40) We can take only the two first order terms from the two series, since higher order corrections 130 FluxSurface Averaging Coefficient X 0.9 - 0.8 -- m = 100 --.m. =.... . . . . . . .. ...-. .. .. -m-2 - 0.7 ..... -. ..... .... - -. .... 0.6 -....... -.... 0.5 - -.. 0.4 -..... - 0.3 - -a -.. ..-...-. ..... ..-. ........... - ........... .......... - -.. -m ........................... -..... .... ... ..... -..... ..... 0.2 0.1 0 0.5 0.5 1 Figure E-4: Flux-surface averaging coefficient A are negligible (see Fig. E-4), which gives: A(60)= £r - (2 + ) 0) 131 0'2 J2 + 260 (oTJ 4 (E.41) Appendix F Listing of testfp2d9yp and fp2d9yp F.1 testfp2d9yp % Test program of the 2-D relativistic bounce-averaged neoclassical Fokker-Planck solver % for the LH and EC absorption problem in presence of an ohmic electric field and toroidal % % magnetic ripple. Circular plasma cross-section. See fp2d9yp.m, ptok9yp.m %Last update: 04/18/2002 %by Y. PEYSSON CEA-DRFC 30/07/1997 <peysson~drfc. cad. cea.fr> %Update for the drift kinetic calculations done by J. Decker and Y. Peysson 06-10/2001 clear all;pause(%.5); clear mex;pause(0.5); clear functions;pause(O.5); warning off; [s,dossier,machine] = computyp; %Physical constants qe = 1.6e-19;%Electron charge (C) me = 9.ie-31;/Electron rest mass (Kg) re = 2.82e-15;%Classical electron radius (m) mc2 = 511;%Electron energy rest mass (keV) clum = 3e8;%Speed of light (m/s) %Calculation mesh size nmhu = 200;ANumber of angular values (WARNING: even number) (100 recommended for accurate run) np = 200;/Number of momentum values (WARNING: even number) pnmax = 20;Maximum value of the momentum grid (pth-ref) %Global plasma parameters 132 (200 recommended for accurate run) [ap,Rp,Ip,Bt,Ncoils,Zi,mi,fi,BeLi,qmin,eq,TeO,Tea,eTe,neO,nea,ene,TiO,Tia,eTi,ZeffO,Zeffa,eZeff] = ptok9yp('CMOD'); %TeO = ie-3;TiO = ie-3; %.Normalizedradius values at which the distribution is calculated X drho = ie-2;/Xmaximum distance between two flux surfaces for radial derivatives. %rho = [drho:drho:1-drho];%whole radial grid for dke calculations rho = 15/22; rhodisplay = rho(i); ref-mode = 1;XReference values: (0) from core Te and ne, %(M) from Te and ne at the normalized radius (paramater only active for a single radial value, otherwise ref-mode = 0) normref = 0;%Normalization procedure for the ohmic electric field, LH and EC quasilinear diffusion: %(0) from local values Te and ne, (1) from reference values Te-ref and ne-ref epsiX = O.OO;%Core Ohmic electric field (pthref*nhuthref/e or pth*nhuth/e) epsia = 0.00;.Edge Ohmic electric field (pth-ref*nhuthref/e or pth*nhuth/e) eepsi = 0;XExponent for Ohmic electric field vparminh = 3.5;LH wave : Lower limit of the plateau (vth-ref or vth) vparmaxlh = 6;%LH wave : Upper limit of the plateau (vthref or vth) DOlh = 1;%LH quasi-linear diffusion coefficient (nhuth-ref*pth-ref^2 or nhuth*pth~2) sm-lh = 0;ALH quasi-linear diffusion coefficient smoothing parameter (no smoothing = 0) DO-trap = 1;%LH quasi-linear diffusion coefficient in trapped region: DO-vdep = 1;%LH (0) cut to 0, or (1) no cut quasi-linear diffusion coefficient dependence over vpar: (0) no dep, or (1) 1/v dep Dperp-cy = DOtrap-cy 0.0;%EC = 0;%LH quasi-linear diffusion coefficient (nhuth-ref*pth-ref~2 or nhuth*pth^2) quasi-linear diffusion coefficient in trapped region: (0) cut to 0, or (1) no cut -0.30;%EC wave parallel refractive index value dnpar-cy = 0.02;%EC wave parallel refractive index width omega-cy = 220;AEC frequency (GHz) xomega-cyn0 = 0.98; n-cy = 2;AHarmonic number; npar-cy = polar-cy = 1;%EC wave polarization, (0) for the ordinary mode, (1) for the extraordinary mode thetapoloidal-cy = 0;%Poloidal angle at which the EC wave is absorbed (deg) sm-cy = 0;%EC quasi-linear diffusion coefficient smoothing parameter (no smoothing = 0) trunc = 0;%Collision operator: (0) maxwellian, (1) truncated bouncemode = 2;XBounce averaging option: (0) no bounce averaging, (1) explicit symmetrization enforced at each time step, 133 %(2) dke-mode = DrO = full implicit method with 15 diagonals 0;XFokker-Planck equation (0), drift kinetic equation (1) 0.0;%Core radial diffusion coefficient (m^2/s) pDr = 1;%Coefficient for the parabolic Dr radial profile Dr-model = 0;%Radial diffusion type: (1) magnetic turbulence model (vpar/vth), (2) no vpar dependence VrO = 0;XCore radial pinch coefficient (m/s) pVr = 1;XCoefficient for the parabolic Vr radial profile Vr-model = 0;%Radial pinch type: (1) magnetic turbulence model (vpar/vth), (2) no vpar dependence vparminr = 3.5;%Lower limit of the parallel velocity dependence of the radial diffusion and pinch (vth-ref or vth) nhuloss = NaN;%Magnetic ripple loss frequency, nhuloss > 1000 (or NaN if no ripple losses) (nhu-th) (WARNING: only for TORE SUPRA) precOf = le-10;/Convergence level of the residu nit-f = 30;XMaximum number of iterations for f dtn = 1000;%integration time step (1/nhuth-ref) (dtn > 0: fully implicit time differencing scheme %dtn < 0: Crank-Nicholson time differencing scheme) prec0_g = le-10;XConvergence level of the residu (if NaN, iterations stop with nit-g) nit.g = 30;XMaximum number of iterations for f initguess = 0;%Initial guess for the distribution function: (0) Maxwellian, (1) Fuchs model with Tperp for LH current drive only, (2) from a file invproc = 1;%Matrix inversion method: (1) Full LU factorization, (2) qmr iterative method, %(3) bicgstab iterative method, (4) cconv = 0;Coordinate conversion (p,mhu) -> cgs iterative method, (5) pcg iterative method (ppar,pperp) method: (0) Matlab built-in functions, (1) Mex file display-mode = 1;XDisplay mode: (0): no, (1): partial, (2): full nlevel = 30;%Number of level for contour plots storemode = 0;Temporary storing option for sparse matrices calculations (in RAM: 0, file 1) w2f_mode = 0;XWrite the final electron distribution in a file: *** ******* ******* *** * ** **** *** if display-mode > 1, figure(i);clf; figure(2);clf; figure(i); end if bounce-mode == 0,dke-mode = 0;end if dke-mode == 1,bounce_mode = 2;end precO = [prec0_f,prec0_g]; 134 (0) no save, (1) save in disk nit = [nit-f,nit-g]; mhumin = -1; mhumax = 1; dmhu = (mhumax - mhumin)/nmhu; mhu = [mhumin + dmhu/2: dmhu:mhumax - dmhu/2]; mhup = mhu + dmhu/2; mhu2p = mhup.-2; Xmhu = ones(np,1)*mhu; Rp-norm = Rp/ap;%Normalized major radius rdke = % list [%; of points for DKE calculations if dke_mode == 1, rho = sort(rho); % list in ascending order rho = rho(rho>=drho & rho<=(1-drho)); % avoid dke calculations at the center or at the edge xrho = [rho(1) - drho, rho(1)]; % r- point for radial derivative rdke = 2; if (length(rho) == 1) X dke calc. for one point only xrho = [xrho, rho(i) + drho];% r+ point for radial derivative end for i = 2:length(rho) if rho(i-1) < rho(i)-drho-eps X fp points are added only if radial gap between two consecutive % dke points is too large xrho = [xrho, rho(i) - drho]; end xrho = [xrho, rho(i)]; rdke = [rdke, length(xrho)]; if (length(rho) == i) I (rho(i+1)>rho(i)+drho+eps) xrho = [xrho, rho(i) + drho]; end end else of points for fp calculations xrho = rho; %list end nr = length(xrho); %number of points for fp calculations nr-dke = length(rdke);%number of points for dke calculations xia = xrho/Rp.norm; ir-display = find(xrho == rho-display); display = [display-mode,ir-display] ;%Display parameters %Local plasma parameters xTe = (TeO - Tea)*(1 - xrho.-2).^eTe + Tea;%Electron temperature (keV) xne = (neo - nea)*(1 - xrho.~2).^ene + nea;%Electron density (m-3) xTi = (TiO - Tia)*(i - xrho.^2).~eTi + Tia;ADominant ion and impurity temperatures Te/2) (keV) 135 (usually, Ti = xZeff = (ZeffO - Zeffa)*(1 - xrho.~2).^eZeff + Zeffa;%Effective charge (a.u.) X %Local safety factor value qmax = ap*ap*Bt/Rp/Ip/0.2;%Ampere's theorem at the plasma edge (circular plasma cross-section) xq = (qmax - qmin)*xrho.^eq + qmin; %Ion density calculation (m-3) TO BE COMPLETED if (length(Zi) == 1), xni = xne/Zi; elseif (length(Zi) == 2) & (max(max(Zi)) > 1) % [ngaz,nimp] = lowzyp(ne,Te,Zeffmax(max(Zi)),min(min(Zi))) ;%One light impurity fully stripped model % ni = [ngaz,nimp]; elseif (length(Zi) <= 3) & (max(max(Zi)) == 1) % if sum(fi) > 1, error('Wrong fraction of hydrogen isotops'); % % else ni = fi*ne; % end else % infoyp(2,'Use an impurity transport or equilibrium model'); % return; end % XXfinit-ref = zeros(np,nmhu,nr); XXDlhref = zeros(np,nmhu,nr); XXDcyref = zeros(np,nmhu,nr); XXnhulossref = zeros(np,nmhu,nr); XXDrref = zeros(np,nmhu,nr); XXVr-ref = zeros(np,nmhu,nr); %Reference plasma parameters (for the normalization: pth-ref, nhuth-ref) if length(rho) > 1 1 refmode == 0, Teref = TeO;XCore temperature ne-ref = neO;%Core density if display-mode >= 1 infoyp(2,'Core reference temperature and density'); disp(' ------------------------------------------------------------------------------------------------------------------); end ref_mode = 0; else % rho == 1 and ref-mode == 1 if nr-dke Te-ref ne_ref == = = 0, xTe(i);%Local temperature xne(i);%Local density if display-mode >= 1 136 infoyp(2,'Local reference temperature and density'); disp('-----------------------------------------------------------------------------------------------------------------') end else Te-ref = xTe(2);%Local temperature ne-ref = xne(2);%Local density if display-mode >= 1 infoyp(2,'Local reference temperature and density'); disp( -----------------------------------------------------------------------------------------------------------------') end end end Tenref = Te-ref/mc2; betath-ref = sqrt(Ten-ref);%Normalized pth-ref/mc as prescribed by Karney pth-ref = betath-ref; pmax-ref = pnmax*pth-ref; dp-ref = pmax-ref/np; p-ref = [dp-ref/2:dp-ref:pmax-ref - dp-ref/2]; pn-ref = p.ref/pth-ref; dpn-ref = dp-ref/pth-ref; pn2_ref = pn-ref.*pn-ref; Xpn-ref = pn-ref'*ones(1,nmhu); Xpn2_ref = pn2_ref'*ones(1,nmhu); Ec-ref = mc2*(sqrt(i+p-ref.*p-ref) - 1);%Fast electron kinetic energy in keV Xpnpar-ref = Xpn-ref.*Xmhu; Xpnperp2_ref = Xpn2_ref - Xpnpar-ref.*Xpnpar-ref; lnc-ref = 15.2-0.5*log(ne-ref/1e20)+log(Te-ref);%Reference Coulomb logarithm (in "Tokamaks" by Wesson) nhuref = 2.91e-6*(ne-ref/1e6)*lnc-ref*(Te-ref*1000)^(-1.5);%Reference bulk electron collision rate: NRL formula value xftp-normref = (me/qe)*xq*clum*betath-ref/ap/Bt./xia;%Normalization equation (ftilde) z-ref = betath-ref*pnref; z2-ref = zref.*zref; gamma-ref = sqrt(1 + z2_ref); Xgamma-ref = gamma-ref'*ones(1,nmhu); v-ref = pn-ref./gamma-ref; Xvpar-ref = (v-ref'*ones(1,nmhu)).*(ones(length(v-ref) ,1)*mhu); xTenorm xTi-norm xnenorm xni-norm = = = xTe/Teref; xTi/Teref; xne/neref; xni/ne-ref; 137 factor for drift kinetic xTen = xTe/mc2; xTin = xTi/mc2; for ir = 1:nr, if norm_ref == 0, betath = sqrt(xTen(ir));XNormalized pth/mc as prescribed by Karney pth = betath; pmax = pnmax*pth; dp = pmax/np; p = [dp/2:dp:pmax - dp/2]; pn = p/pth; pn2 = pn.*pn; Xpn = pn'*ones(1,nmhu); Xpn2 = pn2'*ones(1,nmhu); Ec = mc2*(sqrt(1+p.*p) - 1);%Fast electron kinetic energy in keV Xpnpar = Xpn.*Xmhu; Xpnperp2 = Xpn2 - Xpnpar.*Xpnpar; lnc = 15.2-0.5*log(xne(ir)/ie2O)+log(xTe(ir));%Coulomb logarithm (in Tokamaks by Wesson) nhu = 2.9ie-6*(xne(ir)/1e6)*lnc*(xTe(ir)*1000)^(-1.5);XBulk electron collision rate: NRL formula value z = betath*pn; z2 =z.*z; sqrt(i + z2); gamma Xgamma = gamma'*ones(1,nmhu); v = pn./gamma; Xvpar = (v'*ones(i,nmhu)).*(ones(length(v),i)*mhu); rbetath = betath/betathref; rnhuth = nhu/nhu-ref; else rbetath = 1; rnhuth = 1; end xepsiO-ref(ir) = epsiO*rbetath*rnhuth; xepsia-ref(ir) = epsia*rbetath*rnhuth; xDOlhref(ir) = DO-lh*rbetath*rbetath*rnhuth; xvparmin-lh-ref(ir) = vparmin-lh*rbetath; xvparmax-lh-ref(ir) = vparmax-lh*rbetath; xDperp-cy-ref(ir) = Dperp-cy*rbetath*rbetath*rnhuth; xvparmin-r-ref(ir) = vparmin-r*rbetath; xnhuloss-ref(ir) = nhuloss*rnhuth; % LH diffusion coefficient 138 xepsi-ref(ir) = (xepsiO-ref(ir) - xepsia-ref(ir))*xrho(ir) .eepsi + xepsia-ref(ir); %Parabolic dependence of the Ohmic electric field mhutrap2 = 2*xia(ir)/(1+xia(ir)); if DOvdep == 1 XDlh-ref = smoothyp(xDO-lh-ref(ir)*xvparmin-lhref(ir)./Xvparref.*... (Xvparref >= xvparmin-lh-ref(ir) & Xvpar.ref <= xvparmax-lh-ref(ir)),sm-1h);XLH quasi-linear diffusion coefficient matrix with v1/vpar dependence else XDlh-ref = smoothyp(xDO-lh-ref(ir)*(ones(size(Xvpar-ref)).*... (Xvpar-ref >= xvparmin-lh-ref(ir) & Xvpar-ref <= xvparmax-lhref(ir))),sm-1h);%LH quasi-linear diffusion coefficient matrix end if DO-trap == 0 XDlh-ref = XDlh-ref.*(Xmhu.*Xmhu > mhutrap2);%Dlh = 0 in trapped region end XDlh-ref(np-2:np,:) = O*XDlh-ref(np-2:np,:);%Boundary condition (used in Baranov's code) XXDlh-ref(:,:,ir) = XDlh-ref; X EC diffusion coefficient xomegac(ir) = qe*Bt./(I+xia(ir))/me/2/pi/e9;XElectron cyclotron resonance frequency at thetapol = 0 (GHz) xomega-cyn(ir) = xomega-cynO;WARNING: set for X2 mode only xpsib(ir) = (1+xia(ir))/(1+xia(ir)*cos(theta-poloidal.cy*pi/180)); xparam-cy(1:2,ir) = xpsib(ir);xomega-cyn(ir)]; Xmhu-psib = sign(Xmhu).*sqrt(U - xpsib(ir)*(1 - Xmhu.^2)); Xpnperp2_psib-ref = Xpn2_ref.*(i - Xmhu-psib.^2); Xpnpar2_psib-ref = Xpn2_ref - Xpnperp2_psibref; Xnparres-ref = (Xgammaref - xomegacyn(ir)) ./sqrt (Xpnpar2_psib-ref) .*sign(Xmhu-psib) /betath-ref; XWARNING: For the second harmonic only XDcyref = real(xDperp-cy-ref(ir)*Xpnperp2_psib-ref.*Xgamma-ref.*exp(-(Xnparres.ref npar-cy).^2/dnpar-cy^2)./sqrt(Xpnpar2_psibref));X/*EC -... wave quasilinear diffusion coefficient XDcyref = smoothyp(XDcy-ref,sm-cy);%EC quasi-linear diffusion coefficient matrix XDcy-ref(np-2:np,:) = 0*XDcy-ref(np-2:np,:);%Boundary condition (used in Baranov's code) if DO.trap-cy == 0 XDcyref = XDcy.ref.*(Xmhu.*Xmhu > mhutrap2);%Dcy = 0 in trapped region else XDcyref = XDcyref + fliplr(XDcy-ref.*(Xmhu.*Xmhu < mhutrap2));%Dcy symmetric in trapped region end XXDcy-ref(:,:,ir) = XDcyref; %Radial diffusion and pinch coefficients 139 if Drmodel==O, XDrv-ref = DrO*ones(size(np,nmhu))/nhu-ref/ap/ap;%Radial diffusion: standard model Dr(r) = DrO(r) elseif Drmodel==1, XDrv-ref = DrO*abs(Xvpar-ref)/nhu-ref/ap/ap;XRadial diffusion: magnetic turbulence model: Dr(r) = DrO(r)*vpar-ref/vth-ref end XDrv-ref = XDrvref.*(Xvpar-ref >= xvparminrref(ir)); XXDrref(:,:,ir) = XDrv-ref*(1+pDr*xrho(ir)^2);X3-D radial diffusion matrix if Vr-model==O, XVrv-ref = VrO*ones(size(np,nmhu))/nhu/ap;XRadial pinch: standard model : Vr(r) = VrO(r) elseif Vrmodel==, XVrv-ref = VrO*abs(Xvpar)/nhu/ap;%Radial pinch: magnetic turbulence model: Vr(r) = VrO(r)*vpar-ref/vth-ref end XVrv-ref = XVrv-ref.*(Xvpar-ref XXVrref(:,:,ir) >= xvparmin-r-ref(ir)); = XVrv-ref*(1+pVr*xrho(ir)Y2);%3-D radial pinch matrix %Loss term for the electrons trapped in the toroidal magnetic ripple if bouncemode >= 1 & isnan(xnhulossref(ir)) == 0, xNq(ir) = Ncoils*xq(ir); [xthetabanana(ir),xthetaloss(ir),xpndetrap(ir),xEseuil(ir),xdeltaripple(ir)] = detrapmj3(xZeff(ir),ap,Bt,Rp,BeLi,Ip,xne(ir),xrho(ir)); %WARNING: Only valid for TORE SUPRA xpndetrap-ref(ir) = xpndetrap(ir)/betath-ref; xmhusupertrap(ir) = sin(pi*xthetaloss(ir)/180); Xmaskrip-ref = (Xpn-ref > xpndetrap-ref(ir)).*(abs(Xmhu) < xmhusupertrap(ir)); Xnhuloss-ref = Xmaskripref*xnhuloss-ref(ir); else xdeltaripple(ir) = 0; xNq(ir) = Ncoils*xq(ir); Xnhuloss-ref = zeros(length(pn-ref),length(mhu)); end XXnhuloss.ref(:,:,ir) = Xnhulossref; if initguess == 0, fM-ref = exp(-pn-ref.*pn-ref./(1 + gamma-ref)/xTe-norm(ir))/2/pi/xTe-norm(ir)/sqrt(2*pi*xTe-norm(ir)); %Maxwellian distribution normalized to normalized density ne-norm (1st order gamma corrections) XfMref = fM-ref'*ones(1,nmhu); normfMref = 2*pi*trapzyp([pn-ref',pnref '.*pnref'.*trapzyp([mhu',XfM-ref'])']); XfMref = xne-norm(ir)*XfM-ref/normfMref; Xf0_ref = XfM-ref; title-initguess = 'Relativistic Maxwellian'; 140 elseif initguess == 1, % Initial guess for the distribution function from ref. V.Fuchs et al., Phys. Fluids 28 (1985) 3619. alpha = 2 beta = 2 - 2/(2+Zi(i)); alpha; Tpinr-ref = (xvparmax-lh-ref(ir)^(alpha+1) - xvparmin-lhref(ir)^(alpha+i))*(alpha1)/(alpha+i) - (alpha-1)*(xvparmax-lh-ref(ir) - xvparmin-lh-ref(ir))*xvparmin-lhref(ir)^alpha + xvparmaxlh-ref (ir) (alpha-1) - xvparmin-lh-ref(ir)^(alpha-1); Tp2nr-ref = 2*(alpha-1)*(xvparmax-lh-ref(ir) xvparmin-lhref(ir))*xvparmin-lh-ref(ir)^(alpha-2) - (xvparmax-lhref(ir)^(alpha-1) - xvparmin-lh-ref(ir)-(alpha-1)); Tpnr-ref = Tpinr-ref/Tp2nr-ref; 1.0*Tpnr-ref;%Relativistic correction (if necessary) Xpperp2_ref = Xpn-ref.*Xpn-ref.*(1 - Xmhu.*Xmhu); Xppar-ref = Xpn-ref.*Xmhu; Xppar2_ref = Xppar-ref.*Xppar-ref; Xgamma-ref = gamma-ref'*ones(1,length(mhu)); Xpparmin-ref = xvparmin-lh-ref (ir) *sqrt (1 +Xpperp2_ref*betathref ^2) /(1betath-ref-2*xvparmin-lh-ref(ir)^2)); Xpparmax-ref = xvparmax.lh-ref (ir)*sqrt (1 +Xpperp2_ref *betath-ref ^2) /(1betath-ref^2*xvparmax-lhref(ir)^2)); Xmaskplat-ref = (Xppar-ref >= Xpparmin-ref).*(Xppar-ref <= Xpparmaxref); XfsthOref = Xmaskplatref.*exp(-Xpperp2_ref/2/Tpr.ref)/2/pi/Tpr-ref; Xmaskback-ref = (Xppar-ref <= Xpparmin-ref); Xfsth-ref = Xmaskback-ref.*exp(Xpn-ref.*Xpn-ref/2/Tpr-ref).*exp(Xpparmin-ref.*Xpparmin-ref/2/Tpr-ref)/2/pi/Tpr-ref; Xmaskup-ref = (Xppar-ref > Xpparmax-ref); Xfsth2_ref = Xmaskupref.*exp(-(Xpn-ref.*Xpn-ref.*(Xppar-ref./Xpparmaxref).^(2/Zi(i)) Tpr.ref = Xpparmax-ref . *Xpparmax-ref)/Tpr-ref/2)/2/pi/Tpr-ref ;%See thesis of R.Arslanbekov Xfsthref = XfsthOref+Xfsthiref+Xfsth2_ref; fM-ref = xne-norm(ir)*exp(pn-ref.*pn-ref./(i+gamma-ref)/xTe-norm(ir))/2/pi/xTe-norm(ir)/sqrt(2*pi*xTenorm(ir)); XfM-ref = fMref'*ones(1,nmhu); normfMref = 2*pi*trapzyp([pn-ref(:),pn2-ref(:).*trapzyp([mhu',XfMref'])']); normfsth-ref = 2*pi*trapzyp([pn-ref(:),pn2_ref(:).*trapzyp([mhu',Xfsth.ref])']); XfMref = XfM-ref/normfMref; Xfsthref = Xfsthref/normfsth-ref; lambdaref = 1/(1 + Xfsthref(min(find(Xmaskplatref(:,nmhu-)==)),nmhu-)/... XfMref (min(find(Xmaskplat-ref(: ,nmhu-1)==)),nmhu-1)); if (xDlhOref(ir) == 0),lambda-ref = O;end XfOref = XfM-ref + Xfsth-ref*lambda-ref; normfOref = 2*pi*trapzyp([pn.ref(:),pn2_ref(:).*trapzyp([mhu',XfOref'])']); XfOref = xne-norm(ir)*XfQref/normfQref; titleinitguess = 'Fuchs et al. LH model'; 141 - elseif initguess == 2, eval(['load ',dossier,s,'XXfinit.mat']) XfOref = squeeze(XXfinit(:,:,ir)); title-initguess = 'From data file'; end XXfinitref(:,:,ir) = XfOref; %Display initial distribution function if display-mode == 2, normfOref = 2*pi*trapzyp([pnref(:),pn2_ref(:).*trapzyp([mhu',Xf&_ref'])']); [XfOcyl-ref,ppar-cyl-ref,pperpcyl-ref] = s2cyp(full(XfOref),pnref,mhu,cconv); Xppar-cyl-ref = ppar-cylref(:)*ones(i,length(pperp-cyl.ref)); Xpperp-cyl-ref = ones(length(ppar-cyl-ref),i)*pperp-cyl-ref(:)'; Xp-cyl-ref = sqrt(Xppar-cyl-ref.*Xppar-cyl-ref + Xpperp-cyl-ref.*Xpperp-cyl-ref); Xmhu-cyl-ref = Xppar-cyl-ref./sqrt(Xppar-cyl-ref.~2+Xpperp-cyl-ref.^2); Xgammacyl-ref = sqrt(i + Xp-cyl-ref.*Xp-cyl-ref*betath-ref*betath-ref); Xgammapar-cyl-ref = sqrt(i + Xppar-cyl-ref.*Xppar-cyl-ref*betath-ref*betath-ref);/?????????? Xvpar-cyl-ref = Xppar-cyl-ref./Xgamma-cyl-ref; dpperp-cyl-ref = pperp-cyl-ref(2) - pperp-cyl-ref(1); dppar-cyl-ref = ppar-cyl-ref(2) - ppar-cyl-ref(1); if xDO-lh-ref(ir) ~= 0, pparresmin-lh-cyl-ref = xvparminlh-ref(ir)*sqrt(i + betath-ref^2.*pperp-cyl-ref.^2)/sqrt(1 - xvparminjlh-ref(ir)^2*betath-ref^2);%LH resonance condition pparresmax-lh-cyl-ref = xvparmaxlh-ref(ir)*sqrt(1 + betath-ref^2.*pperp-cyl-ref.^2)/sqrt(i - xvparmax.lh-ref(ir)^2*betath-ref^2);XLH resonance condition end XfO-cyl-ref = XfOcyl-ref.*(Xf0_cyl-ref>O);%Remove negative values XfOcyl-ref = XfO-cyl-ref.*(Xp-cyl-ref<max(ppar-cyl-ref));XRemove values above max(ppar) XfOcyl-ref = Xf0_cyl-ref.*(abs(Xmhu-cyl-ref)<=1 - dmhu/2);%Remove values outside from the domain of calculation currOref = 2*pi*trapzyp([pn-ref(:),pn2_ref(:).*(pn-ref(:)./gammaref(:)).*trapzyp([mhu',Xmhu'.*XfOref'])']) currO-cyl-ref = 2*pi*trapzyp([pperp-cyl-ref(:),pperp-cyl-ref(:).*trapzyp([ppar-cyl-ref(:),Xvpar-cyl-ref.*Xf0_cyl_ ref])']); if nrdke >= 1, if ir == ir-display-1, figure(i),subplot(131);zoom on elseif ir == ir-display, 142 figure(i),subplot(132);zoom on elseif ir == ir-display+1, figure(1),subplot(133);zoom on end C = contour(ppar-cyl-ref,pperp-cyl-ref,log(XfOcyl_ref'),[20:20/nlevel:0]);axis('equal'); faxis = axis;dfaxis-x = (faxis(2) - faxis(1))/100;dfaxis_y = (faxis(4) - faxis(3))/100; text(faxis(i) + dfaxis-x*5,faxis(4) text(faxis(i) + dfaxis-x*5,faxis(4) - dfaxis-y*5,['r/a = ',num2str(xrho(ir))]); - dfaxis-y*10,['Te(norm) = ',num2str(xTenorm(ir))]); text(faxis(i) + dfaxis-x*5,faxis(4) - dfaxis-y*15, ['ne(norm) = ',num2str(xne.norm(ir))]); xlabel('ppar/pth-ref');ylabel('pperp/pth-ref');title(title-initguess); pause(Q.1); -= 0, hold on,plot(pparresmin-lh-cyl-ref,pperp-cyl-ref,'k-'),plot (pparresmax-lh-cyl-ref ,pperp-cyl-ref, 'k--'),hold off end if xDO-lh-ref(ir) if ir == ir-display-1, figure(2),subplot(231);zoom on elseif ir == irdisplay, figure(2),subplot(232);zoom on elseif ir == ir-display+1, figure(2),subplot(233);zoom on end semilogy(-v-ref,XfM-ref(:,i),'g--',v_refXfM-ref(:,nmhu),'g--',v-ref,Xf0_ref(:,1),'c-',vref,XfO._ref(:,nmhu),'c-'); %Forward and backward directions only axis([-max(v-ref),max(v-ref),ie-20,10]);grid on;zoom on xlabel('vpar/vth-ref');ylabel('f(pperp = 0)');title(['Norm.(',num2str(xrho(ir)),') ',num2str(normfOref)]); pause(O.1); if ir == ir-display-1, figure(2),subplot(234);zoom on elseif ir == ir-display, figure(2),subplot(235);zoom on elseif ir == ir-display+1, figure(2),subplot(236);zoom on end plot(pn-ref,pn-ref,'r-.',pn-ref,vref,'b:');grid on;zoom on xlabel('p/pth-ref');ylabel('v/vth-ref');title(['j = ',num2str(curr0_ref)]); pause(0.1); elseif ir == ir-display %if ir == irdisplay figure(1),subplot(132);zoom on 143 = %end C = contour(ppar-cyl-ref ,pperp-cyl-ref ,log(Xf0_cyl-ref'),[20:20/nlevel:0]);axis('equal'); faxis = axis;dfaxis-x = (faxis(2) - faxis(1))/100;dfaxisy faxis(3))/100; text(faxis(i) + dfaxis-x*5,faxis(4) text(faxis(1) + dfaxis-x*5,faxis(4) = (faxis(4) - - dfaxis-y*5,['r/a = ',num2str(xrho(ir))]); - dfaxisy*10, ['Te(norm) = ,num2str(xTenorm(ir))]); text(faxis(i) + dfaxis-x*5,faxis(4) - dfaxis-y*15, ['ne(norm) = ',num2str(xnenorm(ir))]); xlabel('ppar/pth-ref');ylabel('pperp/pth-ref');title (title-initguess); pause(O.1); 0, hold on,plot(pparresmin-lh-cylref ,pperp-cyl-ref, 'k-'),plot(pparresmax-lhcyl-ref ,pperp-cyl-ref, 'k--'),hold off end if xDOlhref(ir) -= figure(2),subplot(232);zoom on %end semilogy(-vref ,XfM_ref(: ,1),'g--',v-ref,XfM-ref(: ,nmhu),'g--',- v_ref,XfOref(:,),c-',v-ref,XfOref(:,nmihu),'c-'); /Forward and backward directions only axis([-max(v-ref),max(vref),le-20,10]);grid on;zoom on xlabel('vpar/vth-ref');ylabel('f(pperp = 0)');title(['Norm. (',num2str(xrho(ir)),') = ',num2str(normfOref)]); pause(O.1); figure(2),subplot(235);zoom on;pause(O.1) Xend plot(pn-refpn-ref,'r-.',pn-ref v_ref ,'b:');grid on;zoom on xlabel('p/pth-ref');ylabel('v/vth-ref');title(['j = ',num2str(currOref)]); pause(0.1); end end end X 2D Fokker-Planck calculations timeO = clock; [XXf0_ref ,XXf0tp-ref,XXf0_g-ref,XXSpOref,XXSmhuOref,XXSpO_g_ref,XXSmhuo_g_ref,XXSpotp-ref,... XXSmhuOtpref ,xPcollref ,xPcoll-totref ,xPcollref_fsav,xPcolltotref_fsav, xPabs-ref _fsav,... xPabs-tot-ref_fsav, xnormfref ,xnormf-ref_fsav,xcurrO_ref ,xcurrtotref ,xcurr0_ref_fsav,... xcurr-tot-ref-fsav,xcurrB-ref_fsav,xRR-reffsavxTe_normoutXpn-ref,Xmhu-ref,xmhubounce2] = fp2d9yp-new2 (betath-ref ,Rp-norm, xTenorm,xnenorm, Zi,mi, xninorm,xTi-norm,pnref ,mhu,XXDlh_ref,. 144 XXDcy-ref,xparam-cy,XXnhuloss-ref,xepsi-refbounce-mode,rdke,xia,xftpnorm-refXXDr-ref,XXVrref, xdeltaripple,xNq,trunc,dtn,precO,nit,invproc,display,storemodeXXfinitref);% if display-mode >= 1, if nr-dke == 0, infoyp(2,['Full elapsed time for solving the Fokker-Planck equation: ',num2str(etime(clock,time0)),' Cs)']) else infoyp(2,['Full elapsed time for solving the drift kinetic equation: ',num2str(etime(clock,time0)),' Cs)']) end disp(' --------------------------------------------------------------------------------------; ----------------------------- end if v2fmode == 1, XXfp-out = XXfOref; XXfp-tp-out XXfp-g-out eval(['save XXfOtp-ref; = XXfOg-ref; ',dossier,s,'XXdke_out.mat = XXfp-out XXfp-tp-out XXfp-gout Xmhu Xpn-ref']) end P-ref = 9.le-31*(clum*betath-ref)^2*nhu-ref*ne-ref/1e6;%MKSA power unit j-ref = 1.6e-19*clum*betath-ref*ne-ref/le6;.MKSA current unit Edreicer-ref = me*clum*betath-ref*nhu-ref/qe;%MKSA Dreicer field unit xcollisionnality = 0.012*(xne/le20).*xZeff.*xq*Rp./xia.^1.5./xTe.^2;XFrom 0. Sauter et al. Phys. Plasma 6 (1999) 2834 [xcurr-hir-mksa-fsav,xcurr-saumksafsav,xcurr-i_mksa-fsav,xcurrjlormksafsav hsneomodels9jd(xrho,ap,Rp,Zi,xq,Bt,TeO,Tea,eTe,neO,nea,ene,TiO,Tia,eTi); =. %Calculation of the flux averaged bootstrap current from Hirshman and Sauter models (bulk contribution) if display-mode >=I = XfOref = squeeze(XXf _ref(:,:,ir display));%Display results at the required radial Xf0_tp~ref value = value squeeze(XXf0_tp.ref(:,:,irdisplay));.Display results at the required radial XfOg-ref = squeeze(XXfOg-ref(:,:,irdisplay));%Display results at the required radial value Xfinit-ref = squeeze(XXfinit-ref(:,:,ir-display));%Display results at the required radial value XDlh-ref = squeeze(XXDlh-ref(:,:,ir-display));%Display results at the required radial value XDcyref = squeeze(XXDcy-ref(:,:,ir-display));%7Display results at the required radial value XSpOref = squeeze(XXSpOref(:,:,ir.display));%Display results at the required radial value XSmhu0_ref = squeeze(XXSmhuOref(:,:,ir-display));Y.Display results at the required radial 145 value infoyp(2,['Reference electron temperature (keV): ',num2str(Ten-ref*mc2)]) infoyp(2,['Reference electron density (10+19 m-3): ',num2str(neref/1e19)]) infoyp(2,['MKSA power unit (P.ref): ',num2str(P-ref),' (MW/m3)']) infoyp(2,['MKSA current unit (jref): ',num2str(jref),' (MA/m2)']) infoyp(2,['MKSA Dreicer field unit (Edreicer-ref): ',num2str(Edreicer-ref),' (V/m)']) disp(' ------------------------------------------------------------------------------------------------------------------); infoyp(2, ['Radial position at which results are displayed: ',num2str(xrho(irdisplay)),' (ap)']) disp(' -----------------------------------------------------------------------------------------------------------------'Y); infoyp(2,['Electron temperature (keV): ',num2str(xTe(irdisplay))]) infoyp(2, ['Electron temperature increment (keV): ',num2str ( (xTe-norm-out (ir-display) - xTe-norm(ir-display))*Ten-ref*mc2)J) infoyp(2,['Electron density (10+19 m-3): ',num2str(xne(ir-display)/iei9)]) disp('---------------------------------------------------------------------------------------------------------------'); infoyp(2,['Inverse aspect ratio: ',nuim2str(xia(irdisplay))]) infoyp(2,['Collisionality parameter: ',num2str(xcollisionnality(ir-display))]) disp(I --------------------------------------------------------------------------------------'); ---------------------------- % Magnetic ripple losses (********* to be cross-checked **********) if bouncemode >= 1 & isnan(xnhuloss-ref(ir-display)) == 0, Gripmhuref = 2*pi*trapzyp([pn-ref',Xmaskrip-ref.*XSmhu0_ref.*Xpn-ref])*sqrt(i-... min(mhu(find(abs(mhu)<xmhusupertrap(ir-display))))-2); Grippn-ref = 2*pi*pn(max(find(pn-ref<xpndetrap-ref(ir-display)))) ^2*trapzyp([mhu',Xmaskrip-ref' Gripflux-ref = Gripmhu-ref (max(f ind (abs (mhu) <xmhusupertrap(ir-display)))) Gripmhu-ref(min(find(abs(mhu)<xmhusupertrap(ir-display)))) + .*XSpO-ref']); - Grippn-ref(max(find(pn-ref<xpndetrap-ref(ir-display)))+1) GriptauOref = trapzyp( [pn-ref' ,Xnhuloss-ref .*Xf0_ref .*Xpn-ref .*Xpn-ref]); Griptau-ref = 2*pi*trapzyp([mhu',Griptauref']),%Flux of electrons leaving the plasma through the loss cone infoyp(2, ['Ripple loss (s-i.m-3): ',num2str(Griptau-ref*nhu-ref*xne(ir-display))]); disp(' -----------------------------------------------------------------------------------------------------------------') end [Xfinit-cyl.ref,ppar-cyl-ref,pperp-cyl-ref] = s2cyp(Xfinit-ref,pn.ref,mhu,cconv); %Spherical to cylindrical coordinate transformation [XfOcyl-ref,ppar-cyl-ref,pperp-cyl-ref] s2cyp(Xf0_ref ,pnref,mhu,cconv);%Spherical = to cylindrical coordinate transformation [XDlh-cyl-ref,ppar-cyl-ref,pperp-cyl-ref] = s2cyp(XDlh-ref ,pn-ref ,mhu,cconv); %Spherical to = s2cyp(XDcyref ,pn-ref ,mhu, cconv);%Spherical to cylindrical coordinate transformation [XDcy.cyl-ref,ppar-cyl-ref,pperp-cyl-ref] 146 cylindrical coordinate transformation Xppar-cyl-ref = ppar-cyl-ref(: )*ones(1,length(pperp-cyl-ref)); Xpperp-cyl-ref = ones(length(ppar-cyl-ref) , 1)*pperp-cyl-ref(:)'; Xmhu-cyl-ref = Xppar-cyl-ref./sqrt(Xppar-cyl-ref.^2+Xpperp-cyl-ref.~2); Xp-cyl-ref = sqrt(Xppar-cyl-ref.*Xppar-cyl-ref + Xpperp.cyl-ref.*Xpperp-cyl-ref); Xganmmacyl-ref = sqrt(1 + Xp-cyl-ref.*Xp-cyl-ref*betath-ref*betath-ref); Xgammapar-cyl-ref = sqrt(1 + Xppar-cylref .*Xppar-cylref *betath-ref*betath-ref) ;?????????? Xvpar-cyl-ref = Xpparcyl_ref./Xgammacyl_ref; dpperp-cyl-ref = pperp-cyl-ref(2) - pperp-cyl-ref(1); dppar-cyl-ref = ppar-cyl-ref(2) - ppar-cyl-ref(1); XfOcyl-ref = XfOcyl-ref.*(XfOcyl-ref>O);%Remove negative values XfOcyl-ref = XfO-cyl-ref.*(Xp-cyl-ref<max(ppar-cyl-ref));%Remove values above max(ppar) XfOcyl-ref = Xf0_cyl-ref.*(abs(Xmhu-cyl-ref)<=1-dmhu/2);%Remove values outside from the domain of calculation = XDlh-cyl-ref.*(XDlh-cyl-ref>O);%Remove negative values XDlh-cyl-ref XDlh-cyl-ref XDlh-cyl.ref XDlh-cyl-ref = XDlh-cyl-ref.*(Xp-cyl-ref<max(ppar-cyl-ref));%Remove values above max(ppar) = XDlh-cyl-ref. * (XDlh-cyl-ref<=max(max(XDlh-ref))) ;%Remove too large values = XDlh-cyl-ref.*(abs(Xmhu-cyl-ref)<=-dmhu/2);Remove values outside from the domain of calculation XDcy-cyl-ref = XDcy-cyl-ref.*(XDcy-cyl-ref>O);%Remove negative values XDcy-cyl-ref = XDcy-cyl-ref.*(Xp-cyl-ref<max(ppar-cyl-ref));%Remove values above max(ppar) XDcy-cyl-ref = XDcy-cylref.*(XDcy-cyl-ref<=max(max(XDcy-ref)));XRemove too large values XDcy-cyl-ref = XDcy-cyl-ref.*(abs(Xmhu-cyl-ref)<=-dmhu/2);XRemove values outside from the domain of calculation %LH and EC quasi-linear domains pparresmin-lh-cyl-ref = xvparmin-lh-ref (ir-display)*sqrt (1 + betathref^2.*pperp-cyl-ref.^2)/sqrt(i xvparmin-lh-ref (ir-display) 2*betath-ref^2) ;%LH resonance condition pparresmax-lh-cyl-ref = xvparmax-lh-ref(ir-display)*sqrt(1 betath-ref^2.*pperp-cyl-ref.^2)/sqrt(1 + -. xvparmaxlh-ref (ir-display) 2*betath-ref 2) ;%LH resonance condition pperp2res.cy-cyl-ref 1)/betath-ref2 = ((xomega-cyn(ir-display) + npar-cy*betath-ref*ppar-cyl-ref).^2- - ppar-cyl-ref.^2;XEC resonance condition mask-pperp2res-cy-cyl-ref = find(pperp2res.cy-cyl-ref >=O); pperpres-cy-cyl-ref = sqrt(pperp2res-cy-cyl-ref(mask-pperp2res-cy-cyl-ref)); pparres-cy-cyl-ref = ppar-cyl-ref(mask-pperp2res-cy-cyl-ref); pparres-cy-cy10_ref = (npar-cy*xomega-cyn(ir-display) - sign(npar-cy)*sqrt(npar-cy^2 xomega-cyn(ir-display)^2))/betath-ref/(1 1+ - npar-cy^2);%EC resonance condition at pperp = 0 %calculation in cylindrical coordinates 147 xnormf-cyl-ref(ir-display) = 2*pi*trapzyp([pperp-cyl-ref (:) ,pperp-cyl-ref (:).*trapzyp([ppar-cyl-ref (:),XfQcyl-ref])']); xcurrOcylref (ir-display) = 2*pi*trapzyp([pperp-cyl-ref(:),pperp-cyl-ref(:).*... trapzyp([ppar-cyl-ref(:),Xvpar-cyl-ref.*XfOcyl-ref])']); %Flux calculations % Calculation of F// and Tperp if display-mode >=2 FparOcyl-ref = 2*pi*trapzyp( [pperp-cyl-ref(:),Xpperp-cyl-ref' .*XfOcyl-ref ']); Fparinit-cyl-ref = 2*pi*trapzyp([pperp-cyl-ref(:),Xpperp-cyl-ref'.*Xfinit-cyl-ref']); zFarOcyl-ref = find(FparQcyl-ref==O);FparOcyl-ref(zFarO-cylref) = FparOcyl-ref(zFarOcyl-ref)+le-60;%zero removal Fpar3_cyl-ref = 2*pi*trapzyp([pperp-cyl-ref(:),Xpperp-cyl-ref'.*Xpperp-cyl-ref'.*Xpperp-cyl-ref'.*XfO-cyl-ref']); Tperp-cyl-ref = Fpar3_cyl-ref./FparOcyl-ref/2; Tperpn-cyl-ref = betath-ref*betath-ref*Tperp-cyl.ref*mc2/Te-ref; figure(3);clf subplot (121),semilogy(ppar-cylref ,FparOcyl-ref, 'r-' ,ppar-cyl-ref ,Fparinit-cyl-ref, 'b-');grid on; axis([-max(pn-ref),max(pnref),le-20,10]);zoom on ylabel('FO//');xlabel('ppar/pth-ref');title( ['r/a = ',num2str(xrho(ir.display)),')']); subplot(122) ,plot(ppar-cyl-ref ,Tperpn-cyl-ref, 'b-') ;grid on;zoom on ylabel('Tperp/Te-ref');xlabel('ppar/pth-ref');title(['(r/a = ',num2str(xrho(ir-display)),')']); pause(O.1); figure(4),clf C = contour(ppar-cyl-ref ,pperp-cyl-ref ,log(Xf0_cylref'), [-20:20/nlevel:0]) ;grid on;zoom on; %Distribution function and wave quasilinear diffusion coefficient contour plot axis('equal') title('2-D steady state electron distribution function'); xlabel('ppar/pth-ref'); ylabel('pperp/pth-ref'); if bounce-mode >= 1,%Draw bounce domain boundaries line ( [0, pnmax*sqrt (xmhubounce2(ir-display))] , [O,pnmax*sqrt ( - xmhubounce2(ir-display))]); line( [,-pnmax*sqrt(xmhubounce2(ir-display))],[O,pnmax*sqrt(i - xmhubounce2(ir-display))]); if isnan(nhuloss) == 0,XDraw the loss cone line( [O,pnmax*sqrt(icos(xthetaloss(ir-display)*pi/180)^2)],[0,pnmax*cos(xthetaloss(ir-display)*pi/180)],... 'LineStyle','-','color','r'); line([O,-pnmax*sqrt(1- 148 cos(xthetaloss(ir-display)*pi/180)^2)], [O,pnmax*cos(xthetaloss(ir-display)*pi/180)],... 'LineStyle','-','color','r'); end end if xDO-lh-ref(ir-display) -= 0, hold on,plot(pparresmin-lhcyl-ref,pperp-cylref,'k-- '),plot (pparresmaxlh-cylref ,pperp-cyl-ref, 'k--'),hold off end if xDperp-cy-ref(ir-display) -= 0, hold on;plot(pparres-cy-cyl-ref,pperpres-cy-cyl-ref, 'k-. ');hold off hold on,plot(pparres-cy-cylOref,0,'k*'),hold off; end faxis = axis;dfaxis-x = (faxis(2) - faxis(1))/100;dfaxis-y text(faxis(1) + dfaxis-x*5,faxis(4) = (faxis(4) - faxis(3))/100; - dfaxis.y*5,['r/a = ',num2str(xrho(ir.display))]); pause(0.1); if xDO-lh-ref(ir-display) -= 0, figure(7);clf C = contour(ppar-cyl-ref,pperp-cyl-ref,XDlh-cyl-ref',nlevel);grid on;zoom on;%LH diffusion coefficient axis('equal') title('Lower Hybrid diffusion coefficient (nhu-ref*pth-ref^2)'); xlabel('ppar/pth-ref'); ylabel('pperp/pth-ref'); hold on,plot(pparresmin-lh-cyl-ref,pperp-cylref,'k-'),plot (pparresmax-lh-cyl-ref ,pperp-cyl-ref,'k--'),hold off if bounce-mode >= 1,%Draw bounce domain boundaries line( [O,pnmax*sqrt(xmhubounce2(ir-display))], [0,pnmax*sqrt(i xmhubounce2(ir-display))]); line( [O,-pnmax*sqrt(xmhubounce2(ir-display))] , [O,pnmax*sqrt(i - - xmhubounce2(ir-display))]); if isnan(nhuloss) == 0,YDraw the toroidal ripple loss cone line ( [O,pnmax*sqrt(icos(xthetaloss(ir-display)*pi/180)-2)] ,[0,pnmax*cos(xthetaloss(ir-display)*pi/180)] 'LineStyle','-','color','r'); line([O,-pnmax*sqrt(icos(xthetaloss(ir-display)*pi/180)^2)] , [O,pnmax*cos(xthetaloss(irdisplay)*pi/180)], 'LineStyle','-','color','r'); end end faxis = axis;dfaxisx = (faxis(2) - faxis(1))/100;dfaxis-y faxis(3))/100; text(faxis(i) + dfaxis-x*5,faxis(4) - dfaxis-y*5,['r/a ',num2str(xrho(ir-display))]); pause(O.1); end if xDperp-cy-ref(ir-display) -= 0, figure(8);clf 149 (faxis(4) - C = contour(ppar-cyl-ref,pperp-cyl-ref,XDcy-cyl-ref',nlevel);grid on;zoom on;%EC diffusion coefficient axis('equal') title('Electron cyclotron diffusion coefficient (nhu-ref*pth-ref^2)'); xlabel('ppar/pth-ref'); ylabel('pperp/pth-ref'); hold on;plot(pparres-cy-cyl-ref,pperpres-cy-cyl-ref, 'k-. ');hold off hold on,plot(pparres-cy-cylOref,0,'k*'),hold off; if bounce-mode >= 1,%Draw bounce domain boundaries line([O,pnmax*sqrt(xmhubounce2(ir-display))], [O,pnmax*sqrt(i - xmhubounce2(ir-display))]); line( [0,-pnmax*sqrt(xmhubounce2(ir-display))], [0,pnmax*sqrt(i - xmhubounce2(ir-display))]); if isnan(nhuloss) == 0,%Draw the toroidal ripple loss cone line ( [0,pnmax*sqrt(1cos(xthetaloss(irdisplay)*pi/180)^2)], [0,pnmax*cos(xthetaloss(ir-display)*pi/180)] 'LineStyle','-','color','r'); line( [0,-pnmax*sqrt (1cos(xthetaloss(ir-display)*pi/180)^2)], [0,pnmax*cos(xthetaloss(irdisplay)*pi/180)],... 'LineStyle','-','color','r'); end end faxis = axis;dfaxisx = (faxis(2) - faxis(1))/100;dfaxisy = (faxis(4) - faxis(3))/100; text(faxis(1) + dfaxis-x*5,faxis(4) - dfaxis-y*5,['r/a = ',num2str(xrho(ir_display))]); pause(0.1); end end if isempty(find(rdke==ir-display))%no xcurr-tot-cyl-ref(ir-display) display of dke calculations = xcurrOcyl-ref(ir-display); xnormf-tot-cyl-ref(ir-display) = xnormf-cyl-ref(ir-display); % only the flux-surface averaged density of absorbed power is physical disp(' -----------------------------------------------------------------------------------------------------------------')); infoyp(2,'Global results (normalized to reference units) at Bmin [theta-pol = 0 (deg)]:'); - Density [spherical]: disp([' ',nuim2str(xnormf-ref(ir-display)),', [cylindrical]: ',num2str(xnormf-cyl-ref(ir-display))]) disp([' [cylindrical]: - RF current density [spherical]: ',num2str(xcurrcref(ir-display)),', ',... num2str(xcurrOcyl-ref(ir-display))]) disp([' - RF power density lost on collisions (coll) [spherical]: ',num2str(xPcoll-ref(irdisplay))]) 150 disp('-----------------------------------------------------------------------------------------------------------------'); infoyp(2,'Global results (normalized to MKSA units) at Bmin [theta-pol = 0 (deg)]:'); disp([' - Density (10+19 m-3) [spherical]: ,num2str(xnormf-ref (ir-display)*ne-ref/e19),', [cylindrical]: ',... num2str(xnormf-tot-cyl-ref(ir-display)*ne-ref/e9)]) disp([' - RF current density (MA/m2) [spherical]: [cylindrical]: ,num2str(j.ref*xcurrOref(irdisplay)),', disp([' ',... num2str(j-ref*xcurr.cyl-ref(irdisplay))]) - RF power density lost on collisions (MW/m3) [spherical]: ',num2str(P-ref*xPcoll-ref(ir-display))]) disp(' ------------------------------------------------------------------------------------------------------------------); infoyp(2,'Global flux surface averaged results (normalized to reference units):'); ',num2str(xnormf-ref.fsav(ir-display))]) disp([' - Density: disp([' - RF current density: disp([' - RF power density lost on collisions (coll) [spherical]: [spherical]: [spherical]: ',num2str(xcurrOref_fsav(ir-display))) ',num2str(xPcoll-ref-fsav(irdisplay))]) disp([' - RF absorbed power density (drag) [spherical]: ',num2str(xPabs-ref-fsav(ir-display))]) if xPabs-ref-fsav(ir-display) ~= 0, disp([' - RF current drive efficiency [spherical]: ',... num2str(xcurrOref_fsav(ir-display)/(xPabs-ref_fsav(ir-display)+eps))]) else disp([' - RF current drive efficiency [spherical]: Inf, [cylindrical]: Inf']) end disp([' - Runaway rate [spherical]: ',num2str(xRR-ref-fsav(ir-display,np-1))]) disp([' - Bulk current [spherical]: ',num2str(xcurrB-ref_fsav(ir-display))]) disp('---------------------------------------------------------------------------------------------------------------); infoyp(2,'Global flux surface averaged results (normalized to MKSA units):'); disp([' - Density (10+19 m-3) [spherical]: ,num2str(xnormf-ref_fsa(ir-display)*ne-ref/1e19)]) disp([' - RF current density (MA/m2) [spherical]: ',num2str(j-ref*xcurraref-fsav(ir-display))]) disp([' - RF power density lost on collisions (coll) [spherical]: ',num2str(P-ref*xPcoll-ref-fsav(ir-display))]) disp([' - RF absorbed power density (MW/m3) [spherical]: ,num2str(P-ref*xPabs-ref-fsav(ir-display))]) if xPabs-ref-fsav(ir-display) disp([' -= 0, - RF current drive efficiency (A.m/M) [spherical]: ,... num2str(jref*xcurroref_fsav(ir-display)/P-ref/xPabs-ref_fsav(ir-display))]) else disp([' - RF current drive efficiency (A.m/M) [spherical]: Inf, [cylindrical]: Inf']) end disp([' - Runaway rate (Kg.m-3.s-1) [spherical]: 151 ',num2str(xRR-ref-fsav(ir-display,np- 1)*nhu-ref*ne-ref*me)]) - Bulk current (MA/m2) [spherical]: disp([' ',num2str(j-ref*xcurrB-ref-fsav(ir-display))]) disp('------------------------------------------------------------------------------------------------------------------ ) else irdke-display = find((rdke==ir-display)); [XfOg-cyl-ref,ppar-cyl-ref,pperp-cyl-ref] = s2cyp(XfO-g-ref,pnrefmhucconv); [XfOtp-cyl-ref,ppar-cyl-ref,pperp-cyl-ref] = s2cyp(XfO-tp-ref,pn-ref,mhu,cconv); XfO-tpg-cyl-ref = XfO-g-cyl1ref + XfOtp-cyl-ref; XfO-tpg-cyl-ref = XfO-tpg-cyl-ref.*(Xp-cyl-ref<max(ppar-cyl-ref));%Remove values above max(ppar) XfO-tpg-cyl-ref = Xf 0_tpg-cyl-ref.*(Xmhu-cyl-ref<1-dmhu/2);%Remove values outside from the domain of calculation Flbootstrap-cyl-ref = 2*pi*trapzyp([pperp-cyl-ref(:),Xpperp-cylref'.*XfOtpg-cyl-ref']); % non cylindric term calculated by fp2dyp XfO-tot-cyl-ref = Xf0_cyl-ref + XfO-g-cyl-ref + XfOtp.cyl-ref; xcurr-tot-cyl-ref(ir-display) = 2*pi*trapzyp( [pperp-cyl-ref(:) ,pperp-cylref(:) *trapzyp( [ppar-cyl-ref(:),... Xvpar-cyl-ref.*Xf0_tot-cyl-ref])']); if display-mode >= 2 figure(9) ,plot(ppar-cyl-ref ,Flbootstrap-cyl-ref),ylabel('F1(bootstrap)') ,xlabel('ppar') ;zoom on pnplot-ref = min(find(pn-ref>=4)); figure(10),plot(mhu,XfOtp-ref(pnplot-ref,:)','b--',mhu,XfQg-ref(pnplotref,:)','rylabel('ftp (b--) and g (r-.)');xlabel('mhu') title('pn-ref = 4') pause(O.1); end disp('---------------------------------------------------------------------------------------------------------------'); infoyp(2,'Global results (normalized to reference units) at Bmin [theta-pol = 0 (deg)]:'); - Density [spherical] : ',num2str(xnormf-ref (ir-display)),', disp([' [cylindrical]: ',num2str(xnormf-cyl-ref(ir-display))]) disp([' [cylindrical]: - RF only current density [spherical]: ',num2str(xcurrOref(ir-display)),', ,... num2str(xcurrOcyl-ref(ir-display))]) disp([' - Electron bootstrap current density [spherical]: ',... num2str(xcurr-tot-ref (ir-display) - xcurr0_ref (ir-display)),... ', [cylindrical]: ',num2str(xcurr-tot-cyl-ref (ir-display) xcurrOcyl-ref(ir-display))]) disp([' - RF + electron bootstrap current density [spherical]: 152 ',... [cylindrical]: num2str(xcurrtotref(ir-display)),', ,num2str(xcurr-tot-cyl-ref(ir-display))]) - Power density dissipated on collisions (FP solution only) disp([' [spherical]: ,num2str(xPcoll-ref(ir-display))]) - Power density dissipated on collisions (DKE solution) disp([' [spherical]: ,num2str(xPcoll-tot-ref(ir-display))]) disp(' ------------------------------------------------------------------------------------------------------------------) -; infoyp(2,'Global results (normalized to MKSA units) at Bmin [theta-pol = 0 (deg)]:'); - Density (10+19 m-3) disp([' [spherical]: [cylindrical]: ,,... num2str(xnormf-cyl-ref(ir-display)*ne-ref/1e19)]) ',num2str(xnormf-ref(irdisplay)*ne.ref/1e19),', - RF only current density (MA/m2) [spherical]: disp([' ',num2str(j-ref*xcurrOref(ir-display)),... 1, disp([' [cylindrical]: ',num2str(j-ref*xcurro-cyl-ref(ir-display))]) - Electron bootstrap current density (MA/m2) [spherical]: ',... num2str(jref*(xcurr-tot-ref (ir.display) - xcurr0_ref (ir-display))),... , [cylindrical]: ',num2str(jref*(xcurr-tot-cyl-ref(ir-display) xcurrOcyl-ref(ir-display)))]) disp([' - RF + electron bootstrap current density (MA/m2) num2str(j-ref*xcurr-tot-ref(ir-display)),', [spherical]: ',... [cylindrical]: ',num2str(j-ref*xcurr-tot-cyl-ref(ir-display))]) disp([' - RF power density lost on collisions (FP solution only)(MW/m3) [spherical]: num2str(Pref*xPcoll-ref(ir-display))]) disp([' - RF power density lost on collisions (DKE solution)(MW/m3) [spherical]: num2str(P-ref*xPcoll-tot-ref(ir.display))]) disp( ---------------------------------------------------------------------------------------------------------------); infoyp(2,'Global flux surface averaged results (normalized to reference units):'); [spherical]: ',num2str(xnormf.-ref.-fsa(ir-display))]) disp([' - Density: disp([' - RF only current density: [spherical]: ,num2str(xcurrOref-fsav(ir-display))]) disp([' - Electron Bootstrap current density: ',num2str(xcurr-tot-ref-fsav(ir-display) [spherical]: - xcurrOref-fsav(ir-display))]) disp([' - RF + electron bootstrap current density: [spherical]: ',num2str(xcurr-tot-reffsav(irdisplay))]) disp([' - Ion bootstrap current density: ',num2str(xcurr-i-mksafsav(ir-display)/j-ref)]) disp([' - Total bootstrap current density [spherical]: ,num2str(xcurr-tot-ref-fsav(ir-display) - xcurrOref -fsav(ir-display) + xcurr-i-mksa-fsav(ir-display)/j-ref)]); disp([' - Hirshman model for bootstrap: ,num2str(xcurr-hir-mksa-fsav(ir-display)/j-ref)]) disp([' - Sauter model for bootstrap: ,num2str(xcurr-sau-mksafsav(irdisplay)/j-ref)]) 153 ,... disp([' - RF + total bootstrap current density [spherical]: ',... num2str(xcurr-tot-reffsav(ir-display) + xcurr_i-mksafsav(ir-display)/j-ref)]); disp([' - Power density dissipated on collisions (FP solution only) [spherical]: ',num2str(xPcoll-ref-fsav(irdisplay))]) disp([' - Power density dissipated on collisions (DKE solution) [spherical]: ',num2str(xPcoll-tot-ref-fsay(ir-display))]) disp([' - RF absorbed power density (FP solution only) [spherical]: ',num2str(xPabs-reffsav(ir-display))]) disp([' - RF absorbed power density (DKE solution) [spherical]: ',num2str(xPabs-tot-ref-fsav(ir-display))]) if xPabsreffsav(ir-display) -= 0, - RF current drive efficiency (FP solution only) disp([' [spherical]: ,... num2str(xcurrOref-fsav(ir-display)/(xPabs-ref-fsa(ir-display)+eps))]) else disp([' [cylindrical]: - RF current drive efficiency (FP solution only) [spherical]: Inf, Inf']) end disp([' - Runaway rate [spherical]: ',num2str(xRR-ref-fsav(ir-display,np-1))]) disp([' - Bulk current [spherical]: ',num2str(xcurrB-ref-fsav(ir-display))]) disp('---------------------------------------------------------------------------------------------------------------'); infoyp(2,'Global flux surface averaged results (normalized to MKSA units):'); disp([' - Density (10+19 m-3) [spherical]: ,num2str(xnormf-ref-fsav(ir-display)*ne-ref/1e19)]) disp([' - RF only current density (MA/m2) [spherical]: ,num2str(j-ref*xcurrOreffsav(irdisplay))]) disp([' - Electron bootstrap current density (MA/m2) [spherical]: num2str(j-ref*(xcurr-tot-ref-fsa(ir-display) disp([' ',... - xcurr0_ref-fsa(ir.display)))]) - RF + electron bootstrap current density (MA/m2) [spherical]: ,num2str(j-ref*xcurr-tot-ref-fsa(ir-display))]) disp([' - Ion bootstrap current density (MA/m2): ,num2str(xcurr-i-mksa-fsa(ir-display))]) disp([' - Total bootstrap current density (MA/m2) [spherical]: num2str(j-ref*(xcurr-tot-ref-fsa(ir-display) xcurr-i-mksa-fsav(irdisplay))]) disp([' ',... - xcurr0_ref-fsav(ir-display)) + - Hirshman model for bootstrap (MA/m2): ,num2str(xcurr-hir-mksa-fsav(ir-display))]) disp([' - Sauter model for bootstrap (MA/m2): ,num2str(xcurr-saumksa-fsav(ir-display))]) disp([' - RF + total bootstrap current density (MA/m2): [spherical]: ',... num2str(j-ref*xcurrtot-ref-fsav(ir-display) + xcurr_i_mksa-fsa(ir-display))]) disp([' - Power density dissipated on collisions (FP solution only) [spherical]: ,num2str(xPcoll-ref-fsav(ir-display))]) disp([' - Power density dissipated on collisions (DKE solution) [spherical]: ,num2str(xPcoll-totref-fsav(ir-display))]) disp([' - RF absorbed power density (FP solution only) [spherical]: ,num2str(P-ref*xPabs-ref-fsav(ir-display))]) disp([' - RF absorbed power density (DKE solution) [spherical]: 154 ',num2str(P-ref*xPabs-totrefjfsav(ir-display))]) if xPabs-ref-fsav(ir-display) ~= 0, - RF current drive efficiency (FP solution only) [spherical]: disp([' ',... num2str(j-ref*xcurrO-ref-fsav(ir-display)/P-ref/(xPabs-ref-fsav(ir-display)+eps))]) else - RF current drive efficiency (FP solution only) [spherical]: Inf, disp([' [cylindrical]: Inf']) end disp([' - Runaway rate (Kg.m-3.s-1) [spherical]: ',num2str(xRR-ref-fsav(ir-display,np1)*nhu-ref*ne-ref*me)]) - Bulk current (MA/m2) [spherical]: disp([' ',num2str(j-ref*xcurrB-ref-fsav(ir-display))]) disp(' ------------------------------------------------------------------------------------------------------------------- end end if display-mode == 2 if nr-dke == 0 & nr > 1 figure(200),subplot (221) ,plot(xrho,j-ref*xcurrOref_fsav, set(gca,'xlim',[0,1]) zoom on;grid on; xlabel('r/a');ylabel('<J> (MA/m^2)'); title('Flux Surface Averaged Current density'); figure(200),subplot(222) ,plot(xrho,P-ref*xPabs-ref, set(gca,'xlim',[0,1]) zoom on;grid on; xlabel('r/a');ylabel('P_{abs} (MW/m^3)'); title('Density of Absorbed Power'); '+'); '+'); figure(200),subplot(223) ,plot(xrho,xTe, 'ro' ,xrho,xTi, 'bx'); set(gca,'xlim',[0,1]) zoom on;grid on; xlabel('r/a');ylabel('T (keV)'); title('Temperature') legend('Electron','Ion'); figure(200),subplot(224) ,plot(xrho,xne/1e20, 'ro' ,xrho,xni/1e20, 'bx'); set(gca,'xlim',[0,1]) zoom on;grid on; xlabel('r/a');ylabel('n (m-3)\times 10-20'); title('Densities') legend('Electron','Ion'); 155 elseif nrdke >1 figure(200),subplot(221),plot(xrho,jref*xcurrOreffsav, set(gca,'xlim',[0,1]) zoom on;grid on; '+'); xlabel('r/a');ylabel('<J> (MA/m^2)'); title('Flux Surface Averaged Current density'); figure(200) ,subplot(222) ,plot(xrho,P-ref*xPabs-ref,'+'); set(gca,'xlim',[0,1]) zoom on;grid on; xlabel('r/a');ylabel('P_{abs} (MW/m^3)'); title('Density of Absorbed Power'); figure(200) ,subplot(223) ,plot(xrho,xTe, 'ro' ,xrho,xTi, 'bx'); set(gca,'xlim',[0,1]) zoom on;grid on; xlabel('r/a');ylabel('T (keV)'); title('Temperature') legend('Electron','Ion'); figure(200) ,subplot(224) ,plot(xrho,xne/1e20, 'ro' ,xrho,xni/1e20, 'bx'); set(gca,'xlim',[0,1]) zoom on;grid on; xlabel('r/a');ylabel('n (m-3)\times 10-20'); title('Densities') legend('Electron','Ion'); srho = 0:0.01:1; sq = (qmax - qmin)*srho.-eq + qmin; [scurr-hir-mksa-fsav,scurr-sau-mksafsavscurr-i-mksa-fsav,scurr_lor-mksa-fsav] hsneomodels9jd(srho, ap,Rp,Zi, sq,Bt,TeO,Tea,eTe,neO,nea,ene,TiO,Tia,eTi); = %Calculation of the flux averaged bootstrap current from Hirshman and Sauter models (bulk contribution) figure(201), plot(xrho(rdke),j-ref*xcurr-totref-fsav(rdke) + xcurr_i_mksafsav(rdke),'ro',... xrho(rdke) ,j-ref*xcurrO-ref-fsav(rdke), 'bx',... xrho(rdke),j-ref*(xcurr-totref-fsav(rdke) - xcurr0_reffsav(rdke)) + xcurr_i_mksa-fsav(rdke),'k+',... srho,scurr-hir-mksafsav,':',... srho,scurr-saumksajfsav,'-'); set(gca,'xlim',[0,1]) legend('J^{tot}','J^{RF}','J^{BS}','J^{BS} (Hirshman),'J^{BS} zoom on;grid on; xlabel('r/a');ylabel('<J> (MA/m~2)'); title('Flux Surface Averaged Current densities'); end 156 (Sauter)'); end 157 F.2 fp2d9yp function [XXf0,XXf _tp,XXf Og,XXSpO,XXSmhuO,XXSpOg,XXSmhuOg,XXSpOtp,... XXSmhuOtp,PcollO,PcolltotPcollOfsavPcolltot_fsav,PabsO_fsav,... Pabs_totfsav,normf,normfjfsav,curr_0,currtot,currOfsav,curr_tot_fsav,... currB-fsav,RR-fsav,Te-out-norm,Xpn,Xmhu,mhubounce2 = ... fp2d9yp-new_2(betath,Rp-norm,Te-norm,ne-norm,Zi,mi,ni-norm,Ti-norm,... pn,mhu,XXDlh,XXDcy,param-cy,XXnhuloss,epsi,bouncemode,rdke,ia,ftp-norm,... XXDr,XXVr,delta,Nq,trunc,dtn,precO,nit,invproc,display,storemode,XXfinit); % Self-consistent 2-D relativistic solver of the drift kinetic equation in momentum space % with Beliaev-Budker collision integrals and toroidal magnetic losses % Fully implicit or Crank-Nicholson time differencing schemes % LH and EC wave quasilinear diffusion calculations + ohmic electric field % See references: % - C. Karney, Comput. Phys. Rep. 4 (1986) 183. % - B. Braams, C. Karney, Phys.fluids B1 (1989) 1355 % - M. Shoucri and I. Shkarofsky, Comp. Phys. Comm. 82 (1994) 287 %- I. Shkarofsky and M. Shoucri, Nuclear Fusion, 37 (1997) 539 % - J.P.S. Bizarro and P. Rodrigues, Nuclear Fusion, 37 (1997) 1509 Y. Peysson and M. Shoucri, Comp. Phys. Comm. 109 (1998) 55 %% - S.D. Schultz, A. Bers and A.B. Rahm, AIP Proc. of the 12th Conf. % % Radio Frequency Power in Plasmas, Savannah (USA), 403 1997,327 (see lhfp2d9yp.m) %Reste faire: %3) Diffusion radiale avec pas variable %6) Calcul selfconsistent du champ electrique ohmique avec bootstrap %7) Valider les integrales de bounce non-axisymetrique %Lower Hybrid wave: D(p//,pper) = Dlh(v//min,v//max) %Electron cyclotron wave: D(p//,pper) = % % Dcy*gamma*pperp^2*exp(-((gamma-omega)/p//betath - n//)^2/dn//^2)/abs(p//) Input: % - betath: Normalized reference thermal velocity (vth/c) [1,1] % - Rp-norm: Normaized plasma major radius (ap) [1,1] % - Tenorm: normalized electron temperature (Te/Te-ref) [1,nr] ' - ne-norm: normalized electron density (ne/ne-ref) [1,nr] I - Zi: ion charges [1,m] % - mi: ' - ni-norm: normalized ion density (ni/neref) [m,nr] ' - pn: normalized electron momentum space grid (pth-ref) [1,np] ion masses (u.m.a.) [1,m] 158 - mhu: cos(theta) angular grid [1,nmhu] 7 7 - XXDlh: LH normalized quasi-linear diffusion coefficient (nhuthref*pthref^2) [np,nmhu,nr] - XXDcy: EC normalized quasi-linear diffusion coefficient (nhuth-ref*pth-ref-2) % [np,nmhu,nr] % - param-cy: *******************normalized EC frequency [1,nr] % % - XXnhuloss: normalized loss frequency (nhuth-ref) [np,nmhu,nr] - epsi: normalized ohmic electric field (pth-ref*nhuth-ref/e) [1,nr] % - bouncemode: bounce averaged option: (0) no trapping, (1) explicit flux and distribution symmetrization, (2) full implicit calculations % - rdke: list for positions for dke calculations [1,nr-dke]. if rdke==[], fokker-planck calculations only % % % - ia: inverse aspect ratio [1,nr] % - ftp-norm: normalization factor for the drift kinetic equation % - XXDr: Fast electron radial diffusion (nhuth-ref*ap^2) [np,nmhu,nr] % - XXVr: [1,nr] [np,nmhu,nr] % Fast electron radial pinch (nhuth-ref*ap) - delta: Toroidal magnetic ripple depth [1,nr] % - Nq: Number of toroidal magnetic coils * local safety factor [1,nr] % - trunc: 1 -> truncated e-e collision operator, 0 -> Maxwellian e-e collision operator [1,1] . (default = 0) - dtn: normalized integration time step (dtn > 0: fully implicit time differencing % scheme, % dtn < 0: Crank-Nicholson time differencing scheme) (1/nhu-th) [1,1] % % (default = 1000) - precO: required accuracy on the residu for f and for g (M) [1,2] (default = [ie-10,le-10]) % % - nit: maximum number of iterations % % - invproc: matrix inversion procedure (1: - display: display mode parameter (full: 2, 2-5: Iterative method) [1,1] partial: 1, no: = 0) index of the radial position where results are displayed (default = [0,1]) % % LU decomposition, (default = 1) % % % for f and g [1,2] (default = [20,20]) - storemode: Temporary storing option for sparse matrices calculations (in RAM: 0, in disk file 1) % % % % % (default = 0) - XXfinit: initial guess for the 2D electron momentum distribution function Output: - XXf0: 2D electron momentum distribution function normalized to the normalized density [np,nmhiu,nr] %% - XXfOg: Second neoclassical correction (g) [np,nmhu,nr] % - %' XXSpO: p-component of the 2D electron momentum flux for fO[np,nmhu,nr] XXSmhuO: mhu-component of the 2D electron momentum flux for fO[np,nmhu,nr] - XXSpOg: %- [np,nmhu,nr] (default = Maxwellian) XXf0_tp: First neoclassical correction (f-tp) [np,nmhu,nr] p-component of the 2D electron momentum flux for g[np,nmhu,nr] XXSmhuOg: mhu-component of the 2D electron momentum flux for g[np,nmhu,nr] 159 % - XXSpOtp: p-component of the 2D electron momentum flux for ftp[np,nmhu,nr] % - XXSmhuOtp: % - PcollO: Power loss on collisions from fO(me*ne*nhuth*vth-2)[1,nr] % % - Pcoll-tot: Power loss on collisions from f0+g+f-tp(me*ne*nhuth*vth~2)[1,nr] % - Pcoll-tot-fsav: FS averaged Power loss on collisions from - PcollOfsav: mhu-component of the 2D electron momentum flux for ftp[np,nmhu,nr] FS averaged Power loss on collisions from f0(me*ne*nhuth*vth^2)[1,nr] fO+g+f-tp(me*ne*nhuth*vth^2)[1,nr] % % - PabsOfsav: FS averaged RF absorbed power from fO(me*ne*nhuth*vth~2) [1,nr] RF absorbed power from f0+g+f-tp(me*ne*nhuth*vth^2) % - currO0: RF + ohmic current density [1,nr] % - curr-tot: Total current density (RF + ohmic + boostrap current) % - curr_0_fsav: % - currtotfsav: - Pabstotfsav: FS averaged FS averaged RF + ohmic current density FS averaged [1,nr] [1,nr] [1,nr] Total current density (RF + ohmic + boostrap current) [1,nr] % - currB: Bulk current (RF + ohmic + boostrap - runway current) % - RR: Runaway rate through the surface of a sphere of radius p [nr,np] % - Tenout: New temperature of the bulk (mec2) % - normf-tot-fsav: % - curr0-fsav: Flux surface averaged RF + ohmic current density [1,nr] % - currtotfsav: Total flux surface averaged current density (RF + ohmic + boostrap [1,nr] [1,nr] Flux surface averaged norm of the distribution function [1,nr] current) % - Xpn: Momentum grid normalized to the reference momentum value [np,nmhu] % - Xmhu: % - mhubounce2: % Angular grid [np,nmhu] Square of the bounce averaged cosine angle [1,1] Warning: none %Last Update: 05/05/2002 %by Y. Peysson CEA-DRFC 21/07/1997 <peysson~drfc.cad.cea.fr> %Update for the drift kinetic calculations done by J. Decker and Y. Peysson 06-10/2001 if nargin < 23, error('Wrong number of input arguments in fp2d9yp') elseif nargin == 23, trunc = 0; dtn = 1000; precO [le-10,le-10]; nit = 50; invproc = 1; display = [0,1]; store_mode = 0; elseif nargin == 24, dtn = 1000; precO = [le-10,1e-10]; nit = [20,20]; invproc = 1; display = [0,1]; 160 store-mode = 0; elseif nargin == 25, precO = [le-10,le-10]; nit = [20,20]; invproc = 1; display = [0,1]; store-mode elseif nargin = 0; == 26, nit = [20,20]; invproc = 1; display = [0,1]; store-mode = 0; elseif nargin == 27, invproc = 1; display = 1; store-mode = 0; elseif nargin == 28, display = [0,1]; store-mode = 0; elseif nargin == 29, store-mode = 0; end narginmax = 31; timeCPUO = cputime; pfactor = 20;%Supergrid for very accurate collison integral calculation me = 1/1860;%Electron mass (u.m.a.) if dtn > 0, scheme = 1;%Implicit differencing scheme elseif dtn < 0, dtn = abs(dtn); scheme = 2;%Crank-Nicholson differencing scheme end spparms('default');XSet parameters for sparse matrix ordering algorithms and direct linear equation solver spparms('supernd',4); spparms('rreduce',4); precOf = precO(1); precOg = precO(2); display-mode = display(1); ir-display = display(2); nit_f = nit(1); nitg = nit(2); nr-dke = length(rdke); 161 xpsib = paramncy(1,:); xomega-cy = param-cy(2,:); if bouncemode == O,nr-dke == O;end if nr-dke >= 1,bouncemode = 2;end nmhu = length(mhu);%Size of angular grid npn = length(pn);%Size of momentum grid nr = length(ia);%Size of radial grid if store-mode == 1, delete MXPmat.mat; save MXPmat.mat nr; end %Masks for collision integrals Xa masku = triu(ones(npn,npn)); maskl = tril(ones(npn,npn)); %Momentum grid pth = betath; dpn = pn(3) - pn(2); pn2 = pn.*pn; pn3 = pn2.*pn; xpn = pn'*ones(i,npn); xpn2 = xpn.*xpn; xpn3 = xpn2.*xpn; Xpn = pn'*ones(i,nmhu); Xpn2 = Xpn.*Xpn; Xpn3 = Xpn2.*Xpn; pnm = pn - dpn/2;pnm(1) = 0; pn2m = pnm.*pnm; Xpnm = pnm'*ones(i,nmhu); Xpn2m = Xpnm.*Xpnm; pnp = pn + dpn/2; pn2p = pnp.*pnp; Xpnp = pnp'*ones(i,nmhu); Xpn2p = Xpnp.*Xpnp; z = betath*pn; z2 =z.*z; z3 = z2.*z; zm = betath*pnm; z2m = zm.*zm; zp = betath*pnp; z2p = zp.*zp; 162 xz = z'*ones(1,length(z)); xz2 = xz.*xz; xz3 = xz2.*xz; gamma = sqrt(1 + z2); gamma2 = gamma.*gamma; gammam = sqrt(1 + z2m); gamma2m = gammam. *gammam; gammap = sqrt(1 + z2p); gamma2p = gammap.*gammap; xgamma = gamma'*ones(1,length(gamma)); xgamma2 = xgamma.*xgamma; Xgamma = gamma'*ones(1,nmhu); Xgammam = gammam'*ones(1,nmhu); Xgammap = gammap'*ones(1,nmhu); sigma asinh(z); sigmam = asinh(zm); sigmap = asinh(zp); xsigma = sigma'*ones(i,length(sigma)); J1 = -3*gamma + sigma.*(3.0./z + 2*z); J2 = gamma - sigma./z -2*gamma.*z2/3; J3 = -3*gamma.*sigma./z2 + 3.0./z + z - 2*z2.*z/5; J4 = gamma.*sigma.*(15.0./z2 + 6) - 15.0./z - 11*z; xJ1 = -3*xgamma + xsigma.*(3.0./xz + 2*xz); xJ2 = xgamma - xsigma./xz - 2*xgamma.*xz2/3; xJ3 = -3*xgamma.*xsigma./xz2 + 3.0./xz + xz - 2*xz2.*xz/5; xJ4 = xgamma.*xsigma.*(15.0./xz2 + 6) - 15.0./xz - 11*xz; v = pn./gamma; v.*v; vm = pnm./gammam; v2 v2m = vm.*vm; vp = pnp./gammap; v2p = vp.*vp; xv = v'*ones(1,length(v)); xv2 = xv.*xv; Ungular grid dmhu = mhu(3) - mhu(2); mhum = mhu - dmhu/2;mhum(i) = -1; mhup = mhu + dmhu/2;mhup(nmhu) = 1; Xmhu = ones(npn,i)*mhu; Xmhu2 = Xmhu.*Xmhu; X1mmhu2 = 1 - Xmhu2; Xmhum = ones(npn,1)*mhum; Xmhum(find(Xmhum==O)) = eps; 163 Xmhu2m = Xmhum.*Xmhum; Xmhu2m(find(Xmhu2m==O)) = eps; X1mmhu2m = 1 - Xmhu2m; Xmhup = ones(npn,1)*mhup; Xmhup(find(Xmhup==O))= eps; Xmhu2p = Xmhup.*Xmhup; X1mmhu2p = 1 - Xmhu2p; mp = [2:npn-1]; mpm = mp - 1; mpp = mp + 1; mm = [2:nmhu-1]; mmm = mm - 1; mmp = mm + 1; %Super momentum grid definitions for collision integrals spn = [eps:dpn/pfactor:max(pn)]; nspn = length(spn); spn2 = spn.*spn; spn3 sz = spn2.*spn; = betath*spn; sz2 = sz.*sz; sz3 = sz2.*sz; sgamma = sqrt(1 + sz2); sgamma2 = sgamma.*sgamma; ssigma = asinh(sz); sv = spn./sgamma; sv2 = sJ1 = -3*sgamma sv.*sv; + ssigma.*(3.0./sz + 2*sz); sJ2 = sgamma - ssigma./sz - 2*sgamma.*sz2/3; sJ3 = -3*sgamma.*ssigma./sz2 + 3.0./sz + sz sJ4 = sgamma.*ssigma.*(15.0./sz2 + 6) - - 2*sz2.*sz/5; 15.0./sz - 11*sz; if nargin < narginmax,XXfinit = zeros(np,nmhu,nr);end;%For normf0 = zeros(nr,nit-f); normfl = zeros(nr,nit-f); currO = zeros(nr,nit-f); curri = zeros(nr,nit-f); prec-curr = zeros(nr,nit-f); residu-f = ones(nr,nit-f); residu-g = ones(nr,nit-g); ns = zeros(i,nr); 164 the initial guess nstp = zeros(1,nr); ns-g = zeros(i,nr); mhubounce2 = zeros(1,nr); rho = zeros(1,nr); Pabs = zeros(1,nr); Pcoll = zeros(1,nr); Tenormout = zeros(1,nr); RR = zeros(nr,npn); mhubounce2 = zeros(1,nr); XXI XXf zeros(npnnmlunr); = zeros(npn,nmhu,nr); XXfOtp= zeros(npn,nmu,nr); XXfO._g = zeros(npn,nmhu,nr); XXSp = zeros(npn,nmhu,nr); XXSmhu = zeros(npn,nmhu,nr); XXfM = zeros(npn,nmu,nr); XXfMgth = zeros(npn,nmhu,nr); XXF = zeros(npnnnhu,nr); XXFm = zeros(npn,nmhu,nr); XXFp = zeros(npn,nmhu,nr); XXA = zeros(npn,nmu,nr); XXAm = zeros(npn,nmhu,nr); XXAp = zeros(npn,nmhu,nr); XXBt = zeros(npn,nmhu,nr); XXDlhim = zeros(npn,nhu,nr); XXDlhip = zeros(npnnmhunr); XXDlhjm = zeros(npn,nmhu,nr); XXDlhjp = zeros(npn,nmhu,nr); XXDcyim = zeros(npn,nmbu,nr); XXDcyip = zeros(npn,nmhu,nr); XXDcyjm = zeros(npnnmhunr); XXDcyjp = zeros(npn,nmhu,nr); XXsssl = zeros(npn,nmu,nr); XXlambda = zeros(npn,nmu,nr); XXmsomOs = zeros(npn,nmuli,nr); XXdphib = zeros(npn,nmhu,nr); if nrdke >= 12 I (nr-dke == 0 & nr >= 12) radialmode = 1; else radialmode = 0; if display-mode >= 1 infoyp(2,['WARNING: radial mesh too coarse, for radial diffusion or pinch calculations']) disp('---------------------------------------------------------------------------------------------------------------); 165 end end if display-mode >=I, disp('Calculation parameters:'); 'I if (storemode == 0), disp(' - Matrices storage in RAM'); else - Matrices storage in disk file');end disp(' if (invproc == 1), disp(' - Full LU factorization method'); elseif (invproc elseif (invproc elseif (invproc elseif (invproc == 2), disp(' - QMR iterative method'); == 3), disp(' - BICGSTAB iterative method'); == 4), disp(' - CGS iterative method'); == 5), disp(' - PCG iterative method');end if (scheme == 1), disp([' - Implicit time differencing scheme']); elseif (scheme == 2),disp([' - Crank-Nicholson time differencing scheme']);end if (trunc == 0), disp([' - Maxwellian e-e collision operator']); elseif (trunc == 1), disp([' - Truncated e-e collision operator']);end if (bounce-mode == 0), - No bounce averaging']); disp([' elseif (bounce-mode == 1), - Bounce averaging + explicit symmetrization in the bounce domain (9 diagonals disp([' operator, dtn << 1)']); elseif (bounce-mode == 2), disp([' - Bounce averaging + implicit symmetrization in the bounce domain (15 diagonals operator)']);end if (nr-dke == 0), disp([' - Resolution of the Fokker-Planck equation']); elseif (nrdke >= 1), disp([' - Resolution of the drift kinetic equation']);end disp([' - Momentum grid: ',int2str(npn)]); disp([' - Angular grid: ',int2str(nmhu)]); disp([' - Total radial grid: ',int2str(nr)]); if nr-dke == 0 disp([' - Effective radial grid: ',int2str(nr)]); disp([' - Effective radial grid: ',int2str(nrdke)]); else end disp(I -----------------------------------------------------------------------------------------------------------------'Y); end timeO = clock; for ir = 1:nr, rho(ir) = ia(ir)*Rp-norm; if (bouncemode >= 1) & (ia(ir) > 0),XBounce-averaged factors mhubounce2(ir) = 2*ia(ir)/(1+ia(ir)); 166 XY = zeros(size(Xmhu)); XY(Xmhu2 > mhubounce2(ir)) = mhubounce2(ir)./Xmhu2(Xmhu2 > mhubounce2(ir)); XY(Xmhu2 <= mhubounce2(ir)) = Xmhu2(Xmhu2 <= mhubounce2(ir))/mhubounce2(ir); [XK,XE] = ellipke(XY); XJO = zeros(size(Xmhu)); XJO(Xmhu2 > mhubounce2(ir)) = XK(Xmhu2 > mhubounce2(ir)); XJO(Xmhu2 <= mhubounce2(ir)) = abs(Xmu(Xmhu2 <= mhubounce2(ir))).*XK(Xmhu2 <= mhubounce2(ir) )/sqrt (mhubounce2(ir)); XJ2 = zeros(size(Xmhu)); XJ2(Xmhu2 > mhubounce2(ir)) = Xmhu2(Xmhu2 > mhubounce2(ir)).*(XK(Xmhu2 > mhubounce2(ir)) - XE(Xmhu2 > mhubounce2(ir)))/mhubounce2(ir); XJ2(Xmhu2 <= mhubounce2(ir)) = abs(Xmhu(Xmhu2 <= mhubounce2(ir))).*(XK(Xmhu2 <= mhubounce2(ir)) - XE(Xmhu2 <= mhubounce2(ir))) /sqrt (mhubounce2(ir)); XJ4 = (2*(i + Xmhu2/mhubounce2(ir)).*XJ2 - Xmhu2.*XJO/mhubounce2(ir))/3; XYm = zeros(size(Xmhum)); XYm(Xmhu2m > mhubounce2(ir)) = mhubounce2(ir)./Xmhu2m(Xmhu2m > mhubounce2(ir)); XYm(Xmhu2m <= mhubounce2(ir)) = Xmhu2m(Xmhu2m <= mhubounce2(ir))/mhubounce2(ir); [XKm,XEm] = ellipke(XYm); XJ~m = zeros(size(Xmhum)); XJOm(Xmhu2m > mhubounce2(ir)) = XKm(Xmhu2m > mhubounce2(ir)); XJ~m(Xmhu2m <= mhubounce2(ir)) = abs(Xmhum(Xmhu2m <= mhubounce2(ir))).*XKm(Xmhu2m mhubounce2(ir) )/sqrt (mhubounce2(ir)); XJ2m = zeros(size(Xmhum)); XJ2m(Xmhu2m > mhubounce2(ir)) = Xmhu2m(Xmhu2m > mhubounce2(ir)).*(XKm(Xmhu2m > mhubounce2(ir)) - XEm(Xmhu2m > mhubounce2(ir)))/mhubounce2(ir); XJ2m(Xmhu2m <= mhubounce2(ir)) = abs(Xmhum(Xmhu2m <= mhubounce2(ir))).*(XKm(Xmhu2m <= mhubounce2(ir)) XEm(Xmhu2m <= mhubounce2(ir)))/sqrt(mhubounce2(ir)); XJ4m = (2*(i + Xmhu2m/mhubounce2(ir)).*XJ2m - Xmhu2m.*XJOm/mhubounce2(ir))/3; XYp = zeros(size(Xmhup)); XYp(Xmhu2p > mhubounce2(ir)) XYp(Xmhu2p <= mhubounce2(ir)) mhubounce2(ir)./Xmhu2p(Xmhu2p = = > mhubounce2(ir)); Xmhu2p(Xmhu2p <= mhubounce2(ir))/mhubounce2(ir); [XKp,XEp] = ellipke(XYp); XJOp = zeros(size(Xmhup)); XJ~p(Xmhu2p > mhubounce2(ir)) = XKp(Xmhu2p > mhubounce2(ir)); XJOp(Xmhu2p <= mhubounce2(ir)) = ... abs(Xmhup(Xmhu2p <= mhubounce2(ir))).*XKp(Xmhu2p <= mhubounce2(ir))/sqrt(mhubounce2(ir)); XJ2p = zeros(size(Xmhup)); XJ2p(Xmhu2p > mhubounce2(ir)) = Xmhu2p(Xmhu2p > mhubounce2(ir)).*(XKp(Xmhu2p > mhubounce2(ir)) - XEp(Xmhu2p > mhubounce2(ir)))/mhubounce2(ir); XJ2p(Xmhu2p <= mhubounce2(ir)) = abs(Xmhup(Xmhu2p <= mhubounce2(ir))).*(XKp(Xmhu2p <= mhubounce2(ir)) 167 - <= XEp(Xmhu2p <= mhubounce2(ir)))/sqrt(mhubounce2(ir)); XJ4p = (2*(1 + Xmhu2p/mhubounce2(ir)).*XJ2p - Xmhu2p.*XJOp/mhubounce2(ir))/3; %As done by M. Ju et al. in EUR-CEA-FC-1712 report Xlambda = zeros(size(XY));Xlambdam = zeros(size(XYm));Xlambdap = zeros(size(XYp));Xlambda Xsssl = zeros(size(XY));Xssslm = zeros(size(XYm));Xssslp = zeros(size(XYp));%s*/lambda Xdphib zeros(size(XY));Xdphibm = zeros(size(XYm));Xdphibp = zeros(size(XYp));%<Delta> %Axisymmetric bounce-averaging terms Xlambda(Xmhu2 > mhubounce2(ir)) = 2*(XJO(Xmhu2 > mhubounce2(ir)) 0.5*mhubounce2(ir)*XJ2(Xmhu2 - > mhubounce2(ir)))/pi; %Parameter lambda for circulating electrons Xlambdam(Xmhu2m > mhubounce2(ir)) = ... 2*(XJOm(Xmhu2m > mhubounce2(ir)) - 0.5*mhubounce2(ir)*XJ2m(Xmhu2m > 0.5*mhubounce2(ir)*XJ2p(Xmhu2p > mhubounce2(ir)))/pi; Xlambdap(Xmhu2p > mhubounce2(ir)) = 2*(XJOp(Xmhu2p > mhubounce2(ir)) - mhubounce2(ir)))/pi; Xlambda(Xmhu2 <= mhubounce2(ir)) = 2*(XJO(Xmhu2 <= mhubounce2(ir)) - 0.5*mhubounce2(ir)*XJ2(Xmhu2 <= mhubounce2(ir)))/pi; %Parameter lambda for bouncing electrons Xlambdam(Xmhu2m <= mhubounce2(ir)) = ... 2*(XJOm(Xmhu2m <= mhubounce2(ir)) - 0.5*mhubounce2(ir)*XJ2m(Xmhu2m <= 0.5*mhubounce2(ir)*XJ2p(Xmhu2p <= mhubounce2(ir)))/pi; Xlambdap(Xmhu2p <= mhubounce2(ir)) = 2*(XJOp(Xmhu2p <= mhubounce2(ir)) - mhubounce2(ir)))/pi; 0/= Xlambdam(find(Xlambdam==O)) Xlambdap (find (Xlambdap==O) ) = eps; =eps ; Xsssl(Xmhu2 > mhubounce2(ir)) = sqrt((1 + ia(ir))/(1 - ia(ir)))./Xlambda(Xmhu2 > mhubounce2(ir)); %Parameter s*/lambda for circulating electrons Xssslm(Xmhu2m > mhubounce2(ir)) = sqrt((i + ia(ir))/(i - ia(ir)))./Xlambdam(Xmhu2m > mhubounce2(ir)); Xssslp(Xmhu2p > mhubounce2(ir)) = sqrt((i + ia(ir))/(1 - ia(ir)))./Xlambdap(Xmhu2p > mhubounce2(ir)); Xdphib(Xmhu2 > mhubounce2(ir)) = -2/pi*mhubounce2(ir)*(XJ2(Xmhu2 > mhubounce2(ir)) - 0.5*mhubounce2(ir)*XJ4(Xmhu2 > mhubounce2(ir)))./Xlambda(Xmhu2 > mhubounce2(ir)); %Parameter <Delta>0 for circulating electrons Xdphibp(Xmhu2p > mhubounce2(ir)) = ... -2/pi*mhubounce2(ir)*(XJ2p(Xmhu2p > mhubounce2(ir)) 0.5*mhubounce2(ir)*XJ4p(Xmhu2p - > mhubounce2(ir))) ./Xlambdap(Xmhu2p > mhubounce2(ir)); Xdphibm(Xmhu2m > mhubounce2(ir)) = ... 168 -2/pi*mhubounce2(ir)*(XJ2m(Xmhu2m > mhubounce2(ir)) 0.5*mhubounce2(ir)*XJ4m(Xmhu2m > mhubounce2(ir)))./Xlambdam(Xmhu2m > mhubounce2(ir)); Xsssl(Xmhu2 <= mhubounce2(ir)) = 0;%Parameter s*/lambda for bouncing electrons Xssslm(Xmhu2m <= mhubounce2(ir)) = 0; Xssslp(Xmhu2p <= mhubounce2(ir)) = 0; Xdphib(Xmhu2 <= mhubounce2(ir)) = ... -2/pi*mhubounce2(ir)*(XJ2(Xmhu2 <= mhubounce2(ir)) 0.5*mhubounce2(ir)*XJ4(Xmhu2 <= mhubounce2(ir)))./Xlambda(Xmhu2 <= mhubounce2(ir)); %Parameter <Delta>0 for bouncing electrons Xdphibp(Xmhu2p <= mhubounce2(ir)) = ... -2/pi*mhubounce2(ir)*(XJ2p(Xmhu2p <= mhubounce2(ir)) - 0.5*mhubounce2(ir)*XJ4p(Xmhu2p <= mhubounce2(ir))) ./Xlambdap(Xmhu2p <= mhubounce2(ir)); Xdphibm(Xmhu2m <= mhubounce2(ir)) = -2/pi*mhubounce2(ir)*(XJ2m(Xmhu2m <= mhubounce2(ir)) 0.5*mhubounce2(ir)*XJ4m(Xmhu2m <= mhubounce2(ir)))./Xlambdam(Xmhu2m <= mhubounce2(ir)); Xmhu-psib = sign(Xmhu).*sqrt(i - xpsib(ir)*(i - Xmhu.~2)); Xmhu-psib = Xmhu-psib + eps*(Xmhu-psib==0); Xmhu-psibm = sign(Xmhum).*sqrt(i - xpsib(ir)*(i - Xmhum.-2)); Xmhu-psibm = Xmhupsibm + eps*(Xmhu-psibm==0); Xmhu-psibp = sign(Xmhup).*sqrt(i - xpsib(ir)*(1 - Xmhup.^2)); Xmhu-psibp = Xmhu-psibp + eps*(Xmhu.psibp==O); XAsAeffcy = real(Xmhu./Xlambda./Xmhupsib);XEffective area of a magnetic surface for localized EC absorption XAsAeffcym = real(Xmhum./Xlambdam./Xmhu-psibm); XAsAeff-cyp = real(Xmhup./Xlambdap./Xmhu-psibp); XRlambdam = Xlambdam./Xlambda; XRlambdap = Xlambdap./Xlambda; %Bounce average correction term for I(fm,ftildei) Xmsom0s = zeros(size(XY)); % = {mhu^2/mhuO~2} = [1 - {psi}*[1-mhu0^2]]/mhuO^2 Xmsom0s(Xmhu2 <= mhubounce2(ir)) = 0; Xmsom0s(Xmhu2 > mhubounce2(ir)) 2/pi*(XJO(Xmhu2 > mhubounce2(ir)) + ... (0.5 - 1./Xmhu2(Xmhu2 > mhubounce2(ir)))*mhubounce2(ir).*XJ2(Xmhu2 > mhubounce2(ir)) + (3/8 - 0.5./Xmhu2(Xmhu2 > mhubounce2(ir)))* ... mhubounce2(ir) .~2.*XJ4(Xmhu2 > mhubounce2(ir))) ./Xlambda(Xmhu2 > mhubounce2(ir)); XXmsom0s(:,:,ir) = Xmsom0s; %Non-axisymmetric corrections (********* to be cross-checked ***********) if 0, % if delta(ir) > 0, 169 Xlambdacorr = zeros(size(XY));Xlambdacorrm = zeros(size(XYm));Xlambdacorrp zeros(size(XYp));%lambdal Xdphiblambdacorr = zeros(size(XY));%<Delta>i*(lambdaO+1ambda1) Xdphiblambdacorrm = zeros(size(XYm)); = Xdphiblambdacorrp = zeros(size(XYp)); thetaO = zeros(size(Xmhu));thetaom = zeros(size(Xmhum));theta0p = zeros(size(Xmhup));%pitch angle thetaO(Xmhu2 > mhubounce2(ir))=acos(Xmhu(Xmhu2 > mhubounce2(ir))); theta0m(Xmhu2m > mhubounce2(ir))=acos(Xmhum(Xmhu2m > mhubounce2(ir))); theta0p(Xmhu2p > mhubounce2(ir))=acos(Xmhup(Xmhu2p > mhubounce2(ir))); mhubounce2(ir))=acos(Xmhu(Xmhu2 <= mhubounce2(ir))); theta0m(Xmhu2m <= mhubounce2(ir))=acos(Xmhum(Xmhu2m <= mhubounce2(ir))); theta0p(Xmhu2p <= mhubounce2(ir))=acos(Xmhup(Xmhu2p <= mhubounce2(ir))); thetaO(Xmhu2 <= thetaB = zeros(size(Xmhu));thetaBm = zeros(size(Xmhum));thetaBp = zeros(size(Xmhup)) ;Y.bounce angle thetaB(Xmhu2 > mhubounce2(ir)) = pi; thetaBm(Xmhu2m > mhubounce2(ir)) = pi; thetaBp(Xmhu2p > mhubounce2(ir)) = pi; thetaB(Xmhu2 <= mhubounce2(ir)) = acos(1-2./(mhubounce2(ir)./cos(thetaO(Xmhu2 <= mhubounce2(ir))).^2)); thetaBm(Xmhu2m <= mhubounce2(ir)) mhubounce2(ir))).~2)); thetaBp(Xmhu2p <= mhubounce2(ir)) = acos(1-2./(mhubounce2(ir)./cos(thetaom(Xmhu2m <= = acos(1-2./(mhubounce2(ir)./cos(thetaop(Xmhu2p <= mhubounce2(ir))).~2)); thetaBm(find(thetaBm==O)) = thetaBp(find(thetaBp==O)) = eps; eps; %Circulating electrons ssslIcorr = -pi/2*delta(ir)./sqrt(i-mhubounce2(ir)).*((1 - sqrt(i-mhubounce2(ir)))./sqrt(mhubounce2(ir))).~(2.*N(ir)); /*si* Xlambdacorr(Xmhu2 > mhubounce2(ir)) = ... -pi/4*delta(ir) .*tan(thetaO(Xmhu2 > mhubounce2(ir))).*(( mhubounce2(ir))).~2./sqrt(1-XY(Xmhu2 > -. sqrt(i-XY(Xmhu2 > mhubounce2(ir)))) ./sqrt(XY(Xmhu2 > mhubounce2(ir)))).^(2.*Nq(ir)); Xlambdacorrm(Xmhu2m > mhubounce2(ir)) = -pi/4*delta(ir) .*tan (theta0m(Xmhu2m > mhubounce2(ir))) .2./sqrt(i-XYm(Xmhu2m > mhubounce2(ir))).*((1-... sqrt(i-XYm(Xmhu2m > mhubounce2(ir)))) ./sqrt(XYm(Xmhu2m > mhubounce2(ir)))).~(2.*Ng(ir)); Xlambdacorrp(Xmhu2p > mhubounce2(ir)) = -pi/4*delta(ir).*tan(theta0p(Xmhu2p > mhubounce2(ir))).^2./sqrt(I-XYp(Xmhu2p mhubounce2(ir))).*((1-... sqrt(i-XYp(Xmhu2p > mhubounce2(ir))))./sqrt(XYp(Xmhu2p mhubounce2(ir)))).^(2.*Nq(ir)); 170 > > Xdphiblambdacorr(Xmhu2 > mhubounce2(ir)) = ... 3/16*delta(ir)*pi*mhubounce2(ir).*tan(thetaO(Xmhu2 > mhubounce2(ir))).^2./sqrt(1 XY(Xmhu2 > mhubounce2(ir))).*((1-sqrt(1-XY(Xmhu2 > mhubounce2(ir))))./sqrt(XY(Xmhu2 mhubounce2(ir)))).^(2.*Nq(ir)); > Xdphiblambdacorrp(Xmhu2p > mhubounce2(ir)) = ... 3/16*delta(ir)*pi*mhubounce2(ir)*tan(theta0p(Xmhu2p > mhubounce2(ir))).^2./sqrt(1 XYp(Xmhu2p> mhubounce2(ir))).*((1-sqrt(1 - XYp(Xmhu2p> mhubounce2(ir))))./sqrt(XYp(Xmhu2p> mhubounce2(ir)))).^(2.*Nq(ir)); Xdphiblambdacorrm(Xmhu2m > mhubounce2(ir)) = ... 3/16*delta(ir)*pi*mhubounce2(ir).*tan(theta0m(Xmhu2m > mhubounce2(ir))).-2./sqrt(1 - XYm(Xmhu2m> mhubounce2(ir))) .*((1-sqrt(1 XYm(Xmhu2m> - mhubounce2(ir)))) ./sqrt(XYm(Xmhu2m> mhubounce2(ir)))).^(2.*Nq(ir)); %bouncing electrons Xlambdacorr(Xmhu2 <= mhubounce2(ir)) = sqrt(pi*Nq(ir))/2*delta(ir).*tan(thetaO(Xmhu2 <= mhubounce2(ir))).^2.*((1 - cos(thetaB(Xmhu2 <= mhubounce2(ir))))./sin(thetaB(Xmhu2 <= mhubounce2(ir)))).^(3/2).*sin(pi/4 - ... Nq(ir).*thetaB(Xmhu2 <= mhubounce2(ir))); Xlambdacorrm(Xmhu2m <= mhubounce2(ir)) = ... sqrt(pi*Nq(ir))/2*delta(ir).*tan(theta0m(Xmhu2m <= mhubounce2(ir))).^2.*((1 - cos(thetaBm(Xmhu2m <= mhubounce2(ir)))). /sin(thetaBm(Xmhu2m <= mhubounce2(ir)))).-(3/2).*sin(pi/4 - ... Nq(ir) .*thetaBm(Xmhu2m <= mhubounce2(ir))); Xlambdacorrp(Xmhu2p <= mhubounce2(ir)) = ... mhubounce2(ir))).^2.*((1 mhubounce2(ir)))) ./sin(thetaBp(Xmhu2p <= sqrt(pi*Nq(ir))/2*delta(ir).*tan(theta0p(Xmhu2p <= cos(thetaBp(Xmhu2p <= mhubounce2(ir)))).^(3/2).*sin(pi/4 - Nq(ir).*thetaBp(Xmhu2p <= mhubounce2(ir))); Xdphiblambdacorr(Xmhu2 <= mhubounce2(ir)) = ... -3/8*delta(ir)*sqrt(pi*Nq(ir))*mhubounce2(ir).*tan(thetaO(Xmhu2 <= mhubounce2(ir))).^2.*(1 - cos(thetaB(Xmhu2 <= mhubounce2(ir)))).^(5/2)./sin(thetaB(Xmhu2 <= mhubounce2(ir))).^(3/2).*sin(pi/4 - Nq(ir).*thetaB(Xmhu2 <= mhubounce2(ir))); Xdphiblambdacorrp(Xmhu2p <= mhubounce2(ir)) = ... -3/8*delta(ir)*sqrt(pi*Nq(ir))*mhubounce2(ir).*tan(theta0p(Xmhu2p <= mhubounce2(ir))).^2.*(1 - cos(thetaBp(Xmhu2p <= mhubounce2(ir)))).^(5/2)./sin(thetaBp(Xmhu2p <= mhubounce2(ir))).^(3/2).*sin(pi/4 -... Nq(ir).*thetaBp(Xmhu2p <= mhubounce2(ir))); Xdphiblambdacorrm(Xmhu2m <= mhubounce2(ir)) = ... -3/8*delta(ir)*sqrt(pi*Nq(ir))*mhubounce2(ir).*tan(theta0m(Xmhu2m <= mhubounce2(ir))).^2.*(1 - cos(thetaBm(Xmhu2m <= mhubounce2(ir)))).^(5/2)./sin(thetaBm(Xmhu2m <= 171 - mhubounce2(ir))). (3/2) .*sin(pi/4 - Nq(ir).*thetaBm(Xmhu2m <= mhubounce2(ir))); %New bounce-averaged coefficients due to non-axisymmetric geometry Xsssl = Xsssl + ssslicorr; Xlambda(Xmhu2 > mhubounce2(ir)) = Xlambda(Xmhu2 > mhubounce2(ir)) + Xlambdacorr(Xmhu2 > mhubounce2(ir)); Xlambdam(Xmhu2m > mhubounce2(ir)) = Xlambdam(Xmhu2m > mhubounce2(ir)) + Xlambdacorrm(Xmhu2m > mhubounce2(ir)); Xlambdap(Xmhu2p > mhubounce2(ir)) = Xlambdap(Xmhu2p > mhubounce2(ir)) + Xlambdacorrp(Xmhu2p > mhubounce2(ir)); Xlambda(Xmhu2 <= mhubounce2(ir)) = Xlambda(Xmhu2 <= mhubounce2(ir)) + Xlambdacorr(Xmhu2 <= mhubounce2(ir)); Xlambdam(Xmhu2m <= mhubounce2(ir)) = Xlambdam(Xmhu2m <= mhubounce2(ir)) + Xlambdacorrm(Xmhu2m <= mhubounce2(ir)); Xlambdap(Xmhu2p <= mhubounce2(ir)) = Xlambdap(Xmhu2p <= mhubounce2(ir)) Xlambdacorrp(Xmhu2p <= mhubounce2(ir)); XRlambdam = Xlambdam./Xlambda; XRlambdap = Xlambdap./Xlambda; + >> Xsssl(Xmhu2 > mhubounce2(ir)) = Xsssl./Xambda(Xmhu2 > mhubounce2(ir)); Xssslm(Xmhu2m > mhubounce2(ir)) = Xsssl./Xlambdam(Xmhu2m > mhubounce2(ir)); Xssslp(Xmhu2p > mhubounce2(ir)) = Xsssl./Xlambdap(Xmu2p > mhubounce2(ir)); Xsssl(Xmhu2 <= mhubounce2(ir)) = 0; Xssslm(Xmhu2m <= mhubounce2(ir)) = 0; Xssslp(Xmhu2p <= mhubounce2(ir)) = 0; Xdphib(Xmhu2 > mhubounce2(ir)) = Xdphib(Xmhu2 > mhubounce2(ir)) + Xdphiblambdacorr(Xmhu2 > mhubounce2(ir)) ./Xlambda(Xmhu2 > mhubounce2(ir)); Xdphibp(Xmhu2p > mhubounce2(ir)) = .. Xdphibp(Xmhu2p > mhubounce2(ir)) + Xdphiblambdacorrp(Xmhu2p > mhubounce2(ir)) ./Xlambdap(Xmhu2p > mhubounce2(ir)); Xdphibm(Xmhu2m > mhubounce2(ir)) = ... Xdphibm(Xmhu2m > mhubounce2(ir)) + Xdphiblambdacorrm(Xmhu2m > mhubounce2(ir)) ./Xlambdam(Xmhu2m > mhubounce2(ir)); Xdphib(Xmhu2 <= mhubounce2(ir)) = Xdphib(Xmhu2 <= mhubounce2(ir)) + Xdphiblambdacorr(Xmhu2 <= mhubounce2(ir))./Xlambda(Xmhu2 <= mhubounce2(ir)); Xdphibp(Xmhu2p <= mhubounce2(ir)) = ... Xdphibp(Xmhu2p <= mhubounce2(ir)) + Xdphiblambdacorrp(Xmhu2p <= mhubounce2(ir)) ./Xlambdap(Xmhu2p <= mhubounce2(ir)); Xdphibm(Xmhu2m <= mhubounce2(ir)) = ... Xdphibm(Xmhu2m <= mhubounce2(ir)) + Xdphiblambdacorrm(Xmhu2m <= mhubounce2(ir)) ./Xlambdam(Xmhu2m <= mhubounce2(ir)); end 172 else mhubounce2(ir) = 0; Xsssl = ones(size(Xmhu)); Xssslm = Xsssl; Xssslp = Xsssl; Xdphib = zeros(size(Xmhu)); Xdphibm = Xdphib; Xdphibp = Xdphib; Xlambda = ones(size(Xmhu)); XRlambdam = ones(size(Xmhu)); XRlambdap = ones(size(Xmhu)); XAsAeff-cy = ones(size(Xmhu)); XAsAeffcym = ones(size(Xmhu)); XAsAeff-cyp = ones(size(Xmhu)); Xmsom~s = ones(size(Xmhu)); end XXsssl(:,:,ir) = Xsssl; XXlambda(:,:,ir) = Xlambda; XXmsom0s(:,:,ir) = Xmsom0s; %Relativistic Maxwellian distribution function for collision integrals fM = exp(-pn2./(1 + gamma)/Te-norm(ir))/2/pi/Te-norm(ir)/sqrt(2*pi*Te-norm(ir)); normfM = 4*pi*trapzyp([pn',pn'.*pn'.*fM']); fM = fM*nenorm(ir)/normfM; xfM = fM'*ones(i,length(fM)); XXfM(:,:,ir) = fM'*ones(1,nmhu); if nargin < narginmax,XXfinit(:,:,ir) = fM'*ones(i,nmhu);end;XInitial ne-norm) guess (normalized to sfM = exp(-spn2./(i + sgamma)/Te-norm(ir))/2/pi/Te-norm(ir) /sqrt(2*pi*Te-norm(ir)); normsfM = 4*pi*trapzyp([spn',spn'.*spn'.*sfM']); sfM = sfM*ne-norm(ir)/normsfM; Si fMm = exp(-pn2m./(i + gammam)/Te-norm(ir))/2/pi/Te-norm(ir) /sqrt(2*pi*Te-norm(ir)); normfMm = 4*pi*trapzyp([pnm',pnm' .*pnm'.*fMm']); fMm = fMm*ne-norm(ir)/normfMm; fMp = exp(-pn2p./(1 + gammap)/Te-norm(ir))/2/pi/Te-norm(ir) /sqrt(2*pi*Te-norm(ir)); normfMp = 4*pi*trapzyp([pnp',pnp'.*pnp'.*fMp']); fMp = fMp*ne-norm(ir)/normfMp; %Lower Hybrid quasilinear diffusion coefficient (half-grid) XDlh = squeeze(XXDlh(:,:,ir)); = XDlhim = zeros(size(XDlh));XDlhim(2:npn,:) XDlh(1,:)/2; XDlhip = zeros(size(XDlh));XDlhip(i:npn-1,:) = (XDlh(i:npn-1, :) + XDlh(2:npn,:))/2;XDlhim(i,:) = (XDlh(1:npn-i,:) 173 + XDlh(2:npn,:))/2;XDlhip(npn,:) = XDlh(npn,:)/2; XDlhjm = zeros(size(XDlh));XDlhjm(:,2:nmhu) (XDlh(:,l:nmhu-1) = + XDlh(:,2:nmhu))/2;XDlhjm(:,l) = XDlh(:,i)/2; XDlhjp = zeros(size(XDlh));XDhjp(:,1:nmhiiu-1) XDlh(:,2:nmhu))/2;XDlhjp(:,nmhu) = (XDlh(:,1:nmhu-1) + = XDlh(:,nmhu)/2; XXDlhim(:,:,ir) = XDlhim; XXDlhip(:,:,ir) = XDlhip; XXDlhjm(:,:,ir) = XDlhjm; XXDlhjp(:,:,ir) = XDlhjp; %Electron cyclotron quasilinear diffusion coefficient (half-grid) XDcy = squeeze(XXDcy(:,:,ir)); XDcyim = zeros(size(XDcy));XDcyim(2:npn,:) = (XDcy(i:npn-i,:) + XDcy(2:npn,:))/2;XDcyim(l,:) = XDcy(l,:)/2; XDcyip = zeros(size(XDcy));XDcyip(l:npn-l,:) = (XDcy(i:npn-i,:) + (XDcy(:,l:nmhu-1) + XDcy(2:npn,:))/2;XDcyip(npn,:) = XDcy(npn,:)/2; XDcyjm = zeros(size(XDcy));XDcyjm(:,2:nmhu) = XDcy(:,2:nmhu))/2;XDcyjm(:,l) = XDcy(:,l)/2; XDcyjp = zeros(size(XDcy));XDcyjp(: ,1:nmhu-1) XDcy(:,2:nmihu))/2;XDcyjp(:,nmhu) = (XDcy(:,1:nmhu-1) + = XDcy(:,nmhu)/2; XXDcyim(:,:,ir) = XDcyim; XXDcyip(:,:,ir) = XDcyip; XXDcyjm(:,:,ir) = XDcyjm; XXDcyjp(:,:,ir) = XDcyjp; XDcyim = XDcyim.*XAsAeff-cy; XDcyip = XDcyip.*XAsAeff-cy; XDcyjm = XDcyjm.*XAsAeff-cym; XDcyjp = XDcyjp.*XAsAeff-cyp; %Collision integrals F1_1 = zeros(l,npn); F2_1 = zeros(1,npn); F1_2 = zeros(1,npn); B1_1 = zeros(l,npn); B1_2 = zeros(l,npn); B1_3 = zeros(l,npn); B1_4 = zeros(l,npn); B1_5 = zeros(1,npn); B2_1 = zeros(i,npn); B2_2 = zeros(1,npn); B2_3 = zeros(l,npn); for i = 1:npn,%Loop for very accurate collision integral calculation close to p = especially smasku = spn <= pn(i); smaskl = spn > pn(i); 174 0 F1_1(1,i) = trapzyp([spn',sfM'.*spn'.*sv'.*smasku']); F1_2(i,i) = trapzyp([spn',sfM'.*spn'.*sv'.*(1 - sgamma'.*ssigma'./sz').*smasku']); F2_1(1,i) = trapzyp([spn',sfM'.*spn'.*smaskl']); BX1(1,i) = trapzyp([spn',sfM'.*smasku.*spn2I); B1_2(1,i) = trapzyp([spn',sfM'.*smasku'.*spn2'.*spn2]); ); B1_3(1,i) = trapzyp([spn',sfM'.*smasku'.*spn2'.*sJl'./sgamma]) B1_4(1,i) = trapzyp([spn',sfM'.*smasku'.*spn2'.*sJ2'./sgamma']); = trapzyp([spn',sfM'.*smasku.*spn2.*((sgmma B1_5(1,i) B2_1(1,i) B2_2(1,i) B2_3(1,i) - ssigma'./sz')./sgMma')]); = trapzyp([spn',sfM'.*smaskl'.*spn2'./sv']); = trapzyp([spn',sfM'.*smaskl'.*spn2'./sv'./sgamma2']); = trapzyp([spn',sfM'.*smaskl'.*spn2'.*sv']); end F1 = F1.1./v2 + F1-2./pn2; F2 = (1 - sigma./z./gamma).*F2_1./v; F = 4*pi*(F1 + F2) + sum(Zi.^2.*(me./mi).*ni-norm(ir))./v2; XF = F'*ones(1,nmhu); Fim = (F1_1 - 0.50*dpn*fMm.*pnm.*vm)./v2m + (Fl_2 - 0.50*dpn*fMm.*pnm.*vm.*(1 gammam.*sigmam. /zm)) . /pn2m; F2m = (1 - sigmam./zm./gammam).*(F2_1 + 0.50*dpn*fMm.*pnm)./vm; Fm = 4*pi*(Fim + F2m) + sum(Zi.-2.*(me./mi).*ninorm(ir))./v2m; Fm(1) = 1;%Avoid singularity at p = 0, but the value is not used Fip = (F11 + 0.50*dpn*fMp.*pnp.*vp)./v2p + (F1.2 + 0.50*dpn*fMp.*pnp.*vp.*(1 gammap.*sigmap./zp))./pn2p; F2p = (1 - sigmap./zp./gammap).*(F2-1 - 0.50*dpn*fMp.*pnp)./vp; Fp = 4*pi*(Flp + F2p) + sum(Zi.^2.*(me./mi).*ni-norm(ir))./v2p; - - XFm = Fm'*ones(Inmhu); XFp = Fp'*ones(1,nmhu); XXF(:,:,ir) sXF; XXFm(:,:,ir) = XXFp(:,:,ir) = XFm; XFp; A = 4*pi*Te-norm(ir)*(Fi + F2)./v + sum(Zi.^2.*(me./mi).*ninorm(ir).*Ti-norm(ir))./v./v2; XA = A'*ones(1,nmhu); Am = 4*pi*Te-norm(ir)*(Flm + F2m)./vm + sum(Zi.^2.*(me./mi).*ni-norm(ir).*Ti-norm(ir))./vm./v2m; Am(1) = 1;%Avoid singularity at p = 0, but the value is not used Ap = 4*pi*Te-norm(ir)*(Flp + F2p)./vp + sum(Zi.^2.*(me./mi).*ni-norm(ir).*Ti-norm(ir))./vp./v2p; XAm = Am'*ones(1,nmhiu); XAp = Ap'*ones(1,nmhu); XXA(:,:,ir) = XA; XXAm(:,:,ir) = XAm; XXAp(:,:,ir) = XAp; 175 Bi = B1_1./v/2 - B1_2./v./pn2/6 + B1_3./v./gamma2./z2/8 - Bi_4./v./z2/4 - B1_5./v./gamma2/4; B2 = B2_1/2 + B2_2.*(-gamma2/6 + J1./z2./gamma/8 - gamma.*J2./z2/4) - B2_3.*(ganmma - sigma./z)./pn2./gamma/4; Bt = 4*pi*(Bi + B2) + sum(Zi.^2.*ni_norm(ir))./v/2 sum(Zi.^2.*ni-norm(ir) .*(me./mi) .*Ti-norm(ir))./v./v2/2; XBt = Bt'*ones(i,nmhu); XXBt(:,:,ir) = XBt; %Chang & Cooper weights: link between full grid (distribution mesh) and half grid (flux mesh) in the momentum direction Xdeltaip = gyp(-dpn*(epsi(ir)*Xssslp.*Xmhu - XFp)./(XAp + XDlhip.*Xmhu2 + XDcyip.*Ximmhu2*xpsib(ir))); %WARNING: EC term to be added Xdeltaim = gyp(-dpn*(epsi(ir)*Xssslm.*Xmhu - XFm)./(XAm + XDlhim.*Xmhu2 + XDcyim. *Ximmhu2*xpsib(ir))); %WARNING: EC term to be added Xdeltajp = Xdeltajm = 0.5*ones(size(Xdeltaip)); 0.5*ones(size(Xdeltaim)); XXdeltaip(:,:,ir) = Xdeltaip; XXdeltaim(:,:,ir) = Xdeltaim; XXdeltajp(:,:,ir) = Xdeltajp; XXdeltajm(:,:,ir) = Xdeltajm; XLeft-hand side matrix terms: collisions, dc electric field, LH and EC wave, losses, etc... Xa = zeros(npnnmhu);%f(ij-i) Xb = zeros(npn,nmhu);%f(i-i,j) Xc = zeros(npn,nmhu);%f(i,j) Xd = zeros(npn,nmhu);%f(i+l,j) Xe = zeros(npn,nmhu);Xf(i,j+1) Xf Xg Xh Xi = zeros(npn,nmhu);%f(i-1,j-1) = zeros(npn,nmhu);%f(i+i,j+) = zeros(npn,nmhu);%f(i-1,j+1) = zeros(npn,nmhu);%f(i+1,j-1) %Collision matrix coefficients Xa Xb Xc Xc = - X1mmhu2m.*XRlambdam.*XBt.*(1 + Xdphibm./Xmhu2m)/dmhu/dmhu;Xf (i,j-1) = Xpn2m.*(XFm.*Xdeltaim - XAm/dpn)/dpn;%f(i-,j) = Ximmhu2p.*XRlambdap.*(XBt .*(1 + Xdphibp. /Xmhu2p))/dmhu/dmhu; %f(i,j) = Xc + Ximmhu2m.*XRlambdam.*(XBt.*(1 Xc = Xc + Xpn2m.*(XFm.*(i + Xdphibm./Xmhu2m))/dmhu/dmhu;%f (i,j) - Xdeltaim) + XAm/dpn)/dpn;%f(i,j) Xc = Xc - Xpn2p.*(XFp.*Xdeltaip - XAp/dpn)/dpn;%f(i,j) Xd = - Xpn2p.*(XFp.*(i - Xdeltaip) + XAp/dpn)/dpn;%f(i+i,j) Xe = -Ximmhu2p.*XRlambdap.*XBt.*(i + Xdphibp./Xmhu2p)/dmhu/dmhu;Xf(i,j+i) %DC electric field matrix coefficients 176 Xa = Xa - epsi(ir)*Xmmhu2m.*Xssslm.*XRlambdam.*Xpn.*Xdeltajm/dmhu;X.f(i,j-1) Xb = Xb - epsi(ir)*Xpn2m.*Xmhu.*Xsssl.*Xdeltaim/dpn;%f(i-1,j) Xc = Xc + epsi(ir)*Xsssl.*Xmhu.*(Xpn2p.*Xdeltaip - Xpn2m.*(1 - Xdeltaim))/dpn;Xf(i,j) Xc = Xc + epsi(ir)*Ximmhu2p.*XRlambdap.*Xssslp.*Xpn.*Xdeltajp/dmhu;%f(i,j) Xc = Xc - epsi(ir)*Xlmmhu2m.*Xssslm.*XRlambdam.*Xpn.*(1 - Xdeltajm)/dmhu;%f(i,j) Xd = Xd + epsi(ir)*Xsssl.*Xpn2p.*Xmhu.*(l - Xdeltaip)/dpn;Xf(i+i,j) Xe = Xe + epsi(ir)*Xssslp.*XRlambdap.*Xlmmhu2p.*Xpn.*(1 - Xdeltajp)/dmhu;%f(i,j+1) %LH wave matrix coefficients X %Discretization technique of Simonetto et al. simonetto = 1; if abs(simonetto) == 1, Xa = Xa - Xlmmhu2m. 2.*XRlambdam.*XDlhjm/dmhu/dmhu; Xf(i,j-1) Xa = Xa - Xmhu.*Ximmhu2.*Xpnm.*XDlhim/4/dpn/dmhu; Xa = Xa + Xmhu.*Xlmmhu2.*Xpnp.*XDlhip/4/dpn/dmhu; Xb = Xb - Xmhu2.*XDlhim.*Xpn2m/dpn/dpn;%f(i-1,j) Xb = Xb + Xpn.*(XRlambdap.*XDlhjp.*Xmhup.*Ximmhu2p - XRlambdam.*XDlhjm.*Xmhum.*Ximmhu2m)/4/dmhu/dpn; Xc = Xc + Xmhu2.*XDlhip.*Xpn2p/dpn/dpn;.f(i,j) Xc = Xc + Xmhu2.*XDlhim.*Xpn2m/dpn/dpn;%f(i,j) Xc = Xc + Ximmhiu2p. ^2.*XRlambdap.*XDlhjp/dmhu/dmhu;%f(i,j) Xc = Xc + Xlmmhu2m. -2.*XRlambdam.*XDlhjm/dmhu/dmhu;%f (i, j) Xd = Xd - Xmhu2.*XDlhip.*Xpn2p/dpn/dpn;%f(i+1,j) Xd = Xd - Xpn.*(XRlambdap.*XDlhjp.*Xmhup.*Ximmhu2p - XRlambdam.*XDlhjm. *Xmhum.*Ximmhu2m)/4/dmhu/dpn; Xe = Xe - Xlmmhiu2p.~2.*XRlambdap.*XDlhjp/dmhu/dmhu;%f(i,j+1) Xe = Xe + Xmhu.*Xlmmhu2.*Xpnm.*XDlhim/4/dpn/dmhu; Xe = Xe - Xmhu.*Ximmhu2.*Xpnp.*XDlhip/4/dpn/dmhu; Xf = Xf - Xmhu. *Xmmhu2. *XDlhim. *Xpnm/dpn/dmhu/4; %f (i-1, j-1) Xf = Xf - Xmhum.*XImmhi2m.*XRlambdam.*XDhjm.*Xpn/dpn/dmhu/4; Xg = Xg - Xmhu.*Xlmmhu2.*XDlhip.*Xpnp/dpn/dmhu/4; %f(i+1,j +1) Xg = Xg - Xmhup.*Xlmmhiu2p.*XRlambdap.*XDlhjp.*Xpn/dpn/dmhu/4; Xh = Xh + Xmhu.*Xmmhu2.*XDlhim.*Xpnm/dpn/dmhu/4;%Xf(i-1,j+1) Xh = Xh + Xmhup.*Xlmmhu2p.*XRlambdap.*XDlhjp.*Xpn/dpn/dmhu/4; Xi = Xi + Xmhu.*Xlmmhu2.*XDlhip.*Xpnp/dpn/dmhu/4; %f(i+1,j-1) Xi = Xi + Xmhum.*Xmmhu2m.*XRlambdam.*XDlhjm.*Xpn/dpn/dmhu/4; %Discretization technique of Shoucri et al. else Xa = Xa - Ximmhu2m. 2.*XRlambdam.*XDlhjm/dmhu/dmhu; Xf(i,j-i) Xa(mp,mm) = Xa(mp,mm) + Xmhu(mp,mm).*Xmmhu2(mp,nmm).*(XDlh(mp,mm) Xpn(mp,mm).*(XDlh(mpp,mm) + - XDlh(mpm,mm))/2/dpn)/2/dmhu; Xb = Xb - Xmhu2.*XDlhim.*Xpn2m/dpn/dpn;%f(i-1,j) Xb(mp,mm) = Xb(mp,mm) + Xpn(mp,mm) . *(XDlh(mp,mmp) . *Xmhu(mp,mmp) . *Xlmmhu2(mp,mmp) 177 . *Xlambda(mp,mmp) - ./Xlambda(mp,mm)/dpn/dmhu/4; XDlh(mp,mmm) .*Xmhu(mp,mmm) .*Ximmhu2(mp,mmm) .*Xlambda(mp,mmm)) % Xb = Xb + Xpn.*(XDlhjp.*Xmhup.*Xmmhu2p.*Xlambdap XDlhjm.*Xmhum.*Xlmmhu2m.*Xlambdam)./Xlambda/dpn/dmhu/2; Xc = Xc + Xmhu2.*XDlhip.*Xpn2p/dpn/dpn;Xf(i,j) Xc = Xc + Xmhu2.*XDlhim.*Xpn2m/dpn/dpn; Xc = Xc + Ximmhu2p.^2.*XRlambdap.*XD1hjp/dmhu/dmhu; Xc = Xc + Ximmhu2m.^2.*XRlambdam.*XD1hjm/dmhu/dmhu; Xd = Xd - Xmhu2.*XDlhip.*Xpn2p/dpn/dpn;Xf(i+,j) Xd(mp,mm) = Xd(mp,mm) - Xpn(mp,mm).*(XD1h(mp,mmp).*Xmhu(mp,mmp).*Ximmhu2(mp,mmp).*Xlambda(mp,mmp) ./Xlambda(mp,mm)/4/dpn/dmhu; XDlh(mp,mmm) .*Xmhu(mp,mmm) .*Ximmhu2(mp,mmm) .*Xlambda(mp,mmm)) % Xd = Xd - Xpn.*(XDlhjp.*Xmhup.*Ximmhu2p.*Xlambdap - - XDlhjm.*Xmhum. *Ximmhu2m. *Xlambdam) ./Xlambda/dpn/dmhu/2; Xe = Xe - Ximmhu2p.^2.*XRlambdap.*XD1hjp/dmhu/dmhu;X/f(i,j+1) Xe(mp,mm) = Xe(mp,mm) - Xpn(mp,mm) .*(XD1h(mpp,mm) Xmhu(mp,mm).*Ximmhu2(mp,mm).*(XDlh(mp,mm) + - XD1h(mpm,mm))/2/dpn)/2/dmhu; Xf = Xf - Xmhu.*Ximmhu2.*XD1h.*Xpn/dpn/dmhu/2;Xf(i-i,j-1) Xg = Xg - Xmhu.*Ximmhu2.*XD1h.*Xpn/dpn/dmhu/2;Xf(i+,j+) Xh = Xh + Xmhu.*Ximmhu2.*XDlh.*Xpn/dpn/dmhu/2;Xf(i-,j+) Xi = Xi + Xmhu.*Xlmmhu2.*XDlh.*Xpn/dpn/dmhu/2;Xf (i+i,j-1) end %EC wave matrix coefficients Xcym = xpsib(ir)*Ximmhu2m - xomega-cy(ir)./Xgamma; XcyOm = xpsib(ir)*Ximmhu2 - xomega_ cy(ir)./Xgammam; Xcy0p = xpsib(ir)*Xlmmhu2 - xomega-cy(ir)./Xgammap; Xcyp = xpsib(ir)*Xlmmhu2p - xomega.cy(ir)./Xgamma; Xa = Xa + Xpnp.*XDcyip.*Ximmhu2.*Xcy0p./Xmhu/4/dmhu/dpn - Xpnm. *XDcyim. *Ximmhu2. *Xcy0m. /Xmhu/4/dmhu/dpn; %f (i,j-1) Xa = Xa - XRlambdam.*Ximmhu2m. *XDcyjm.*Xcym. *Xcym./(Xmhu2m+eps) ./xpsib(ir)/dmhu/dmhu; Xb = Xb - Xpn2m.*XDcyim.*Xmmhu2.*xpsib(ir)/dpn/dpn; Xf(i-i,j) Xb = Xb + Xpn.*XRlambdap.*Ximmhu2p.*XDcyjp.*Xcyp./(Xmhup+eps)/dpn/dmhu/4 - Xpn.*XRlambdam.*Ximmiu2m.*XDcyjm.*Xcym./(Xmhum+eps)/dpn/dmhu/4; Xc = Xc + Xpn2p.*XDcyip.*Xlmmhu2.*xpsib(ir)/dpn/dpn + Xpn2m. *XDcyim. *Xlmmhu2. *xpsib(ir) /dpn/dpn ;*f(i,j) Xc = Xc + XRlambdap.*Xlmmhu2p.*XDcyjp.*Xcyp.*Xcyp. /(Xmhup+eps) ./(Xmhup+eps)/xpsib(ir)/dmhu/dmhu; Xc = Xc + XRlambdam.*Ximmhu2m.*XDcyjm.*Xcym.*Xcym. /(Xmhum+eps) ./(Xmhum+eps)/xpsib(ir)/dmhu/dmhu; Xd = Xd - Xpn2p.*XDcyip.*Ximmhu2.*xpsib(ir)/dpn/dpn;Xf(i+1,j) Xd = Xd - Xpn.*XRlambdap.*Ximmhu2p.*XDcyjp.*Xcyp./(Xmhup+eps)/dpn/dmhu/4 + Xpn. *XRlambdam. *X1mmhu2m. *XDcyjm. *Xcym. / (Xmhum+eps) /dpn/dmhu/4; Xe = Xe - Xpnp.*XDcyip.*Xmmhu2.*Xcy0p./Xmhu/4/dmhu/dpn + Xpnm. *XDcyim. *Ximmhu2. *Xcy0m. /Xmhu/4/dmhu/dpn;Xf (i,j+i) Xe = Xe - XRlambdap.*Xmmiu2p.*XDcyjp.*Xcyp.*Xcyp./(Xmhu2p+eps)./xpsib(ir)/dmhu/dmhu; 178 Xf = Xf - Xpnm.*XDcyim.*Xmmhu2.*Xcy0m./Xmhu/dmhu/dpn/4 Xpn. *XRlambdam. *Ximmhu2m.*XDcyjm. *Xcym. / (Xmhum+eps)/dpn/dmhu/4; Xf (i-1, j-1) Xg = Xg - Xpnp.*XDcyip.*Xlmmhu2.*Xcy0p./Xmhu/dmhu/dpn/4 Xpn.*XRlambdap.*Xlmmhu2p.*XDcyjp.*Xcyp./(Xmhup+eps)/dpn/dmhu/4;*/f(i+l,j+1) Xh = Xh + Xpnm.*XDcyim.*Xmmhu2.*Xcy0m./Xmhu/dmhu/dpn/4 + ... Xpn. *XRlambdap. *Ximmhu2p. *XDcyjp. *Xcyp./(Xmhup+eps)/dpn/dmhu/4;%f (i-1,j+1) Xi = Xi + Xpnp.*XDcyip.*X1mmhu2.*Xcy0p./Xmhu/dmhu/dpn/4 + ... Xpn.*XRlambdam.*Ximmhu2m.*XDcyjm.*Xcym./(Xmhum+eps)/dpn/dmhu/4; Xf (i+i,j-1) %Loss matrix coefficients Xnhuloss = squeeze(XXnhuloss(: , :,ir)); Xc = Xc + Xnhuloss.*Xpn2; %Time differencing scheme Xa = Xa/scheme; Xb = Xb/scheme; Xc = Xc/scheme + Xpn2/dtn; Xd = Xd/scheme; Xe = Xe/scheme; Xf = Xf/scheme; Xg = Xg/scheme; Xh = Xh/scheme; Xi = Xi/scheme; %Boundaries of the bounce domain for f if bounce-mode == 0,%No bounce averaging Xmask = [1: :nmhu] ; ns(ir) = 0;XNumber of mhu values that are removed for implicit bounce averaged calculations Xa-t = Xa; Xb-t = Xb; Xc-t = Xc; Xd_t = Xd; Xe-t = Xe; Xft = Xf; Xg-t = Xg; Xh-t = Xh; Xi-t = Xi; mhu_t = mhu; elseif bounce-mode == 1, %Explicit bounce-averaging calculations, enforced on operators five or nine diagonals modes: symetrization Xmask = [1:1:nmhu]; ns(ir) = 0;%Number of mhu values that are removed for implicit bounce averaged calculations 179 Xat = Xa; Xb-t = Xb; Xct = Xc; Xdt = Xd; Xet = Xe; Xf t = Xf; Xg-t = Xg; Xh-t = Xh; Xit = Xi; mhut = mhu; = min(find(mhu.*mhu<mhubounce2(ir))); jmhutXm jmhut-max = max(find(mhu.*mhu<mhubounce2(ir))); djmhut = (jmhutmax - jmhutmin+i)/2; if djmhut > 3,%At least three points in the bounce domain to enforce operator symmetrization Xa-tp = fliplr(Xa-t(: ,find((mhu>=0) & (abs(mhu) < sqrt(mhubounce2(ir)))))); Xatm = Xa-t(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))); Xa-ts = (Xa-tp + Xatm)/2; Xa-t(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xats; Xa-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = fliplr(Xa-ts); Xbtp = fliplr(Xb-t(:,find((mhu>=Q) & (abs(mhu) < sqrt(mhubounce2(ir)))))); Xb_tm = Xbrt(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))); Xb-ts = (Xb-tp + Xb-tm)/2; Xb-t(:,find((mhu<=Q) Xb-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xb-ts; = fliplr(Xb-ts); Xctp = fliplr(Xct(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir)))))); Xc_tm = Xcit(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))); Xc-ts = (Xc-tp + Xc-tm)/2; Xc-t(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xcts; Xc-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = fliplr(Xcts); XX-tp = fliplr(Xd-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir)))))); & >=) (abs(mhu) < sqrt(mhubounce2(ir))))); Xd_tm = XLt(:,find((mhu< Xd-ts = (Xd.tp + Xd-tm)/2; Xd-t(:,find((mhu<=O) Xd-t(:,find((mhu>=Q) & (abs(mhu) < sqrt(mhubounce2(ir))))) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xdts; = fliplr(Xd-ts); =< Xetp = fliplr(Xet(: ,find((hu>=0) & (abs(mhu) < sqrtnhubounce2(ir)))))); Xe-tm = Xet(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))); Xe-ts = (Xe-tp + Xetm)/2; Xe-t(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) Xe-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xe-ts; = fliplr(Xe-ts); Xf-tp = fliplr(Xf-t(:,find((mhu>=0) & (abs(mhu) < sqrt(mhubounce2(ir)))))); Xftm = Xf-t(:,find((mhu<=0) & (abs(mhu) < sqrt(mhubounce2(ir))))); 180 Xf-ts = (Xf-tp + Xf-tm)/2; Xf-t(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xf-ts; Xft(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = fliplr(Xf-ts); Xg-tp = fliplr(Xg-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir)))))); Xg-tm = Xg-t(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))); Xg-ts = (Xg-tp + Xg-tm)/2; Xgt(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xg-ts; Xg-t(:,find((mhu>=) & (abs(mhu) < sqrt(mhubounce2(ir))))) = fliplr(Xg-ts); Xhtp = fliplr(Xh-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir)))))); (mhu) < sqrt(mhubounce2(ir))))); Xh-tm = Xhrt(:,find((mhu<=O) & (abs Xhts = (Xhtp + Xh-tm)/2; Xh-t(:,find((mhu<=Q) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xhts; Xh-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = fliplr(Xh-ts); Xi-tp = fliplr(Xit(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir)))))); Xi-tm = Xit(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))); Xi-ts = (Xi.tp + Xi-tm)/2; Xi-t(:,find((mhu<=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = Xits; Xi-t(:,find((mhu>=O) & (abs(mhu) < sqrt(mhubounce2(ir))))) = fliplr(Xi-ts); % Xa-t(2:npn,jmhut-min-1) = Xa-t(2:npn,jmhut-min-)/2;%f(i,jmhut-min-1) % % % % % Xet(2:npn,jmhut-max+i) Xf-t(2:npn,jmhut-min-1) Xg-t(2:npn,jmhut-max+i) Xh-t(2:npn,jmhut-max+) Xi-t(2:npn,jmhut-min-1) = Xe-t(2:npn,jmhut-max+)/2;f(i,jmhut-max+) = Xf-t(2:npn,jmhut-min-1)/2;%f(i-,jmhut-min-1) = Xg-t(2:npn,jmhut-max+)/2;Xf(i+,jmhutmax+1) = Xh-t(2:npn,jmhut-max+i)/2;%f(i-i,jmhut-max+) = Xi-t(2:npn,jmhut-min-i)/2;%f(i+1,jmhut-min-1) end elseif bounce-mode == 2,%Full implicit bounce-averaging calculations, fifteen diagonals mode jmhut-min = min(find(mhu. *mhu<mhubounce2(ir))) ; jmhut-max = max(find(mhu.*mhu<mhubounce2(ir))); djmhut = (jmhut-max - jmhut-min+i)/2; if djmhut > 3,%At least three points in the bounce domain =d Xj = zeros(npn,nmhu);%Extra diagonals Xk = zeros(npn,nmhu);XExtra diagonals Xl = zeros(npn,nmhu);%Extra diagonals Xm = zeros(npn,nmhu);XExtra diagonals Xn = zeros(npn,nmhu);%Extra diagonals Xo = zeros(npn,nmhu);X.Extra diagonals Xmask = (Xmhu2 < mhubounce2(ir)) & (Xmhu < O);%Only the half-bounce region is removed Xmask = nonzeros(~(Xmask(2,:)==1).*cumsum(ones(i,nmhu)))'; ns(ir) = nmihu - length(Xmask);%number of mhu values that are removed Xa-t = Xa(:,Xmask);%Matrix reduction along the angular direction Xb-t = Xb(:,Xmask); Xc-t = Xc(:,Xmask); 181 Xd_t Xd(:,Xmask) Xe_t Xf_t Xe(:,Xmask) Xf(:,Xmask) Xg-t Xg(:,Xmask) Xh_t Xh(:,Xmask) Xi(:,Xmask) Xj(:,Xmask) Xk(:,Xmask) Xl(:,Xmask) Xm(:,Xmask) Xn(:,Xmask) Xo(:,Xmask) Xi_t Xj -t Xk_t X1-t Xm-t Xn_t Xo_t X~ Xft(: ,jmhutmax Xa-t(:,jmhutmax Xi-t(:,jmhutmax ns (ir)) ns(ir)) ns(ir)) Xft (:,jmhutmax - ns(ir))/2; Xa-t(: ,jmhut-max - ns(ir))/2; Xj-t(:,jmhut-max Xk-t(:,jmhut-max Xlt(:,jmhutmax ns(ir)) ns(ir)) ns(ir)) Xf_t(: ,jmhut-max - ns(ir));Xf(i-i,j-djmhut) Xat(:,jmhut-max - ns(ir));%f(i,j-djmhut) Xi-t(: ,jmhut-max - ns(ir));Xf(i+,j-djmhut) ,jmhut-max - ns(ir))/2; 0X Xm.t C:,jmhut-min Xn-t ,jmhut_min Xo~t(: ,jmhut-min 1) Xh-t(:,jmhut-min 1) Xe-t(:,jmhut-min 1) - 1);%f(i-1,j+djmhut) - 1);%f(i,j+djmhut) Xg-t(: ,jmhut-min - 1);%f(i+1,j+djmhut) XJ Xh-t(: ,jmhut_min Xet(: ,jmhut_min xg-t( ,jmhut-min 1) 0; 1) 0; 1) 0; =0 ns(ir)) 0;%df(pn,mhu=pi/2) 0;%df(pn,mhu=pi/2) ns(ir)) 1;%df(pn,mhu=pi/2) =0 Xd-t(:,nmhu/2 ns(ir)) 0;%df(pn,mhu=pi/2) Xe-t(: ,nmhu/2 ns(ir)) -1;%df(pn,mhu=pi/2) Xf.t(:,nmhu/2 ns(ir)) 0;%df(pn,mhu=pi/2) =0 Xg-t(:,nmhu/2 ns(ir)) =0 Xh-t(:,nmhu/2 ns(ir)) 0;%df(pn,mhu=pi/2) 0;%df(pn,mhu=pi/2) Xi-t(:,nmhu/2 ns(ir)) ns(ir)) 0;Xdf(pn,mhu=pi/2) 0;%df(pn,mhu=pi/2) =0 Xjt(:,nmhu/2 Xk-t(:,nmhu/2 ns(ir)) =0 Xlt(:,nmhu/2 ns(ir)) 0;%df(pn,mhu=pi/2) 0;%df(pn,mhu=pi/2) Xmt(:,nmhu/2 ns(ir)) ns(ir)) Xo.t(:,nmhu/2 ns(ir)) 0;%df(pn,mhu=pi/2) 0;%df(pn,mhu=pi/2) 0;%df(pn,mhu=pi/2) =0 Xn-t(:,nmhu/2 Xat(:,nmhu/2 ns(ir)) Xb-t(:,nmhu/2 Xct(:,nmhu/2 =0 =0 =0 =0 =0 =0 =0 =0 0;%df/dmhu(abs(mhu) Xj -t(2: npn, 3) Q;Xj-t(2:npn,nmhu - ns(ir) 1) = 1) = 0 Xkt(2:npn,3) 0;Xk-t(2:npn,mihu - ns(ir) 1) = 0;%df/dmhu(abs(mhu) == 1) = 0 Xlt(2:npn,3) Q;Xlt(2:npn,nmhu - ns(ir) Q;Xm-t(2:npn,nmhu - ns(ir) 1) = 0;%df/dmhu(abs(mhu) == 1) = 0 1) = 0 Xmt(2:npn,3) 182 = 0;%df/dmhu(abs(mhu) == == 1) Xn_t(2:npn,3) = O;Xn-t(2:npn,nmhu - ns(ir) - 1) = 0;%df/dmhu(abs(mhu) Xot(2:npn,3) = 0;Xo-t(2:npn,nmhu - ns(ir) - 1) = 0;%df/dmhu(abs(mhu) == 1) = == 0 1) = 0 mhu_t = mhu(Xmask); else Xmask = [1:1:nmhu]; ns(ir) = 0;%Number of mhu values that are removed for implicit bounce averaged calculations bounce_mode = 1; if display-mode>=0, infoyp(2,'WARNING: Not enough grid point in the bounce region for bounce-averaged !') calculations end Xa_t = Xa; Xb-t = Xb; Xc-t = Xc; Xdt Xe_t Xd; = = Xe; Xft = Xf; Xgt = Xh_t = Xh; Xg; Xit = Xi; mhu-t = mhu; end end %Boundary conditions at p = dp/2 Xa-t(i,:) = 0; Xb.t(i,:) = 0; Xc-t(1,:) = Xpn2(1,Xmask)/dtn; Xd.t(1,:) = 0; Xet(1,:) = 0; Xf.t(1,:) = 0; Xg.t(1,:) = 0; Xh_t(1,:) Xi-t(1,:) = 0; =0; if bouncemode == 2, Xj-t(i,:) = 0; Xkt(,:) = 0; X1_t(1,:) =0; Xm.t(1,:) = 0; Xn-t(i,:) Xo-t(i,:) = = 0; 0; end if ~isempty(find(ir==rdke)) 183 %Matrix coefficients calculations for ftp Xatp = zeros(size(Xa));%ftp(i,j-1) Xbtp = zeros(size(Xb));%ftp(i-i,j) Xc-tp = zeros(size(Xc));%ftp(i,j) Xdtp = zeros(size(Xd));%ftp(i+,j) Xe.tp = zeros(size(Xe));%ftp(i,j+1) Xftp = zeros(size(Xf));%ftp(i-,j-1) Xg-tp = zeros(size(Xg));%ftp(i+i,j+1) Xh-tp = zeros(size(Xh));%ftp(i-,j+1) Xi.tp = zeros(size(Xi));%ftp(i+i,j-1) %Collision matrix coefficients for ftp Xsssl-tp = Xsssl*sqrt((i - ia(ir))/(i + ia(ir)))/(i + ia(ir)); alpha-tp = (ia(ir) - ia(ir)*ia(ir)/2)/(1 + ia(ir)); Xa_tp(:,1) = 0; Xa-tp(: ,mm) = -Xsssl-tp(: ,mm).*XBt(: ,mm).*Xmmhu2m(: ,mm).*(1 alpha-tp. /Xmhum(: ,mm) ./Xmhu(: ,mmm) )/dmhu/dmhu; Xa.tp(: ,nmhu) = -Xsssltp(: ,nmhu).*XBt(:,nmhu).*Xmmhu2m(: ,nmhu).*(1 alpha-tp./Xmhum(: ,nmhu)./Xmhu(: ,nmhu-1))/dmhu/dmhu; Xb-tp = Xsssl-tp.*Xpn2m.*(XFm.*Xdeltaim - XAm/dpn)/dpn; Xctp = Xsssl-tp.*Xpn2m.*(XFm.*(i - Xdeltaim) + XAm/dpn)/dpn; Xc-tp = Xc-tp - Xsssltp.*Xpn2p.*(XFp.*Xdeltaip - XAp/dpn)/dpn; Xc-tp = Xc.tp + Xsssltp.*XBt.*Xlmmhu2m.*(1 - alpha-tp./Xmhum./Xmhu)/dmhu/dmhu; Xctp = Xc-tp + Xsssltp.*XBt.*Ximmhu2p.*(1 - alpha-tp./Xmhup./Xmhu)/dmhu/dmhu; Xd-tp = -Xsssl-tp.*Xpn2p.*(XFp.*(i - Xdeltaip) + XAp/dpn)/dpn; Xe-tp(:,i) = -Xsssl-tp(:,1).*XBt(:,i).*Xmmhu2p(:,i).*(1 alpha-tp./Xmhup(: ,i)./Xmhu(: ,2))/dmhu/dmhu; Xe-tp(:,mm) = -Xsssl-tp(:,mm).*XBt(:,mm).*Xlmmhu2p(:,mm).*(1 - alpha-tp./Xmhup(: ,mm)./Xmhu(: ,mmp))/dmhu/dmhu; Xe-tp(:,nmhu) = 0; %DC electric field matrix coefficients for ftp % Xa-tp = Xa-tp +; % Xbtp = Xb-tp +; % Xctp = Xc-tp +; % Xctp = Xc-tp +; Xc-tp = Xc.tp +; Xd-tp = Xd-tp +; Xetp = Xe-tp +; % % % (******* NOT YET IMPLEMENTED ********) XLH wave matrix coefficients for ftp X if simonetto == -1 %previous scheme Xatp = Xa-tp - Ximmhu2m.~2.*XDlhjm/dmhu/dmhu;X/f(i,j-1) 184 Xa-tp = Xa-tp - Xmhu.*Xlmmhu2.*Xpnm.*XDlhim/4/dpn/dmhu; Xa-tp = Xa-tp + Xmhu.*Xlmmhu2.*Xpnp.*XDlhip/4/dpn/dmhu; Xb-tp = Xb-tp - Xmhu2.*XDlhim.*Xpn2m/dpn/dpn;%f(i-1,j) Xb-tp = Xb-tp + Xpn.*(XDlhjp.*Xmhup.*Xlmmhu2p - XDlhjm.*Xmhum.*Xlmmhu2m)/4/dmhu/dpn; Xc-tp = Xc-tp + Xmhu2.*XDlhip.*Xpn2p/dpn/dpn;%f(i,j) Xc-tp = Xc-tp + Xmhu2.*XDlhim.*Xpn2m/dpn/dpn;%f(i,j) Xc-tp = Xc-tp + Xlmmhu2p.^2.*XDlhjp/dmhu/dmhu;X.f(i,j) Xc-tp = Xc-tp + Xlmmhu2m.-2.*XD1hjm/dmhu/dmhu;Xf(i,j) Xd-tp = Xd-tp - Xmhu2.*XDlhip.*Xpn2p/dpn/dpn; Xf(i+1,j) Xd-tp = Xd-tp - Xpn.*(XDlhjp.*Xmhup.*Xlmmhu2p - XDlhjm.*Xmhum.*Xlmmhiu2m)/4/dmhu/dpn; Xe-tp = Xe-tp - Xlmmhu2p.^2.*XDlhjp/dmhu/dmhu;%Xf(i,j+1) Xe-tp = Xe-tp + Xmhu.*Xlmmhu2.*Xpnm.*XDlhim/4/dpn/dmhu; Xe-tp = Xe-tp - Xmhu.*Xlmmhu2.*Xpnp.*XDlhip/4/dpn/dmhu; Xftp = Xf-tp - Xmhu.*Xlznmhi2.*XDlhim.*Xpnm/dpn/dmhu/4; /f(i-1,j-1) Xf-tp = Xf-tp - Xmhum.*Xlmmhu2m.*XDlhjm.*Xpn/dpn/dmhu/4; Xg-tp = Xg-tp - Xmhu.*Xlmmhu2.*XDlhip.*Xpnp/dpn/dmhu/4; %f(i+1,j+1) Xg-tp = Xg-tp - Xmhup.*Xlmmhu2p.*XDlhjp.*Xpn/dpn/dmhu/4; Xh-tp = Xh-tp + Xmhu.*Xlmmhu2.*XDlhim.*Xpnm/dpn/dmhu/4;X/f(i-1,j+1) Xh-tp = Xh-tp + Xmhup.*Xlmmhu2p.*XDlhjp.*Xpn/dpn/dmhu/4; Xi-tp = Xi-tp + Xmhu.*Xlmmhu2.*XDlhip.*Xpnp/dpn/dmhu/4;/f (i+1,j-1) Xi-tp = Xi-tp + Xmhum.*Xlmmhu2m.*XDlhjm.*Xpn/dpn/dmhu/4; elseif simonetto == 1, Xa-tp = Xa-tp - Ximmhu2m. ^2.*XRlambdam.*XDlhjm/dmhu/dmhu; Xf(i,j-1) Xa-tp = Xa-tp - Xmhu.*Xlmmhu2.*Xpnm.*XDlhim/4/dpn/dmhu; Xa-tp = Xa-tp + Xmhu.*Xlmmhu2.*Xpnp.*XDlhip/4/dpn/dmhu; Xb-tp = Xb-tp - Xmhu2.*XDlhim.*Xpn2m/dpn/dpn; %f(i-i,j) Xb-tp = Xb-tp + Xpn.*(XRlambdap.*XDlhjp.*Xmhup.*Xlmmhu2p XRlambdam.*XDlhjm.*Xmhum.*Xlmmhu2m)/4/dmhu/dpn; Xc-tp = Xc-tp + Xmhu2.*XDlhip.*Xpn2p/dpn/dpn;%f(i,j) Xc-tp = Xc-tp + Xmhu2.*XDlhim.*Xpn2m/dpn/dpn;%f(i,j) Xc-tp = Xc-tp + Xlmmhu2p.^2.*XRlambdap.*XDlhjp/dmhu/dmhu;Xf(i,j) Xc-tp = Xc-tp + Xlmmhu2m.^2.*XRlambdam.*XDlhjm/dmhu/dmhu;%f(i,j) Xd-tp = Xd-tp - Xmhu2.*XDlhip.*Xpn2p/dpn/dpn; Xf (i+1, j) Xd.tp = Xd-tp - Xpn.*(XRlambdap.*XDlhjp.*Xmhup.*Xlmmhu2p XRlambdam.*XDlhjm.*Xmhum.*Xlmmhiu2m)/4/dmhu/dpn; Xe-tp = Xetp - Xlmmhu2p. ^2.*XRlambdap.*XD1hjp/dmhu/dmhu; Xf(i,j+1) Xe-tp = Xe-tp + Xmhu.*Xlmmh12.*Xpnm.*XDlhim/4/dpn/dmhu; Xe-tp = Xe-tp - Xmhu.*Xlmmhu2.*Xpnp.*XDlhip/4/dpn/dmhu; Xftp = Xftp - Xmhu.*Xlmmhu2.*XDlhim.*Xpnm/dpn/dmhu/4;Xf(i-1,j-1) Xftp = Xftp - Xmhum.*Xlmmhu2m.*XRlambdam.*XDlbjm.*Xpn/dpn/dmhu/4; Xg-tp = Xg-tp - Xmhu.*Xlmmhu2.*XDlhip.*Xpnp/dpn/dmhu/4; Xf (i+1,j+1) Xg-tp = Xg-tp - Xmhup.*Xlmmhu2p.*XRlambdap.*XDlhjp.*Xpn/dpn/dmhu/4; Xh-tp Xh-tp = Xh-tp + Xmhu.*Ximmhu2.*XDlhim.*Xpnm/dpn/dmhu/4;.f (i-1,j+i) = Xh-tp + Xmhup.*Xlmmihu2p.*XRlambdap.*XDlhjp.*Xpn/dpn/dmhu/4; Xi-tp = Xi-tp + Xmhu.*Ximmhu2.*XDlhip.*Xpnp/dpn/dmhu/4;Xf (i+i,j-1) Xi-tp = Xi-tp + Xmhum.*Xlmmhu2m.*XRlambdam.*XDlhjm.*Xpn/dpn/dmhu/4; %Discretization technique of Shoucri et al. 185 else Xa-tp = Xa-tp Xa-tp(mp,mm) Ximmhu2m.^2.*XRlambdam.*XDlhjm/dmhu/dmhu;/f (i,j-1) - Xa-tp(mp,mm) + Xmhu(mp,mm).*Ximmhu2(mp,mm).*(XDlh(mp,mm) + = Xpn(mp,mm) .*(XDlh(mpp,mm) - XDlh(mpm,mm)) /2/dpn)/2/dmhu; Xb-tp = Xb-tp Xb-tp(mp,mm) - Xmhu2. *XDlhim. *Xpn2m/dpn/dpn; X/f (i-i, j) Xb-tp(mp,mm) + = Xpn(mp,mm).*(XDlh(mp,mmp).*Xmhu(mp,mmp).*Xlmmhu2(mp,mmp).*Xlambda(mp,mmp) XDlh(mp,mmm). *Xmhu(mp,mmm) .*Xlmmhu2(mp,mmm). - *Xlambda(mp,mmm)). /Xlambda(mp,mm) /dpn/dmhu/4; % Xb-tp = Xb-tp + Xpn.*(XDlhjp.*Xmhup.*Xlmmhiu2p.*Xlambdap XDlhjm. *Xmhum. *Xlmmhu2m.*Xlambdam) ./Xlambda/dpn/dmhu/2; Xc-tp = Xc-tp + Xmhu2.*XDlhip.*Xpn2p/dpn/dpn;Xf(i,j) Xc-tp = Xc-tp + Xmhu2.*XDlhim.*Xpn2m/dpn/dpn; Xc-tp = Xc-tp + Ximmhu2p.^2.*XRlambdap.*XDlhjp/dmhu/dmhu; Xc-tp = Xc-tp + Ximmhu2m.-2.*XRlambdam.*XDlhjm/dmhu/dmhu; Xd-tp = Xd-tp Xd-tp(mp,mm) - Xmhu2.*XDlhip. *Xpn2p/dpn/dpn; .f(i+1, j) Xd-tp(mp,mm) - = Xpn(mp,mm) .*(XDlh(mp,mmp) .*Xmhu(mp,rmmp) .*Xmmbihu2(mp,mmp) .*Xlambda(mp,mmp) -... XDlh(mp,mmm) .*Xmhu(mp,mmm) .*Xlmmhu2(mp,mmm) .*Xlambda(mp,mmm)) ./Xlambda(mp,mm)/4/dpn/dmhu; % Xd-tp = Xd-tp - Xpn.*(XDlhjp.*Xmhup.*Xlmmhu2p.*Xlambdap - XDlhjm.*Xmhum.*Xlmmhu2m.*Xlambdam) ./Xlambda/dpn/dmhu/2; Xetp = Xe-tp Xe-tp(mp,mm) = Ximmhu2p. 2.*XRlambdap.*XDlhjp/dmhu/dmhu; Xf(i,j+i) Xe-tp(mp,mm) - Xmhu(mp,mm).*Ximmhu2(mp,mm).*(XDlh(mp,mm) Xpn(mp,mm) .*(XDlh(mpp,mm) + ... XDlh(mpm,mm))/2/dpn)/2/dmhu; Xf-tp = Xf-tp - Xmhu.*Ximmhiu2.*XD1h.*Xpn/dpn/dmhu/2;.f(i-i,j-1) Xg-tp = Xg-tp - Xmhu.*Ximmhu2.*XDlh.*Xpn/dpn/dmhu/2;Xf(i+1,j+1) Xh-tp = Xh-tp + Xmhu.*Xlmmhu2.*XDlh.*Xpn/dpn/dmhu/2;/f(i-1,j+) Xi-tp = Xi.tp + Xmhu.*Xlmmhu2.*XDlh.*Xpn/dpn/dmhu/2;Xf(i+,j-1) end %EC wave matrix coefficients for ftp Xcym = xpsib(ir)*Xlmmhu2m - xomegacy(ir).Xgama;.2 XcyOm = xpsib(ir)*Ximmhu2 - xomega-cy(ir)./Xgammm;%3 Xcy0p = xpsib(ir)*Xlmmhu2 - xomega-cy(ir)./Xgammap;4 Xcyp = xpsib(ir)*Ximmhu2p - xomega-cy(ir)./Xgamma;6 Xmhub = sign(Xmhu).*sqrt(i - xpsib(ir)*Ximmhu2); Xmhubm = sign (Xmhum). *sqrt (1 - xpsib(ir)*Xmmhu2m); Xmhubp = sign(Xmhup).*sqrt(1 - xpsib(ir)*Ximmhu2p); Xatp = Xa-tp + Xpnp.*XDcyip.*Xlmmhu2.*Xcy0p.*Xmhub./Xmhu2/xpsib(ir)/4/dmhu/dpn;/f(i,j-1) Xatp = Xa-tp - Xpnm.*XDcyim.*Xlmmhu2.*Xcy0m.*Xmhub./Xmhu2/xpsib(ir)/4/dmhu/dpn; Xatp = Xa-tp XRlambdam. *X1mmhu2m. *XDcyjm. *Xcym. *Xcym. *Xmhubm. / (Xmhum+eps) ./ (Xmhu2m+eps) ./xpsib(ir) /xpsib(ir) /d mhu/dmhu; 186 Xa-tp = Xa-tp + XRlambdam.*Ximmhu2m.*XDcyjm.*Xcym.*Xcym.*(xpsib(ir)./(Xmhu2m+eps) ./(Xmhubm+eps) . . . ./(Xmhu2m+eps) 1) /xpsib(ir)/xpsib(ir)/dmhu; Xb-tp = Xb-tp - Xpn2m. *XDcyim. *Xlmmhu2.*Xmhub. /Xmhu/dpn/dpn; %f (i-1, Xb-tp = Xb-tp + Xpnm.*XDcyim.*Ximmhu2.*Xcy0m*(xpsib(ir)- j) 1) ./Xmhu./Xmhu2./Xmhub/xpsib(ir)/dpn; Xb-tp = Xb-tp + Xpn. *XRlambdap. *Xlmmhu2p. *XDcyjp. *Xcyp. *Xmhubp. /Xmhu2p/xpsib(ir) /dpn/dmhu/4; Xb-tp = Xb-tp - Xpn.*XRlambdam. *Xlmmhu2m. *XDcyjm. *Xcym. *Xmhubm. /(Xmhu2m+eps)/xpsib(ir)/dpn/dmhu/4; Xc-tp = Xc.tp + Xpn2p. *XDcyip. *Xlmmhu2.*Xmhub. /Xmhu/dpn/dpn;%f (i,j) Xc-tp = Xc-tp + Xpn2m.*XDcyim.*Ximmhu2.*Xmhub./Xmhu/dpn/dpn; Xc-tp = Xc-tp + XRlambdap.*Xlmmhu2p.*XDcyjp.*Xcyp. *Xcyp. *Xmhubp. /Xmhu2p./Xmhup/xpsib(ir)/xpsib(ir)/dmhu/dmhu; Xc.tp = Xc-tp + XRlambdam.*Xlmmhu2m.*XDcyjm.*Xcym.*Xcym.*Xmhubm./(Xmhu2m+eps)./(Xmhum+eps)/xpsib(ir)/xpsib(ir)/dm hu/dmhu; Xd.tp = Xd-tp - Xpn2p.*XDcyip.*Xlmmhu2.*Xmhub./Xmhu/dpn/dpn;%f (i+,j) Xd-tp = Xd-tp - Xpnp.*XDcyip.*Ximmhu2.*Xcy0p.*(xpsib(ir)- 1). /Xmhu2./Xmhub. /Xmhu/xpsib(ir)/dpn; Xd-tp = Xd-tp - Xpn.*XRlambdap.*Xlmmhu2p.*XDcyjp.*Xcyp.*Xmhubp./Xmhu2p/xpsib(ir)/dpn/dmhu/4; Xd-tp = Xd-tp + Xpn.*XRlambdam.*Xlmmhu2m.*XDcyjm.*Xcym.*Xmhubm./(Xmhu2m+eps)/xpsib(ir)/dpn/dmhu/4; Xe-tp = Xe-tp - Xpnp.*XDcyip.*Xlmmhu2.*Xcy0p.*Xmhub./Xmhu2/4/dmhu/dpn/xpsib(ir); f(ij+1) Xe-tp = Xe.tp + Xpnm.*XDcyim.*Ximmhu2.*Xcy0m.*Xmhub./Xmhu2/4/dmhu/dpn/xpsib(ir); Xe-tp = Xe-tp - XRlambdap.*Ximmhu2p.*XDcyjp.*Xcyp.*Xcyp.*Xmhubp./Xmhup./Xmhu2p./xpsib(ir)/xpsib(ir)/dmhu/dmhu; Xe-tp = Xe-tp - XRlambdap.*Xlmmhu2p.*XDcyjp.*Xcyp.*Xcyp.*(xpsib(ir)1) ./Xmhubp./Xmhu2p./Xmhu2p./xpsib(ir)/xpsib(ir)/dmhu; Xf._tp = Xftp - Xpnm. *XDcyim.*Ximmhu2.*Xcy0m. *Xmhub. /Xmhu2/xpsib(ir) /dmhu/dpn/4; Xfttp = Xfttp - Xpn. *XRlambdam. *Xlmmhu2m. *XDcyjm. *Xcym.*Xmhubm./(Xmhu2m+eps)/dpn/dmhu/xpsib(ir)/4; Xf (i-1,j-1) Xg-tp = Xg-tp Xpnp.*XDcyip.*Xlmmhu2.*Xcy0p.*Xmhub./Xmhu2/dmhu/dpn/xpsib(ir)/4; %f(i+1,j+1) Xg-tp = Xg.tp - Xpn. *XRlambdap. *Ximmhu2p. *XDcyjp. *Xcyp. *Xmhubp. /Xmhu2p/dpn/dmhu/xpsib (ir)/4; Xh.tp = XhWtp + Xpnm.*XDcyim.*Ximmhu2.*Xcy0m.*Xmhub./Xmhu2/dmhu/dpn/xpsib(ir)/4;%f(i1,j+i) Xh-tp = Xh-tp + Xpn.*XRlambdap.*Xlmmhu2p.*XDcyjp.*Xcyp.*Xmhubp./Xmhu2p/dpn/dmhu/xpsib(ir)/4; Xi-tp = Xi-tp + Xpnp.*XDcyip.*Ximmhu2.*Xcy0p.*Xmhub./Xmhu2/xpsib(ir)/dmhu/dpn/4;Xf(i+1,j- 1) Xitp = Xi-tp + Xpn.*XRlambdam.*Ximmhu2m.*XDcyjm.*Xcym.*Xmhubm./(Xmhu2m+eps)/xpsib(ir)/dpn/dmhu/4; %Boundaries of the bounce domain for ftp Xmask-tp = Xmhu2 < mhubounce2(ir); 187 Xmask-tp = nstp(ir) nonzeros(~(Xmask-tp(2, :)==1).*cumsum(ones(1,nmhu)))'; = nmhu - length(Xmask-tp);Xnumber of mhu values that are removed Xa-tp-t = Xa-tp(:,Xmasktp);%Matrix reduction along the angular direction Xbtp-t = Xb.tp(:,Xmask-tp); Xc-tp-t = Xc-tp(:,Xmasktp); Xd-tp-t = Xdtp(:,Xmasktp); Xetp-t = Xe-tp(:,Xmasktp); Xf-tp-t Xg-tp-t Xh-tp-t Xi-tp-t = Xf-tp(:,Xmask-tp); = Xg-tp(:,Xmasktp); = Xh-tp(:,Xmasktp); = Xi-tp(:,Xmasktp); Xf-tp.t(:,(nmhu - ns-tp(ir))/2 + 1) =;%ftp(i-ij-i) Xa-tp-t(:,(nmhu - ns-tp(ir))/2 + 1) = 0;%ftp(i,j-1) Xatp.t(:,(nmhu - ns..tp(ir))/2 + i) = O;X.ftp(i,j-) Xi-tp-t(:,(nmhu - ns-tp(ir))/2 + 1) = 0;%ftp(i+1,j-1) Xh_tpt(:,(nmhu - ns-tp(ir))/2) = 0;Yftp(i-1,j+) Xe_tp_t(:,(nmhu 0;Xftp(i,j+l) - ns-tp(ir))/2) = Xg-tp-t(:,(nmhu - ns-tp(ir))/2) = 0;%ftp(i+,j+i) %Matrix coefficients calculations for g Xag = Xa*scheme;%g(i,j-1) Xb-g Xc-g Xdg Xe.g Xf-g = Xb*scheme;%g(i-1,j) = (Xc - Xpn2/dtn)*scheme;Xg(i,j) = Xd*scheme;%g(i+i,j) = Xe*scheme;%g(i,j+1) = Xf*scheme;Xg(i-i,j-1) Xg-g = Xg*scheme;%g(i+i,j+i) Xh-g = Xh*scheme;Yg(i-i,j+i) Xi-g = Xi*scheme;%g(i+i,j-i) %Boundary conditions for g (the Lorentz model is forced at p = 0) XIth = (abs(Xmhu) - sqrt(mhubounce2(ir))).*(1 + 0.25*sqrt(mhubounce2(ir)). /abs (Xmhu));%Large asoect ratio limit XfOg-th = -XIth.*Xftp./abs(Xmhu); XfOg-th(:,mhu.*mhu<mhubounce2(ir)) = 0; XXfOg-th(:,:,ir) = XfOg_th; Xag(i,:) = 0;%g(i,j-1) Xb-g(i,:) = 0;Xg(i-i,j) Xc.g(i,:) = 1;%g(i,j) Xd-g(,:) = 0;%g(i+1,j) Xe.g(1,:) = 0;%g(i,j+i) Xfg(i,:) = 0;%g(i-i,j-1) Xg-g(,:) = 0;%g(i+i,j+i) Xhg(1,:) = 0;%g(i-i,j+i) Xi-g(,:) = 0;%g(i+1,j-1) 188 XBoundaries of the bounce domain for g Xmaskg = Xmask-tp; ns-g(ir) = ns-tp(ir);%number of mhu values that are removed Xa-g-t = Xa-g(:,Xmask-g);XMatrix reduction along the angular direction Xb-g-t = Xb.g(:,Xmask-g); Xc-g-t = Xc-g(:,Xmask-g); Xd-g-t = Xd-g(:,Xmask-g); Xe-g-t = Xe-g(:,Xmask-g); Xf-g-t = Xf-g(:,Xmask.g); Xg-g-t = Xg-g(:,Xmask-g); Xh-g-t = Xh-g(:,Xmask-g); Xi-g-t = Xi-g(:,Xmask-g); Xe-gt(:,(nmhu - ns-g(ir))/2) = ;%g(pnmhu = -mhut) = 0 Xg-g-t(:,(nmhu - ns-g(ir))/2) = 0;%g(pn,mhu = -mhut) = 0 Xh-gt(:,(nmhiu - ns-g(ir))/2) = 0;%g(pn,mhu = -mhut) = 0 Xag-t(:,(nmhu - ns-g(ir))/2 + 1) = 0;%g(pn,mhu = mhut) = 0 Xf .g-t(:,(nmhu - nsg(ir))/2 + 1) = O;%g(pnmhu = mhut) = 0 Xig-t(:,(nmhu - ns-g(ir))/2 + 1) = 0;7g(pn,mhu = mhut) = 0 end %Matrices calculation if bounce-mode <= 1, MXc = reshape(Xct' ,(nmh-ns(ir))*npn,i); MXP-f-t = sparse([1:(nmhu-ns(ir))*npn], [1: (nmhu-ns(ir))*npn],MXc,(nmhu-ns(ir))*npn,(nmhuns(ir))*npn); MXa = reshape(Xa-t',(nmhu-ns(ir))*npn,1); MXPft = MXP_f_t + sparse([1+1:(nmlhu-ns(ir))*npn],[1:(nmhu-ns(ir))*npn1,MXa(1+1:length(MXa)),... (nmhu-ns (ir) )*npn, (nmhu-ns (ir) )*npn); MXe = reshape(Xet' ,(nmhu-ns(ir))*npn,i); MXP_f_t = MXP_f_t + sparse([1:(nmhu-ns(ir))*npn-1],[1+1:(nmhu- ns(ir))*npn],MXe(1:length(MXe)-1),... (nmhu-ns (ir))*npn, (nmhu-ns (ir))*npn); MXb = reshape(Xb-t',(nmhh-ns(ir))*npn,1); MXP-f-t = MXP-f-t + sparse([1+(nmhu-ns(ir)):(nmhu-ns(ir))*npn],[1:(nmhu-ns(ir))*npn- (nmhu-ns(ir))],... MXb(1+(nmhu-ns(ir)):length(MXb)) ,(nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MXd = reshape(Xd-t',(nmihu-ns(ir))*npn,i); MXP_f_t = MXP-f-t + sparse([i:(nmhu-ns(ir))*npn-(nmhu-ns(ir))],[i+(nmhu-ns(ir)):(nmhuns(ir))*npn],... MXd(1:length(MXd)-(nmhu-ns(ir))),(nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MXf = reshape(Xft' ,(nmhu-ns(ir))*npn,1); MXP_f_t = MXPf-t + sparse([i+(nmhu-ns(ir))+1:(nmhu-ns(ir))*npn],[:(nmhu-ns(ir))*npn- 189 (nmhu-ns(ir))-1],... MXf(l+(nmhu-ns(ir))+l:length(MXf)),(nmhu-ns(ir))*npn,(nmhu-ns(ir))*npn); MXh = reshape(Xht' , (nmhu-ns(ir))*npn,1); MXP_f_t = MXP-f-t + sparse([1+(nmhu-ns(ir))-1: (nmhu-ns(ir))*npn] , [1: (nmhu-ns(ir))*npn- (nmhu-ns(ir))+1],... MXh(l+(nmhu-ns(ir))-l:length(MXh)),(nmhu-ns(ir))*npn,(nmhu-ns(ir))*npn); MXi = reshape(Xi-t',(nmhu-ns(ir))*npn,1); MXP_f_t = MXPf -t + sparse([1: (nmhu-ns(ir))*npn-(nmhu-ns(ir))+l], [1+(nmhu-ns(ir))- 1:(nmhu-ns(ir))*npn],... MXi(1:length(MXi)-(nmhu-ns(ir))+1) , (nmhu-ns(ir))*npn, (nhu-ns(ir))*npn); MXg = reshape(Xgt' ,(nmhiu-ns(ir))*npn,1); MXP-f-t = MXP-f-t + sparse( [1: (nmhu-ns(ir) )*npn-(nmhu-ns(ir) )-1] , [1+(nmhuns(ir))+l:(nmhu-ns(ir))*npn],... MXg(1:length(MXg)-(nmhu-ns(ir))-1) , (nmhu-ns(ir))*npn, (nmhu-ns (ir))*npn); elseif bounce-mode == 2, MXc = reshape(Xc-t',(nmhu-ns(ir))*npn,l);c(i,j) MXP-f-t = sparse( [1: (nmhu-ns(ir))*npn] , [1: (nmliu-ns(ir))*npn],MXc, (nmhu-ns(ir))*npn, (nmhu- ns(ir))*npn); MXa = reshape(Xa.t',(nmhu-ns(ir))*npn,l);%a(i,j-1) MXP-f-t = MXP-f-t + sparse([1+1: (nmhu-ns(ir))*npn] , [1: (nmhu-ns(ir))*npn- 1],MXa(1+1:length(MXa)),... (nmhu-ns(ir) )*npn, (nmhu-ns (ir) )*npn); MXe = reshape(Xe-t',(nmhu-ns(ir))*npn,l);Xe(i,j+l) MXP_f_t = MXP-f-t + sparse([l:(nmhu-ns(ir))*npn-1],[1+1:(nmhuns(ir))*npn],MXe(l:length(MXe)-l),... (nmhu-ns(ir))*npn,(nmhu-ns(ir))*npn); MXj = reshape(Xj-t',(nmhu-ns(ir))*npn,1); %j(i-1,j-djmhut) MXP-ft = MXPft + sparse ([l+(nmhu-ns (ir))+djmhut: (nmhu-ns(ir))*npn] , [1: (nmhuns(ir))*npn-(nmhu-ns(ir))-djmhut],... MXj (1+(nmhu-ns(ir))+djmhut:length(MXj)), (nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MXk = reshape(Xk-t',(nmh-ns(ir))*npn,1);%k(i,j-djmhut) MXP-f-t = MXP-f-t + sparse( [l+djmhut: (nmhu-ns(ir))*npn] , [1: (nmhu-ns(ir))*npndjmhut],MXk(l+djmhut:length(MXk)),... (nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MX1 = reshape(X1_t',(nmhu-ns(ir))*npn,1); %1(i+1,j-djmhut) MXP_f_t = MXP-f-t + sparse( [1: (nmhu-ns(ir))*npn-(nmhu-ns(ir))+djmhut] , [1+(nmhu-ns(ir))- djmhut:(nmhu-ns(ir))*npn] .... MX1(1:length(MX1)-(nmhu-ns(ir))+djmhut), (nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MXf = reshape(Xf-t',(nmhu-ns(ir))*npn,l);Xf(i-l,j-1) MXP-f-t = MXP-f-t + sparse([i+(nmhu-ns(ir))+l: (nmhu-ns(ir))*npn], [1: (nmhu-ns(ir))*npn(nmhu-ns(ir))-1],... MXf(1+(nmhiu-ns(ir))+1:length(MXf)) ,(nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MXb = reshape(Xb-t',(nmhu-ns(ir))*npn,l);Xb(i-l,j) MXP-f-t = MXP-f-t + sparse ([l+(nmhu-ns(ir)): (nmhu-ns(ir))*npn] , [1: (nmhu-ns(ir))*npn- (nmhu-ns(ir))],... MXb(l+(nmhu-ns(ir)):length(MXb)),(nmhu-ns(ir))*npn,(nmhu-ns(ir))*npn); MXh = reshape(Xh-tt',(nmhu-ns(ir))*npn,1);XYh(i-1,j+1) MXP_f_t = MXP-f-t + sparse( [1+(nmhu-ns(ir))-1:(nmhu-ns(ir))*npn],[1:(nmhu-ns(ir))*npn(nmhu-ns(ir))+1].... 190 MXh(1+(nmhu-ns(ir))-1:length(MXh)), (nmhu-ns(ir))*npn,(nmhu-ns(ir))*npn); MXi = reshape(Xi-t',(nmhu-ns(ir))*npn,1); %i(i+1,j-1) MXP_f-t = MXP-f-t + sparse([1: (nmhu-ns(ir))*npn-(nmhu-ns(ir))+] , [1+(nmhu-ns(ir))- 1:(nmhu-ns(ir))*npn],... MXi(1:length(MXi)-(nmhu-ns(ir))+1), (nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MXd = reshape(Xd-t',(nmhiu-ns(ir))*npn,1);%d(i+i,j) MXP-f-t = MXP-f-t + sparse([1:(nmhu-ns(ir))*npn-(nmhu-ns(ir))],[1+(nmhu-ns(ir)):(nmhuns(ir))*npn],... MXd(1:length(MXd)-(nmhu-ns(ir))), (nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MXg = reshape(Xg-t',(nmh-ns(ir))*npn,1); %g(i+1,j+1) MXP_f_t = MXP-f-t + sparse([1:(nmhu-ns(ir))*npn-(nmhu-ns(ir))-1],[1+(nmhuns(ir))+1:(nmhu-ns(ir))*npn],... MXg(1:length(MXg)-(nmhu-ns(ir))-1), (nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); MXm = reshape (Xm-t' ,(nmhu-ns(ir))*npn,i) ;Ym(i-1, j+djmhut) MXP-f-t = MXP-f-t + sparse ([i+(nmhu-ns(ir))-djmhut: (nmhu-ns(ir))*npn], [1: (nmhuns(ir))*npn-(nmihu-ns(ir))+djmhut], ... MXm(1+(nmhu-ns(ir))-djmhut:length(MXm)),(nmhu-ns(ir))*npn,(nmhu-ns(ir))*npn); MXn = reshape(Xn-t', (nmhu-ns(ir))*npn,1);%n(i, j+djmhut) MXPf_t = MXP-f.t + sparse([[1: (nmhu-ns(ir))*npn-djmhut], [1+djmhut: (nmhuns(ir))*npn],MXn(1:length(MXn)-djmhut),... (nmhu-ns (ir))*npn, (nmhiu-ns (ir))*npn); MXo = reshape(Xo-t',(nmhiu-ns(ir))*npn,1);%o(i+i,j+djmhut) MXPf_t = MXPft + sparse([1: (nmhu-ns(ir))*npn-(nmhu-ns(ir))-djmhut], [1+(nmhu- ns(ir))+djmhut:(nmhu-ns(ir))*npn],... MXo(1: length(MXo)-(nmhilu-ns(ir))-djmhut) , (nmhu-ns(ir))*npn, (nmhu-ns(ir))*npn); end MXPDI-f-t = inv(diag(diag(MXP_f_t))); MXPCft = MXPDI-f-t*MXP-f-t;%Main diagonal matrix preconditionning MXPDI-f.t;'1); eval(['MXPDIXint2str(ir),'ft eval(['MXPC',int2str(ir),'_f_t eval(['Xmask',int2str(ir),' = MXPCf-t;']); = Xmask;']); if store-mode == 1, eval(['save MXPmat.mat MXPDI',int2str(ir),'_f-t MXPC',int2str(ir),'_f_t Xmask',int2str(ir),' -append']); eval(['clear MXPDI',int2str(ir),'_f-t MXPC',int2str(ir),'_f-t Xmask',int2str(ir)]); end if ~isempty(find(ir==rdke)) %Matrix calculation for ftp MXc-tp-t = reshape(Xc-tpt' ,(nmihu - ns-tp(ir))*npn,i); MXP-tp-t = sparse([i:(nmhu - ns-tp(ir))*npn],[i:(nmhu - nstp(ir))*npn],MXctpt,(nmhu ns-tp(ir))*npn,... (nmhu - ns-tp(ir))*npn); MXa-tp-t = reshape(Xa-tp-t',(nmhu - ns-tp(ir))*npn,1); 191 - MXPtp.t = MXP-tp-t + sparse([1+1:(nmhu - ns-tp(ir))*npn],[1:(nmhu - nstp(ir))*npn1],MXa-tp-t(1+1:length(MXa-tp-t)),... (nmhu - ns-tp(ir))*npn,(nmhu ns-tp(ir))*npn); - MXetp-t = reshape(Xe-tp-t',(nmhu - ns-tp(ir))*npn,1); MXP_tpt = MXP-tpt + sparse([1:(nmhu - nstp(ir))*npn-1],[1+1:(nmhu - ns-tp(ir))*npn],MXe-tp-t(1:length(MXe-tp-t)-),... (nmhu MXbtp-t - ns-tp(ir))*npn,(nmhu ns-tp(ir))*npn); - = reshape(Xb-tp-t',(nmhu - ns-tp(ir))*npn,1); MXP-tp-t = MXP_tpt + sparse([1+(nmhu - nstp(ir)):(nmhu nstp(ir))*npn],[1:(nmhu - - ns-tp(ir))*npn-(nmhu - ns-tp(ir))],... MXb-tp-t(1+(nmhu - ns-tp(ir)):length(MXb-tpt)), (nmhu - nstp(ir))*npn,(nmhu - ns-tp(ir))*npn); MXdtp.t = reshape(Xd-tp-t',(nmhu - ns-tp(ir))*npn,1); MXP_tpt = MXP_tpt + sparse([1:(nmiu - nstp(ir))*npn-(nmhu - ns-tp(ir))],[1+(nmhu - nstp(ir)):(nmihu - ns-tp(ir))*npn],... MXd-tp-t(1: length(MXd-tp-t)-(nmhu - nstp(ir))),(nmhu - nstp(ir))*npn,(nmhu ns-tp(ir))*npn); MXftp-t = reshape(Xftp-t',(nmhu - ns-tp(ir))*npn,1); MXPtpt = MXPtpt + sparse([1+(nmhiu - nstp(ir))+1:(nmhu - ns-tp(ir))*npn,... [1:(nmhu - nstp(ir))*npn-(nmhu - nstp(ir))-1],MXftpt(1+(nmhu ns-tp(ir))+1:length(MXf-tpt)),... (nmhu MXh-tpt MXPtp-t - ns-tp(ir))*npn,(nmhu ns-tp(ir))*npn); - = reshape (Xh-tp-t' , (nmhu - ns-tp(ir))*npn,i); = MXPtpt + sparse([1+(nmhu [1:(nmhu - nstp(ir))*npn-(nmhu - ns_tp(ir))-1:(nmhu - ns.tp(ir))*npn],... - ns-tp(ir))+1],MXh-tpt(1+(nmlhu - ns-tp(ir))- 1:length(MXh-tp-t)),... (nmhu - ns-tp(ir))*npn,(nmhu MXi-tp-t = reshape(Xi-tp-t' , ns-tp(ir))*npn); - (nmhu - ns.tp(ir))*npn,1); MXPtpt + sparse([1:(nmhu - nstp(ir))*npn-(nmhu - ns-tp(ir))+1],... MXP_tpt [1+(nmhu - nstp(ir))-1:(nmhu - ns-tp(ir))*npn],MXi-tp-t(1:length(MXi-tp-t)-(nmhu - nstp(ir))+1),... (nmhu MXg-tp-t MXPtpt - ns-tp(ir))*npn,(nmhu - ns-tp(ir))*npn); = reshape(Xg-tp-t',(nmhu = - ns-tp(ir))*npn,1); MXPtpt + sparse([1:(nmhu - nstp(ir))*npn-(nmhu - nstp(ir))-1],... [1+(nmhu - ns-tp(ir))+1:(nmhu - ns-tp(ir))*npn] ,MXg-tpt(1:length(MXg-tpt)-(nmhu ns_tp(ir))-1),... (nmhu - ns-tp(ir))*npn,(nmhu - ns-tp(ir))*npn); eval(['MXP',int2str(ir),'_tpt = MXP.tp-t;']); if store-mode == 1, eval(['save MXPmat.mat MXP',int2str(ir),'_tp-t -append']); eval(['clear MXP',int2str(ir),'_tpt']); end %Matrix calculation for g MXc_g_t = reshape(Xcg-t' ,(nmhu - ns-g(ir))*npn,1); MXP-g-t = sparse([1:(nmhu - ns-g(ir))*npn],[i:(nmhu 192 - ns-g(ir))*npn],MXc-g-t,(nmhu - - ns-g(ir))*npn,(nmhu - ns-g(ir))*npn); MXa_g_t = reshape(Xag-t' ,(nmhu - ns-g(ir))*npn,1); MXP_g-t = MXP_g_t + sparse([1+1:(nmhu MXa_g_t(1+1:length(MXa-g-t)) ns-g(ir))*npn],[1:(nmhu - ,(nmhu - - ns-g(ir))*npn-1],... ns-g(ir))*npn,(nmhu - ns-g(ir))*npn); MXe_gt = reshape(Xe-gt',(nmhu - ns-g(ir))*npn,1); MXPgt = MXP_g_t + sparse([1:(nmhu - ns-g(ir))*npn-1],[1+1:(nmhu - ns-g(ir))*npn],... (nmhu - ns-g(ir))*npn,(nmhu - ns-g(ir))*npn); MXe_g_t(1:length(MXeg-t)-1), MXb_g.t = reshape(Xbg-t' ,(nmhu - ns-g(ir))*npn,1); MXP_g-t = MXP_g-t + sparse([1+(nmhu - asg(ir)):(nmhu - ns-g(ir))*npn],... [1:(nmhu - ns-g(ir))*npn-(nmhu nsg(ir))],MXb-g-t(1+(nmhu - - nsg(ir)):length(MXb_g_t)),... (nmhu - ns-g(ir))*npn,(nmhu - ns-g(ir))*npn); MXd_g_t = reshape(Xd-g-t',(nmhu - ns-g(ir))*npn,1); MXP_g_t = MXP_g_t + sparse([i:(nmhu - nsg(ir))*npn-(nmhu - ns.g(ir))],... [1+(nmhu - nsg(ir)):(nmhu ns-g(ir))*npn],MXd_g_t(1:length(MXd-g-t)-(nmhu - - ns.g(ir))),... (nmhu - ns-g(ir))*npn,(nmhu ns-g(ir))*npn); - MXf_g_t = reshape(Xf-g-t',(nmhu - ns-g(ir))*npn,1); MXP_g_t = MXP_gt + sparse([i+(nmhu - ns-g(ir))+1:(nmhu - ns-g(ir))*npn],... [1:(nmhu - nsg(ir))*npn-(nmhu nsg(ir))-1],MXf_g_t(1+(nmhu - - nsg(ir))+1:length(MXf_g-t)),... (nmhu - ns-g(ir))*npn,(nmhu - nsg(ir))*npn); MXh_gt = reshape (Xh-g-t' , (nmhu - ns-g(ir) ) *npn,1); MXP_g-t = MXP_g_t + sparse([1+(nmhu [1:(nmhu - nsg(ir))*npn-(nmhu - nsg(ir))-1:(nmhu - ns-g(ir))*npn],... nsg(ir))+I],MXh_g_t(1+(nmhu - ns-g(ir))- 1:length(MXh-g-t)),... (nmhu - nsg(ir))*npn,(nmhu - ns-g(ir))*npn); MXi_gt = reshape(Xi-g-t',(nmhlu - ns-g(ir))*npn,1); MXP_g_t = MXP_g_t + sparse([1:(nmhu - ns-g(ir))*npn-(nmhu [1+(nmhu - nsg(ir))-1:(nmhu - - ns-g(ir))+1],... ns-g(ir))*npn],MXi_g_t(1:length(MXi-g-t)-(nmhu - ns-g(ir))+1),... (nmhu - ns-g(ir))*npn,(nmhu - ns-g(ir))*npn); MXg_g-t = reshape(Xgg-t' ,(nmhu - ns-g(ir))*npn,1); MXP_g_t = MXP-g-t + sparse([1:(nmhu - ns-g(ir))*npn-(nmhiu [1+(nmhu - nsg(ir))+i:(nmhu - - ns-g(ir))-1],... ns-g(ir))*npn],MXg_g_t (1:length(MXg-g-t)-(nmhu nsg(ir))-1),... (nmhu MXPDI-g-t - ns-g(ir))*npn,(nmhu - ns-g(ir))*npn); inv(diag(diag(MXP_g_t))); MXPC-g-t = MXPDI-g-t*MXP-g-t;XMain diagonal matrix preconditionning eval(['MXPDI',int2str(ir),'_g-t eval(['MXPC',int2str(ir),'_g_t = MXPDI-g.t;']); = MXPC-gt;']); eval(['Xmask',int2str(ir),'_g = Xmask-g;']); if store-mode == 1, eval(['save MXPmat.mat MXPDI',int2str(ir),'_g-t MXPC',int2str(ir),' Xmask',int2str(ir),'_g -append']); eval(['clear MXPDI',int2str(ir),'_g_t MXPC',int2str(ir),'_g_t 193 g-t - Xmask',int2str(ir),'_g']); end end if display-mode >= 1,infoyp(2, ['Matrix calculations (',int2str(ir),'/',int2str(nr),') done.']);end end clear ir ssslO XY XE XK XJO XJ2 XJ4 XYm XEm XKm XJOm XJ2m XJ4m XYp XEp XKp XJOp XJ2p XJ4p clear alphatp Xsssl Xsssl-tp Xssslm Xssslp Xdphib Xdphibm Xdphibp Xlambda Xlambdam Xlambdap clear XRlambdam XRlambdap XAsAeff-cy XAsAeff-cym XAsAeff-cyp clear Xmhu-psib Xmhu-psibm Xmhu-psibp XAsAeff-cy XAsAeff-cym XAsAeff-cyp XmsomOs clear Xdphiblambdacorr Xdphiblambdacorrm Xdphiblambdacorrp thetaO theta0m theta0p thetaB thetaBm thetaBp clear sssllcorr Xlambdacorr Xlambdacorrm Xlambdacorrp clear Xa Xb Xc Xd Xe Xf Xg Xh Xi Xj Xk Xl Xm Xn Xo clear Xat Xbt Xct Xdt Xet Xf-t Xg.t Xh.t Xi-t Xj-t Xk-t Xlt Xm-t Xnt Xo_t clear Xats Xbts Xcts Xdts Xe-ts Xf-ts Xg-ts Xh-ts Xi-ts clear Xatm Xbtm Xctm Xdtm Xe-tm Xf-tm Xg-tm Xh-tm Xitm clear Xa-tp Xbtp Xc-tp Xd-tp Xe.tp Xf-tp Xg-tp Xh-tp Xi-tp clear Xa-tp-t Xb-tp-t Xc-tp-t Xd-tp-t Xe-tp-t Xf-tp-t Xg-tp-t Xh-tp-t Xi-tp-t clear Xa-g Xb-g Xc-g Xd-g Xe-g Xf-g Xg-g XIhg Xi-g clear Xa-g-t Xb-g-t Xc-g-t Xd-g-t Xe-g.t Xf-g.t Xg-g-t Xh-g-t Xi-g.t clear MXa MXb MXc MXd MXe MXf MXg MXh MXi MXj MXk MX1 MXm MXn MXo clear MXa-tp-t MXb-tp-t MXc-tp-t MXd-tp-t MXetp-t MXf-tp-t MXg-tp-t MXh-tp-t MXi-tp-t clear MXa-g-t MXb_g_t MXc-g-t MXd.g-t MXe_g_t MXftg-t MXg_g_t MXhgt MXi-g-t clear fM normfM xfM sfM normsfM fMm normfMm fMp normfMp clear XDlh XDlhim XDlhip XDlhjm XDlhjp clear XDcy XDcyim XDcyip XDcyjm XDcyjp clear Xmhu-t Xmhub Xmhubm Xmhubp Xcym Xcyp XcyOm Xcy0p clear Xdeltaip Xdeltaim Xdeltajp Xdeltajm clear Fl_1 F2_1 F1_2 B1_1 B1_2 B1_3 B1_4 B1_5 B2_1 B2_2 B2_3 clear F1 F2 F XF Fim F2m Fm Fip F2p Fp XFm XFp A XA Am Ap XAm XAp B1 B2 Bt XBt clear MXP_f_t MXPC_f_t MXPDI_f_t MXPtpt MXP_g_t MXPC_g_t MXPDI-g-t clear Xmask Xmask-g Xmask-tp clear Xnhuloss XI-th XfOg-th clear jmhut.min jmhut-max djmhut if display-mode >= l,infoyp(2,['Full elapsed time for matrix calculation: ',num2str(etime(clock,timeO)),' (s)']);end X************************************************** Main Fokker-Planck loop if display-mode >= 1 disp(' -----------------------------------------------------------------------------------------------------------------') end 194 XXfO = XXfinit;%Initial guess (normalized to ne-norm) while 1, for ir = 1:nr, XfM = squeeze(XXfM(:,:,ir)); fM = XfM(:,1)'; Xsssl = squeeze(XXsssl(:,:,ir)); XI = squeeze(XXI(:,:,ir)); if store-mode == 1, eval(['load MXPmat.mat MXPDI',int2str(ir),'_f-t MXPC',int2str(ir),'_ft Xmask',int2str(ir)]); end eval(['MXPDItft = MXPDI',int2str(ir) , 'ft; ') ;Load local value eval(['MXPCIft = MXPC' ,int2str(ir),'_f-t;]);%Load local value eval(['Xmask = Xmask',int2str(ir),';']);XLoad local value eval( ['clear MXPDI' ,int2str(ir) ,_f _t MXPC' ,int2str(ir) ,_f _t Xmask' ,int2str(ir)]); if invproc == 1,%MatLab built-in full LU factorization [MXLftMXU_f-t] = lu(MXPC-f-t); elseif invproc == 2,%MatLab built-in iterative inversion method [MXLf_tMXU_f-t] = luinc(MXPC_f_t,1e-5); end for it = 2:nit-f, Xf0 = squeeze(XXfO(:,:,ir));%Load value only if residu-f(ir,it-1) >= precOf, Xq = (XI + scheme*XfO/dtn).*Xpn2; Xqt = Xq(:,Xmask); XfO_t = XfO(:,Xmask); if scheme == 2,Xq-t = Xq-t + reshape(-MXPDI_f_t*MXPC-f_t*reshape(Xf0_t',(nmhu - ns(ir))*npn,1),... (nmhu - ns(ir)),npn)';end;%Crank-Nicholson if bounce-mode == 2,Xq-t(2:npn,nmhu/2 + 1 - ns(ir)) = O;end;%df/dmhu(mhu == pi/2) =0 %A XRt = reshape(MXPDI-f_t*reshape(Xq-t',(nmhu - ns(ir))*npn,i),(nmhu - ns(ir)),npn)' reshape(MXPC-ft*reshape(Xf0t' , (nmhu - ns(ir))*npn,i),(nmhu - ns(ir)),npn)'; XA if invproc == 1,%Full LU factorization XYt = reshape(MXL-f-t\reshape(XR-t',(nmhu - ns(ir))*npn,1),(nmhu - 195 ns(ir)),npn)'; %Solving the simultaneous linear equations XS-t = reshape(MXU-f-t\reshape(XY-t',(nmhu - ns(ir))*npn,1),(nmhu - ns(ir)),npn)'; %Solving the simultaneous linear equations elseif invproc == 2,%qmr iterative method XS.t = reshape(qmr(MXPC-f-t,reshape(XRt' , (nmihu - ns(ir))*npn,1),1e-6,(nmhu ns(ir))*npn,... MXL_f_t,MXUf-t),(nmhu - ns(ir)),npn)'; elseif invproc == 3,Xbicgstab iterative method XS.t = reshape(bicgstab(MXPC-f-t,reshape(XR_t', (nmhu - ns(ir))*npn,1),1e6,(nmhu - ns(ir))*npn,... MXL-f-t,MXU-f-t),(nmhu - ns(ir)),npn)'; elseif invproc == 4,%cgs iterative method XS-t = reshape(cgs(MXPC-f_treshape(XR-t',(nmhu - ns(ir))*npn,1),Ie-6,(nmhu - ns(ir))*npn,MXL-f-t,MXU-f-t),... (nmhu - ns(ir)),npn)'; elseif invproc == 5,%pcg iterative method XS-t = reshape(pcg(MXPC-f-t,reshape(XRt',(nmhiu - ns(ir))*npn,1),1e-6,(nmhu ns(ir))*npn,MXL-f-t,MXU-f-t),... (nmhu - ns(ir)),npn)'; end Xfit = XfO-t + XS_t; XMatrix expansion for bounce averaged calculations if bouncemode == 0, Xf1 = Xfit; elseif bouncemode == 1, Xfltp = fliplr(Xfit(:,find((mhu>=0) & (abs(mhu) <= sqrt(mhubounce2(ir)))))); Xfitm Xfits = Xfit(:,find((mhu<=0) & (abs(mhu) <= sqrt(mhubounce2(ir))))); = (Xfitp + Xfitm)/2; Xflt(:,find((mhu<=O) & (abs(mhu) <= sqrt(mhubounce2(ir))))) = Xf1_ts; Xflt(:,find((mhu>=O) & (abs(mhu) <= sqrt(mhubounce2(ir))))) = fliplr(Xfl-ts); Xfi = Xf1_t; elseif bounce-mode == 2, XfI = zeros(size(Xf0)); Xfl(:,1:nmhiu/2 - ns(ir)) = Xflt(:,1:nmhu/2 - ns(ir)); Xfi(:,nmhu/2 + 1:nmhu) = Xfi-t(:,nmhu/2 + 1 - ns(ir):nmhu - ns(ir)); Xfi(:,nmhu/2 + 1 - ns(ir):nmhu/2) = fliplr(Xfit(:,nmhu/2 + 1 ns(ir):nmhu/2)); end =A normf0(ir,it) = 2*pi*trapzyp([pn',pn2'.*trapzyp([mhu',XfO'])']); normfi(ir,it) = 2*pi*trapzyp([pn',pn2'.*trapzyp([mhu',Xfl'])']); currO(ir,it) = 2*pi*trapzyp([pn',pn2'.*(pn'./gamma').*trapzyp([mhu',Xmhu'.*Xf0'])'])*nenorm(ir)/normf0(ir,it); 196 - curri(ir,it) = 2*pi*trapzyp([pn',pn2'.*(pn'./gamma').*trapzyp([mhu',Xmhu'.*Xf1'])'])*ne-norm(ir)/normf1(ir,it); prec-curr(ir,it) = abs((currl(ir,it) - currO(ir,it))/currO(ir,it)); = sqrt(2*pi*trapzyp([pn',pn2'.*trapzyp([mhu',(Xfl'- residu-f(ir,it) XfO').~2.*XfO'])'])/normfl(ir,it)/dtn/dtn); %As done by J.P. Bizarro et al., Nuclear Fusion, 37 (1997) 1509 if display-mode >= 1, infoyp(2, ['Normalized minor radius: ratio: Inverse aspect ',num2str(rho(ir)),', ',num2str(ia(ir)),... ', iteration : ',int2str(it),' / ',int2str(nit-f),', Residu = ,num2str(residuf(ir,it))]); disp([' - Density [t-1]: ',num2str(normf0(ir,it-i)),' - Current [t-1]: ',num2str(curr0(ir,it-1)),' - [t]: ',num2str(normf1(ir,it))]);; disp([' - [t]: ',num2str(curr1(ir,it))]); disp([' - Current relative accuracy [t]: ',num2str(prec-curr(ir,it))]); end if display-mode == 2, if nr-dke >= 1, if ir == ir-display-1, figure(100),subplot (321),semilogy(-pn,XfM(: ,2), 'g--',pn,XfM(: ,nmhu1), 'g--', .. -pn,Xf1(:,2),'r-',pn,Xf1(:,nmhu-i),'r-');%f(perp = 0) axis('square');axis([-max(pn),max(pn),1e-20,10]),zoom on title(['Iteration: ',int2str(it)]);xlabel('pn- ref');ylabel('f(pperp=0)') hold on;zoom on figure(100),subplot(322),semilogy([1:it] ,residu-f(ir,1:it),'rIr+', [1:it],... precOf*ones(size([1:it])),'b--'); axis('square');axis([0,it,precO-f/10,1]); title('Convergence - f');xlabel('Iteration');ylabel('Residu') hold on;zoom on pause(0.1); elseif ir == ir-display, figure(100) ,subplot (323),semilogy(-pn,XfM(: ,2), 'g--' ,pn,XfM(: ,nmhu1), 'g--' ,.. -pn,Xfi(:,2),'r-',pn,Xf1(:,nmhu-1),'r-');%f(perp = 0) axis('square');axis([-max(pn),max(pn),1e-20,10]),zoom on title(['Iteration: ',int2str(it)]);xlabel('pn- ref');ylabel('f(pperp=0)') hold on;zoom on figure(100),subplot(324),semilogy([i:it] ,residu-f(ir,1:it),'r+', [1:it] ,precOf*ones(size([1:it])) ,'b--'); axis('square');axis([0,it,precOf/10,1]); 197 title('Convergence - f');xlabel('Iteration') ;ylabel('Residu') hold on;zoom on pause(O.1); elseif ir == ir-display+1, figure(100) ,subplot(325),semilogy(-pn,XfM(: ,2), 'g--',pn,XfM(: ,nmhu1), 'g--',.. -pn,Xfi(:,2),'r-',pn,Xfi(:,nmhu-1),'r-');Xf(perp = 0) axis('square');axis([-max(pn),max(pn),ie-20,10]),zoom title(['Iteration: on ',int2str(it)]);xlabel('pn- ref');ylabel('f(pperp=0)') hold on;zoom on figure(100),subplot(326),semilogy([i:it],residu-f(ir,i:it),'r+', [:it],... precOf*ones(size([1:it])),'b--'); axis('square');axis([O,it,precOf/10,1]); title('Convergence - f');xlabel('Iteration');ylabel('Residu') hold on;zoom on pause(0.1); end else if ir == ir-display, figure(100) ,subplot(121),semilogy(-pn,XfM(: ,2), 'g--',pn,XfM(: ,nmhu1),... 'g--',-pn,Xfi(:,2),'r-',pn,Xfl(:,nmhu-1),'r-');%f(perp axis('square');axis([-max(pn),max(pn),ie-20,10]),zoom on title(['Iteration: = ',int2str(it)]);xlabel('pn- ref');ylabel('f(pperp=O)') hold on; figure(100),subplot(122),semilogy([1:it],residu-f(ir,i:it),'r+',[i:it],... precOf*ones(size([1:it])),'b--'); axis('square');axis([O,it,precOf/10,1]); title('Convergence - f');xlabel('Iteration') ;ylabel('Residu') hold on; pause(O.1); end end end %First order Legendre correction (2nd order has a negligible effect) if trunc == 1, fl = 1.5*trapzyp([mhu',Xfl'.*(mhu'*ones(1,npn))]); xfl = f1'*ones(1,length(fi)); Il = trapzyp([pn',xf1.*masku.*xpn3./xgamma])/3/Te-norm(ir) - ... trapzyp([pn',xf1.*masku.*xpn3]).*gamma*2/3/Te-norm(ir) trapzyp([pn',xf1.*masku.*xpn3.*xpn2./xgamma]).*gamma/5/Te-norm(ir)/Te-norm(ir) 198 ... ... 0) + trapzyp([pn' ,xf1.*masku.*(xgamma - xsigma./xz) .*xpn./xgamma]) - ... trapzyp( pn' ,xf1.*masku. *xpn3. *xJ2. /xgamma. /xz2]). *gamma/Te-norm(ir) + trapzyp([pn',xfl.*masku.*xpn3.*(1 3*xgamma.*xsigma./xz2./xz)./xgamma]).*(gamma.*pn2 + 3.0./xz2 - - 5*Te-norm(ir))/6/Te-norm(ir)/Te-norm(ir) ... trapzyp([pn',xf1.*masku.*xpn3.*xJ3./xz./xganmma]).*gAnma/2/betath/betath/Te-norm(ir)/Te-norm(ir) + trapzyp([pn',xf1.*masku.*xpn3.*xJ1./xz2./xgamma]).*gamma/2/Te-norm(ir) - + trapzyp([pn',xf1.*masku.*xpn.*(xgamma.*xsigma./xz 1)./xgamma]).*pn2/Tenorm(ir) ... trapzyp([pn',xf1.*masku.*xpn3.*xJ4./xz./xgamma]).*gamma/12/betath/betath/Te-norm(ir)/Te.norm(ir); 12 = trapzyp([pn',xf1.*maskl./xgamma])/3/Te-norm(ir) ... + trapzyp([pn',xf1.*maskl]).*(-2*gamma/3/Te-norm(ir) + pn2/5/Tenorm(ir)/Tenorm(ir)) ... + trapzyp([pn',xfl.*maskl./xgamma).*(gimma - sigma./z)./pn2 ... - trapzyp([pn',xf1.*maskl]).*J2./z2/Te-norm(ir) ... + trapzyp([pn',xfl.*maskl.*(xgamma.*xpn2 3.0./z2 - 5*Tenorm(ir))./xgamma]).*(1 - 3*gamma.*sigma./z2./z)/6/Te-norm(ir)/Te-norm(ir) trapzyp([pn',xf1.*maskl]).*(J3./z/2/betath/betath/Te-norm(ir)/Te-norm(ir) J4./z/12/betath/betath/Te-norm(ir)/Te-norm(ir)) ... + J1./z2/2/Tenorm(ir) ... + trapzyp([pn',xf1.*maskl.*xpn2./xgamma]).*(gamma.*sigma./z 1)./pn2/Tenorm(ir); XI = 4*pi*((fM.*(fl + I1./pn2 + 12.*pn)./gamma)'*mhu).*Xsssl; XI(1,:) = 0;%Boundary conditions at p = 0 XXI(:,:,ir) = XI; end XXfO(:,:,ir) = Xfl; else normfl(ir,it) = normfl(ir,it-1); residu-f(ir,it) = residu-f(ir,it-1); end end XXfO(:,:,ir) = ne-norm(ir)*Xfl/normfl(ir,nit-f); end % % % % if radialmode == 1,%Radial diffusion or pinch for imhu = 1:nmhu, for ip = 1:np, [Mrl,MrO,Mrr] = transprad8yp(dtn,xrho(:),squeeze(XXDr(ip,im,:)),squeeze(XXVr(ip,im, % Ar = Mrl\MrO; 199 :)),1); - + XXfi(ip,im,:) = Ar*squeeze(XXfO(ip,im,:));%Radial transport calculation (with p 0j dependence) % end % end % end % else break; % end end clear ir fM XfM Xsssl MXPC_f_t MXPDI-ftt Xmask MXL_f-t MXU-f-t clear XfO XfOt Xq Xq-t Xf1 Xf1_t XfItp Xfitm Xfits XRt XSt XY_t clear fl xfl Ii 12 XI if display-mode == 2, figure(100),subplot(121),hold off; figure(100),subplot(122),hold off; end if nr-dke >= 1, for ir 1:nrdke, = jri rdke(ir)-1; = jr2 = rdke(ir); jr3 rdke(ir)+i; = XfOm = squeeze(XXfO(:,:,jrl)); XfO = squeeze(XXfO(:,:,jr2)); XfOp = squeeze(XXfO(:,:,jr3)); XfM fM = squeeze(XXfM(:,:,jr2)); XfM(:,1)'; = Xmsom0s Xsssl Xlambda = squeeze(XXmsom0s(:,:,jr2)); = squeeze(XXsssl(:,:,jr2)); = squeeze(XXlambda(:,:,jr2)); XfOg-th = squeeze(XXfOgth(:,:,jr2)); if store-mode == 1, eval( ['load MXPmat.mat MXPDI',int2str(jr2), '_g_t MXPC',int2str(jr2), Xmask',int2str(jr2),'_g']; eval(['load MXPmat.mat MXP',int2str(jr2),'_tpt']); end eval(['MXPltpt = MXP',int2str(jr2),'_tp-t;']); eval(['MXPDI-g-t = MXPDI',int2str(jr2),'_g.t;']); eval(['MXPC-g-t = MXPC',int2str(jr2),'_g-t;']); eval(['Xmask-g = Xmask',int2str(jr2),'_g;']); 200 gt Xmask-tp = Xmask-g; eval(['clear MXPDI',int2str(jr2),'.g.t MXPC',int2str(jr2),'-g-t Xmask',int2str(jr2),'_g']); eval(['clear MXP',int2str(jr2),'_tpt']); if invproc == 1,%MatLab built-in full LU factorization [MXL-g-t,MXU-g-t] = lu(MXPC-g-t); elseif invproc == 2,XMatLab built-in iterative inversion method [MXL-g-t,MXU-g-t] = luinc(MXPC-g-t,ie-5); end dr = (ia(jr3) ia(jrl))*Rp-norm;%radial step for gradient calculations (dke) - drm = (ia(jrl) - ia(jr2))*Rp-norm; drp = (ia(jr3) - ia(jr2))*Rp-norm; Xdf0drho = -drm*XfOp/dr/drp + drp*XfOm/dr/drm - (drp + drm)*XfO/drp/drm;%Calculation of the radial gradient of f XfOtp = - ftp-norm(jr2)*(Xpn.*Xmhu.*Xdf0drho); XXfOtp(:,:,jr2) = XfOtp; XFirst order Legendre correction for ftp fitp = 1.5*trapzyp([mhu',XfO._tp'.*XmsomOs'.*Xlambda' .*(mhu'*ones(i,npn))]); xfltp = fLtp'*ones(1,length(f1_tp)); XI-tp = zeros(size(XfOtp)); if trunc == 1, I1_tp = trapzyp([pn',xfltp.*masku.*xpn3./xgamma])/3/Te-norm(jr2) - ... trapzyp( [pn' ,xfi-tp.*masku.*xpn3]) .*gamma*2/3/Te-norm(jr2) ... trapzyp( [pn' ,xf1_tp.*masku. *xpn3. *xpn2./xgAmma]) .*gamma/5/Te-norm(jr2)/Te-norm(jr2) ... + trapzyp([pn',xfitp.*masku.*(xgamma - xsigma./xz).*xpn./xgamma]) ... - trapzyp( [pn' ,xfl..tp. *masku.*xpn3.*xJ2./xgamma./xz2]) .*gamma/Te-norm(jr2) ... + trapzyp([pn',xfitp.*masku.*xpn3.*(I + 3.0./xz2 3*xgamma.*xsigma./xz2./xz)./xgamma]).*(gamma.*pn2 - 5*Te-norm(jr2))/6/Te-norm(jr2)/Te-norm(jr2) ... trapzyp([pn',xfltp.*masku.*xpn3.*xJ3./xz./xgamma]).*gAnma/2/betath/betath/Te-norm(jr2)/Te-norm(j r2) ... + trapzyp([pn',xfitp.*masku.*xpn3.*xJi./xz2./xgamma]).*gamma/2/Te-norm(jr2) ... + trapzyp([pn',xfitp.*masku.*xpn.*(xgamma.*xsigma./xz - 1)./xgamma]).*pn2/Tenorm(jr2) ... trapzyp( [pn' ,xf 1_tp. *masku. *xpn3. *xJ4. /xz. /xgamma]) .*gamma/12/betath/betath/Te-norm(jr2) /Te-norm( jr2); 12_tp = trapzyp([pn',xfltp.*maskl./xgamma])/3/Te-norm(jr2) ... + trapzyp([pn',xfitp.*maskl]).*(-2*gamma/3/Te-norm(jr2) + pn2/5/Te-norm(jr2)/Te-norm(jr2)) ... 201 + trapzyp( [pn' ,xf1_tp.*maskl./xgamma]) .*(gamma - sigma./z) ./pn2 ... trapzyp([pn',xfltp.*maskl.*(xgamma.*xpn2 - 5*Te-norm(jr2))./xgamma]).*(1 + - trapzyp([pn',xf1_tp.*maskl]).*J2./z2/Te-norm(jr2) + 3.0./z2 - 3*gamma.*sigma./z2./z)/6/Te-norm(jr2)/Te-norm(jr2) ... + trapzyp([pn',xf1_tp.*maskl]).*(J3./z/2/betath/betath/Te-norm(jr2)/Te-norm(jr2) + J1./z2/2/Te-norm(jr2) - J4./z/12/betath/betath/Te-norm(jr2)/Te.norm(jr2)) ... + trapzyp([pn',xf1_tp.*maskl.*xpn2./xgamma]).*(gamma.*sigma./z - 1)./pn2/Te-norm(jr2); XI-tp = 4*pi*((fM.*(fitp + II-tp./pn2 + 12-tp.*pn)./gamma)'*mhu).*Xmsom0s; end XItp-t = XI-tp(:,Xmask-tp); XI.g_t = zeros(size(XI-tp-t)); Xf0_tp-t = XfQtp(:,Xmask-tp); XfOg-th-t = XfOg-th(:,Xmask-tp); for it.g = 2:nit-g, XfOg = squeeze(XXfOg(:,:,jr2));%Load value only XfOg-t = XfQg(:,Xmask-g); if residug(jr2,it-g-1) >= precOg, Xq-g-t = reshape(-MXP-tp-t*reshape(XfOtp-t' , (nmhu - nstp(jr2))*npn,1),(nmhu - ns-tp(jr2)),npn)'; Xq-g-t = Xq-g-t + (XILg-t + XI-tp-t).*Xpn2(:,Xmask-g); Xq-g-t(1,:) = XfOg-th-t(,:);Boundary conditions at p = 0 Xq-g-t(:,(nmhu - ns-g(jr2))/2) = 0;%g(pn,mhu = -mhut) = 0 Xq-g-t(:,(nmhu - ns-g(jr2))/2 + 1) = 0;Xg(pn,mhu = mhut) = 0 XR-t = reshape(MXPDI-g-t*reshape(Xqg-t' ,(nmhu ns-g(jr2)),npn)' - ns-tp(jr2))*npn,1),(nmhu - - reshape(MXPC-g-t*reshape(XfOgt' ,(nmhu - ns-g(jr2))*npn,1),(nmhu - ns-g(jr2)),npn)'; if invproc == 1,XFull LU factorization XY-t = reshape(MXL-g-t\reshape(XR.t' ,(nmhu - ns-tp(jr2))*npn,1),(nmhu - ns-g(jr2)),npn)'; %Solving the simultaneous linear equations XS-t = reshape(MXU-g-t\reshape(XY-t' , (nmhu - ns-tp(jr2))*npn,1),(nmhu - ns-g(jr2)),npn)'; %Solving the simultaneous linear equations elseif invproc == 2,Xqmr iterative method XS-t = reshape(qmr(MXPC-g-t,reshape(XRt' 6,(nmhu - , (nmhu - ns-g(jr2))*npn,1),le- . ns-g(jr2))*npn,MXL-g-t,MXU-g-t),(nmhu - ns-g(jr2)),npn)'; elseif invproc == 2,%bicgstab iterative method XS-t = reshape(bicgstab(MXPC-g-t,reshape(XRt' 202 ,(nmhu - ns-g(jr2))*npn,1),1e- 6,(nmhu - nsg(jr2)),npn)'; ns-g(jr2))*npn,MXL-g-t,MXU-g-t),(nmhu elseif invproc == 2,%cgs iterative method XSt = reshape(cgs(MXPC-g-t,reshape(XRt' , (nmhu - ns-g(jr2))*npn,1),1e- 6,(nmhu - nsg(jr2)),npn)'; ns-g(jr2))*npn,MXL-g-t,MXU-g-t),(nmhu elseif invproc == 2,%pcg iterative method XS-t = reshape(pcg(MXPC-g-t,reshape(XR-t' , (nmhu - nsg(jr2))*npn,1),1e- 6,(nmhu ns-g(jr2))*npn,MXL-g-t,MXU-g-t),(nmhu - ns-g(jr2)),npn)'; end Xfig-t = XfO-g-t + XS-t; %Expansion of the function g Xf2_g(1:npn,i:nmhu/2 - ns-g(jr2)/2) = Xflg-t(:npn,1:(nmhu - ns-g(jr2))/2); Xf2_g(1:npn,nmhu/2 + ns-g(jr2)/2 + 1:nmhu) = Xflg-t(:npn,(nmhu - ns-g(jr2))/2 + 1:nmhu - nsg(jr2)); for is = 1:ns-g(jr2), Xf2_g(:npn,Xmask-g((nmhu - ns-g(jr2))/2) + is) end Xf1_g = Xf2_g; = 0; norml.g(jr2,it-g) = 2*pi*trapzyp([pn',pn2'.*trapzyp([mhu',Xfig'])']); residu-g(jr2,it-g) = sqrt(abs(2*pi*trapzyp([pn',pn2'.*trapzyp([mhu',(Xflg' - XfOg').^2.*Xflg'])'])/normlg(jr2,it-g))); if displaymode >= 1, infoyp(2, ['Normalized minor radius: ratio: ',num2str(rho(jr2)),', Inverse aspect ',... num2str(ia(jr2)),', iteration : ',int2str(it-g),' / ,int2str(nit-g),... ', Residu = ',num2str(residu-g(jr2,it-g))]); end if display-mode == 2, if jr2 == ir-display, figure(101),subplot(121) ,plot(-pn,Xf1_g(: ,1), 'r-' ,pn,Xfl1_g(: ,nmhu),'r-'); %g(perp = 0) axis('square');set(gca,'xlim',[-10,10]); %faxis = axis;axis([faxis(1)/4,faxis(2)/4,faxis(3),faxis(4)]);zoom title( ['Iteration: ',int2str(itg)]);xlabel('pn- refV);ylabel('g(pperp=0)') hold on;zoom on figure(101),subplot(122),semilogy([1:it-g] ,residu-g(jr2,1:it-g),... 'r+',[1:itg],precog*ones(size([1:it-g])),'b--'); axis('square');axis([0,it-g,precg/10,1]); title('Convergence - g');xlabel('Iteration');ylabel('Residu') 203 on hold on;zoom on pause(O.1); end end %First order Legendre correction for g XI-g-t = zeros(size(XI-tp-t)); if trunc == 1, f1-g = 1.5*trapzyp([mhu',Xf1_g'.*(mhu'*ones(1,npn))]); xflg = f1_g'*ones(1,length(f1_g)); I1_g = - trapzyp([pn',xflg.*masku.*xpn3./xgammal)/3/Te-norm(jr2) trapzyp( [pn' ,xf1_g. *masku. *xpn3]). *gamma*2/3/Te-norm(jr2) ... ... trapzyp([pn',xf1_g.*masku.*xpn3.*xpn2./xgamma]).*gamma/5/Te-norm(jr2)/Te-norm(jr2) ... + trapzyp([pn',xf1_g.*masku.*(xgamma - xsigma./xz).*xpn./xgamma]) - ... trapzyp([pn',xf1_g.*masku.*xpn3.*xJ2./xgamma./xz2]).*gamma/Te-norm(jr2) + trapzyp([pn',xflg.*masku.*xpn3.*(1 3*xgamma.*xsigma./xz2./xz)./xgamma]).*(gamma.*pn2 - + 3.0./xz2 - ... 5*Tenorm(jr2))/6/Te-norm(jr2)/Te-norm(jr2) ... trapzyp([pn',xf1_g.*masku.*xpn3.*xJ3./xz./xgamma]).*gamma/2/betath/betath/Te-norm(jr2)/Te-norm(jr 2) ... trapzyp([pn',xflg.*masku.*xpn3.*xJi./xz2./xgamma]).*gamma/2/Te-norm(jr2) ... + trapzyp([pn',xfig.*masku.*xpn.*(xgamma.*xsigma./xz - 1)./xgamma]).*pn2/Tenorm(jr2) ... trapzyp([pn',xflg.*masku.*xpn3.*xJ4./xz./xgamma]).*gamma/12/betath/betath/Te-norm(jr2)/Te-norm(j r2); 12_g = trapzyp([pn',xflg.*maskl./xgamma])/3/Te-norm(jr2) ... + trapzyp([pn',xf1_g.*maskl]).*(-2*gamma/3/Te-norm(jr2) + pn2/5/Te-norm(jr2)/Te-norm(jr2)) ... + trapzyp([pn',xf 1_g.*maskl./xgamma]).*(gamma - sigma./z)./pn2 - trapzyp([pn',xf1_g.*maskl]).*J2./z2/Te-norm(jr2) ... ... + trapzyp([pn',xflg.*maskl.*(xgamma.*xpn2 - 5*Tenorm(jr2))./xgamma]).*(1 + 3.0./z2 3*gamma.*sigma./z2./z)/6/Te-norm(jr2)/Te-norm(jr2) ... trapzyp([pn',xflg.*maskl]).*(J3./z/2/betath/betath/Te-norm(jr2)/Te-norm(jr2) + J1./z2/2/Tenorm(jr2) 4./z/12/betath/betath/Te-norm(jr2)/Te-norm(jr2)) ... + trapzyp([pn',xf1_g.*maskl.*xpn2./xganmma]).*(gamma.*sigma./z 1)./pn2/Tenorm(jr2); XI-g = 4*pi*((fM.*(flg - + I1_g./pn2 + 12_g.*pn)./gamma)'*mhu).*Xsssl; XI-g-t = XI-g(:,Xmask-g); end 204 XXfOg(:,:,jr2) = Xflg; else residu-g(jr2,it-g) = residu-g(jr2,itg-1); end end c-g(jr2) = -1/ne-norm(jr2) * 2*pi*trapzyp([mhu',trapzyp([pn',(Xfog + XfOtp).*Xpn2])']);XDensity conservation for g XfOg = XfOg + c-g(jr2)*XfO; XXfOg(:,:,jr2) = XfOg; end else XXfOtp = zeros(size(XXf0)); XXfOg = zeros(size(XXf0)); end clear fM XfM Xsssl XmsomOs Xlambda MXP-tp-t MXPC-g-t MXPDI-g-t Xmask-g MXL-g-t MXUg-t clear Xdf0drho XfO-tp XfOtp-t ir jri jr2 jr3 dr drm drp clear Xf0 XfOm XfOp XfO-g XfOg-t XfO-g-th-t Xq-g Xq-g-t Xf1_g Xf2_g Xflg-t XRt XSt XY_t clear fl-g xflg clear fitp I1_g 12_g XI-g XI-g-t xfltp Ii-tp 12_tp XILtp XI-g-tp if display == 2, if ~isempty(find(rdke==ir-display)) =A XfM = squeeze(XXfM(:,:,ir-display-1)); XfO = squeeze(XXfO(:,:,ir..display-1)); figure(102),subplot(321),semilogy(-pn,XfM(:,2),'g--',pn,XfM(:,nmhu-1),'g--',pn,XfO(:,2),'r-',... pn,XfO(:,nmhu-1),'r-');%f(perp = 0) axis('square');axis([-max(pn),max(pn),ie-20,10]);zoom title(['Iteration: on ',int2str(nit-f)]);xlabel('pn-ref');ylabel('f(pperp=o)') hold on;zoom on figure(102),subplot(322),plot([i:nit-f] ,currl(ir-display-1,:),'r-'); axis('square');if max(max(curr1(ir-display-1,:))) -= 0,axis([O,nit_f,O,1.1*max(max(currl(ir-display-1,:)))]);end title('Convergence');xlabel('Iteration');ylabel('Current') hold on;zoom on pause(O.1); XfM = squeeze(XXfM(:,:,ir-display)); Xf0 = squeeze(XXfO(:,:,ir-display)); figure(102),subplot(323),semilogy(-pn,XfM(:,2),'g--',pn,XfM(:,nmhu-1),'g--',pn,XfO(:,2),'r-',... pn,XfO(:,nmhiu-1),'r-');%f(perp = 0) axis('square');axis([-max(pn),max(pn),ie-20,10]);zoom on title(['Iteration: ',int2str(nit-f)]);xlabel('pn-ref');ylabel('f(pperp=o)') 205 hold on;zoom on figure(102),subplot(324),plot([1:nit-f],currl(ir-display,:),'r-'); axis('square');if max(max(currl(irdisplay,:))) -= 0,axis([O,nit_f,0,1.1*max(max(curr1(irdisplay,:)))]);end title('Convergence');xlabel('Iteration');ylabel('Current') hold on;zoom on pause(O.1); XfM = squeeze(XXfM(:,:Xirdisplay+1)); XfO = squeeze(XXfO(:,:,ir-display+1)); figure(102),subplot(325),semilogy(-pn,XfM(: ,2), 'g--' ,pn,XfM(: ,nmhu-1) ,'g-pn,XfO(:,2),'r-',... pn,XfO(:,nmhu-1),'r-');Xf(perp = 0) axis('square');axis([-max(pn) ,max(pn) ,le-20,10]) ,zoom on title(['Iteration: ',int2str(nit-f)]);xlabel('pn-ref');ylabel('f(pperp=O)') hold on;zoom on figure(102),subplot(326),plot([l:nitf],currl(ir-display+,:),'r-'); axis('square');if max(max(curr1(ir_display+1,:))) -= 0,axis([0,nit_.f,Q,1.1*max(max(currl(irdisplay+1,:)))]);end title('Convergence');xlabel('Iteration');ylabel('Current') hold on;zoom on pause(O.1); else XfM = squeeze(XXfM(:,:,ir_display)); Xf0 = squeeze(XXf0(:,:,irdisplay)); figure(102),subplot(121),semilogy(-pn,XfM(:,2), 'g--',pn,XfM(: ,nmhu-1), 'g-- pn,XfO(:,2),'r-',... pn,XfO(:,nmhu-1),'r-');%f(perp = 0) axis('square');axis([-max(pn),max(pn),le-20,10]),zoom title(['Iteration: on ',int2str(nit-f)]);xlabel('pn-ref');ylabel('f(pperp=O)') hold on; figure(102),subplot(122),plot([i:nit-] ,currl(irdisplay,:),'r-'); axis('square');if max(max(currl(ir-display,:))) -= 0,axis([O,nit-f,0,1.1*max(max(curr(ir_display,:)))]);end title('Current convergence');xlabel('Iteration');ylabel('Current') hold on; pause(O.1); end end clear ir XfM Xf0 for jr = 1:nr, XDlh = squeeze(XXDlh(:,:,jr)); XDlhim = squeeze(XXDlhim(:,:,jr)); XDlhjm = squeeze(XXDlhjm(:,:,jr)); 206 - Xmhu-psib = sign(Xmhu).*sqrt(1 - xpsib(jr)*(i - Xmhu.~2)); Xmhu-psibm = sign(Xmhum).*sqrt(1 - xpsib(jr)*(i - Xmhum.~2)); Xmhu-psibp = sign(Xmhup).*sqrt(1 - xpsib(jr)*(1 - Xmhup.^2)); Xmhu-psib(Xmhu-psib==O) = eps; Xmhu-psibm(Xmhu-psibm==O) = Xmhu-psibp(Xmhu-psibp==O) = eps; eps; XDcy = squeeze(XXDcy(:,:,jr)); XDcyim = squeeze(XXDcyim(:,:,jr)); XDcyjm = squeeze(XXDcyjm(:,:,jr)); XA squeeze(XXA(:,:,jr)); = XAm = squeeze(XXAm(:,:,jr)); XF = squeeze(XXF(:,:,jr)); XFm = squeeze(XXFm(:,:,jr)); XBt = squeeze(XXBt(:,:,jr)); Xdeltaip = XXdeltaip(:,:,jr); Xdeltaim = XXdeltaim(:,:,jr); Xdeltajp = XXdeltajp(:,:,jr); Xdeltajm = XXdeltajm(:,:,jr); Xsssl = squeeze(XXsssl(:,:,jr)); XfO = squeeze(XXfO(:,:,jr)); XfM = squeeze(XXfM(:,:,jr)); XfOtp = squeeze(XXfOtp(:,)) Xfg = squeeze(XXfOg(:,:,jr)); XfOtot = Xf0 + XfOg + XfO-tp;%Electron momentum distribution function from drift kinetic equation % Bulk heating calculations fO = 0.5*trapzyp([mhu',XfO']); fM = XfM(:,1)'; vth20 = 4*pi*trapzyp([pn',pn'.*pn'.*v'.*v'.*fO'])/3; vth2M = 4*pi*trapzyp([pn',pn'.*pn'.*v'.*v'.*fM'])/3; Te-out-norm(jr) = (vth20/vth2M)*Te-norm(jr) ;%Bulk heating calculations % Calculation of bounce-averaging coefficients if bounce-mode >= 1, m = 30;% m-1 is the order of the series expansion for lambda and lambda-tp (m>0, enough) Xmmask = (Xmhu2>mhubounce2(jr)); [lambda,Delta,lambda-tp,sstar-tp] = bouncejd(mhubounce2(jr),mhu,m); Xlambda = ones(npn,1)*lambda; Xlambda-tp = ones(npn,1)*lambdatp; 207 m=2 is XDelta = ones(npn,1)*Delta; Xsstar-tp = ones(npn,i)*sstar-tp; [lambdam,Deltam,lambda-tpm,sstar-tpm] Xlambdam = ones(npn,i)*lambdam; Xlambda-tpm = ones(npn,1)*lambda.tpm; XDeltam = ones(npn,1)*Deltam; Xsstar-tpm = ones(npn,1)*sstar-tpm; = bouncejd(mhubounce2(jr),mhum,m); else Xmmask = ones(npn,nmhu); Xlambda = ones(npnnmhu); Xlambda-tp = ones(npn,nmhu); XDelta = zeros(npn,nmhu); Xsstar-tp = ones(npn,nmhu); Xlambdam ones(npnnmhu); Xlambdatpm = ones(npn,nmhu); XDeltam = zeros(npn,nmhu); Xsstar-tpm = ones(npn,nmhu); end Xdphib = -XDelta; Xdphibm = -XDeltam; % Current densities calculations if bounce-mode >= 1, normf(jr) = 2*pi*trapzyp([pn',pn2'.*trapzyp([mhu',XfO'])']); normf-fsav(jr) = 2*pi*trapzyp([pn',pn2'.*trapzyp([mhu',XfO'*(i+ia(jr)).*Xlambda'])']); curr_0(jr) = 2*pi*trapzyp([pn',pn2'.*(pn'./gamma).*trapzyp([mhu',Xmhu'.*Xf0'])']); currOfsa(jr) = 2*pi*trapzyp([pn',pn2l.*(pn'./gAmma').*trapzyp(Emhu',Xmhu'.*Xf0'*(1+ia(jr)).*Xmmask'])']); curr-tp(jr) = 2*pi*trapzyp([pn',pn2'.*(pn'./gamma').*trapzyp([mhu',Xmhu'.*Xfotp'])']); currtp-fsav(jr) = 2*pi*trapzyp([pn',pn2'.*(pn'./gamma').*trapzyp([mhu',Xmhu'.*Xfotp'*(1+ia(jr)).*Xlambda-tp']),]); curr-g(jr) = 2 *pi*trapzyp([pn',pn2'.*(pn'./gamma').*trapzyp([mhu',Xmhu'.*Xfog']) curr-g-fsav(jr) = 2*pi*trapzyp([pn',pn2'.*(pn'./gamma').*trapzyp([mhu',Xmhu'.*XfOg'*(1+ia(jr)).*Xmmask'])']); X curr-tot(jr) = currO(jr) + curr.tp(jr) + curr-g(jr); curr-tot-fsav(jr) = curr_0_fsav(jr) + curr-tp-fsav(jr) + curr-g-fsav(jr);% else normf(jr) = 2*pi*trapzyp([pn',pn2'.*trapzyp([mhu',XfO'])']); normf-fsav(jr) = normf(jr); 208 ]); currO(jr) = 2*pi*trapzyp([pn',pn2'.*(pn'./gamma').*trapzyp([mhu',Xmhu'.*Xf0'])']); curr_0_fsav(jr) = currO(jr); curr-tp(jr) = 0; curr-tp-fsav(jr) = 0; curr-g(jr) = 0; curr-g-fsav(jr) = 0; curr-tot(jr) = curr_0(jr) + curr-tp(jr) + curr-g(jr); curr-tot-fsav(jr) = curr_0_fsav(jr) + curr-tp.fsav(jr) + curr-g(jr);%-fsav-s(jr); end % Flux Calculations Xpnm(i,:) = eps; Xmhum(Xmhum==0) = eps; Xmhu2m(Xmhu2m==0) = eps; = eps; Xlambdam(Xlambdam==0) Xmhup(Xmhup==0) % = eps; For fO XfOim = zeros(size(Xf0)); Xf0im(2:npn,:) = Xdeltaim(2:npn,:).*XfO(i:npn-i,:) + (1-Xdeltaim(2:npn,:)).*XfO(2:npn,:); XfOim(i,:) = XfO(i,:); XdfOdpim = gradientjd(XfO,dpn,i); XdfOdmim = (gradientjd(XfOim',dmhu,i)'+gradientjd(XfOim',dmhu,2)')/2; XfOjm = zeros(size(XfO)); XfOjm(:,2:nmhu) = Xdeltajm(:,2:nmhu).*XfO(:,1:nmhu-1) + (1Xdeltaim(: ,2:nmhu)).*XfO(: ,2:nmhu); Xfojm(:,1) = XfO(:,1); XdfOdpjm = (gradientjd(XfOjm,dpn,i)+gradientjd(XfOjm,dpn,2))/2; XdfOdpjm(npn,:) = 2*XdfOdpjm(npn,:); Xdf0dmjm = gradientjd(Xf0',dmhu,1)'; if bouncemode >= 1, XSpOcoll = - XAm.*Xdf0dpim - XFm.*XfOim;%Collision momentum flux, not bounce averaged XSmhuOcoll = sqrt(X1mmhu2m).*XBt.*XdfOdmjm./Xpn;%Collision angular flux, not bounce averaged XSpOcoll-bav = - XAm.*XdfOdpim - XFm.*XfOim;%Collision momentum flux XSmhu&_coll-bav = sqrt(Ximmhu2m).*(XBt.*XdfOdmjm.*(1 + Xdphibm. /Xmhu2m)./Xpn);%Collision angular flux XSpOohm-bav = epsi(jr).*Xmhu.*Xfaim.*Xmmask./Xlambda;XOhmic electric field momentum flux XSmhu0_ohmbav = - epsi(jr)*sqrt(Xmmbihu2m). *Xf0jm. *Xmmask./Xlambdam; %Ohmic electric field angular flux XSpOlh-bav = - XDlhim.*Xmhu.*(Xmhu.*XdfOdpim + Xlmmhu2.*XdfOdmim./Xpnm)./Xlambda;XLH wave field momentum flux 209 XSmhuO-lhbav = sqrt(Ximmhu2m).*XDlhjm.*(Xmhum.*XdfOdpjm + Ximmhu2m.*XdfOdmjm./Xpn)./Xlambdam;LH wave field angular flux XSpO-cy-bav = - XDcyim.*Xmhu./Xmhu-psib.*Xlmmhu2.*(xpsib(jr)*XdfOdpim + (Xlmmhu2*xpsib(jr) xomega-cy(jr)./Xgammam).*XdfOdmim./Xpnm./Xmhu)./Xlambda;X/*EC wave field momentum flux XSmhuO-cy-bav = sqrt(Xlmmhu2m) .*XDcyjm. *Xmhum./Xmhu..psibm. *(XdfOdpjm. *(Xlmmhu2m*xpsib(jr) xomega-cy(jr)./Xgamma) + XdfOdmjm.*(Xlmmhu2m*xpsib(jr) xomegacy(jr) ./Xgamma) .2. /Xpn./Xmhum/xpsib(jr)) ./Xmhum. /Xlambdam; /EC wave field angular flux XSpObav = XSpOcoll-bav + XSpOohm-bav + XSpOlh-bav + XSpQcy-bav;%Total momentum flux XSmhuObav = XSmhu0_collbav + XSmhuOohmbav + XSmhuOlhbav + XSmhuOcy-bav; %Total angular flux XXSp'(:,:,jr) = XSpAbav; XXSmhu(:,:,jr) = XSmhuObav; % For g Xf0_gim = zeros(size(XfOg)); XfOgim(2:npn,:) = Xdeltaim(2:npn,:).*XfQg(l:npn-,:) + (1Xdeltaim(2:npn,:)).*XfOg(2:npn,:); XfOgim(1,:) = XfO-g(1,:); XdfOgdpim = gradientjd(XfOg,dpn,1); XdfOgdmim = (gradientjd(XfO-gim',dmhu,i)'+gradientjd(XfOgim',dmhu,2)')/2; Xf0_gjm = zeros(size(XfQg)); XfOgjm(:,2:nmhu) = Xdeltajm(:,2:nmhu).*XfOg(:,1:nmhu-1) + (1Xdeltaim(:,2:nmhiu)).*XfOg(:,2:nmhu); Xfogjm(:,1) = XfOg(:,1); Xdf0_gdpjm = (gradientjd(XfO-gjm,dpn,1)+gradientjd(XfO-gjm,dpn,2))/2; XdfOgdpjm(npn,:) = 2*XdfOgdpjm(npn,:); XdfOgdmjm = gradientjd(XfOg',dmhu,1)'; XSpOg-coll = - XAm.*XdfOgdpim - XFm.*Xfc-gim;%Collision momentum flux, not bounce averaged XSmhuO-g-coll = sqrt(X1mmhu2m).*XBt.*XdfOgdmjm./Xpn;%Collision angular flux , not bounce averaged XSpOg-coll-bav = XSmhu0_g-coll-bav - = XAm.*Xdf0_gdpim - XFm.*XfOgim;XCollision momentum flux sqrt(Xlmmhu2m).*(XBt.*XdfOgdmjm.*(1 + Xdphibm./Xmhu2m) ./Xpn) ;XCollision angular flux XSpOg-ohm-bav = epsi(jr). *Xmhu.*Xf0_gim.*Xmmask. /Xlambda;%Ohmic electric field momentum flux XSmhuO-g-ohm-bav = - epsi (jr)*sqrt(Xmmhlu2m). *Xf 0_gjm. *Xmmask. /Xlambdam; %Ohmic electric field angular flux 210 XSpOg-lh_bav = - XDlhim.*Xmhu.*(Xmhu.*Xdf&_gdpim + ... Xlmmhu2.*Xdf0_gdmim./Xpnm)./Xlambda;X.LH wave field momentum flux XSmhu0g-lh-bav = sqrt(Ximmhu2m).*XDlhjm.*(Xmhum.*XdfOgdpjm + ... Xlmmhu2m.*XdfOgdmjm./Xpn)./Xlambdam;LH wave field angular flux XSpOg-cy-bav = - XDcyim.*Xmhu./Xmhu-psib.*Xmmhu2.*(xpsib(jr)*XdfO-gdpim + (Xlmmihu2*xpsib(jr) - xomegacy(jr) ./Xgammam).*Xdf Ogdmim./Xpnm./Xmhu) ./Xlambda; XEC wave field momentum flux XSmhu0g-cy-bav = sqrt(Xmmhu2m) .*XDcyjm.*Xmhum./Xmhu-psibm.*(XdfO-gdpjm.*(Ximmi2m*xpsib(jr) xomega-cy(jr)./Xgamma) + XdfO.gdmjm.*(Ximmhu2m*xpsib(jr) xomegacy(jr) ./Xgamma) .2./Xpn./Xmhum/xpsib(jr)) ./Xmhum. /Xlambdam; /EC wave field angular flux XSpO-g-bav = XSpO-g-coll-bav + XSp0g-ohm-bav + XSpOg-lh-bav + XSpO-g-cy-bav;%Total momentum flux XSmhuOg_bav = XSmhu0g-collbav + XSmhu0g-ohm-bav + XSmhu0g-lh-bav + XSmhuOg-cy-bav;%Total angular flux XXSpOg(:,:,jr) = XSpOg-bav; XXSmhuO-g(:,:,jr) = XSmhuO.g_bav; % For f-tp XfOtpim = zeros(size(XfOtp)); XfOtpim(2:npn,:) = Xdeltaim(2:npn,:).*XfO-tp(1:npn-,:) + (1- Xdeltaim(2:npn,:)).*XfOtp(2:npn,:); XfOtpim(,:) = Xfotp(,:); XdfOtpdpim = gradientjd(XfOtp,dpn,i); XdfOtpdmim = (gradientjd(XfOtpim',dmhu,i)'+gradientjd(XfO-tpim',dmhu,2)')/2; Xf&-tpjm = zeros(size(XfOtp)); XfOtpjm(:,2:nmhu) = Xdeltajm(:,2:nmihu).*XfOtp(:,1:nmihu-1) + (1- Xdeltaim(:,2:nmhiu)).*XfOtp(:,2:nmhu); XfOtpjm(:,i) = XfOtp(:,i); XdfOtpdpjm = (gradientjd(XfOtpjm,dpn,1)+gradientjd(XfOtpjm,dpn,2))/2; XdfOtpdpjm(npn,:) = 2*Xdf0_tpdpjm(npn,:); XdfOtpdmjm = gradientjd(XfOtp',dmhu,i)'; % for EC bounce averaged fluxes for f-tp XfOtp-cy = XfOtp.*Xmhu-psib./Xmhu/xpsib(jr); XfOtp-cyim = zeros(size(XfOtp-cy)); XfO-tp-cyim(2:npn,:) = Xdeltaim(2:npn,:).*XfOtp-cy(1:npn-,:) + (1- Xdeltaim(2:npn,:)).*XfOtp(2:npn,:); XfOtp-cyim(,:) = Xfotp-cy(,:); XdfOtp-cydpim = gradientjd(XfOtp-cy,dpn,1); XdfOtp-cydmim = (gradientjd(XfOtp-cyim',dmhu,1)'+gradientjd(XfOtp-cyim',dmhu,2)')/2; 211 Xf0_tp-cyjm = zeros(size(XfOtp-cy)); XfOtp-cyjm(:,2:nmhu) = Xdeltajm(:,2:nmhu).*XfOtp-cy(:,1:nmhu-1) + (1- Xdeltaim(: ,2:nmhu)).*XfOtp_ cy(: ,2:nmhu); Xfotpcyjm(:,i) = Xfotp-cy(:,i); XdfOtp-cydpjm = (gradientjd(XfOtp-cyjm,dpn,1)+gradientjd(XfO-tp-cyjm,dpn,2))/2; XdfOtp-cydpjm(npn,:) = 2*XdfO-tp-cydpjm(npn,:); XdfOtp-cydmjm = gradientjd(XfOtp-cy',dmhu,i)'; XSpOtp-coll = - XAm.*XdfOtpdpim - XFm.*XfO-tpim;%Collision momentum flux, not bounce XSmhuOtp-coll = sqrt(Xmmhu2m).*XBt.*Xdf averaged 0_tpdmjm./Xpn;%Collision angular flux, not bounce averaged XSpOtp-coll-bav = Xmmask./Xlambda/(+ia(jr)).*(XAm.*XdfQtpdpim + - XFm.*Xf0_tpim);%Collision momentum flux XSmhuOtp-coll-bav = Xmmask./Xlambda/(i+ia(jr)).*sqrt(Xlmmhu2m).*(XBt.*Xdf0_tpdmjm.*(1 Xdphibm./Xmhu2m) ./Xpn) ;%Collision angular flux XSpOtp-ohm-bav = epsi (jr). *Xmhu. *XfO._tpim. *Xmmask. *Xlambda-tp. /Xlambda; %Ohmic electric field momentum flux XSmhu0tp-ohm-bav = epsi(jr)*srt(Xmmhu2m).*Xf - 0_tpjm. *Xmmask. *Xlambdatp. /Xlambdam;%Ohmic electric field angular flux XSpO-tp-lh-bav = - XDlhim.*Xmhu.*(Xmhu.*XdfOtpdpim + Xlmmhu2.*XdfOtpdmim./Xpnm)./Xlambda/(+ia(jr)) ;%LH wave field momentum flux XSmhu0_tp-lh-bav = sqrt(Ximmhu2m).*XDlhjm.*(Xmhum.*Xdf0_tpdpjm Xlmmhu2m.*XdfOtpdmjm./Xpn)./Xlambdam/(+ia(jr)) XSpO-tp-cy-bav = - + ... ;%LH wave field angular flux XDcyim.*Xmhu./Xmhu-psib.*Xlmmhu2.*(xpsib(jr)*XdfOtp-cydpim (Xlmmhu2*xpsib(jr) xomegacy(jr) ./Xgammam) .*Xdf + - 0_tpcydmim. /Xpnm. /Xmhu) ./Xlambda; XEC wave field momentum flux XSmhuOtp-cy-bav = sqrt(Xmmhu2m).*XDcyjm.*Xmhum./Xmhu-psibm.*(XdfO-tp-cydpjm.*(Ximmhil2m*xpsib(jr) xomega-cy(jr)./Xgamma) + XdfOtp-cydmjm.*(Xmmhu2m*xpsib(jr) - - xomega-cy(jr)./Xgamma).^2./Xpn./Xmhum/xpsib(jr))./Xmhum./Xlambdam;%EC wave field angular flux XSpOtp-bav = XSpOtp-coll-bav + XSpOtp-ohm-bav + XSp0tp-lh-bav + XSpO-tp-cy-bav;%Total momentum flux XSmhu0tp-bav = XSmhu0_tp-coll-bav + XSmhuOtp-ohm-bav + XSmhuOtp-lh-bav + XSmhuOtp-cy-bav;%Total angular flux XXSpOtp(:,:,jr) = XSpQtp-bav; XXSmhuO-tp(:,:,jr) = XSmhu0tp-bav; else 212 XSpOcoll = - XAm.*XdfOdpim - XFm.*XfOim;%Collision momentum flux, not bounce averaged XSmhuOcoll = sqrt(X1mmhu2m).*XBt.*XdfOdmjm./Xpn;%Collision angular flux, not bounce averaged XSpOohm = epsi(jr).*Xmhu.*XfOim;%Ohmic electric field momentum flux XSmhuOohm = - epsi(jr)*sqrt(Ximmhu2m).*XfOjm;XOhmic electric field angular flux XSpOlh = momentum flux XSmhuOlh - XDlhim.*Xmhu.*(Xmhu.*XdfOdpim = sqrt(Ximmhu2m).*XDlhjm.*(Xmhum.*XdfOdpjm + X1mmhiu2m.*Xdf0dmjm./Xpn);%LH wave + Xlmmhu2.*XdfOdmim./Xpnm); LH wave field field angular flux XSpOcy = - XDcyim.*Xlmmhu2.*(XdfOdpin + (Ximmhiu2 - xomega-cy(jr)./Xgammam).*XdfOdmim./Xpnm./Xmhu); /*EC wave field momentum flux XSmhuOcy = sqrt(Xlmmhu2m) .*XDcyjm. *(Xdf Odpjm. *(Xlmmhu2m xomega-cy(jr)./Xgamma) + XdfOdmjm.*(Ximmhu2mxomegacy(jr) ./Xgamma) .2./Xpn./Xmhum) ./Xmhum;;EC wave field angular flux XSpO = XSpO-coll + XSpOohm + XSpO-lh + XSpOcy;%Total momentum flux XSmhuO = XSmhuOcoll + XSmhuOohm + XSmhuOlh + XSmhuOcy;%Total angular flux X= XXSp(:,:,jr) = XSp; XXSmhuQ(:,:,jr) = XSmhu; XXSpOg(:,:,jr) = 0; XXShuOg(:,:,jr) = 0; XXSpOtp(:,:,jr) = 0; XXSmhuOtp(:,:,jr) = 0; end % Power densities calculations dPcollO = trapzyp([pnm',Xpn2m.*Xpnm.*XSpOcoll./Xgammam]); PcollO(jr) = -2*pi*trapzyp([mhu',dPcollO']) ;Power loss on collisions if bounce-mode >= 1, dPcollOg = trapzyp([pnm',Xpn2m.*Xpnm.*XSpOg-coll./Xgammam]); PcollO-g(jr) = -2*pi*trapzyp([mhu',dPcoll&.g']);%Power loss on collisions dPcollOtp = trapzyp([pnm',Xpn2m.*Xpnm.*XSpOtp-coll./Xgammam]); PcollOtp(jr) = -2*pi*trapzyp([mhu',dPcollOtp']);%Power Pcolltot(jr) = PcollO(jr) + Pcoll0_g(jr) loss on collisions + PcollOtp(jr); else Pcolltot(jr) = PcollO(jr); end 213 % Power densities calculations (flux-surface averaged) if bounce_mode >= 1, dPcollQ-fsav = trapzyp([pnm',Xpn2m.*Xpnm.*(i+ia(jr)).*Xlambda.*XSpQcoll-bav./Xgammam]); PcollO-fsav(jr) = -2*pi*trapzyp([mhu',dPcollOfsav']);%Power loss on collisions dPcollQ-g-fsav = trapzyp([pnm',Xpn2m.*Xpnm.*(+ia(jr)).*Xlambda.*XSpO.g-coll-bav./Xgammam]); PcollOg-fsav(jr) = -2*pi*trapzyp([mhu',dPcollOg-fsav']);%Power loss on collisions dPcollOtp-fsav = trapzyp([pnm' ,Xpn2m.*Xpnm.*(i+ia(jr)).*Xlambda.*XSpOtp-collbav./Xgammam]); PcollO-tp-fsav(jr) = -2*pi*trapzyp([mhu',dPcollQ-tp-fsav']) ;%Power loss on collisions dPabsO-lh_fsav = trapzyp([pnm',Xpn2m.*Xpnm.*(i+ia(jr)) .*Xlambda.*XSpQlhbav./Xgammam]); PabsOlh-fsav = 2*pi*trapzyp([mhu',dPabsOlh-fsav']);%LH absorbed power dPabsO-g-lh-fsav = trapzyp([pnm',Xpn2m.*Xpnm.*(i+ia(jr)).*Xlambda.*XSpO-g-lh-bav./Xgammam]); PabsOg-lh-fsav = 2*pi*trapzyp([mhu',dPabsOg-lh-fsav']);%LH absorbed power dPabsO-tp-lh-fsav = trapzyp([pnm',Xpn2m.*Xpnm.*(i+ia(jr)).*Xlambda.*XSpOtp-1h-bav./Xgammam]); PabsOtp-lh-fsav = 2*pi*trapzyp([mhu',dPabsOtp_lh_fsav']);%LH absorbed power dPabsOcy-fsav = trapzyp([pnm',Xpn2m.*Xpnm.*(i+ia(jr)).*Xlambda.*XSpOcy-bav./Xgammam]); PabsOcy-fsav = 2*pi*trapzyp([mhu',dPabsOcy-fsav']);%EC absorbed power dPabsOg-cy-fsav = trapzyp([pnm',Xpn2m.*Xpnm.*(i+ia(jr)).*Xlambda.*XSpOg-cy-bav./Xgmmam); PabsOg-cy-fsav = 2*pi*trapzyp([mhu',dPabsO-gcy-fsav']);%EC absorbed power dPabsO-tp-cy-fsav = trapzyp([pnm',Xpn2m.*Xpnm.*(1+ia(jr)).*Xlambda.*XSpOtpcy-bav./Xgammam]); PabsOtp-cy-fsav = 2*pi*trapzyp([mhu',dPabsOtp-cy-fsav']);%EC absorbed power PabsOfsav(jr) = PabsOlh-fsav + PabsOcy-fsav;XLH + EC absorbed power PabsQg-fsav(jr) = PabsO-g-lh-fsav + PabsOg_cy-fsav;%LH + EC absorbed power PabsOtp-fsav(jr) = PabsOtp-lh-fsav + PabsOtp-cy-fsav;XLH + EC absorbed power Pcolltotfsav(jr) = PcollOfsav(jr) + PcollOg-fsav(jr) + PcollOtp-fsav(jr); Pabstotfsav(jr) = PabsOfsav(jr) + PabsOg-fsav(jr) + PabsO-tp-fsav(jr); else dPabsO-lhfsav = trapzyp([pnm',Xpn2m.*Xpnm.*XSpOlh./Xgammam]); PabsOlhfsav = 2*pi*trapzyp([mhu',dPabsOlh-fsav']);%LH 214 absorbed power dPabsOcy-fsav = trapzyp([pnm',Xpn2m.*Xpnm.*XSpOcy./Xgammam]); PabsOcy-fsav = 2*pi*trapzyp([mhu',dPabsOcy-fsav']);%EC absorbed power PabsOfsav(jr) = PabsOlh_fsav + PabsOcy-fsav;%LH + EC absorbed power PabsOg-fsav(jr) = 0; PabsO.tp-fsav(jr) = 0; Pcoll0.fsav(jr) = PcollO(jr); Pcolltotfsav(jr) = Pcoltot(jr); Pabstot-fsav(jr) = PabsOfsav(jr) + PabsO-g-fsav(jr) + PabsOtp-fsav(jr); end if bouncemode >= 1, RR-fsav(jr,:) = 2*pi*pn2.*trapzyp([mhu',XSpObav'.*(i+ia(jr)).*Xlambda'] );Runaway rate else RR-fsav(jr,:) = 2*pi*pn2.*trapzyp([mhu',XSpO']);%Runaway rate end if epsi(jr) 0, currB-fsav(jr) = currtot.fsav(jr) - 0.5*RR-fsav(jr,npn-1)*max(v2)/epsi(jr); %Bulk current (useful for non-zero dc electric field only) ****** -= else currB-fsav(jr) = curr-tot.fsav(jr); end end 215 Bibliography [1] P. Bonoli, Linear theory of lower hybrid heating, IEEE Transactions on Plasma Science PS-12 (1984), no. 2, 95-107. [2] N.J. Fisch A.H. Boozer, Creating an asymmetric plasma resistivity with waves, Phys. Rev. Lett. 45 (1980), no. 9, 720-722. [3] M. Brambilla, Propagationand absorption of waves at the lower hybrid resonance, Plasma Phys. 18 (1976), 669-674. [4] J.S. Chang G Cooper, J. Comp. Phys. 6 (1970), 1. [5] C.F. Kennel F. Engelmann, Velocity space diffusion from weak plasma turbulence in a mag- netic field, Phys. Fluids 9 (1966), no. 12, 2377-2387. [6] A. Simonetto et al., A numerical code for the solution of the relativistic bounce-averaged fokker-planck equation, Tech. Report FP 00/08, Istituto Di Fisica Del Plasma, Via Cozzi 53 - 20125 Milano (Italy), 2000. [7] 0. Sauter et al., Steady-state fully non-inductive current driven by electron cyclotron waves in a magnetically confined plasma, Phys. Rev. Lett. 84 (2000), no. 15, 3322-3325. [8] , Steady-state fully noninductive operation with electron cyclotron current drive and current profile control in the tokamak a configuration variable (tcv), Phys. Plasmas 8 (2001), no. 5, 2199-2207. [9] P.T. Bonoli et al., Modelling of advanced tokamak scenarios with lhcd in alcator c-mod, Nuclear Fusion 40 (2000), no. 6, 1251-1256. [10] V.S. Chan et al., Kinetic theory of electron cyclotron current drive in a toroidal device, Nuclear Fusion 22 (1982), no. 6, 787-795. [11] C.F.F. Karney N.J. Fisch, Efficiency of current drive by fast waves, Phys. Fluids 28 (1984), no. 1, 116-126. 216 [12] V. Erckmann U. Gasparino, Electron cyclotron current drive in toroidal fusion plasmas, Plasma Phys. and Cont. Fusion 36 (1994), 1869-1962. [13] M. N. Rosenbluth R. D. Hazeltine F. L. Hinton, Plasma transport in toroidal confinement systems, phys. fluids 15 (1972), no. 1, 116. [14] J.D. Huba, Nrl plasma formulary, Naval Research Laboratory. [15] B.J. Braams C.F.F Karney, Conductivity of a relativisticplasma, Phys. Fluids B 1 (1989), no. 7, 1355-1368. [16] C.F.F. Karney, Pokker-planck and quasilinearcodes, Comp. Phys. Rep 4 (1986), 183-244. [17] I. Lerche, Qusilinear theory of resonant diffusion in a magneto-active relativistic plasma, Phys. Fluis 11 (1968), no. 8, 1720-1726. [18] 0. Sauter C. Angioni Y.R. Lin-Liu, Neoclassical conductivity and bootstrap currentformulas for general axisymmetric equilibria and arbitrary collisionality regime, Phys. Plasmas 6 (1999), no. 7, 2834-2839. [19] T.C. Luce, Electron cyclotron current drive in diii-d, Proc. of 13th Topical Conference on RF Power in Plasmas, Stephano Bernabei, editor, Annapolis, MD, 1999. [20] J. Killeen G.D. Kerbel M.G. McCoy and A.A. Mirin, Computational methods for kinetic models of magnetically confined plasmas, Springer-Verlag, 1986. [21] T. Ohkawa, Steady-state operation of tokamaks by rf heating, Tech. Report 4356.007.001, General Atomic, 1976. [22] Y. Peysson and the TORE SUPRA Team, Progress towards high power lower hybrid current drive in tore supra, Plasma Phys. and Cont. Fusion 42 (2000), no. 12B, 87-114. [23] M. Porkolab, Advanced tokamak operation of alcator c-mod with lhcd profile control, Presented at the Alcator C-Mod Program Advisory Committee Meeting, MIT, Feb. 7 1999. [24] P. Bellan M. Porkolab, Phys. Rev. Lett. 34 (1975), 124. [25] J.P.S Bizarro P. Rodrigues, Fast and accurate two dimentionalfokker-planck calculations in velocity space for rf heating and current drive, Nuclear Fusion 37 (1997), no. 11, 1509-1513. [26] Y. Peysson M Schoucri, An approximate factorization procedure for solving nine-point elliptic difference equations. applicationfor a fast 2-d relativistic fokker-planck solver, Comp. Phys. Comm. 109 (1998), 55-80. 217 [27] S. Schultz, Lower hybrid and electron cyclotron current drive with bootstrap current in tokamaks, Ph.D. thesis, MIT, 1999. [28] M. Shoucri I. Shkarofsky, A fast 2dfokker-planck solver with synergistic effects, Comp. Phys. Comm. 82 (1994), 287-305. [29] I.P. Shkarofsky M.M. Shoucri, Modelling of lower hybrid current drive in the presence of spacial radial diffusion, Nuclear Fusion 37 (1997), no. 4, 539-547. [30] S.P. Hirshman D.J. Sigmar, Neoclassicaltransport of impurities in tokamak plasmas,Nuclear Fusion 21 (1981), no. 9, 1079-1201. [31] T.H. Stix, Radiation and absorbtion via mode conversion in a homogeneous collision-free plasma, Phys. Rev. Lett. 15 (1965), no. 23, 878-882. [32] , Waves in plasmas, American Institute of Physics, 1992. [33] A.A. Vedenov, Theory of a weakly turbulent plasma, Reviews of Plasma Physics, vol. 3, pp. 229-277, M.A. Lemtovich ed., Consultants Bureau, New-York, 1967. 218