0001 function [na,E,R,Z,psin,B] = stixgolant_yp(equil,omega_lh)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 [qe,me,mp,~,e0] = pc_dke_yp;
0024
0025 R = equil.Rp + equil.ptx;
0026 Z = equil.Zp + equil.pty;
0027 B = sqrt(equil.ptBPHI.^2 + equil.ptBx.^2 + equil.ptBy.^2);
0028 psin = equil.psi_apRp(:)*ones(1,length(equil.theta))/equil.psi_apRp(end);
0029
0030
0031
0032 omega_cen = (qe/me).*B/omega_lh;
0033 omega_pen = qe*sqrt(equil.pne(:)*ones(1,length(equil.theta))/e0/me)/omega_lh;
0034 omega_cin = shiftdim(repmat((qe*equil.zZi./mp./equil.zmi)',1,length(equil.psi_apRp),length(equil.theta)),1).*repmat(B,1,1,length(equil.zZi))/omega_lh;
0035 omega_pin = shiftdim(repmat((qe*equil.zZi./sqrt(e0.*mp.*equil.zmi))',1,length(equil.psi_apRp),length(equil.theta)),1).*shiftdim(repmat(sqrt(equil.pzni),1,1,length(equil.theta)),1)/omega_lh;
0036
0037 Xperp = -omega_pen.^2./(1.0 - omega_cen.^2) - sum(omega_pin.^2./(1.0 - omega_cin.^2),3);
0038 Xpar = -omega_pen.^2 - sum(omega_pin.^2,3);
0039 Xx = omega_pen.^2.*omega_cen./(1.0 - omega_cen.^2) + sum(omega_pin.^2.*omega_cin./(1.0 - omega_cin.^2),3);
0040
0041 Kperp = 1 + Xperp;
0042 Kpar = 1 + Xpar;
0043 Kx = Xx;
0044
0045
0046
0047 a = (Kpar + Kperp).^2 - 4*Kpar.*Kperp;
0048 b = 8*Kpar.*Kperp.^2 - 2*Kperp.*(Kpar + Kperp).^2 + 2*(Kpar + Kperp).*Kx.^2;
0049 c = -4*Kpar.*Kperp.^3 + Kperp.^2.*(Kpar + Kperp).^2 + 4*Kpar.*Kperp.*Kx.^2 - 2*Kperp.*(Kpar + Kperp).*Kx.^2 + Kx.^4;
0050 delta = b.^2 - 4*a.*c;
0051
0052 na = sqrt((-b + sqrt(delta))./2./a);
0053
0054 E = 511*(1.0./sqrt(1-1.0./na.^2)-1);