Commit 475c5cb4 authored by Lore, Jeremy's avatar Lore, Jeremy
Browse files

Add DTS

parent fe219ed9
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -3,8 +3,10 @@ clearvars;
run_path = 'C:\Users\jjl\Dropbox (ORNL)\DIII-D\Qprl experiment\1743XX';
outFileName = 'downstream_data_174306.mat';

IRFileName = 'IR_profile_174306_twin_3100_4000_elm_80_95.mat';
IRFileName = 'IR_profile_174306_twin_3200_4000_elm_80_95.mat';
LPFileName = 'LP_174306_processed.mat';
TSFileName = 'dts_osp_174306.mat';


% From plot_ir_profile
IR = load(fullfile(run_path,IRFileName)); IR = IR.IR;
@@ -14,5 +16,7 @@ DownStream.HeatFlux.IR = IR;
LP = load(fullfile(run_path,LPFileName)); LP = LP.LP;
DownStream.LP = LP;

TS = load(fullfile(run_path,TSFileName)); TS = TS.ts2d;
DownStream.TS = TS;

save(fullfile(run_path,outFileName),'DownStream')
 No newline at end of file
+11 −11
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ fname = 'C:\Users\jjl\Dropbox (ORNL)\DIII-D\Qprl experiment\1743XX\irtv_174306_3
% twin = [4300,4400];
% twin = [3300,3700];
% twin = [3200,4800];
tWinMS = [3100,4000];
tWinMS = [3200,4000];
elmWin = [0.8,0.95];
% elm_win = [0.9,0.95];

@@ -26,13 +26,13 @@ dtThreshMS = 1; % Discard "ELM" spikes repeated in this threshold (ms)
% Select ir radius to find ELMS (in dR from Outer SP)
dROutFindELMCM = -10;

WRITE_FILE = 0;
WRITE_FILE = 1;
MAKE2DPLOTS = 0;

dROuterWantRangeCM = [-10,20];
dRInnerWantRangeCM = [-5,8];
nOuterBinIR = 12;  % Number of radial bins in dR range
nInnerBinIR = 12;  % Number of radial bins in dR range
dROuterWantRangeCM = [-10,22];
dRInnerWantRangeCM = [-5,15];
nOuterBinIR = 50;  % Number of radial bins in dR range
nInnerBinIR = 50;  % Number of radial bins in dR range

% fname_stub = 'out';

@@ -47,7 +47,6 @@ if MAKE2DPLOTS
    plotIR2D(IR,dROuterWantRangeCM,dRInnerWantRangeCM);
end
IR = elmFilter(IR,elmWin);
% IR = binIR(IR,dROuterWantRangeCM,dRInnerWantRangeCM,nBinIR);
IR.Binned.Outer = binIR(IR.ElmFiltered.time,IR.ElmFiltered.dROutCM,IR.ElmFiltered.dataMWm2,dROuterWantRangeCM,nOuterBinIR);
IR.Binned.Inner = binIR(IR.ElmFiltered.time,IR.ElmFiltered.dRInCM,IR.ElmFiltered.dataMWm2,dRInnerWantRangeCM,nInnerBinIR);

@@ -97,6 +96,7 @@ IR.Inner.dRSepShift = SHIFT_CM/100;
IR.Inner.q = fullIR.Binned.Inner.dataMWm2*1e6;
IR.Inner.qErr = fullIR.Binned.Inner.errMWm2*1e6;

fprintf('%s\n',fullFileNameOut);
save(fullFileNameOut,'IR')


@@ -298,15 +298,15 @@ for ibin = 1:nBin
    for jtime = 1:length(timeMS)
        inBin = find( radiusCM(:,jtime) >= IRBinned.dRBinEdgesCM(ibin) & radiusCM(:,jtime) < IRBinned.dRBinEdgesCM(ibin+1));
        this = dataMWm2(inBin,jtime);
        databin(jtime)    = mean(this);
        databinvar(jtime) = var(this);
        databin(jtime)    = mean(this,'omitnan');
        databinvar(jtime) = var(this,'omitnan');
    end
    %     IRBinned.dataMWm2(ibin) = sum(databin./databinvar)./sum(1./databinvar);
    %     IRBinned.errMWm2(ibin) = sqrt(1./sum(1./databinvar));
    
    IRBinned.dataMWm2(ibin) = mean(databin);
    IRBinned.dataMWm2(ibin) = mean(databin,'omitnan');
    %     IR.Binned.Outer.errMWm2(ibin) = std(databin)./sqrt(length(databin));
    IRBinned.errMWm2(ibin) = std(databin);
    IRBinned.errMWm2(ibin) = std(databin,'omitnan');
    
    %     IRBinned.errMWm2(ibin) = std(databin);
end
+38 −14
Original line number Diff line number Diff line
@@ -18,25 +18,32 @@ g = readg_g3d(gfile_name);
%         fname_out_part = '5MW_detach';
%         fname ='C:\Work\DIII-D\APS 2016\2dts_data\dts_fitted1d_osp_multishot_156871156872156873156874_remapto156855at4527msEFIT04_fuelD_ioncharge1_gamma7p539_see0p000_weightedfits.dat';        
% end
fname ='C:\Users\jjl\Dropbox (ORNL)\DIII-D\Qprl experiment\1753XX\dts_fitted1d_osp_174306_2000to5000msEFIT03_remapto3500msEFIT03_fuelD_ioncharge1_gamma7p539_see0p000_weightedfits.dat';
run_path = 'C:\Users\jjl\Dropbox (ORNL)\DIII-D\Qprl experiment\1743XX\';
fname = fullfile(run_path,'dts_fitted1d_osp_174306_2000to5000msEFIT03_remapto3500msEFIT03_fuelD_ioncharge1_gamma7p539_see0p000_weightedfits.dat');
outfile = fullfile(run_path,'dts_osp_174306.mat');

ts2d = read_2dts_dat_file(fname);

WRITE_IT = 0;
WRITE_IT = 1;

plot_log = 0;

minval_Te = 0.4;
maxval_Te = 100;

minval_ne = 0.02;
maxval_ne = 4;
minval_ne = 0.02;  % e 20
maxval_ne = 1;

minval_q = 0;
maxval_q = 10;

PLOT_TE =1;
PLOT_NE = 1;
PLOT_Q = 1;

% ichan_use = 1;  %0:7
colorMapName = 'parula';

% ichan_use = 0;  %0:7
ichan_use = 0:7;  %0:7

% Make 1D arrays
@@ -69,7 +76,7 @@ if PLOT_TE
    end
    colorbar;
    ncols = 1024;
    colormap(colorflipper(ncols,'rainbow'));
    colormap(colorflipper(ncols,colorMapName));
    if plot_log
        set(gca,'clim',log10([minval_Te,maxval_Te]))
    else
@@ -92,7 +99,7 @@ if PLOT_NE
    end
    colorbar;
    ncols = 1024;
    colormap(colorflipper(ncols,'rainbow'));
    colormap(colorflipper(ncols,colorMapName));
    if plot_log
        set(gca,'clim',log10([minval_ne,maxval_ne]))
    else
@@ -112,7 +119,12 @@ if PLOT_Q
    end
    colorbar;
    ncols = 1024;
    c = colormap(colorflipper(ncols,'rainbow'));
    colormap(colorflipper(ncols,colorMapName));
    if plot_log
        set(gca,'clim',log10([minval_q,maxval_q]))
    else
        set(gca,'clim',[minval_q,maxval_q])
    end    
    plot_sep_g(g,1,0);
    axis([1.35,1.65,-1.25,-0.95])
    title('q perp [MW/m^2]')
@@ -157,12 +169,17 @@ if length(ichan_use) == 1
        xlabel('R [m]')
        ylabel('T_{e} [eV]')
        
        figure; hold on; box on;
        errorbar((R1d-Rsep)*100,ne1d,dne1d,'ko')
        xlabel('R [m]')
        ylabel('n_{e} []')        
        
        % experimental
        figure; hold on; box on;
        scatter((R1d-Rsep)*100,q1d,[],time1d,'filled')
        colorbar;
        ncols = 1024;
        colormap(colorflipper(ncols,'rainbow'));
        colormap(colorflipper(ncols,colorMapName));
        
      
    end
@@ -172,10 +189,14 @@ end

if WRITE_IT
    [pathstr] = fileparts(fname);
    if length(ichan_use) == 1
        fprintf('Skipping write because too many channels!\n')
    
    save(outfile,'ts2d');
    
    
    if length(ichan_use) == 1 & 0 % Switched to mat version
        
        if ichan_use == 0
            fprintf('Skipping write because not channel 0!\n')
            
            
            fname_out = fullfile(pathstr,strcat('Te_2DTS_1D_chan0_targ_',fname_out_part,'.dat'));
            fprintf('Writing Te data to file: %s\n',fname_out)
@@ -204,10 +225,13 @@ if WRITE_IT
            end
            fclose(fid);
                     
            
        else
            fprintf('Skipping write because not channel 0!\n')
            
            
        end
    else
        fprintf('Skipping write because too many channels!\n')
    end
end