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 grains, such as the average kinetic energy or the maximum residence time. A Granular Flow interface with the name <phys> (usually gran) creates the following operators:
<phys>.sum(expr) evaluates the sum of the expression expr over the grains. The sum includes all grains that are active. It excludes grains that have not yet been released and those that have disappeared.
<phys>.sum_all(expr) evaluates the sum of the expression expr over all grains, including grains that are not yet released or have disappeared. Since the coordinates of unreleased and disappeared grains are not-a-number (NaN), the sum may return NaN if the model includes unreleased or disappeared grains. An expression such as pt.sum_all(isnan(qx)) can be used to compute the total number of unreleased and disappeared grains.
<phys>.ave(expr) evaluates the average of the expression expr over the active grains. Unreleased and disappeared grains contribute to neither the numerator nor the denominator of the arithmetic mean.
<phys>.ave_all(expr) evaluates the average of the expression expr over all grains. It is likely to return NaN if the model includes unreleased or disappeared grains.
<phys>.max(expr) evaluates the maximum value of the expression expr over all active grains.
<phys>.max_all(expr) evaluates the maximum value of the expression expr over all grains.
The treatment of NaN values in nonlocal maximum couplings can be platform-dependent, so use caution when evaluating the maximum over all grains including disappeared and unreleased grains.
<phys>.min(expr) evaluates the minimum value of the expression expr over the active grains.
<phys>.min_all(expr) evaluates the minimum value of the expression expr over all grains.
The treatment of NaN values in nonlocal minimum couplings can be platform-dependent, so use caution when evaluating the minimum over all grains including disappeared and unreleased grains.
<phys>.max(expr, evalExpr) evaluates the expression evalExpr for the grain that has the maximum value of the expression expr out of all active grains. For example, in a model that uses the Granular Flow interface with the name gran, the expression gran.max(gran.V, qx) would evaluate the x-coordinate qx of the grain with the greatest velocity magnitude gran.V.
<phys>.max_all(expr, evalExpr) evaluates the expression evalExpr for the grain that has the maximum value of the expression expr for all grains, including disappeared and unreleased grains.
<phys>.min(expr, evalExpr) evaluates the expression evalExpr for the grain that has the minimum value of the expression expr out of all active grains. For example, in a model that uses the Granular Flow interface with name gran, the expression gran.min(gran.V, qx) would evaluate the x-coordinate qx of the grain with the smallest velocity magnitude gran.V.
<phys>.min_all(expr, evalExpr) evaluates the expression evalExpr for the grain that has the minimum value of the expression expr for all grains, including disappeared and unreleased grains.
An instance of the Granular Flow interface with the default name gran defines the built-in nonlocal couplings shown in Table 2-1.