Calculate the external sink and source coefficients for the 3D electron relativistic drift kinetic solver (right-hand side terms of the FP equation. Some sink and source terme may be described by Krook term. See magnetic ripple case for example) by Y. Peysson (CEA-DRFC) (yves.peysson@cea.fr) and J. Decker (CEA-DRFC) (joan.decker@cea.fr) modified version for runaway implementation (03/07/2007) (D Schmitt) Warning : the call line in main must be modified; the number of argument has changed.
0001 function [XXsinksource] = sinksourcecoeffbuilder_dke_yp(dkeparam,display,gridDKE,mksa,Zbouncecoef,XXsinksource_in) 0002 % 0003 % Calculate the external sink and source coefficients for the 3D electron 0004 % relativistic drift kinetic solver (right-hand side terms of the FP 0005 % equation. Some sink and source terme may be described by Krook term. 0006 % See magnetic ripple case for example) 0007 % 0008 % by Y. Peysson (CEA-DRFC) (yves.peysson@cea.fr) and J. Decker (CEA-DRFC) (joan.decker@cea.fr) 0009 % 0010 % modified version for runaway implementation (03/07/2007) (D Schmitt) 0011 % 0012 % Warning : the call line in main must be modified; the number of 0013 % argument has changed. 0014 % 0015 time0 = clock; 0016 timeCPU0 = cputime; 0017 memoryLU_f = 0; 0018 memoryLU_g = 0; 0019 % 0020 bounce_mode = dkeparam.bounce_mode; 0021 % 0022 display_mode = display.display_mode; 0023 % 0024 npn = gridDKE.npn; 0025 nmhu = gridDKE.nmhu; 0026 nr = gridDKE.nr; 0027 XXpn2=gridDKE.XXpn2; 0028 Zmask_f0_Tp=Zbouncecoef.Zmask_f0_Tp; 0029 Zmask_f0_Tm=Zbouncecoef.Zmask_f0_Tm; 0030 Zmask_f0_P=Zbouncecoef.Zmask_f0_P; 0031 0032 % 0033 if isempty(XXsinksource_in),XXsinksource = zeros(npn,nmhu,nr); 0034 % 0035 else 0036 % 0037 if bounce_mode==1 0038 for ir=1:nr %symetrization of the trapped region 0039 XXsinksource(:,Zmask_f0_Tp{ir},ir) = ( XXsinksource_in(:,Zmask_f0_Tp{ir},ir) +fliplr(XXsinksource_in(:,Zmask_f0_Tm{ir},ir)) )/2; 0040 XXsinksource(:,Zmask_f0_Tm{ir},ir) = XXsinksource_in(:,Zmask_f0_Tm{ir},ir); % symetrization useless here 0041 XXsinksource(:,Zmask_f0_P{ir},ir )= XXsinksource_in(:,Zmask_f0_P{ir},ir); 0042 end 0043 else XXsinksource=XXsinksource_in; 0044 end 0045 % 0046 % partial Jacobian multiplication to avoid singularities, and normalization 0047 XXsinksource = XXsinksource/(mksa.nhu_ref*mksa.ne_ref); 0048 end 0049 % 0050 %