Opening and Running Two Stream (Visual setup)

It is possible to run postprocessing analysis scripts within the VSimComposer environment. These scripts can process data generated in a simulation and write that data to a .h5 file that can then be visualized like any other simulation data.

Here, we will discuss the basic process of using a predefined analysis script. Other analysis options include using text-based setup to set a default analysis script in their .pre file and importing custom analysis scripts. For more details on these procedures, please see analysisdefault and VSim Customization: Create Your Own Script.

In this section, we will go through the basics of running analysis scripts, and will incorporate the two stream example (visual setup) to illustrate the processes. To open the two stream example and follow along:

  • Select the New -> From Example menu item in the File menu.
  • In the resulting Examples window, expand the VSim for Basic Physics option.
  • Expand the Basic Examples option.
  • Select Two-Stream Instability and press the Choose button.
  • In the resulting dialog, create a new folder if desired, and press the Save button to create a copy of this example in your run area.
  • This will open the Two-Stream Instabilitiy example. For this exercise, we will use the default parameters.

See Fig. 81.

Setup Window

Fig. 81 Setup Window for Two Stream Example

Select a Predefined (Installed with VSim) Analysis Script

VSimComposer allows the user to select a predefined (installed with VSim) analysis script from the Analysis window. You can either type in the filename of your analysis script or check the box Show All Analyzers to choose one from the list. You can also select the Import Analyzer button at the bottom to import your own customized script.

For the two stream example, wait until the simulation run has completed and then click on the Analyze tab located below the Run tab on the left hand side of the screen.

  • In the Analysis Controls pane, check the box Show All Analyzers. This will bring up all of the available analysis scripts.
  • For this example, we will select computePtclNumDensity.py.
  • In the Analysis Results pane and under the Outputs tab, instructions as to which variables have to be given by the user will appear.
  • For this particular script, the only two variables are the simulationName and the speciesName. For simulationName, give it the name of the simulation, in our case twoStream. The speciesName parameter is either electrons0 or electrons1, the two species of electrons in this simulation.

See Fig. 82.

Analysis Window

Fig. 82 Analysis Window with Parameters

This process should be the same for both visual and text-based simulations.

However, there are different processes for keeping analysis scripts available for your simulation through closing and reopening. For visual setup, simply run your simulation and analysis script of choice as usual, and then return to the Setup tab and select the Save and Setup button in the top right. This process saves your analysis script in the .sdf file for your simulation. For text setup, you can Set a Default Analysis Script in your .pre File.

Running the Analysis Script

Click the Analyze button located at the top right of the Control pane.

Analysis Window

Fig. 83 Analysis Window Successful Run

Output of an Analysis Script

The data generated from the execution of an analysis script will be stored as a .vsh5 file and is visualizable underneath the Visualize tab. Be aware that the analysis script may also produce data that it writes to the screen or as hdf5 output.

Finishing up with the two stream example, the data we got from computePtclNumDensity.py can be visualized through the following:

  • Open the Visualize tab. You may need to click on the Reload Data button at the bottom of the Visualization Controls pane if you have gone back and forth between the windows and the VSim computational engine has generated more data.
  • Switch the Data View to 1-D Fields.
  • For Graph 1, select electrons0Density for the Base Variable which is the first drop-down selection under Graph 1.
  • For Graph 2, select electrons0Density again for the Base Variable. In the Visualization Results pane (2nd graph), click the FFT box to see the Fast Fourier Transform output of the frequency domain.
  • To match the visualization of this documentation, select Dump 2 in the slide bar at the bottom of the Visualization Results pane.
  • Click on the DRAW button at the bottom of the Visualization Controls pane.

You can explore other visualization options in this window, or can rerun the simulation with different parameters to investigate further.

Visualization Window

Fig. 84 Visualization of the analysis data