plotchords_jd

PURPOSE ^

SYNOPSIS ^

function plotchords_jd(equil,hxrspec,xvar,p_opt,c_opt,nr)

DESCRIPTION ^

 This function plots the chords over the magnetic equilibrium

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function plotchords_jd(equil,hxrspec,xvar,p_opt,c_opt,nr)
0002 %
0003 % This function plots the chords over the magnetic equilibrium
0004 %
0005 if nargin < 6,
0006     nr = 20;
0007 end
0008 %
0009 if nargin < 5,
0010     c_opt = 0;
0011 end
0012 %
0013 if nargin < 4,
0014     p_opt = -1;
0015 end
0016 %
0017 if nargin < 3,
0018     xvar = 'g';
0019 end
0020 %
0021 str = 'HXR chords';
0022 method = 'spline';
0023 %
0024 figure(1),clf,set(1,'Name',str)
0025 %
0026 rho = linspace(0,1,nr + 1);
0027 %
0028 if strcmp(xvar,'p'),
0029     prho = sqrt(equil.psi_apRp/equil.psi_apRp(end));
0030 elseif strcmp(xvar,'g'),
0031     prho = equil.ptx(:,1)./ equil.ptx(end,1);
0032 else
0033     error('Other rho not yet implemented')
0034 end
0035 %
0036 ptx = interp1(prho,equil.ptx,rho,method);
0037 pty = interp1(prho,equil.pty,rho,method);
0038 %
0039 tpR = ptx.' + equil.Rp;
0040 tpZ = pty.' + equil.Zp;
0041 %
0042 xlim = NaN;
0043 ylim = NaN;
0044 %
0045 graph1D_jd(tpR,tpZ,0,0,'R(m)','Z(m)',str,NaN,xlim,ylim,'-','none','r',2,20,gca,0.9,0.7,0.5);
0046 axis('equal');
0047 %
0048 if isstruct(hxrspec),
0049     %
0050     nc = length(hxrspec.beta_hxr);
0051     nL = 1000;
0052     %
0053     Lmax = 1.1*max(abs(tpZ(:,end) - hxrspec.Z_hxr(1)));
0054     %
0055     if c_opt == 0,%plot chord within plasma
0056         Lmin = -0.9*min(abs(tpZ(:,end) - hxrspec.Z_hxr(1)));
0057     else% plot entire chord
0058         Lmin = Lmax/10;
0059     end
0060     L = linspace(-Lmax,Lmin,nL).';%Chord length
0061     %
0062     R = zeros(nL,nc);
0063     Z = zeros(nL,nc);
0064     %
0065     cstr = repmat(['#',repmat(' ',[1,length(num2str(nc))])],[nc,1]);
0066     %
0067     for ic = 1:nc,
0068         R(:,ic) = hxrspec.R_hxr(ic) + L*sin(hxrspec.beta_hxr(ic))*cos(hxrspec.alpha_hxr(ic));
0069         Z(:,ic) = hxrspec.Z_hxr(ic) + L*cos(hxrspec.beta_hxr(ic));
0070         cstr(ic,2:2+length(num2str(ic))-1) = num2str(ic);
0071     end
0072     %
0073     graph1D_jd(R,Z,0,0,'','','',NaN,xlim,ylim,'-','none','b',0.5);
0074     %
0075     text(R(1,:),Z(1,:),cstr);
0076     %
0077     xmin = min([min(min(tpR)),min(min(R))])*0.9;
0078     xmax = max([max(max(tpR)),max(max(R))])*1.1;
0079     %
0080     ymin = min([min(min(tpZ)),min(min(Z))])*0.9;
0081     ymax = max([max(max(tpZ)),max(max(Z))])*1.1;
0082     %
0083     axis('equal');axis([xmin,xmax,ymin,ymax]);
0084     set(gca,'xtickmode','auto')
0085     set(gca,'ytickmode','auto')
0086 end
0087 %
0088 print_jd(p_opt,['Fig_HXR_chords_',equil.id]);
0089 %
0090 
0091

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