rundke_runaway

PURPOSE ^

This script is used to run LUKE for the runaway problem

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 This script is used to run LUKE for the runaway problem

 by J. Decker, Y. Peysson and E. Nilsson

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %
0002 % This script is used to run LUKE for the runaway problem
0003 %
0004 % by J. Decker, Y. Peysson and E. Nilsson
0005 %
0006 clear all
0007 clear mex
0008 clear functions
0009 close all
0010 warning('off')
0011 %
0012 permission = test_permissions_yp;
0013 %
0014 if ~permission 
0015     disp('Please move the script to a local folder where you have write permission before to run it')
0016     return;
0017 end
0018 %
0019 % *********************** This part must be specified by the user *****************************
0020 %
0021 % printing option
0022 %
0023 id_simul = 'Runaway_alpha5_sync';%Simulation ID
0024 p_opt = -1;% printing and saving options : (-1) do nothing (0) print figures (1) print figures and save figures and results (2) save figures and results
0025 %
0026 [qe,me,~,~,e0,~,~,mc2] = pc_dke_yp;%Universal physics constants
0027 %
0028 % calculation mode : (0) quasi steady state (1) time evolution
0029 %
0030 opt.timevol = 1;
0031 %
0032 % normalized electric field (with respect to the Critical field Ec)
0033 %
0034 alpha = 5;%E/Ec
0035 %
0036 % temperature betath2 = Te/mc2
0037 % (betath2 = 10^(-6) is validated for NR limit)
0038 %
0039 betath2 = 3/mc2;
0040 %
0041 % the ratio of the syncrotron reaction force to the collisional drag scales as wc2/wp2
0042 % -> set wpr = 0 or opt.synchro_mode = 0 to ignore syncrotron reaction force
0043 %
0044 wpr = ([4]*qe/me)^2/([1e19]*qe^2/(me*e0));%wc2/wp2
0045 %
0046 opt.synchro_mode = 1;
0047 %
0048 % ion charge (single species, cold ions)
0049 %
0050 Zi = 1.5;
0051 %
0052 Emin = NaN;%runaway energy threshold in MeV (limit where electrons are "counted")
0053 % Emax = (sqrt(20^2*betath2+1)-1)*mc2/1e3;%1;%grid energy threshold in MeV [(sqrt(pnmax_S^2*betath2+1)-1)*mc2/1e3 = 0.63163 corresponds to pnmax_S = 20 for betath = 0.1]
0054 %
0055 % collision mode :
0056 % (0) : Relativistic Maxwellian background
0057 % (1) : High-velocity limit
0058 % (2) : Linearized Belaiev-Budker (momentum-conserving)
0059 %
0060 opt.coll_mode = 0;
0061 opt.bounce_mode = 0;%1;% bounce-averaged calculation
0062 opt.boundary_mode_f = 0;% Enforcing the Maxwellian initial value at the first "boundary_mode_f" grid points
0063 opt.norm_mode_f = 0;%Local normalization of f0 at each iteration (0) no, the default value when the numerical conservative scheme is correct, (1) yes
0064 %
0065 % time grid (normalized to collision time) -> you can specify :
0066 % - linear arbitrary grid with tn array                 : opt.tnmin = 0 ;opt.tn = 1000:1000:10000,dtn = NaN;opt.tnmin = 0
0067 % - linear arbitrary grid with dtn array                : opt.tnmin = 0 ;opt.tn = NaN;dtn = 1000*ones(1,10);
0068 % - linear grid with tnmax and grid step                : opt.tnmin = 0 ;opt.tn = 10000;dtn = 1000;
0069 % - linear grid with tnmax and number of grid steps     : opt.tnmin = 0 ;opt.tn = 10000;dtn = 10i;
0070 % - log grid with tnmin, tnmax and number of grid steps : opt.tnmin = 1 ;opt.tn = 10000;dtn = 10;
0071 %
0072 opt.tnmin = 1;%0;% > 0 for log scale
0073 opt.tn = 1e6;%10000;% 10000 is time for asymptotic solution
0074 opt.dtn = 61;%1000;% 10 time steps required for accurate runaway solution - see rundke_dtn
0075 %
0076 % momentum space grid -> you can specify nmhu_S and either
0077 % - the momentum grid pn_S directly
0078 % - the parameters np_S, pnmax_S, np_tail, pnmax_S_tail as follows
0079 %
0080 grid.nmhu_S = 101;% number of pitch angle grid points
0081 grid.np_S = 101;% number of bulk momentum grid points
0082 grid.pnmax_S = 20;%sqrt(((1 + Emax*1e3/mc2)^2 - 1)/betath2);% maximum of bulk momentum (normalized to pT) [pn = 28 corresponds to 1 MeV electrons for betath = 0.1]
0083 grid.np_tail = 0;%100;% number of tail momentum grid points
0084 grid.pnmax_S_tail = 524;% maximum of tail momentum (normalized to pT) [for Te = 3keV 5:5:30 MeV corresponds to pnmax = 140,268,396,524,651,779]
0085 %
0086 % avalanche modelling :
0087 %
0088 % dkeparam.pnmin0_KO is the low threshold on initial primary electrons for the knock-on operator
0089 % The condition pnmin0_KO <= pnmax_S is enforced so that the source can be calculated
0090 % - For pnmin0_KO = NaN, the limit is set to pnmax_S
0091 %
0092 % dkeparam.pnmax1_KO is the high threshold on initial secondary (bulk) electrons for the knock-on operator
0093 % in principle, pnmax1_KO <= pnmin2_KO so that secondary electrons can only 'lose energy'
0094 % - For pnmax1_KO = 0, the bulk population is taken as f(1)/fM(1), a logical estimate considering the sink term
0095 % - For pnmax1_KO = NaN, the limit is set to pnmin2_KO
0096 %
0097 % dkeparam.pnmin2_KO is the low threshold on final secondary electrons for the knock-on operator
0098 % - If pnmin2_KO == NaN, the current value of pc (or pnmin_S) is used
0099 % - If pnmin2_KO is imaginary, it is normalized to the actual thermal momentum (instead of reference)
0100 %
0101 % dkeparam.pnmax2_KO is the high threshold on final secondary electrons for the knock-on operator
0102 % in principle, as rosenbluth assumes p0 > p1 we must separate the domain of source runaways (ex : 1MeV) from that of secondary electrons.
0103 % Therefore, we should ensure pnmax2_KO <= pnmin0_KO
0104 % - For pnmax2_KO = NaN, the limit is set to pnmin0_KO
0105 % - If pnmax2_KO > pnmax_S (which violate the principle described above), the source between pnmax_S and pnmax2_KO is calculated as a "number"
0106 %
0107 opt.avalanche_mode = false;%true;%
0108 opt.pnmin0_KO = NaN;% pnmin0_KO = 28 corresponds to 1 MeV electrons for betath = 0.1
0109 opt.pnmax1_KO = 0;%NaN;%grid.pnmax_S;%
0110 opt.pnmin2_KO = 1i;%NaN;%1;% 1i is the "natural" limit as for lower energies it is simply the identity operator
0111 opt.pnmax2_KO = NaN;%100;%
0112 %
0113 path_simul = '';%Simulation path
0114 %
0115 if opt.bounce_mode == 0,
0116     id_equil = 'TScyl';% cylindrical equilibrium, rho_S has no effect
0117 else
0118     id_equil = 'TScirc_e1';% toroidal equilibirum with a/R = 1 : then rho_S = r/R
0119 end
0120 id_wave = '';
0121 %
0122 rho_S = 0.5;
0123 %
0124 graph.itdisp = 21:20:61;%[1,5,10];% display times - only used if opt.timevol > 0
0125 %
0126 if alpha == 2,
0127     %
0128     % E/Ec = 2
0129     %
0130     graph.ylim_norm = [1e-35,1e1];
0131     graph.ytick_norm = 10.^(-35:5:5);
0132     graph.ylim_gamma = [1e-34,1e-18];
0133     graph.ytick_gamma = 10.^(-34:4:-18);
0134     graph.ylim_f = [1e-45,1e5];
0135     graph.ytick_f = 10.^(-45:5:5);
0136 elseif alpha == 3,
0137     %
0138     % E/Ec = 3
0139     %
0140     graph.ylim_norm = [1e-20,1e1];
0141     graph.ytick_norm = 10.^(-20:5:5);
0142     graph.ylim_gamma = [1e-24,1e-12];
0143     graph.ytick_gamma = 10.^(-24:4:-12);
0144     graph.ylim_f = [1e-35,1e5];
0145     graph.ytick_f = 10.^(-35:5:5);
0146 elseif alpha == 5,
0147     %
0148     % E/Ec = 5
0149     %
0150     graph.ylim_norm = [1e-9,1e1];
0151     graph.ytick_norm = 10.^(-10:2:2);
0152     graph.ylim_gamma = [1e-12,1e-4];
0153     graph.ytick_gamma = 10.^(-12:2:-4);
0154 else
0155     graph.ylim_norm = NaN;
0156     graph.ylim_gamma = NaN;
0157 end
0158 %
0159 %************************************************************************************************************************************
0160 %
0161 opt.pnmin_S = sqrt(((1 + Emin*1e3/mc2)^2 - 1)/betath2);
0162 %
0163 % RUN LUKE
0164 %
0165 [RR,mksa,Ec,f,tn,tRR,tnorm] = frundke_runaway(id_simul,alpha,betath2,wpr,Zi,opt,grid,id_equil,id_wave,rho_S);
0166 %
0167 %************************************************************************************************************************************
0168 %
0169 % PROCESS DATA
0170 %
0171 fproc_runaway(RR,mksa,Ec,f,tn,tRR,tnorm,'','','','',alpha,betath2,wpr,Zi,opt,grid,id_equil,rho_S,graph,p_opt,id_simul)
0172 %
0173 %************************************************************************************************************************************
0174 %
0175 if p_opt > 0,
0176     filename = [path_simul,'DKE_RESULTS_',id_simul,'.mat'];
0177     save(filename);
0178     info_dke_yp(2,['Data saved in ',filename]);
0179 end

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.