0001 function [pzni] = species_dke_yp(pne,pZeff,zZi,fi)
0002
0003
0004
0005
0006
0007
0008 if nargin < 4,error('Not enough arguments');end
0009
0010 nz = length(zZi);
0011
0012 if size(pne,1) == 1,
0013 npsi = length(pne);
0014 pzni = zeros(nz,npsi);
0015 N = 1;
0016 else
0017 pzni = repmat(zeros(size(pne)),[nz,1]);
0018 N = size(pne,1);
0019 end
0020
0021 if length(pZeff) == 1, pZeff = pZeff*ones(size(pne));end
0022
0023 if sum(zZi>1) > 1
0024 error('need each species density from impurity transport code')
0025 elseif sum(zZi>1) == 1
0026 Zimp = max(zZi);
0027 pnhyd = pne.*(Zimp - pZeff)/(Zimp - 1);
0028 pnimp = pne.*(pZeff - 1)/(Zimp - 1)/Zimp;
0029 pzni((nz-1)*N+1:nz*N,:) = pnimp;
0030 else
0031 pnhyd = pne;
0032 pnimp = 0*pne;
0033 end
0034
0035 if sum(fi) == 1,
0036 for iz = 1:3,
0037 pzni((iz-1)*N+1:iz*N,:) = fi(iz)*pnhyd;
0038 end
0039 else
0040 error('Hydrogen isotopic fractions do not add to 1')
0041 end
0042 clear fi
0043