Considering Initial Conditions

Sometimes you want to make plots that take into consideration the initial conditions of a simulation. For example, in a long term simulation of asteroid evolution you might want the denote where the particles originated. We can do this with a sort filter and a function filter. Begin by loading in a bin.dat file with a Binary Position source. Send this into a sort filter and sort by p[0] (instead of the default v[0]). This will group the elements together by particle instead of by time step.

Now create a function filter and copy the values and parameters over. We want to add one new value that we will call a_i, for the the initial semi-major axis value. The formula for this should be "{p[0], v[0]=0} v'[1]". Let's parse through this to see what it does. The curly braces tell SwiftVis to do special selections in groups. In this case the groups are defined by constant particle IDs and the element we want to select from each group is the one where the time is 0. If your simulations starts with a different time use that instead. Alternately you could do "min v[0]" to always get the minimum time. Normally v[1] would be the semi-major axis value. The prime tels SwiftVis to use the value of the selected element, so v'[1] is the semi-major axis at the beginning of the simulation.

The output of this can now be sent around instead of the original Binary Position data and there will be a v[7] value in each element giving us the initial semi-major axis. This can be used in color formulas or whatever other way you might want to apply it to aid your analysis.