Gauss Point Evaluation
You can create a smooth field within each element for any expression by using the gpeval() operator. In its most basic version, this operator has the following syntax: gpeval(integration_order, expression).
For a general description of the gpeval() operator, see gpeval in the COMSOL Multiphysics Reference Manual.
The gpeval() operator evaluates an expression at a given set of Gauss points and creates an approximate smooth field using the least squares fit. It is important to use the correct integration order to accurately evaluate state variables stored at Gauss points, as in the case with many nonlinear material models. For example, when quadratic shape functions are used with full integration, the first argument to the gpeval() operator should be 4.
For some common cases, physics interfaces define built-in variables with Gauss point evaluation. As an example, the built-in variable solid.sGpx is equivalent to using the expression gpeval(4,solid.sx). Another example is solid.misesGp. However, similarly using gpeval(4,solid.mises) can lead to unphysical negative values caused by the extrapolation done by the operator. Hence, for a variable that is strictly positive, one should use max(0,gpeval(4,solid.mises)) or similar expressions; this is done for all relevant built-in variables with Gauss point evaluation.
When working with surface plots in a 3D geometry, or with line graphs in 2D and 3D, there is a subtle difference between the built-in variables and the operator syntax. The built-in variables are defined in the domain, and the field is projected from the domain to be evaluated on boundaries and edges. If, however, you type in the operator syntax as an expression in a line graph, the field is created only on that line, using only Gauss points on the element edges. In order to avoid this, create domain variables under Definitions>Variables using the operator syntax, and then use them on boundaries or edges. Another alternative is to use the mean() operator, which evaluates any expression in adjacent entities of higher order. For example, to evaluate a domain variable in different plots in 3D, use the following syntax:
Surface plot: mean(gpeval(integration_order, expr))
Line graph: mean(mean(gpeval(integration_order, expr)))
Point graph: mean(mean(mean(gpeval(integration_order, expr))))
There are also built-in operators that can be used specifically for evaluating domain variables in any type of plot. Their syntax is summarized in Table 2-20. These operators also automatically set the integration order to be consistent with its parent physics interface <phys>, as opposed to the corresponding general operators. Also, for example, reduced integration is taken into account.