write_launchs_ITM

PURPOSE ^

LUKE - Function that writes a C3PO launchs structure into ITM MDS+ database using the CPO format

SYNOPSIS ^

function [status,result] = write_launchs_ITM(wave,numshot,numrun,time)

DESCRIPTION ^

LUKE - Function that writes a C3PO launchs structure into ITM MDS+ database using the CPO format

Function that writes a C3PO launchs  structure into ITM MDS+ database using the CPO format

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 [status,result] = write_launchs_ITM(wave,numshot,numrun,time)
0002 %LUKE - Function that writes a C3PO launchs structure into ITM MDS+ database using the CPO format
0003 %
0004 %Function that writes a C3PO launchs  structure into ITM MDS+ database using the CPO format
0005 %
0006 %by Y.Peysson CEA-IRFM <yves.peysson@cea.fr> and Joan Decker CEA-IRFM (joan.decker@cea.fr)
0007 %
0008 if nargin < 3,error('Not enough input arguments in write_launchs_ITM.m');end
0009 if nargin == 3,
0010     time = [0];%Only one default time slice is written in the ITM MDS+ database
0011 end
0012 %
0013 status = 0;
0014 result = '';
0015 [qe,me,mp,mn,e0,mu0,re,mc2,clum] = pc_dke_yp;
0016 %
0017 ntime = length(time);
0018 %
0019 try,
0020     equil = loadCPO('equilibrium',numshot,numrun);
0021     %
0022     import ualmemory.javainterface.*;
0023     %
0024     Rgeo = equil.eqgeometry.geom_axis.r;
0025     Zgeo = equil.eqgeometry.geom_axis.z;
0026     %
0027     if isinf(Rgeo),
0028         status = -1;
0029         result = 'WARNING: C3PO launchs structure incompatible with infinite major radius, i.e. cylindrical geometrical configuration.';
0030         return
0031     end
0032     %
0033     expIdx = UALAccess.create('euitm',numshot,numrun,numshot,0);
0034     launchCPO = CPO_create('launchs',ntime);
0035     %
0036     for it = 1:ntime,
0037         %
0038         %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 'launchs' CPO %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0039         %
0040         % datainfo element
0041         %
0042         launchCPO(it).datainfo.dataprovider = 'Yves Peysson & Joan Decker, CEA/DSM/IRFM';
0043         launchCPO(it).datainfo.putdate = date;
0044         launchCPO(it).datainfo.source = 'LUKE package';
0045         launchCPO(it).datainfo.comment = 'For validation use';
0046         launchCPO(it).datainfo.isref = 0;
0047         launchCPO(it).datainfo.whatref.user = 'C3PO code';
0048         launchCPO(it).datainfo.whatref.machine = '';
0049         launchCPO(it).datainfo.whatref.shot = numshot;
0050         launchCPO(it).datainfo.whatref.run = numrun;
0051 %        launchCPO(it).datainfo.whatref.occurence = 0;
0052         %
0053         launchCPO(it).name = wave.rayinit.launch.id;
0054         launchCPO(it).type = wave.rayinit.launch.type;
0055         launchCPO(it).frequency = wave.rayinit.launch.omega_rf/2/pi;
0056         %
0057         launchCPO(it).mode = wave.waveparam.mmode;
0058         %
0059         if strcmp(launch.type,'EC'),
0060             %
0061             r = sqrt((wave.rayinit.launch.yR_L - equil.eqgeometry.geom_axis.r)^2 +(wave.rayinit.launch.yZ_L - equil.eqgeometry.geom_axis.z)^2);
0062             if     wave.rayinit.launch.yR_L == equil.eqgeometry.geom_axis.r, 
0063                 if wave.rayinit.launch.yZ_L - equil.eqgeometry.geom_axis.z > 0
0064                     theta = pi/2;
0065                 else
0066                     theta = -pi/2;
0067                 end
0068                 %
0069                 theta = atan((wave.rayinit.launch.yZ_L - equil.eqgeometry.geom_axis.z)/(wave.rayinit.launch.yR_L - equil.eqgeometry.geom_axis.r)) + pi - pi*((wave.rayinit.launch.yR_L - equil.eqgeometry.geom_axis.r) > 0).*sign(wave.rayinit.launch.yZ_L - equil.eqgeometry.geom_axis.z);%poloidal angle [0,2*pi]
0070             end
0071             %
0072             launchCPO(it).position.r = wave.rayinit.launch.yR_L;
0073             launchCPO(it).position.z = wave.rayinit.launch.yZ_L;
0074             launchCPO(it).position.phi = -wave.rayinit.launch.yphi_L;
0075             launchCPO(it).spectrum.nn_phi = 1;
0076             launchCPO(it).spectrum.nn_theta = 1;
0077             launchCPO(it).spectrum.n_phi = sin(wave.rayinit.launch.ybeta_L)*sin(wave.rayinit.launch.yalpha_L)*wave.rayinit.launch.omega_rf*wave.rayinit.launch.yR_L/clum;
0078             launchCPO(it).spectrum.n_theta = (cos(theta)*cos(wave.rayinit.launch.ybeta_L) - sin(wave.rayinit.launch.ybeta_L)*cos(wave.rayinit.launch.yalpha_L)*sin(theta))*wave.rayinit.launch.omega_rf*r/clum;
0079             launchCPO(it).spectrum.power = wave.rayinit.launch.yP_L;
0080             if isfield(launch,'w0'),
0081                 launchCPO(it).beam.spot.waist = wave.rayinit.launch.w0;
0082             else
0083                 launchCPO(it).beam.spot.waist = '';            
0084             end
0085             launchCPO(it).beam.spot.angle = '';
0086             launchCPO(it).beam.phaseellipse.invcurvrad = '';
0087             launchCPO(it).beam.phaseellipse.angle = '';    
0088         elseif strcmp(launch.type,'LH')
0089             launchCPO(it).position.r = '';
0090             launchCPO(it).position.z = wave.rayinit.launch.rZ0;
0091             launchCPO(it).position.phi = '';
0092             launchCPO(it).spectrum.nn_phi = wave.rayinit.launch.phi0;;
0093             launchCPO(it).spectrum.nn_theta = '';
0094             launchCPO(it).spectrum.n_phi = '';
0095             launchCPO(it).spectrum.n_theta = '';
0096             launchCPO(it).spectrum.power = '';
0097             launchCPO(it).beam.spot.waist = '';
0098             launchCPO(it).beam.spot.angle = '';
0099             launchCPO(it).beam.phaseellipse.invcurvrad = '';
0100             launchCPO(it).beam.phaseellipse.angle = '';    
0101         else
0102             error('Error of wave type');        
0103         end        
0104         %
0105         % codeparam element
0106         %
0107         launchCPO(it).codeparam.codename ='C3PO';        
0108         launchCPO(it).codeparam.codeversion = [LUKEversion_jd,' - MATLAB ',version];        
0109         launchCPO(it).codeparam.parameters = '';        
0110         launchCPO(it).codeparam.output_diag = '';        
0111         launchCPO(it).codeparam.output_flag = 0;        
0112         %
0113         % time element
0114         %
0115         launchCPO(it).time = time(it);
0116     end
0117     %
0118     CPO_put(expIdx,launchCPO);
0119     closeBD(expIdx,'euitm',numshot,numrun);
0120 catch
0121     status = -1;
0122     result = 'WARNING: C3PO launchs unsuccessfully writen in the ITM-MDS+ database.';
0123 end
0124 %
0125 
0126 
0127 
0128 
0129 
0130 
0131 
0132 
0133

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