computePtclNumDensity.py

This analyzer script generates particle number density fields based on the particles data files. It works in 1D, 2D, and 3D Cartesian, as well as 2D RZ cylindrical.

The script can optionally perform a spatial average on the resulting data set. The spatial average is weighted and computed over an NxN square kernel. The size of the kernel and number of iterations are specified in the analyzer input. For example, if we set avgNxN to 5, the kernel would be weighted like this:

1

2

4

2

1

2

4

8

4

2

4

8

16

8

4

2

4

8

4

2

1

2

4

2

1

Setting iterateAvg to 2 will perform the averaging twice, for a smoother result.

Spatial averaging can become very slow for kernels much larger than 3, especially if the number of iterations is 2 or more, or if the dimensionality is 3.

The analyzer can also average over the saved particle data dumps. Set timeAvg to 1 if no average is desired. If the user chooses to average over N dumps, then the first N/2 dumps are averaged together and saved in time step 0,1,…,N/2. Likewise for the last N/2 dumps. Starting at data dump N/2, the data are saved from -N/2 to +N/2.

-s <simname>, --simulationName=<simname>

(string, required)

<simname> is the name of the simulation to be analyzed. The file extension should NOT be included in this text field.

-S <spname>, --speciesName=<spname>

(string, required)

<spname> is the name of the species for which particle number density is to be calculated.

-N <avg>, --avgNxN=<avg>

(int, optional, default = 1)

<avg> determines the size of the averaging kernel. Type an odd integer for N, and kernel will be N long in 1D, NxN in 2D, or NxNxN in 3D. Defaults to 1 if no averaging is desired.

-i <I>, --iterateAvg=<I>

(int, optional, default = 1)

If avgNxN > 1, <I> is the number of iterations of the spatial averaging function. Ignored if avgNxN = 1.

-t <T>, --timeAvg=<T>

(int, optional, default = 1)

If timeAvg > 1, <T> is the number of saved particle dumps to average over. If timeAvg = 1, then data are not averaged.

-m <min>, --minDumpNum=<min>

(int, optional)

<min> is the minimum dump number to process.

-M <max>, --maxDumpNum=<max>

(int, optional)

<max> is the maximum dump number to process.

-w, --overwrite

(flag)

Whether a dataset or group should be overwritten if it already exists.

Output

This analyzer script outputs particle number density data as fields. These density fields can help to analyze the particle distribution results in the simulation domain. The files written will have the .vsh5 file extension and will show up under Scalar Data on the Visualization pane as speciesNameDensity.

If you are running this analyzer from the UI, and the output dataset file already exists, then it will be overwritten each time the analyzer is run, unless you uncheck the Overwrite Existing Files box near the bottom of the Analysis Results pane.

If you are running the analyzer from the command line, the dataset will not be overwritten unless the -w, or --overwrite flag is specified on the command line.

The results of your analyzer may not be written into the output file if you have not specified the overwrite option to be True.