3.19 Calculated derivatives
The introduction to matrix construction, Sec. 3.5 , described implicit and explicit discretisation of terms in an equation. It concluded that the principal derivatives of that can be treated implicitly — forming matrix coeﬃcients in — are a time derivative, advection and Laplacian.
Terms with other derivatives must be calculated from respective ﬁelds, e.g. from current values of . In Sec. 3.15 , we have described discretisation of a gradient, which is always explicit. This section gathers together the other derivatives found in equations for ﬂuid dynamics and associated models.
General divergence term
A general divergence term is any term that can be represented by . It excludes the Laplacian term which includes a gradient , and advection which includes .
The discretisation of a general divergence term is an explicit calculation using current values of . It is based on a surface integral using the divergence deﬁnition in Sec. 2.23 as shown below:

(3.30) 
Curl of a vector
The curl derivative is calculated from the gradient and applying the Hodge dual operator given by Eq. (2.40 ) using the following relation:

(3.31) 
Magsquare gradgrad
A derivative which appears in some model equations is , described as “magsquare gradgrad”. This derivative returns a scalar since the magsquare, e.g. , represents the inner product of with itself, as shown in Eq. (2.7 ).
The magsquare calculation always uses the appropriate inner product to reduce the result to a scalar. For a tensor , it is the double inner product, i.e. .
The gradgrad operator yields a thirdrank tensor in the case that is a vector ﬁeld. To avoid storing thirdrank tensors, the magsquare gradgrad operator is evaluated by summing the result from the operator on each component of by

(3.32) 