VERB_code_2.3
(2004)_README Description

The folder contains all of the functions needed to reproduce the plots observed in the 2004 paper (same name as this directory).

HOW IT WORKS

The program runs in the following order:

1. SETUP: The `setup.m` script runs with the parameters that you determine inside the script (discussed below).

2. RUN (optional):   If you opted to run the simulation, the .exe program (VERB_CODE_2.0) will perform the simulation using Parameters_x.ini as a set of guidelines.

3. PLOT (optional):  If you opted to plot the results, the script `Plot.m` will display your results, and you can choose to save the plot in the Figures folder.

HOW TO USE

Very simply, you only need to run the setup.m script to run the program and plot the results!


SETUP

Within the setup.m file, the first thing you will see are four (4) PARAMETERS that you must set: OS, FIGURE, RUN, and PLOT.

OS - specify which operating system you are using so it will run the proper executable file.

FIGURE - specify which Figure from the paper you want to re-create (Figure 5 cannot be reproduced).

RUN - decide if you want to actually run the executable (if you previously ran the simulation on the same figure, it will be unnecessary since you already have the results).

PLOT - decide if you want to plot the results of your data (results are stored in the Output folder and read into Plot.m from there).

An example of this may look like:

OS = 'MAC';
FIGURE = '3';
RUN = true;
PLOT = false;

This will all be re-explained inside setup.m, where you will run the program.

RUN

This folder only contains the VERB_code_2.0.exe file. For more information on how the simulation code actually runs, look into the VERB 2.0 code itself, which hosts all the C++ code for the program.

PLOT

All plotting is done in the Plot.m file, which is called upon by setup.m. The one parameter in Plot.m is SAVEFIG, which simply chooses whether to save the plot in the Figures folder (it will replace existing plots of the same figure!).


Help

Most of the files are clearly documented at the top of the script. If you need help understanding anything, type

help <filename>

and there should be an explanation of what the code does/how it works.

For general help with a folder, type

help <foldername>

while inside that folder's workpath for a brief explanation of each file in that folder. It also contains links to more elaborate descriptions.


Parameters.ini

Within the Execute folder, there should be (1) or more Parameters.ini files, i.e. Parameters0.ini, Parameters.ini, Parameters2.1, ... These files are used to determine how data is achieved and manipulated within the simulation. Looking into the Parameters files themselves will help you understand the specifications of that particular simulation. For example, you can manipulate 'useTau', which chooses the source of tau in your simulation, i.e. from a file, used as a constant, etc.

When you run setup.m on Figure 2.1 and above (Figure 1 does not require a Parameters.ini file), the parameter file associated with that figure will be copied into Parameters.ini. From there, the .exe will use Parameters.ini to simulate the data.

NOTE: Only the Parameters.ini file is intended to change. All other parameter files should never be changed!

Important Functions (these do not require parameterization)

There are only two main functions here:

  • __ElectronFlux.m__: This file calculates the electron flux profile versus L-star for a given Kp, diffusion coefficient, and tau.
  • __RadialDiffCoeff.m__: This file computes the radial diffusion coefficients versus L-star for a given value of Kp, tau and L.

All other functions are helper functions used in these codes. The steady_state.m file plots the time-independent PSD; the 1D Radial Diffusion folder holds the code needed to reproduce pcolor plots of flux versus L versus time (please see README in that folder).

Reproduction Tests

Please run the following code segments to ensure that the output is in line with expectations. This code should plot Figure 1 for tau = 10 in the paper.

1 L = linspace(2,8);
2 Kp = 2;
3 plot(L, 1./RadialDiffCoeff(Kp,L))
4 set(gca,'ylim',[10e-1 10e4],'xlim',[2 8],'yscale','log');

The code above will reproduce our diffusion coefficients vs. L-star plots (Figure 1, Row 1).

1 L = linspace(2,8);
2 Kp = 2;
3 DLL = RadialDiffCoeff(Kp, L);
4 tau = 10;
5 plot(L, steady_state(L, DLL, tau))
6 set(gca,'ylim',[10e-2 10e1],'xlim',[2 8],'yscale','log');

The code above will reproduce our phase space density vs. L-star plots (Figure 1, Row 2).

1 L = linspace(2,8);
2 Kp = 2;
3 tau = 10;
4 plot(L, ElectronFlux(L, Kp, tau))
5 set(gca,'ylim',[10e-1 10e4],'xlim',[2 8],'yscale','log') (Figure 1, Row 3).

The code above will reproduce our electron flux vs. L-star plots.