performTwoHistoryArithmetic.py

This analyzer allows mathematical operations between two histories from the same simulation and writes the results (addition, multiplication, division, subtraction) to a third history. First we will look for histories in individual vsh5 files named baseName_history.vsh5 and if we do not find them we’ll check the regular history file. This behavior reduces problems on restart.

-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.

-H <histname>, --history1Name=<histname>

(string, required)

<histname> is the first history to use in the mathematical operation, H1.

-I <histname>, --history2Name=<histname>

(string, required)

<histname> is the second history to use in the mathematical operation, H2.

-o <histname>, --newhistoryName=<histname>

(string, optional)

<histname> is the history name in which to record the result, H3.

-x <a/s/m/d>, --operation=<a/s/m/d>

(string, required, default = a)

<a/s/m/d> is the mathematical operation to be applied where one of the following is chosen:

a: H3=H1+H2

s: H3=H1-H2

m: H3=H1*H2

d: H3=H1/H2

-w, --overwrite

(flag)

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

Output

The output is a VizSchema compatible history file called simulationName_newHistoryName.vsh5 containing the result. This result should be available in VSimComposer.

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.

Example

Consider the case where you have two different particle species incident on a wall, and separate absorbers for both. You may include histories for just the individual species within the simulation input, and combine them using this analyzer to determine the net current afterwards.