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 Geometrical Optics interface with physics interface tag gop creates the following nonlocal couplings:
gop.gopop1(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.
gop.gopop_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 gop.gopop1(isnan(qx)) can be used to compute the total number of unreleased and disappeared rays.
gop.gopaveop1(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.
gop.gopaveop_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.
gop.gopmaxop1(expr) evaluates the maximum value of the expression expr over all active, frozen, and stuck rays.
gop.gopmaxop_all1(expr) evaluates the maximum value of the expression expr over all rays.
The treatment of NaN values in nonlocal maximum couplings can be platform-dependent, so use caution when evaluating the maximum over all rays including disappeared and unreleased rays.
gop.gopminop1(expr) evaluates the minimum value of the expression expr over the active, frozen, and stuck rays.
gop.gopminop_all1(expr) evaluates the minimum value of the expression expr over all rays.
The treatment of NaN values in nonlocal minimum couplings can be platform-dependent, so use caution when evaluating the minimum over all rays including disappeared and unreleased rays.
gop.gopmaxop1(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 gop.gopmaxop1(gop.I, qx) would evaluate the x-coordinate qx of the ray with the greatest intensity gop.I.
gop.gopmaxop_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.
gop.gopminop1(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 gop.gopminop1(gop.I, qx) would evaluate the x-coordinate qx of the ray with the minimum intensity gop.I.
gop.gopminop_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.
The built-in nonlocal couplings defined by the Geometrical Optics interface are summarized in Table 2-1.