bounceparam_dke_yp

PURPOSE ^

SYNOPSIS ^

function [xq,xqtilde,xqbar,xqhat,xqcronos,XXheaviside,XXheaviside_p,XXheaviside_m,Xxlambda,Xxlambda_p,Xxlambda_m,XXlambda,XXRlambda_m,XXRlambda_p,XXlambda_p2m1,XXRlambda_p2m1_m,XXRlambda_p2m1_p,XXRlambda_p0p3,XXRlambda_p2p2_m,XXRlambda_p2p2_p,XXlambda_p2m2p2,XXRlambda_b_p1p1,XXlambda_b_p1m1p2,XXRlambda_b_p1m1p2,XXRlambda_b_p1m1p2_m,XXRlambda_b_p1m1p2_p,XXlambda_b_p1m1,XXRlambda_b_p1m1,XXRlambda_b_p1m1_m,XXRlambda_b_p1m1_p,XXRlambda_b_p1m2_m,XXRlambda_b_p1m2_p,XXlambda_b_p2m2p2,XXRlambda_b_p2m2p2,XXRlambda_b_p2m2p2_m,XXRlambda_b_p2m2p2_p,XXlambda_b_p3m2,XXRlambda_b_p3m2_m,XXRlambda_b_p3m2_p,XXlambda_b_p2,XXlambda_b_p1m3p4,XXlambda_b_p1m2p2]= bounceparam_dke_yp(bounce_mode,equil_mode,display_mode,mhu,mhum,mhup,npn,equilDKE)

DESCRIPTION ^

by Y.Peysson <yves.peysson@cea.fr> (CEA-DRFC) and J. Decker <joan.decker@cea.fr> (CEA-DRFC)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [xq,xqtilde,xqbar,xqhat,xqcronos,...
0002     XXheaviside,XXheaviside_p,XXheaviside_m,...
0003     Xxlambda,Xxlambda_p,Xxlambda_m,...
0004     XXlambda,XXRlambda_m,XXRlambda_p,...
0005     XXlambda_p2m1,XXRlambda_p2m1_m,XXRlambda_p2m1_p,...
0006     XXRlambda_p0p3,XXRlambda_p2p2_m,XXRlambda_p2p2_p,...
0007     XXlambda_p2m2p2,...
0008     XXRlambda_b_p1p1,...
0009     XXlambda_b_p1m1p2,XXRlambda_b_p1m1p2,XXRlambda_b_p1m1p2_m,XXRlambda_b_p1m1p2_p,...
0010     XXlambda_b_p1m1,XXRlambda_b_p1m1,XXRlambda_b_p1m1_m,XXRlambda_b_p1m1_p,...
0011     XXRlambda_b_p1m2_m,XXRlambda_b_p1m2_p,...
0012     XXlambda_b_p2m2p2,XXRlambda_b_p2m2p2,XXRlambda_b_p2m2p2_m,XXRlambda_b_p2m2p2_p,...
0013     XXlambda_b_p3m2,XXRlambda_b_p3m2_m,XXRlambda_b_p3m2_p,...
0014     XXlambda_b_p2,...
0015     XXlambda_b_p1m3p4,XXlambda_b_p1m2p2]...
0016 =  bounceparam_dke_yp(bounce_mode,equil_mode,display_mode,...
0017     mhu,mhum,mhup,npn,equilDKE)
0018 %
0019 %by Y.Peysson <yves.peysson@cea.fr> (CEA-DRFC) and J. Decker <joan.decker@cea.fr> (CEA-DRFC)
0020 %
0021 etime_bounce = 0;
0022 time0 = clock;
0023 %
0024 nr = size(equilDKE.Xx,1);
0025 nmhu = length(mhu);
0026 %
0027 [xq,xqtilde,xqbar,xqhat,xqcronos] = qfactors_dke_yp(equil_mode,equilDKE.Rp,equilDKE.ap,...
0028     equilDKE.Xx,equilDKE.Xy,equilDKE.XBx,equilDKE.XBy,equilDKE.XBphi,...
0029     equilDKE.xx0,equilDKE.xB0,equilDKE.xBT0,equilDKE.xBp0);%q factors calculations
0030 %
0031 if bounce_mode == 1,
0032     %
0033     [xymaskT,xylambda,xylambda_p2m1,xylambda_p0p3,xylambda_p2p2,xylambda_p2m2p2,xylambda_b_p1p1,xylambda_b_p1m1p2,xylambda_b_p1m1,xylambda_b_p1m2,xylambda_b_p2m2p2,xylambda_b_p3m2,xylambda_b_p2,xylambda_b_p1m3p4,xylambda_b_p1m2p2]...
0034         = bounce_dke_jd(equil_mode,mhu,equilDKE,xqtilde);
0035     [xymaskT_p,xylambda_p,xylambda_p2m1_p,xylambda_p0p3_p,xylambda_p2p2_p,xylambda_p2m2p2_p,xylambda_b_p1p1_p,xylambda_b_p1m1p2_p,xylambda_b_p1m1_p,xylambda_b_p1m2_p,xylambda_b_p2m2p2_p,xylambda_b_p3m2_p,xylambda_b_p2_p,xylambda_b_p1m3p4_p,xylambda_b_p1m2p2_p]...
0036         = bounce_dke_jd(equil_mode,mhup,equilDKE,xqtilde,xymaskT,+1);
0037     [xymaskT_m,xylambda_m,xylambda_p2m1_m,xylambda_p0p3_m,xylambda_p2p2_m,xylambda_p2m2p2_m,xylambda_b_p1p1_m,xylambda_b_p1m1p2_m,xylambda_b_p1m1_m,xylambda_b_p1m2_m,xylambda_b_p2m2p2_m,xylambda_b_p3m2_m,xylambda_b_p2_m,xylambda_b_p1m3p4_m,xylambda_b_p1m2p2_m]...
0038         = bounce_dke_jd(equil_mode,mhum,equilDKE,xqtilde,xymaskT,-1);
0039 %
0040     XXheaviside = repmat(reshape(~xymaskT',[1,nmhu,nr]),[npn,1,1]);%For selecting the circulating population only
0041     XXheaviside_p = repmat(reshape(~xymaskT_p',[1,nmhu,nr]),[npn,1,1]);%For selecting the circulating population only
0042     XXheaviside_m = repmat(reshape(~xymaskT_m',[1,nmhu,nr]),[npn,1,1]);%For selecting the circulating population only
0043     %
0044     XXlambda = repmat(reshape(xylambda',[1,nmhu,nr]),[npn,1,1]);
0045     XXlambda_p = repmat(reshape(xylambda_p',[1,nmhu,nr]),[npn,1,1]);
0046     XXlambda_m = repmat(reshape(xylambda_m',[1,nmhu,nr]),[npn,1,1]);
0047     XXlambda_m(find(XXlambda_m==0)) = eps;
0048      XXlambda(find(XXlambda==0)) = eps;
0049      XXlambda_p(find(XXlambda_p==0)) = eps;
0050 %
0051     XXRlambda_p = XXlambda_p./XXlambda;
0052     XXRlambda_m = XXlambda_m./XXlambda;    
0053     %
0054     Xxlambda = xylambda';
0055     Xxlambda_p = xylambda_p';
0056     Xxlambda_m = xylambda_m'; 
0057     %
0058     %For flux surface averaged Ohmic electric field
0059     %
0060     XXlambda_b_p1m3p4 = repmat(reshape(xylambda_b_p1m3p4',[1,nmhu,nr]),[npn,1,1]);
0061     XXlambda_b_p1m2p2 = repmat(reshape(xylambda_b_p1m2p2',[1,nmhu,nr]),[npn,1,1]);
0062     %
0063     %Fokker-Planck terms
0064     %
0065     XXlambda_p2m1 = repmat(reshape(xylambda_p2m1',[1,nmhu,nr]),[npn,1,1]);
0066     XXlambda_p2m1_p = repmat(reshape(xylambda_p2m1_p',[1,nmhu,nr]),[npn,1,1]);
0067     XXlambda_p2m1_m = repmat(reshape(xylambda_p2m1_m',[1,nmhu,nr]),[npn,1,1]);
0068     XXlambda_p0p3 = repmat(reshape(xylambda_p0p3',[1,nmhu,nr]),[npn,1,1]);
0069     XXlambda_p2p2_p = repmat(reshape(xylambda_p2p2_p',[1,nmhu,nr]),[npn,1,1]);
0070     XXlambda_p2p2_m = repmat(reshape(xylambda_p2p2_m',[1,nmhu,nr]),[npn,1,1]);
0071     XXRlambda_p2m1_p = XXlambda_p2m1_p./XXlambda_p;
0072     XXRlambda_p2m1_p(find(isnan(XXRlambda_p2m1_p))) = eps;
0073     XXRlambda_p2m1_m = XXlambda_p2m1_m./XXlambda_m;
0074     XXRlambda_p2m1_m(find(isnan(XXRlambda_p2m1_m))) = eps;
0075     XXRlambda_p0p3 = XXlambda_p0p3./XXlambda;
0076     XXRlambda_p0p3(find(isnan(XXRlambda_p0p3))) = eps;
0077     XXRlambda_p2p2_p = XXlambda_p2p2_p./XXlambda_p;
0078     XXRlambda_p2p2_p(find(isnan(XXRlambda_p2p2_p))) = eps;
0079     XXRlambda_p2p2_m = XXlambda_p2p2_m./XXlambda_m;
0080     XXRlambda_p2p2_m(find(isnan(XXRlambda_p2p2_m))) = eps;
0081     %
0082     XXlambda_b_p1p1 = repmat(reshape(xylambda_b_p1p1',[1,nmhu,nr]),[npn,1,1]);
0083     XXRlambda_b_p1p1 = XXlambda_b_p1p1./XXlambda;    
0084     %
0085     XXlambda_b_p1m1p2 = repmat(reshape(xylambda_b_p1m1p2',[1,nmhu,nr]),[npn,1,1]);
0086     XXlambda_b_p1m1p2_p = repmat(reshape(xylambda_b_p1m1p2_p',[1,nmhu,nr]),[npn,1,1]);
0087     XXlambda_b_p1m1p2_m = repmat(reshape(xylambda_b_p1m1p2_m',[1,nmhu,nr]),[npn,1,1]);
0088     XXRlambda_b_p1m1p2 = XXlambda_b_p1m1p2./XXlambda;    
0089     XXRlambda_b_p1m1p2_p = XXlambda_b_p1m1p2_p./XXlambda_p;
0090     XXRlambda_b_p1m1p2_p(find(isnan(XXRlambda_b_p1m1p2_p))) = eps;
0091     XXRlambda_b_p1m1p2_m = XXlambda_b_p1m1p2_m./XXlambda_m;
0092     XXRlambda_b_p1m1p2_m(find(isnan(XXRlambda_b_p1m1p2_m))) = eps;
0093     %
0094     %Drift kinetic terms
0095     %
0096     XXlambda_p2m2p2 = repmat(reshape(xylambda_p2m2p2',[1,nmhu,nr]),[npn,1,1]);
0097     %
0098     XXlambda_b_p1m1 = repmat(reshape(xylambda_b_p1m1',[1,nmhu,nr]),[npn,1,1]);
0099     XXlambda_b_p1m1_p = repmat(reshape(xylambda_b_p1m1_p',[1,nmhu,nr]),[npn,1,1]);
0100     XXlambda_b_p1m1_m = repmat(reshape(xylambda_b_p1m1_m',[1,nmhu,nr]),[npn,1,1]);
0101     XXRlambda_b_p1m1 = XXlambda_b_p1m1./XXlambda;
0102     XXRlambda_b_p1m1_p = XXlambda_b_p1m1_p./XXlambda_p;
0103     XXRlambda_b_p1m1_p(find(isnan(XXRlambda_b_p1m1_p))) = eps;
0104     XXRlambda_b_p1m1_m = XXlambda_b_p1m1_m./XXlambda_m;
0105     XXRlambda_b_p1m1_m(find(isnan(XXRlambda_b_p1m1_m))) = eps;
0106     %
0107     XXlambda_b_p1m2 = repmat(reshape(xylambda_b_p1m2',[1,nmhu,nr]),[npn,1,1]);
0108     XXlambda_b_p1m2_p = repmat(reshape(xylambda_b_p1m2_p',[1,nmhu,nr]),[npn,1,1]);
0109     XXlambda_b_p1m2_m = repmat(reshape(xylambda_b_p1m2_m',[1,nmhu,nr]),[npn,1,1]);
0110     XXRlambda_b_p1m2_p = XXlambda_b_p1m2_p./XXlambda_p;
0111     XXRlambda_b_p1m2_p(find(isnan(XXRlambda_b_p1m2_p))) = eps;
0112     XXRlambda_b_p1m2_m = XXlambda_b_p1m2_m./XXlambda_m;
0113     XXRlambda_b_p1m2_m(find(isnan(XXRlambda_b_p1m2_m))) = eps;
0114     %
0115     XXlambda_b_p2m2p2 = repmat(reshape(xylambda_b_p2m2p2',[1,nmhu,nr]),[npn,1,1]);
0116     XXRlambda_b_p2m2p2 = XXlambda_b_p2m2p2./XXlambda;
0117     XXlambda_b_p2m2p2_p = repmat(reshape(xylambda_b_p2m2p2_p',[1,nmhu,nr]),[npn,1,1]);
0118     XXlambda_b_p2m2p2_m = repmat(reshape(xylambda_b_p2m2p2_m',[1,nmhu,nr]),[npn,1,1]);
0119     XXRlambda_b_p2m2p2_p = XXlambda_b_p2m2p2_p./XXlambda_p;
0120     XXRlambda_b_p2m2p2_p(find(isnan(XXRlambda_b_p2m2p2_p))) = eps;
0121     XXRlambda_b_p2m2p2_m = XXlambda_b_p2m2p2_m./XXlambda_m;
0122     XXRlambda_b_p2m2p2_m(find(isnan(XXRlambda_b_p2m2p2_m))) = eps;
0123     %
0124     XXlambda_b_p3m2 = repmat(reshape(xylambda_b_p3m2',[1,nmhu,nr]),[npn,1,1]);
0125     XXlambda_b_p3m2_p = repmat(reshape(xylambda_b_p3m2_p',[1,nmhu,nr]),[npn,1,1]);
0126     XXlambda_b_p3m2_m = repmat(reshape(xylambda_b_p3m2_m',[1,nmhu,nr]),[npn,1,1]);
0127     XXRlambda_b_p3m2_p = XXlambda_b_p3m2_p./XXlambda_p;
0128     XXRlambda_b_p3m2_p(find(isnan(XXRlambda_b_p3m2_p))) = eps;
0129     XXRlambda_b_p3m2_m = XXlambda_b_p3m2_m./XXlambda_m;
0130     XXRlambda_b_p3m2_m(find(isnan(XXRlambda_b_p3m2_m))) = eps;
0131     %
0132     XXlambda_b_p2 = repmat(reshape(xylambda_b_p2',[1,nmhu,nr]),[npn,1,1]);
0133     XXlambda_b_p2_p = repmat(reshape(xylambda_b_p2_p',[1,nmhu,nr]),[npn,1,1]);
0134     XXlambda_b_p2_m = repmat(reshape(xylambda_b_p2_m',[1,nmhu,nr]),[npn,1,1]);
0135     %
0136     etime_bounce = etime_bounce + etime(clock,time0);
0137     if display_mode >= 1,info_dke_yp(2,['Bounce averaging coefficients calculations done in ',num2str(etime_bounce),' (s)']);end    
0138 %
0139 %Non-axisymmetric corrections as done by M. Ju et al. in Phys. Plasmas, 9 (2002) 493 (to be used only with FP calculations, and tested for TORE SUPRA only)
0140 %may be inserted here. Work to be done...
0141 %
0142 else  
0143     XXheaviside = ones(npn,nmhu,nr);
0144     XXheaviside_p = ones(npn,nmhu,nr);
0145     XXheaviside_m = ones(npn,nmhu,nr);
0146     %
0147     XXlambda = ones(npn,nmhu,nr);
0148     Xxlambda = ones(nmhu,nr);
0149     Xxlambda_p = ones(nmhu,nr);
0150     Xxlambda_m = ones(nmhu,nr);
0151     %
0152     XXRlambda_m = ones(npn,nmhu,nr);
0153     XXRlambda_p = ones(npn,nmhu,nr);    
0154     %
0155     XXlambda_p2m1 = ones(npn,nmhu,nr);
0156     XXlambda_p2m1_p = ones(npn,nmhu,nr);
0157     XXlambda_p2m1_m = ones(npn,nmhu,nr);
0158     XXRlambda_p2m1_p = ones(npn,nmhu,nr);
0159     XXRlambda_p2m1_m = ones(npn,nmhu,nr);
0160     XXRlambda_p0p3 = ones(npn,nmhu,nr);
0161     XXRlambda_p2p2_p = ones(npn,nmhu,nr);
0162     XXRlambda_p2p2_m = ones(npn,nmhu,nr);
0163     %
0164     XXlambda_p2m2p2 = ones(npn,nmhu,nr);
0165     %
0166     XXRlambda_b_p1p1 = ones(npn,nmhu,nr);
0167     %
0168     XXlambda_b_p1m1p2 = ones(npn,nmhu,nr);
0169     XXlambda_b_p1m1p2_p = ones(npn,nmhu,nr);
0170     XXlambda_b_p1m1p2_m = ones(npn,nmhu,nr);
0171     XXRlambda_b_p1m1p2 = ones(npn,nmhu,nr);
0172     XXRlambda_b_p1m1p2_p = ones(npn,nmhu,nr);
0173     XXRlambda_b_p1m1p2_m = ones(npn,nmhu,nr);
0174     %
0175     XXlambda_b_p1m1 = ones(npn,nmhu,nr);
0176     XXlambda_b_p1m1_p = ones(npn,nmhu,nr);
0177     XXlambda_b_p1m1_m = ones(npn,nmhu,nr);
0178     XXRlambda_b_p1m1 = ones(npn,nmhu,nr);
0179     XXRlambda_b_p1m1_p = ones(npn,nmhu,nr);
0180     XXRlambda_b_p1m1_m = ones(npn,nmhu,nr);
0181     %
0182     XXlambda_b_p1m2 = ones(npn,nmhu,nr);
0183     XXlambda_b_p1m2_p = ones(npn,nmhu,nr);
0184     XXlambda_b_p1m2_m = ones(npn,nmhu,nr);
0185     XXRlambda_b_p1m2_p = ones(npn,nmhu,nr);
0186     XXRlambda_b_p1m2_m = ones(npn,nmhu,nr);
0187     %
0188     XXlambda_b_p2m2p2 = ones(npn,nmhu,nr);
0189     XXRlambda_b_p2m2p2 = ones(npn,nmhu,nr);
0190     XXlambda_b_p2m2p2_p = ones(npn,nmhu,nr);
0191     XXlambda_b_p2m2p2_m = ones(npn,nmhu,nr);
0192     XXRlambda_b_p2m2p2_p = ones(npn,nmhu,nr);
0193     XXRlambda_b_p2m2p2_m = ones(npn,nmhu,nr);        
0194     %
0195     XXlambda_b_p3m2 = ones(npn,nmhu,nr);
0196     XXlambda_b_p3m2_p = ones(npn,nmhu,nr);
0197     XXlambda_b_p3m2_m = ones(npn,nmhu,nr);
0198     XXRlambda_b_p3m2_p = ones(npn,nmhu,nr);
0199     XXRlambda_b_p3m2_m = ones(npn,nmhu,nr);
0200     %
0201     XXlambda_b_p2 = ones(npn,nmhu,nr);
0202     XXlambda_b_p2_p = ones(npn,nmhu,nr);
0203     XXlambda_b_p2_m = ones(npn,nmhu,nr);
0204     %
0205     XXlambda_b_p1m3p4 = ones(npn,nmhu,nr);    
0206     XXlambda_b_p1m2p2 = ones(npn,nmhu,nr);    
0207 end
0208 
0209

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