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 rays, such as the average intensity or the maximum path length. An instance of the Ray Acoustics interface with Name <name> creates the following four nonlocal couplings:
<name>.<name>op1(expr) evaluates the sum of the expression expr over the rays. The sum includes all rays that are active, frozen, or stuck to boundaries. It excludes rays 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 rays, including rays those that are not yet released or have disappeared. Since the coordinates of unreleased and disappeared rays are not-a-number (NaN), the sum may return NaN if the model includes unreleased or disappeared rays. An expression such as rac.racop1(isnan(qx)) can be used to compute the total number of unreleased and disappeared rays.
<name>.<name>aveop1(expr) evaluates the average of the expression expr over the active, frozen, and stuck rays. Unreleased and disappeared rays 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 rays. It is likely to return NaN if the model includes unreleased or disappeared rays.
<name>.<name>maxop1(expr) evaluates the maximum value of the expression expr over all active, frozen, and stuck rays.
<name>.<name>maxop_all1(expr) evaluates the maximum value of the expression expr over all rays.
<name>.<name>maxop1(expr, evalExpr) evaluates the expression evalExpr for the ray that has the maximum value of the expression expr out of all active, frozen, and stuck rays. For example, the expression rac.racmaxop1(rac.I, qx) would evaluate the x-coordinate qx of the ray with the greatest intensity rac.I.
<name>.<name>maxop_all1(expr, evalExpr) evaluates the expression evalExpr for the ray that has the maximum value of the expression expr for all rays, including disappeared and unreleased rays.
<name>.<name>minop1(expr) evaluates the minimum value of the expression expr over the active, frozen, and stuck rays.
<name>.<name>minop_all1(expr) evaluates the minimum value of the expression expr over all rays.
<name>.<name>minop1(expr, evalExpr) evaluates the expression evalExpr for the ray that has the minimum value of the expression expr out of all active, frozen, and stuck rays. For example, the expression rac.racminop1(rac.I, qx) would evaluate the x-coordinate qx of the ray with the minimum intensity rac.I.
<name>.<name>minop_all1(expr, evalExpr) evaluates the expression evalExpr for the ray that has the minimum value of the expression expr for all rays, including disappeared and unreleased rays.
An instance of the Ray Acoustics interface with the default name rac defines the built-in nonlocal couplings shown in Table 8-3.