disp_jd

PURPOSE ^

SYNOPSIS ^

function [xpsin_out_ft,xMNperp_ft,xM3eps_pmz_ft,xpsin_out_ht,xMNperp_ht,xM3eps_pmz_ht,xM3Pflow_xyz_ht,xMPabs_at,xM3Pflow_pmz_ht] =disp_jd(xpsin,xB,xTe,xne,xNpar,omega,knr,nrt_nr,nrt_fr,kflag,GNperp,nn_nr,tol_ht,nd_ht);

DESCRIPTION ^

 This function calls R2D2 and solves the wave equation for relativistic
 and non-relativistic maxwellian distribution, using the Hermitian
 part of the Dispersion Tensor. The outputs are Nperp and the polarization
 elements. Also the power flux and the power dissipated are calculated
 from the Hermitian and Anto-hermitian parts of the Dispersion Tensor
 respectively. For comparison, Nperp amd the polarization are also 
 calculated using the full Dispersion Tensor.

   INPUTS:

       - tokamak: 
       - xpsin: 
       - rho0: 
       - xtheta: 
       - xNpar: 
       - omega: 
       - knr: 
       - nrt_nr: 
       - nrt_fr: 
       - kflag: 
       - GNperp: 
       - nn_nr:

   OUTPUTS:    

       - xpsin_out_ft: 
       - xMNperp_ft: 
       - xM3eps_pmz_ft: 
       - xpsin_out_ht: 
       - xMNperp_ht: 
       - xM3eps_pmz_ht: 
       - xMPflow_ht: 
       - xMPabs_at:

 by Joan Decker 9/25/03
   Code R2D2 by Abhay Ram
 
 Updated 10/14/03

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [xpsin_out_ft,xMNperp_ft,xM3eps_pmz_ft,xpsin_out_ht,xMNperp_ht,xM3eps_pmz_ht,xM3Pflow_xyz_ht,xMPabs_at,xM3Pflow_pmz_ht] = ...
0002     disp_jd(xpsin,xB,xTe,xne,xNpar,omega,knr,nrt_nr,nrt_fr,kflag,GNperp,nn_nr,tol_ht,nd_ht);
0003 %
0004 % This function calls R2D2 and solves the wave equation for relativistic
0005 % and non-relativistic maxwellian distribution, using the Hermitian
0006 % part of the Dispersion Tensor. The outputs are Nperp and the polarization
0007 % elements. Also the power flux and the power dissipated are calculated
0008 % from the Hermitian and Anto-hermitian parts of the Dispersion Tensor
0009 % respectively. For comparison, Nperp amd the polarization are also
0010 % calculated using the full Dispersion Tensor.
0011 %
0012 %   INPUTS:
0013 %
0014 %       - tokamak:
0015 %       - xpsin:
0016 %       - rho0:
0017 %       - xtheta:
0018 %       - xNpar:
0019 %       - omega:
0020 %       - knr:
0021 %       - nrt_nr:
0022 %       - nrt_fr:
0023 %       - kflag:
0024 %       - GNperp:
0025 %       - nn_nr:
0026 %
0027 %   OUTPUTS:
0028 %
0029 %       - xpsin_out_ft:
0030 %       - xMNperp_ft:
0031 %       - xM3eps_pmz_ft:
0032 %       - xpsin_out_ht:
0033 %       - xMNperp_ht:
0034 %       - xM3eps_pmz_ht:
0035 %       - xMPflow_ht:
0036 %       - xMPabs_at:
0037 %
0038 % by Joan Decker 9/25/03
0039 %   Code R2D2 by Abhay Ram
0040 %
0041 % Updated 10/14/03
0042 %
0043 if nargin < 14
0044     nd_ht = 11;
0045 end
0046 if nargin < 13
0047     tol_ht = 0.2;
0048 end
0049 %
0050 exename = 'R2D2f.exe';
0051 %
0052 pathname = getpath_jd(exename);%
0053 %
0054 root1 = [];
0055 vect = [];
0056 %
0057 wd = cd;
0058 cd(pathname);
0059 %
0060 while (isempty(root1) | isempty (vect)) & tol_ht < 1
0061 %
0062 %    makedisp_simparam_jd(xpsin,xB,xTe,xne,xNpar,omega,knr,nrt_nr,nrt_fr,kflag,GNperp,nn_nr,tol_ht,nd_ht);%
0063     [root_c,root_nr,root_r] = ...
0064     disp_new(xpsin,xB,xTe,xne,xNpar,omega,knr,nrt_nr,nrt_fr,kflag,GNperp,nn_nr,tol_ht,nd_ht);%
0065 %
0066 %    [s,w] = execute_jd(exename);
0067 %
0068     if knr == 1
0069         pf = [];
0070         load pf.m -ascii
0071         root1 = root_nr;
0072         %nr1 = [];
0073         %load nr1.m -ascii
0074         %root1 = nr1;
0075         vect = pf;
0076     else
0077         pfr = [];
0078         load pfr.m -ascii
0079         root1 = root_nr;
0080         %r1 = [];
0081         %load r1.m -ascii
0082         %root1 = r1;
0083         vect = pfr;
0084     end
0085     tol_ht = tol_ht*1.2;
0086 end
0087 if isempty(root1)
0088     error('The ft root was not found')
0089 elseif isempty(vect)
0090     error('The ht root was not found')
0091 end
0092 %
0093 [nr_ft,nn] = size(root1);
0094 %
0095 xpsin_out_ft = root1(:,1)';
0096 %
0097 %nn = (nn-1)/2;
0098 %
0099 %xMNperp_re_ft = root1(:,2:2:2*nn);
0100 %xMNperp_im_ft = root1(:,3:2:2*nn+1);
0101 %
0102 %xMNperp_ft = xMNperp_re_ft + i*xMNperp_im_ft;
0103 xMNperp_ft = root1;
0104 %
0105 if knr == 0
0106     pr = [];
0107     load pr.m -ascii
0108     difu = pr;
0109 else
0110     pn = [];
0111     load pn.m -ascii
0112     difu = pn;
0113 end
0114 
0115 nd_ft = size(difu,1);
0116 
0117 %
0118 for in = 1:nn
0119     xMepsp_re_ft(:,in) = difu(in:nn:nd_ft,4); 
0120     xMepsp_im_ft(:,in) = difu(in:nn:nd_ft,5); 
0121     xMepsm_re_ft(:,in) = difu(in:nn:nd_ft,6); 
0122     xMepsm_im_ft(:,in) = difu(in:nn:nd_ft,7); 
0123     xMepsz_re_ft(:,in) = difu(in:nn:nd_ft,8); 
0124     xMepsz_im_ft(:,in) = difu(in:nn:nd_ft,9); 
0125 end
0126 
0127 xMepsp_abs_ft = abs(xMepsp_re_ft + i*xMepsp_im_ft);
0128 xMepsm_abs_ft = abs(xMepsm_re_ft + i*xMepsm_im_ft);
0129 xMepsz_abs_ft = abs(xMepsz_re_ft + i*xMepsz_im_ft);
0130 %
0131 xMeps_norm_ft = sqrt(xMepsp_abs_ft.^2 + xMepsm_abs_ft.^2 + xMepsz_abs_ft.^2);
0132 %
0133 xMepsp_norm_ft = (xMepsp_re_ft + i*xMepsp_im_ft)./xMeps_norm_ft;
0134 xMepsm_norm_ft = (xMepsm_re_ft + i*xMepsm_im_ft)./xMeps_norm_ft;
0135 xMepsz_norm_ft = (xMepsz_re_ft + i*xMepsz_im_ft)./xMeps_norm_ft;
0136 %
0137 xM3eps_pmz_ft = zeros(nr_ft,nn,3);
0138 %
0139 xM3eps_pmz_ft(:,:,1) = xMepsp_norm_ft;
0140 xM3eps_pmz_ft(:,:,2) = xMepsm_norm_ft;
0141 xM3eps_pmz_ft(:,:,3) = xMepsz_norm_ft;
0142 %
0143 np_ht = size(vect,1);
0144 %
0145 xpsin_out_ht = vect(1:nn:np_ht,1)';
0146 nr_ht = length(xpsin_out_ht);
0147 %
0148 for in = 1:nn
0149     xMNperp_re_ht(:,in) = vect(in:nn:np_ht,2);
0150     xMNperp_im_ht(:,in) = vect(in:nn:np_ht,3);
0151     xMPflow_re_ht_x(:,in) = vect(in:nn:np_ht,4);
0152     xMPflow_im_ht_x(:,in) = vect(in:nn:np_ht,5);
0153     xMPflow_re_ht_y(:,in) = vect(in:nn:np_ht,6);
0154     xMPflow_im_ht_y(:,in) = vect(in:nn:np_ht,7);
0155     xMPflow_re_ht_z(:,in) = vect(in:nn:np_ht,8);
0156     xMPflow_im_ht_z(:,in) = vect(in:nn:np_ht,9);
0157     xMPabs_re_at_x(:,in) = vect(in:nn:np_ht,10);
0158     xMPabs_im_at_x(:,in) = vect(in:nn:np_ht,11);
0159     xMepsx_re_ht(:,in) = vect(in:nn:np_ht,12); 
0160     xMepsx_im_ht(:,in) = vect(in:nn:np_ht,13); 
0161     xMepsy_re_ht(:,in) = vect(in:nn:np_ht,14); 
0162     xMepsy_im_ht(:,in) = vect(in:nn:np_ht,15); 
0163     xMepsz_re_ht(:,in) = vect(in:nn:np_ht,16); 
0164     xMepsz_im_ht(:,in) = vect(in:nn:np_ht,17); 
0165 end
0166 %
0167 xMNperp_ht = xMNperp_re_ht + i*xMNperp_im_ht;
0168 %
0169 xMPflow_ht_x = xMPflow_re_ht_x + i*xMPflow_im_ht_x;
0170 xMPflow_ht_y = xMPflow_re_ht_y + i*xMPflow_im_ht_y;
0171 xMPflow_ht_z = xMPflow_re_ht_z + i*xMPflow_im_ht_z;
0172 xMPabs_at_x = xMPabs_re_at_x + i*xMPabs_im_at_x;
0173 %
0174 xMepsx_abs_ht = abs(xMepsx_re_ht + i*xMepsx_im_ht);
0175 xMepsy_abs_ht = abs(xMepsy_re_ht + i*xMepsy_im_ht);
0176 xMepsz_abs_ht = abs(xMepsz_re_ht + i*xMepsz_im_ht);
0177 %
0178 xMeps_norm_ht = sqrt(xMepsx_abs_ht.^2 + xMepsy_abs_ht.^2 + xMepsz_abs_ht.^2);
0179 %
0180 xMepsx_norm_ht = (xMepsx_re_ht + i*xMepsx_im_ht)./xMeps_norm_ht;
0181 xMepsy_norm_ht = (xMepsy_re_ht + i*xMepsy_im_ht)./xMeps_norm_ht;
0182 xMepsz_norm_ht = (xMepsz_re_ht + i*xMepsz_im_ht)./xMeps_norm_ht;
0183 %
0184 xMepsp_norm_ht = (xMepsx_norm_ht + i*xMepsy_norm_ht)/sqrt(2);
0185 xMepsm_norm_ht = (xMepsx_norm_ht - i*xMepsy_norm_ht)/sqrt(2);
0186 %
0187 xM3eps_pmz_ht = zeros(nr_ht,nn,3);
0188 %
0189 xM3eps_pmz_ht(:,:,1) = xMepsp_norm_ht;
0190 xM3eps_pmz_ht(:,:,2) = xMepsm_norm_ht;
0191 xM3eps_pmz_ht(:,:,3) = xMepsz_norm_ht;
0192 %
0193 xM3Pflow_xyz_ht(:,:,1) = xMPflow_ht_x.*abs(xMepsx_norm_ht).^2;
0194 xM3Pflow_xyz_ht(:,:,2) = xMPflow_ht_y.*abs(xMepsx_norm_ht).^2;
0195 xM3Pflow_xyz_ht(:,:,3) = xMPflow_ht_z.*abs(xMepsx_norm_ht).^2;
0196 %
0197 xM3Pflow_pmz_ht = zeros(nr_ht,nn,3);
0198 %
0199 xM3Pflow_pmz_ht(:,:,1) = (xM3Pflow_xyz_ht(:,:,1) + i*xM3Pflow_xyz_ht(:,:,2))/sqrt(2);
0200 xM3Pflow_pmz_ht(:,:,2) = (xM3Pflow_xyz_ht(:,:,1) - i*xM3Pflow_xyz_ht(:,:,2))/sqrt(2);
0201 xM3Pflow_pmz_ht(:,:,3) = xM3Pflow_xyz_ht(:,:,3);
0202 %
0203 xMPabs_at = xMPabs_at_x.*abs(xMepsx_norm_ht).^2;
0204 %
0205 cd(wd);

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