Add a function and tests for calculating divergence of a vector variable.