Starting with a vector identity,
where is the scalar variable to be diffused and is an arbitrary vector, integrate over a cell volume:
Each colored term in the equation above will be treated separately.
and if = 0 on the boundary, such that the Green term vanishes, then this equation becomes the definition of an adjoint,
which shows that the divergence is the negative adjoint of the gradient.
This is discretized into values defined on each face of the hexahedral cell,
The summation over faces ( ) includes six faces (+ k , - k , + l , - l , + m , - m ), shown here for the intensity variable :
Note that by defining the flux in terms of the remainder of the equation, the gradient is being defined in terms of the divergence.
The Blue term is discretized by evaluating the integrand at each of the cell nodes (octants in 3-D) and summing:
Combining all of the discretized terms of the colored equation and changing to a linear algebra representation gives
Rearranging terms gives
Note that the right hand side is a sum over the six faces, but the left hand side is a sum over the eight nodes.
where f1 , f2 , and f3 are the faces adjacent to node n and the Jacobian matrix is the square matrix given by
Using this definition for the node-centered vectors Wn and Fn and performing some algebraic manipulations results in
where the sum over faces has been written as a dot product of and , which are defined by
is the total number of local faces, which is equal to 6 in 3-D.
To convert the short vectors involving the faces adjacent to a particular node into sparse long vectors involving all of the faces of the cell, define permutation matrices for each node, Pn , such that
where, for example,
Note that Pn is rectangular, with a size of Nd x Nlf ( 3 x 6 for 3-D, 2 x 4 for 2-D, 1 x 2 for 1-D).
Using the permutation matrices, and defining in a fashion similar to ( is a vector of FTfAf for each cell face), gives
The original vector (on which Wf and are based) was an arbitrary vector. It can now be eliminated from the equation to give
which can easily be inverted to give the fluxes (dotted into the areas) in terms of the -differences, = S-1 . This is exactly the form needed for discretization of the diffusion term within Augustus.