LUKEstruct2CPO

PURPOSE ^

LUKE - Function that copy LUKE structure into the corresponding CPO's in the ITM MDS+ database

SYNOPSIS ^

function [CPO_struct] = LUKEstrust2CPO(ver_mds,machine,numshot,numrun,timeslice,struct_name,rawdata,procdata,CPO_struct)

DESCRIPTION ^

LUKE - Function that copy LUKE structure into the corresponding CPO's in the ITM MDS+ database

Function that copy LUKE structure into the corresponding CPO's in the ITM MDS+ database

by Y.Peysson CEA-IRFM <yves.peysson@cea.fr> and Joan Decker CEA-IRFM (joan.decker@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [CPO_struct] = LUKEstrust2CPO(ver_mds,machine,numshot,numrun,timeslice,struct_name,rawdata,procdata,CPO_struct)
0002 %LUKE - Function that copy LUKE structure into the corresponding CPO's in the ITM MDS+ database
0003 %
0004 %Function that copy LUKE structure into the corresponding CPO's in the ITM MDS+ database
0005 %
0006 %by Y.Peysson CEA-IRFM <yves.peysson@cea.fr> and Joan Decker CEA-IRFM (joan.decker@cea.fr)
0007 %
0008 if nargin < 8,error('Not enough input arguments in LUKE2CPO_struct_yp.m');end
0009 %
0010 mds_dataversion0 = str2num(ver_mds(1:end-1));%for using numbers
0011 mds_dataversion1 = ver_mds(end:end);%for using
0012 %
0013 if strcmp('waves',struct_name),
0014     %
0015     ibeam = 1;
0016     %
0017     it = length(CPO_struct) + 1;
0018     %
0019     if isfield(rawdata.dkepath.clustermode.run_lukert.scheduler,'remnum') && rawdata.dkepath.clustermode.run_lukert.scheduler.remnum > 0, 
0020         CPO_struct(it).datainfo.dataprovider = rawdata.dkepath.profilestr(rawdata.dkepath.clustermode.run_lukert.scheduler.remnum);
0021     else
0022         CPO_struct(it).datainfo.dataprovider = ['Local sequential calculations on ',rawdata.dkepath.machine];
0023     end
0024     CPO_struct(it).datainfo.putdate = date;
0025     CPO_struct(it).datainfo.whatref.machine = machine;
0026     CPO_struct(it).datainfo.whatref.shot = numshot;
0027     CPO_struct(it).datainfo.whatref.run = numrun;
0028     %
0029     for iwaves = 1:length(rawdata.dke_out.waves)
0030         CPO_struct(it).coherentwave(iwaves).composition.amn = rawdata.equilDKE.zmi(:);
0031         CPO_struct(it).coherentwave(iwaves).composition.zn = rawdata.equilDKE.zZi(:);
0032         CPO_struct(it).coherentwave(iwaves).composition.zion = rawdata.equilDKE.zZi(:);
0033         CPO_struct(it).coherentwave(iwaves).composition.imp_flag = zeros(size(rawdata.equilDKE.zZi(:)));
0034         %
0035         CPO_struct(it).coherentwave(iwaves).global_param.frequency = rawdata.dke_out.waves{1}.omega_rf/2/pi;
0036         CPO_struct(it).coherentwave(iwaves).global_param.name = '';
0037         CPO_struct(it).coherentwave(iwaves).global_param.type = rawdata.dke_out.waves{1}.rayinit.launch.type;
0038         CPO_struct(it).coherentwave(iwaves).global_param.f_assumption = 1;
0039         CPO_struct(it).coherentwave(iwaves).global_param.power_tot = procdata.scalar.p_rf_2piRp*2*pi*rawdata.equilDKE.Rp*1e6;
0040         CPO_struct(it).coherentwave(iwaves).global_param.power_e = procdata.scalar.p_rf_2piRp*2*pi*rawdata.equilDKE.Rp*1e6;
0041         CPO_struct(it).coherentwave(iwaves).global_param.cur_tor = procdata.scalar.I_tot*rawdata.equil.ITM.sign_Ip*1e6;%co-current: I_tot >0
0042         CPO_struct(it).coherentwave(iwaves).global_param.code_type = 1;
0043         %
0044         CPO_struct(it).coherentwave(iwaves).grid_1d.psi = rawdata.equilDKE.xpsin(:)*rawdata.equilDKE.psia_apRp/rawdata.equilDKE.ap*rawdata.equilDKE.Rp*2*pi + rawdata.equil.ITM.psi0*2*pi;
0045         %
0046         CPO_struct(it).coherentwave(iwaves).profiles_1d.powd_tot = procdata.radial.P_rf(:)*1e6;
0047         CPO_struct(it).coherentwave(iwaves).profiles_1d.powd_e = procdata.radial.P_rf(:)*1e6;
0048         CPO_struct(it).coherentwave(iwaves).profiles_1d.curd_tor = procdata.radial.J_tot(:)*rawdata.equil.ITM.sign_Ip*1e6;%co-current: J_tot >0
0049         CPO_struct(it).coherentwave(iwaves).profiles_1d.pow_tot = procdata.radial.xp_rf_2piRp*rawdata.equilDKE.Rp*2*pi*1e6;
0050         CPO_struct(it).coherentwave(iwaves).profiles_1d.pow_e = procdata.radial.xp_rf_2piRp*rawdata.equilDKE.Rp*2*pi*1e6;
0051         CPO_struct(it).coherentwave(iwaves).profiles_1d.curd_par = '';
0052         CPO_struct(it).coherentwave(iwaves).profiles_1d.cur_tor = procdata.radial.J_tot(:).*rawdata.equilDKE.xdA_dke(:)*rawdata.equil.ITM.sign_Ip*1e6;
0053         %
0054         for irays = 1:length(rawdata.dke_out.waves{iwaves}.rays)
0055             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).npoints = length(rawdata.dke_out.waves{iwaves}.rays{irays}.sx);
0056             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).power = rawdata.dke_out.waves{iwaves}.rays{irays}.P0_2piRp*2*pi*rawdata.equilDKE.Rp;
0057             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).dnpar = rawdata.dke_out.waves{iwaves}.rays{irays}.sdNpar(:);
0058             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).length = rawdata.dke_out.waves{iwaves}.rays{irays}.ss(:);
0059             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).position.r = rawdata.dke_out.waves{iwaves}.rays{irays}.sx(:) + rawdata.equilDKE.Rp;
0060             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).position.z = rawdata.dke_out.waves{iwaves}.rays{irays}.sy(:) + rawdata.equilDKE.Zp;
0061             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).position.phi = -rawdata.dke_out.waves{iwaves}.rays{irays}.sphi(:);%sign change -> ITM: PHI > 0 if direction counter clockwise, LUKE: PHI > 0 direction is clockwise (both view from the top)
0062             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).position.psi = rawdata.dke_out.waves{iwaves}.rays{irays}.spsin(:)*rawdata.equilDKE.psia_apRp/rawdata.equilDKE.ap*rawdata.equilDKE.Rp*2*pi + rawdata.equil.ITM.psi0*2*pi;
0063             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).position.theta = rawdata.dke_out.waves{iwaves}.rays{irays}.stheta(:);
0064             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).wavevector.kr = '';
0065             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).wavevector.kz = '';
0066             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).wavevector.kphi = '';
0067             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).wavevector.npar = -rawdata.dke_out.waves{iwaves}.rays{irays}.sNpar(:);%sign change -> ITM: BPHI > 0 if direction counter clockwise, LUKE: BPHI > 0 direction is clockwise (both view from the top)
0068             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).wavevector.ntor = rawdata.dke_out.waves{iwaves}.rays{irays}.sn(:);
0069             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).wavevector.var_ntor = 0;
0070             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).polarization.epol_p_re = '';
0071             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).polarization.epol_p_im = '';
0072             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).polarization.epol_m_re = '';
0073             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).polarization.epol_m_im = '';
0074             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).polarization.epol_par_re = '';
0075             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).polarization.epol_par_im = '';
0076             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).powerflow.phi_perp = '';
0077             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).powerflow.phi_par = '';
0078             CPO_struct(it).coherentwave(iwaves).beamtracing(ibeam).powerflow.power_e = rawdata.dke_out.waves{iwaves}.rays{irays}.P0_2piRp*2*pi*rawdata.equilDKE.Rp;;
0079             %
0080             ibeam = ibeam + 1;
0081         end
0082     end
0083     %
0084     CPO_struct(it).codeparam.codename = LUKEversion_jd;
0085     CPO_struct(it).codeparam.codeversion = LUKEversion_jd;
0086     %
0087     CPO_struct(it).time = timeslice;
0088 else
0089     error(['There is no CPO with the name ',struct_name,' in the ITM MDS+ database']);
0090 end

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