VERB_code_2.3
setup.m
1 %% Setup the VERB code for different figures
2 %
3 % SETUP is the file you will actually run. It will call VERB_code_2.0.exe
4 % and Plot.m on its own (assuming you want it to).
5 %
6 % In order to run this script, you must outline the following (4)
7 % parameters. After that, it will be ready to run.
8 %
9 % The only other parameter that you should set is 'SAVEFIG' in Plot.m. It
10 % decides whether to save the figure, so be sure to set that parameter as
11 % well before running this script.
12 
13 
14 %% parameters section
15 % Set the following (4) parameters before running the script:
16 % OS, FIGURE, RUN, PLOT
17 
18 % Assuming they are properly set, you will not need to worry about the
19 % code after this section.
20 
21 
22 % DEFINE YOUR OS: WIN MAC LIN
23 OS = 'MAC';
24 
25 % Available options: 1 2.1 2.2 3 4
26 % FIGURE 2 is split into 2.1 and 2.2 because it requires 2 separate runs.
27 % 2.1 refers to the top row; 2.2 refers to the bottom row.
28 % Consult the paper to decide which plot you want to generate.
29 FIGURE = '3';
30 
31 % choose if you want to run the .exe file on your data
32 % if there is no generated data, then set to true.
33 % otherwise, it is up to you.
34 RUN = true;
35 
36 % choose to plot the results.
37 % if RUN = true, it will use data gathered from the simulation
38 % if RUN = false, it will use whatever data was stored in Output_x,
39 % where x represents the FIGURE
40 PLOT = true;
41 
42 
43 
44 %% code starts here
45 VERBcodePath = '../Execute/';
46 
47 addpath('./Various_functions/');
48 
49 % this file may be obtained by any run of the VERB code with parameters of
50 % the grid
51 if(~strcmp(FIGURE,'0'))
52  % Replaced '\' with '/'
53  % If this does not work for Windows, use a switch statement as in
54  % 'create_PSD0.m' for multiple users. Otherwise, delete this comment!
55  Grid_filename = '../Execute/Output/rad_grid.plt';
56  [L, epc, alpha, pc] = load_plt(Grid_filename, 'squeeze', 'permute');
57 
58  OutputFolder = [VERBcodePath 'Output_' FIGURE '/'];
59  if(~exist(OutputFolder,'file'))
60  % FIGURES 1 does not need output folder
61  if(~strcmp(FIGURE,'1'))
62  mkdir(OutputFolder)
63  end
64  end
65  if(~strcmp(FIGURE,'1')) % FIGURE 1 has no parameter file
66  % otherwise, we copy our specified parameter file into the
67  % Parameters.ini file to run with the correct specifications
68  copyfile([VERBcodePath 'Parameters' FIGURE '.ini'],[VERBcodePath 'Parameters.ini']);
69  end
70 end
71 
72 
73 switch(FIGURE)
74  case '0' % only to setup the grid, no results (first time users)
75  OutputFolder = [VERBcodePath 'Output' '/'];
76  if(~exist(OutputFolder,'file'))
77  mkdir(OutputFolder)
78  end
79  copyfile([VERBcodePath 'Parameters0.ini'],[VERBcodePath 'Parameters.ini']);
80  return;
81  case '2.1'
82  tau = 1;
83  Kp = 2;
84  case '2.2'
85  tau = 10;
86  Kp = 2;
87  case '3'
88  tau = 3;
89  Kp = 2;
90  case '4'
91  tau = 3;
92  Kp = 2;
93 end
94 
95 PSD0_filename = '../Execute/Input/myPSD0.plt';
96 L1d = L.arr(:,1,1);
97 PSD_prof = steady_state(L1d, RadialDiffCoeff(Kp,L1d),tau)';
98 PSD_ongrid.arr = squeeze(repmat(PSD_prof,[1 1 3 3]));
99 save_plt(PSD0_filename,PSD_ongrid);
100 
101 if(RUN)
102 cd(VERBcodePath)
103 switch(OS)
104  case 'WIN'
105  system('./VERB_code.exe'); % WiNDOWS
106  case 'MAC'
107  system('./VERB_code_2.0'); % MAC
108  case 'LIN'
109  system('./VERB_code_2.0_linux'); % LINUX
110 end
111 cd('../Setup/');
112 end
113 
114 if(PLOT)
115 cd('../Plot/')
116 run('Plot.m');
117 cd('../Setup/')
118 end
void steady_state(Matrix1D< double > &f, double tau, double Kp, int nx, Matrix1D< double > &L, double f_bnd_out, double f_bnd_in)
Definition: PSD.cpp:2373
functions for write log and support files. Functions are defined in Output.h and descripted in Output...
Definition: Output.cpp:15
Parameters_structure parameters
Parameters structure, with all parameters from the parameters.ini file. The default parameters define...
Definition: Main.cpp:185