VERB_code_2.3
Plot_3pic.m
1 %clear all
2 %close all
3 
4 addpath('../Setup/Various_functions');
5 
6 FontSize =9;
7 
8 figure('Units', 'inches', 'Position', [1 1 8 6],...
9  'DefaultAxesFontName', 'times new roman', 'DefaultAxesFontWeight', 'bold', 'DefaultAxesFontSize', FontSize,...
10  'PaperOrientation', 'portrait', 'PaperPositionMode', 'auto', 'DefaultTextFontWeight', 'bold');
11 
12 % change target_en_list for more options
13 target_en_list = [0.5 1 2];
14 
15 for i = 1:numel(target_en_list)
16 
17  target_en = target_en_list(i);
18 
19  %input parameters
20  Plot_file_name='Comparison_with_without_EMIC';
21  folder_name1='../Execute/Output/';
22  %folder_name2='../Output_chorus_1MeV/';
23  %folder_name3='../Output_chorus_EMIC_1MeV/';
24  %folder_name4='../Output_hiss_sp_2MeV/';
25 
26  %3 Plots' parameters
27  xmin1=0;
28  xmax1=90;
29  ymin1=1e-3;
30  ymax1=5e1;
31 
32  xmin2=xmin1;
33  xmax2=xmax1;
34  ymin2=1e-3;
35  ymax2=1e1;
36 
37  xmin3=xmin1;
38  xmax3=xmax1;
39  ymin3=0.1;
40  ymax3=40;
41 
42  text1=['E=' num2str(target_en) ' MeV'];
43  text2=' Chorus only';
44  text3=' Chorus and EMIC ';
45  xtext_loc=20;
46  ytext_loc=5e-3;
47 
48  % output parameters:
49  output_formats = [{'epsc'}];%,{'pdf'}];%[{'fig'}, {'ai'}, , ];
50  %h_border = 0.18;
51  %v_border = 0.03;
52  %figure('Units', 'inches', 'Position', [1 1 8 6],...
53  % 'DefaultAxesFontName', 'times new roman', 'DefaultAxesFontWeight', 'bold', 'DefaultAxesFontSize', FontSize,...
54  % 'PaperOrientation', 'portrait', 'PaperPositionMode', 'auto', 'DefaultTextFontWeight', 'bold');%, 'PaperPosition', [1 1 3.8 9]);%
55  % figure('Units', 'inches', ...
56  % 'DefaultAxesFontName', 'times new roman', 'DefaultAxesFontWeight', 'bold', 'DefaultAxesFontSize', FontSize,...
57  % 'PaperOrientation', 'portrait', 'PaperPositionMode', 'auto');%, 'PaperPosition', [1 1 3.8 9]);'Position', [1 1 4 8],%
58  %figure
59  nfolders=3;
60  %nrow = 3;
61  %--------------------------------------------------------------------------
62  %First set of plots
63  % for col_num=2:nfolders
64  col_num = i;
65  % switch col_num
66  % case(1)
67  folder_name=folder_name1;
68  text_cur=text1;
69  % case(2)
70  % folder_name=folder_name2;
71  % text_cur=text2;
72  % case(3)
73  % folder_name=folder_name3;
74  % text_cur=text3;
75  % case(4)
76  % folder_name=folder_name4;
77  % text_cur=text4;
78  % end
79 
80  dataFileName = [folder_name,'OutPSD.dat'];
81  gridFileName = [folder_name,'perp_grid.plt'];
82  oneDimDataFileName = [folder_name,'out1d.dat'];
83  zDxxFileName1 = [folder_name,'../DiffCoeff/Daa_chorus_night_FA.plt'];
84  DxxFileName2 = [folder_name,'../DiffCoeff/Daa_chorus_day_FA.plt'];
85  %DxxFileName3 = [folder_name,'Daa_EMIC_Plume.plt']
86  %DxxFileName = '../Output/Daa_Chorus_Day.plt'
87 
88  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 
90  % Loading grid and data
91  [~,en,alpha, f_var1] = load_plt(DxxFileName1, 'squeeze');
92  [~,en,alpha, f_var2] = load_plt(DxxFileName2, 'squeeze');
93  %[alpha, f_var3] = load_plt(DxxFileName3, 'squeeze');
94  f_var.name = 'D_{\alpha\alpha}, days^{-1}';
95 
96  [~,ind_target_en] = min(abs(en.arr(:,1) - target_en ));
97 
98  %alpha.arr = alpha.arr*180/pi;
99  alpha.arr = squeeze( alpha.arr(ind_target_en,:)*180/pi );
100  x_var = alpha;
101 
102  f_var1.arr = squeeze(f_var1.arr(ind_target_en,:));
103  f_var2.arr = squeeze(f_var2.arr(ind_target_en,:));
104 
105 
106  % from now we are operating only with f_var and x_var
107 
108 
109  % subplot area position
110  %h_sps = h_border;
111  %v_sps = v_border;
112  %n_of_vertical_plots = 3;
113  %width = 1 - 2*h_sps;
114  %height = (1-(2+n_of_vertical_plots)*v_sps)/n_of_vertical_plots;
115  %cbar = 0.1;
116  %pos1 = [h_sps, 1 - 1*(v_sps + height), width, height];
117  %pos2 = [h_sps, 1 - 2*(v_sps + height), width, height];
118  %pos3 = [h_sps, 1 - 3*(v_sps + height), width, height];
119  %--------------------------------------------------------------------------
120  %
121  %subplot('Position', pos1);
122  sb=subplot(3,nfolders,col_num);
123  %set(sb,'ActivePositionProperty', 'outerposition' )
124  plot(x_var.arr, f_var1.arr, 'k', 'LineWidth', 2);
125  hold on
126  plot(x_var.arr, f_var2.arr, 'b', 'LineWidth', 2);
127  hold on
128  ylabel('Diffusion Coefficients days$^{-1}$')
129  xlabel('Pitch Angle')
130  %plot(x_var.arr, f_var3.arr, 'r', 'LineWidth', 2);
131 
132  text(xtext_loc, ytext_loc, text_cur)
133  % picture properties
134  set(gca, 'yscale', 'log', 'xlim', [xmin1 xmax1], 'ylim', [ymin1 ymax1]);
135  if(col_num==2)
136  ylabel(f_var.name)
137  end
138  %title(['Energy = ', num2str(epc.arr(1)), ' MeV']);
139  %set(gca, 'xtick', []);
140  %cl=colorbar;
141  %set(cl, 'Visible','off')
142 
143  [L, epc, alpha] = load_plt(gridFileName, 'squeeze');
144  %alpha.arr = alpha.arr*180/pi;
145  alpha.arr = squeeze(alpha.arr(ind_target_en,:))*180/pi;
146  x_var = alpha;
147  [f_var] = load_plt(dataFileName);
148  f_var.arr = squeeze(f_var.arr(:,ind_target_en,:));
149 
150  size(x_var.arr)
151  size(f_var.arr)
152 
153  % plot area
154  %subplot('Position', pos2);
155  sb=subplot(3,nfolders,col_num+nfolders);
156  %set(sb,'ActivePositionProperty', 'outerposition' )
157  % colormap
158  cmap = jet(size(f_var.arr,1));
159  % black for first color
160  cmap(1, :) = [0, 0, 0];
161  % using colormap
162  set(gca, 'ColorOrder', cmap, 'NextPlot', 'replacechildren', 'Box', 'on');
163  plot(x_var.arr, f_var.arr', 'LineWidth', 1);
164  ylabel('Phase Space Density')
165  xlabel('Pitch Angle')
166  % picture properties
167  set(gca, 'yscale', 'log', 'xlim', [xmin2 xmax2], 'ylim', [ymin2 ymax2]);
168  if(col_num==2)
169  ylabel(f_var.name)
170  end
171 
172  %set(gca, 'xtick', []);
173  % loading various 1d data
174  [time, Kp, Boundary_fluxes, Lpp, Bw] = load_plt(oneDimDataFileName, 'squeeze');
175  caxis([0 max(time.arr)]);
176  if (col_num==nfolders)
177  % set(sb,'ActivePositionProperty', 'outerposition' )
178  cl=colorbar
179  set(cl,'Position', [0.918,0.429,0.018 0.177])%('Position', [(pos2(1)+pos2(3)+1-cbar)/2, pos2(2), cbar/2, pos2(4)]);
180  end
181 
182 
183 
184 
185  % if (col_num~=nfolders)
186  % set(cl, 'Visible','off')
187  % end
188 
189 
190  %subplot('Position', pos3);
191  sb=subplot(3,nfolders,col_num+2*nfolders);
192  %set(sb,'ActivePositionProperty', 'outerposition' )
193  it = (length(time.arr)-1);
194  dt = time.arr(it+1) - time.arr(it);
195  % decay.arr=zeros(time.size1,f_var.size1);
196  % for it=1:time.size1-1
197  % decay.arr(it,:)= (f_var.arr(it+1, :) + f_var.arr(it, :)).*dt./(f_var.arr(it, :) - f_var.arr(it+1, :))./2;
198  % end
199  decay.arr = (f_var.arr(it+1, :) + f_var.arr(it, :)).*dt./(f_var.arr(it, :) - f_var.arr(it+1, :))./2;
200  % cmap = jet(size(f_var.arr,1));
201  % % black for first color
202  % cmap(1, :) = [0, 0, 0];
203  % using colormap
204  set(gca, 'yscale', 'linear','ColorOrder', cmap, 'NextPlot', 'replacechildren', 'Box', 'on');
205  plot(alpha.arr, decay.arr,'k', 'LineWidth', 2);
206  set(gca, 'xlim', [xmin3 xmax3], 'ylim', [ymin3 ymax3]);
207  ylabel('Decay time, days');
208 
209  xlabel(alpha.name);
210  %caxis([0 max(time.arr)]);
211  %colorbar%('Position', [(pos2(1)+pos2(3)+1-cbar)/2, pos2(2), cbar/2, pos2(4)]);
212  %cl=colorbar;
213  %set(cl, 'Visible','off')
214 
215  %end % colomn loop
216  %saving to files
217  for it = 1:max(size(output_formats))
218  % saveas(gcf, [Plot_file_name, '.', output_formats{it}], output_formats{it});
219  eval(['print -d', output_formats{it}, ' ', Plot_file_name, '.', output_formats{it}]);
220 
221  end
222  %print -r2048 -dpdf test.pdf
223  %close
224 
225 end
double max(double v1, double v2)
Return maximum.
functions for write log and support files. Functions are defined in Output.h and descripted in Output...
Definition: Output.cpp:15
void gcf(double *gammcf, double a, double x, double *gln)
Returns the incomplete gamma function Q(a, x) evaluated by its continued fraction representation as g...
Definition: erf.cpp:103
Parameters_structure parameters
Parameters structure, with all parameters from the parameters.ini file. The default parameters define...
Definition: Main.cpp:185