VisIt and VLSV bootcamp

Why we teach this lesson

VisIt is a scalable 3D-visualization software, suitable for supercomputing environments. It also has a home-brewed plugin to read and plot .vlsv files, which is why we prefer using it over similar alternatives such as ParaView. In this lesson, we look at configuring a VisIt client-server on LUMI, using VisIt and the .vlsv plugin for data exploration in 3D. VisIt and VLSV plugin are pre-installed on the LUMI workspace.

Intended learning outcomes

  • Using a client-server with VisIt.

  • Basic exploration of .vlsv files

    • SpatialGrid

    • FsGrid

    • Finding stored VDFs

  • Plotting fieldlines and streamlines

  • Plotting contours

  • vlsvextract and plotting a VDF

Maybe:

  • Compiling and installing the .vlsv plugin

Timing

Wednesday morning

Preparations for the exercises

If you haven’t yet done so, please:

  1. Install VisIt 3.3 locally.

  2. Download host_lumi_pepsc.xml and place it into your local $HOME/.visit/hosts

  3. Open VisIt, go to Options - Host profiles.. and change the Account to your username under the lumi-pepsc host.

  4. From options, click Save settings so the username is saved to your config.

Feel free to get to know the `VisIt manuals<https://visit-sphinx-github-user-manual.readthedocs.io/en/develop/getting_started/index.html>`_ as well!

The hands-on

  1. Launch your local VisIt

VisIt produces a plentiful amount of windows.

The main one (gui) is the tall one with plotting tools, from database list on the top, a time slider, and a plotting pipeline window, currently empty.

The other one you encounter by default is the viewer window. This will render your plots and let you navigate them - see the toolbar on the top for navigation, zooming, saving viewpoints, etc. You can have multiple windows as well, and there are handy layout buttons available.

Launching to client-server

  1. Click “Open”

  2. Choose Host lumi-pepsc, as given by the host configuration

    • This opens a VisIt metadata server on the frontend.

  3. Navigate Path to /pfs/lustrep2/scratch/project_465000693/example_runs/Mercury5D/bulk

  4. With file grouping at on/smart, open the bulk files as a database

  5. A Compute engine launch prompt appears. Launch one on small, adjust cpu counts if needed.

    • Might take a bit to queue…

    • A larger number of cores helps esp. with loading data from the .vlsv files!

While we wait a bit…

VisIt works by handling 3D data in pipelines, with two noteworthy concepts. Firstly, we can consider the mesh: the spatial structure that tells us where we have data, and how these data points are connected. In other words, this contains the geometry and topology of the dataset. We can extract new meshes from the existing ones via geometric operations, such as slicing. These operations can also be chained, and at the end we choose what data we actually want show on the mesh at the end of the pipeline. We’ll see plenty of examples soon!

First plots

Mostly, we’ll be using pseudocolor plots. Let’s get a feel for the 2D dataset!

  1. Set the time slider to the end

  2. Add a Pseudocolor plot -> proton/vg_rho to get the proton number density

  3. Notice we have now the full domain plotted - including the 3rd dimension, which is included even in the 2D/5D runs.

../_images/2d_0_rho.png
  1. Select the plot and use the Operator button, navigate to Slicing -> Slice

    • Double-click on the new operator in the pipeline menu.

    • De-select “Project to 2D”

    • Set Normal axis as Z, with intercept at 0

    • Click Apply in the dialog

    • Click Draw in the main window!

../_images/2d_1_slice.png

Double-clicking on the operators or or the plots opens attribure windows for those objects. Feel free to e.g. adjust the Pseudocolor colormaps or variable ranges from Pseudocolor attributes!

Let’s identify the system boundaries next.

Vlasiator boundaries

  1. Set the pseudocolor variable to vg_boundarytype.

visit/2d_2_boundary.png

Let’s compare that to the sysboundarytype enum:

namespace sysboundarytype {
  enum {
      DO_NOT_COMPUTE,   /*!< E.g. cells within the ionospheric outer radius should not be computed at all. */
      NOT_SYSBOUNDARY,  /*!< Cells within the simulation domain are not boundary cells. */
      IONOSPHERE,       /*!< Ionospheric current model. */
      OUTFLOW,          /*!< No fixed conditions on the fields and distribution function. */
      MAXWELLIAN,       /*!< Set Maxwellian boundary condition, i.e. set fields and distribution function. */
      COPYSPHERE,       /*!< A sphere with copy-condition for perturbed B as the simple inner boundary */
      OUTER_BOUNDARY_PADDING, /*!< These cells only occur on FSGrid, where boundaries are not at the highest refinement level */
      N_SYSBOUNDARY_CONDITIONS
  };
}

We find here the COPYSPHERE (5) boundary and DO_NOT_COMPUTE (1) cells covering the planet, approximately, as the inner boundary. Then, we can focus on the actual simulation domain:

  1. Add an operator to the plot: Selection -> threshold

  2. Open the threshold window, remove the “default” variable

  3. Add vg_boundarytype as a threshold variable, set min and max to 1 (NOT_SYSBOUNDARY)

  4. Click apply

../_images/2d_3_threshold.png

Now you can change the variable to e.g. proton/vg_rho, without system boundaries confounding the plot.

Vector plots

Let’s look at the vector plot type. Add one of vg_b_vol, and click Draw. This probably looks very empty:

../_images/2d_4_vector.png

Let’s go to Vector plot attributes, Geometry tab, and unselect Scale by magnitude, Apply:

../_images/2d_5_vector.png

Picking

Let’s see how to find an interesting cell and its CellID with VisIt.

Let’s use the plot of proton/vg_rho as a reference value slice in the background. Add another pseudocolor plot of vg_f_saved, and add a Threshold operator to diplay only cells with vg_f_saved = 1. Draw, and we should have cells with VDFs stored visible on top of the background slice.

../_images/2d_6_fsaved.png

Zoom in to the foreshock, select the Zonal pick operator, and click on a cell that looks like it could have interesting dynamics:

../_images/visit_pick.png

Pick operators in the VisIt viewer. Z for zonal, N for nodal. S for spreadsheet.

The following Pick window should open, showing the picked coordinates and the plotted variable.

../_images/visit-pick-window-default.png

That is not yet very useful. Adding CellID to the query variables helps! We should get a large-ish number, like 332776.

Going 3D

Let’s add a dimension to our plotting, and inspect one of these VDFs. The file /scratch/project_465000693/example_runs/Mercury5D/velgrid.332776.0000122.vlsv contains an extracted VDF (with vlsvextract) from the foreshock area, open it, and add a new window!

visit/new_window.png

Let’s start by plotting the full proton v-space mesh: Pseudocolor->proton

../_images/vdf_0_pseudocolor.png

This is now the outer edge of the VDF. We need to do something else if we want to have a look inside. Let’s add a Threeslice operator and Draw again.

../_images/vdf_1_threeslice.png

Quite a bit of structure there! But we still have the blocky v-space halo with values below the threshold. Let’s add an aptly-named thresholding operator:

../_images/vdf_2_threshold.png

Slices are good, but what if we want to have a more thorough view of the 3D structure of the VDF? Let’s remove the Threeslice operator from the plot, and draw. Now that we still have the threshold operator, we should see the outer edge of the VDF at the threshold value.

../_images/vdf_3_just_threshold.png

Try adjusting the threshold value e.g. to 1e-13!

A proper 3D run

Next, let’s see what one of our old low-resolution 3D tests looked like. Open the database at /scratch/project_465000693/example_data/EGE.

Let’s start by getting a quick overview with a pseudocolor plot of proton/vg_rho once more, and add a threeslice operator.

../_images/3d_0_threeslice.png

Streamline plots

Let’s add some fieldlines! These are produced in VisIt through an IntegralCurve system, which can be a bit hard to get into. Add a new pseudocolor plot with the variable: operators->IntegralCurve->vg_b_vol:

../_images/3d_1_integralcurves.png

Double-clicking on the integralcurve operator let’s you adjust the seeding of the lines. Let’s do something like the following - a spherical region with some radius of ~5e7 meters:

../_images/3d_2_integralcurves.png

Other practical aspects

VisIt may crash from time to time. Save your session often!

There are plenty of levers and clever tricks to pull in VisIt, this is really just scratching the surface in a short time.

Typical pitfalls

Forgetting to click Apply or Draw buttons.

Not noticing the small button with arrows to display

Not saving your session often.