Home‎ > ‎How To's‎ > ‎Diagnostics and Plots‎ > ‎

Lab window moments

This mechanism is used to setup diagnostic locations in the lab frame at fixed z locations. This will record moments from the particles as a function of time at the given locations in the lab frame. The variable top.itlabwn controls how often the diagnostic is calculated. A value of n means that at every nth time step, the moments are calculated. The recommended method of adding the diagnostic locations is using the function addlabwindow. This function can be called at any time.

ilw_pi = addlabwindow(3.1415)

This will add a diagnostic station at z = 3.1415 meters in the lab frame. After the simulation, to plot the Xrms as a function of time at that location, the following call can be made.

pxrmslw(ilw=ilw_pi)

Below is a list of some of the function available for plotting the lab window moments. The whole list can be found in the python script lwplots.py, or printed using lwplotsdoc(). Each function accepts a number of arguments that can be used to control the plot. The documentation can be printed by, for example, doing doc(ppnumpw).

ppnumlw: Plots pnumlw as a function of time
pxbarlw: Plots xbarlw as a function of time
pybarlw: Plots ybarlw as a function of time
pvzbarlw: Plots vzbarlw as a function of time
pepsxlw: Plots epsxlw as a function of time
pepsylw: Plots epsylw as a function of time
pepzslw: Plots epzslw as a function of time
pvxrmslw: Plots vxrmslw as a function of time
pvyrmslw: Plots vyrmslw as a function of time
pvzrmslw: Plots vzrmslw as a function of time
pxrmslw: Plots xrmslw as a function of time
pyrmslw: Plots yrmslw as a function of time
prrmslw: Plots rrmslw as a function of time
pcurrlw: Plots currlw as a function of time
plostparslw: Plots lostparslw as a function of time
plinechglw: Plots linechglw as a function of time

The diagnostic data generated can be accessed directly. This, for example, will get the Xrms data for species js.

xrms = top.xrmslw[:top.ilabwn[ilw_pi,js],ilw_pi,js]

Careful indexing is needed for the first dimension to avoid including unused array elements (which are filled with zeros). The full list of moments can be found in the group Lab_Moments in top.v.

An alternative method can be used to setup lab windows, but it is not recommended. It is only listed here since it can sometimes be seen in old input files. It is to directly set the array top.zlw. This snippet will setup a window similar to the above example.

top.zlw[4] = 3.1415

Then, when calling the plot functions or accessing the arrays, 4 would be used instead of ilw_pi. This is not recommended since you would be required to allocate the space for the top.zlw array and you would have to handle the bookkeeping, keeping track of which window number refers to which location.
Comments