Nonlocal Couplings
The purpose of a model is often to compute the sum, average, maximum value, or minimum value of a quantity over a group of particles, such as the average kinetic energy or the maximum residence time. A particle tracing interface with Name <name> creates the following operators:
<name>.<name>op1(expr) evaluates the sum of the expression expr over the particles. The sum includes all particles that are active, frozen, or stuck to boundaries. It excludes particles that have not yet been released and those that have disappeared.
<name>.<name>op_all1(expr) evaluates the sum of the expression expr over all particles, including particles those that are not yet released or have disappeared. Since the coordinates of unreleased and disappeared particles are not-a-number (NaN), the sum may return NaN if the model includes unreleased or disappeared particles. An expression such as pt.ptop1(isnan(qx)) can be used to compute the total number of unreleased and disappeared particles.
<name>.<name>aveop1(expr) evaluates the average of the expression expr over the active, frozen, and stuck particles. Unreleased and disappeared particles contribute to neither the numerator nor the denominator of the arithmetic mean.
<name>.<name>aveop_all1(expr) evaluates the average of the expression expr over all particles. It is likely to return NaN if the model includes unreleased or disappeared particles.
<name>.<name>maxop1(expr) evaluates the maximum value of the expression expr over all active, frozen, and stuck particles.
<name>.<name>maxop_all1(expr) evaluates the maximum value of the expression expr over all particles.
The treatment of NaN values in nonlocal maximum couplings can be platform-dependent, so use caution when evaluating the maximum over all particles including disappeared and unreleased particles.
<name>.<name>minop1(expr) evaluates the minimum value of the expression expr over the active, frozen, and stuck particles.
<name>.<name>minop_all1(expr) evaluates the minimum value of the expression expr over all particles.
The treatment of NaN values in nonlocal minimum couplings can be platform-dependent, so use caution when evaluating the minimum over all particles including disappeared and unreleased particles.
<name>.<name>maxop1(expr, evalExpr) evaluates the expression evalExpr for the particle that has the maximum value of the expression expr out of all active, frozen, and stuck particles. For example, in a model that uses the Mathematical Particle Tracing interface with name pt, the expression pt.ptmaxop1(pt.V, qx) would evaluate the x-coordinate qx of the particle with the greatest velocity magnitude pt.V.
<name>.<name>maxop_all1(expr, evalExpr) evaluates the expression evalExpr for the particle that has the maximum value of the expression expr for all particles, including disappeared and unreleased particles.
<name>.<name>minop1(expr, evalExpr) evaluates the expression evalExpr for the particle that has the minimum value of the expression expr out of all active, frozen, and stuck particles. For example, in a model that uses the Mathematical Particle Tracing interface with name pt, the expression pt.ptminop1(pt.V, qx) would evaluate the x-coordinate qx of the particle with the smallest velocity magnitude pt.V.
<name>.<name>minop_all1(expr, evalExpr) evaluates the expression evalExpr for the particle that has the minimum value of the expression expr for all particles, including disappeared and unreleased particles.
An instance of the Mathematical Particle Tracing interface with the default name pt defines the built-in nonlocal couplings shown in Table 2-1.