iproc_spectrum_jd

PURPOSE ^

SYNOPSIS ^

function [bNpar0,bdNpar0,bPlhtot,param_tor,param_pol] = iproc_spectrum_jd(spectrum,select,signs)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [bNpar0,bdNpar0,bPlhtot,param_tor,param_pol] = iproc_spectrum_jd(spectrum,select,signs)
0002 %
0003 if nargin < 3,% to keep main lobe positive if no sign specified
0004     signs.ip = 1;
0005     signs.b0 = -1;
0006 end
0007 %
0008 if nargin < 2,
0009     select = struct;
0010 end
0011 %
0012 if ~isfield(spectrum,'Plhtot'),
0013     spectrum.Plhtot = 1e6;% default power : 1 MW
0014 end
0015 %
0016 % This function processes spectral data into a series of toroidal (and
0017 % possibly poloidal) lobes for ray-tracing application
0018 %
0019 [bNtor0,bdNtor0,bPlhtor,param_tor] = proc_aloha_spec_jd(spectrum.nz,NaN,real(spectrum.dP_nz),spectrum.Plhtot,spectrum.param_tor,0,select);
0020 %
0021 if ~isfield(spectrum,'ny') || ~isfield(spectrum,'dP'),
0022     opt_ny = 0;
0023 elseif ~isfield(select,'inter') || ~select.inter,% no interactive mode
0024     opt_ny = spectrum.param_pol.opt_ny;
0025 else
0026     opt_ny = iselect_jd({'With multiple vertical positions','With poloidal spectrum'},'How do you want to describe the wave poloidally ?',select.opt_gui,select.style,1) - 1;
0027 end
0028 %
0029 if opt_ny == 1,% process poloidal aloha spectrum for LUKE
0030     [bNpol0,bdNpol0,bPlhpol,param_pol] = proc_aloha_spec_jd(spectrum.ny,NaN,sum(real(spectrum.dP.')),1,spectrum.param_pol,0,select);     
0031 else
0032     bNpol0 = 0;
0033     bdNpol0 = 0;
0034     bPlhpol = 1;                
0035 end
0036 %
0037 param_pol.opt_ny = opt_ny;
0038 %
0039 % Since N// is not strictly speaking Ntor, we make it imaginary to notify init_RT_jd. In this case, the real part is Ns and the imaginary part is Nz
0040 %
0041 nlobes_tor = length(bNtor0);
0042 nlobes_pol = length(bNpol0);
0043 %
0044 bNpar0 = NaN(1,nlobes_tor*nlobes_pol);
0045 bdNpar0 = NaN(1,nlobes_tor*nlobes_pol);
0046 bPlhtot = NaN(1,nlobes_tor*nlobes_pol);
0047 %
0048 % The number of rays is nlobes_tor x nlobes_pol. The toroidal sign is
0049 % assumed to be for co-current
0050 %
0051 for iy = 1:nlobes_tor,
0052     bNpar0((iy - 1)*nlobes_pol + (1:nlobes_pol)) = -i*bNtor0(iy)*signs.ip*signs.b0 + bNpol0;
0053     %
0054     % the combined spectral width effect is not yet implemented
0055     % (TODO) see how to include it, maybe in init_RT_jd
0056     % watch for possible conflicts with square spectrum prescriptions
0057     %
0058 %   bdNpar0((iy - 1)*nlobes_pol + (1:nlobes_pol)) = 1i*bdNtor0(iy) + bdNpol0;
0059     %
0060     bdNpar0((iy - 1)*nlobes_pol + (1:nlobes_pol)) = bdNtor0(iy)*ones(1,length(bdNpol0));
0061     %
0062     bPlhtot((iy - 1)*nlobes_pol + (1:nlobes_pol)) = bPlhtor(iy)*bPlhpol;
0063 end
0064 %

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