Skip to content

Loading and Plotting simulation data

Michael Hirsch, Ph.D edited this page Jan 4, 2019 · 4 revisions

GEMINI *.m scripts require either:

  • GNU Octave ≥ 4.0
  • Matlab ≥ R2007b

Note that only the essential scripts needed to setup a simple example, and plot the results are included in the main GEMINI repository.
Gemini-scripts repository has more involved examples.

The plotting scripts are mostly in the vis/ directory. The results for an entire simulation can be plotted using plotall.m.

These also illustrates how to read in a sequence of files from a simulation.
This script prints a copy of the output plots into the simulation output directory. Finer-level output control can be achieve by using the 'plotframe.m' and 'loadframe.m' scripts to plot and load data from individual simulation output frames, respectively.

The particular format of the output files is specified by the user in the input config.ini file. There are three options:

  1. full output - output all state variables; very large file sizes will results, but this is required for building initial conditions and for some analysis that require detailed composition and temperature information.
  2. average state parameter output - species averaged temperature and velocity; electron density. Probably best for most uses
  3. density only output - only electron density output. Best for high-res instability runs where only the density is needed and the output cadence is high

The organization of the data in the MATLAB/octave workspace, after a single frame is loaded via 'loadframe.m', is as follows. MKSA units are used throughout:

Time variables:

simdate - a six element vector containing year, month, day, UT hour, UT minute, and UT seconds of the present frame

Grid variables:

  • structure xg - members xg.x1,2,3 are the position variables, xg.h* are the metric factors, xg.dx* are the finite differences,
  • xg.glat,glon are the latitudes and longitudes (degrees geographic) of each grid point, xg.alt is the altitude of each grid point.
  • xg.r,theta,phi - for each grid point: radial distance (from ctr of Earth), magnetic colatitude (rads.), and magnetic longitude (rads.)

The grid structure, by itself, can be read in by the MATLAB function 'readgrid.m'; this is automatically invoked with 'loadframe.m' so there is not need to separately load the grid and output frame data.

Temperature variable:

Ts

  • first three dimensions have size lxs
  • 4th dimension is species index: 1=O+,2=NO+,3=N2+,4=O2+,5=N+, 6=H+,7=e-)

Density variable:

ns (same indexing as temperature)

Drifts:

vs1 (same indexing as temperature)

  • x2-drift component: v2 (same for all species, so this is just size lxs and is a 3D array)
  • x3-drift component: v3

Electromagnetic variables:

  • current density: J1, J2, J3
  • potential: Phitop (EFL potential)

Note that the electric field is not included in the output file, but that it can be calculated from this output by taking -vxB at an altitude above about 200 km or by differentiating the top boundary electric potential 'Phitop' with respect to the x2 and x3 variables; however, note that if a curvilinear grid is used the derivatives must include the appropriate metric factors.

Clone this wiki locally