Without knowing the frame you are working in:
A Tensor is an array of covariant and contravariant ordered index groups. The tensor can be witten by the sum of products of the elements of the array with the tensor product of the basis vectors e_i and their dual 1-forms dx^i.
Any differential operator like D[#. xkl]
or Del[#,xk]
or the covariant derivative simpliy works on tensor products as with ordinary products.
As a linear D
operator it works conventionally on any scalar function including the scalar valued, indexed tensor component and deals with the tensor products of the basis vectors and forms as with ordinary products, The product rule yields a sum over the basis vectors and forms. If the basis vectors a covariantly constant, all these terms are zero. That means that in an euclidean spaces with Cartesian bases only the coefficients are differentiated
General differentials dont make much sense, only the exterior derivative, that works an functions as Dt[ f[x],x ] /.{HoldPattern[D[x]:> dx, HoldPattern[D[D[_]]]]:> 0}
are used because they yield integrands for integrals of all kinds.
So much said, I define
ExteriorD[ Sum[ a _ik dx^i \[Wedge] dx^k ,...]]
--> Sum[ a_ik;l dx^l\[Wedge] dx^i \[Wedge] dx^k ]
where in Einstein notation ik;l denotes covariant D of ik component in direction l and \[Wedge]
is the antisymmetrc vector product TensorProduct[a,b]-TensorProduct[ b, a]
In contrast to partial derivatives, covariant derivatives, exterior derivatives, that yiled linear appoximations to fields in a neighborhood of a point, the divergence of a vector or tensor field is a metric dependent object, because, in essence, it is the limit of the outward transport flow of a tensor field over the small sphere bound a ball from its center at any point, divided by the volume of the ball. In curved spaces volume and surface of spheres depend on the local metric.
So in order to define a coordinate independent notion of Div
you have to replace tensor products of basis differnetials in your tensor product by their complentary tensor product of the differentials of the rest of the indices. This to be done by a metric product is defined to be the Hopf dual and is simply wittten as *T
.
In this notation the Div of a mixed tensor field in Cartesian coordinates with unit euclidean metric
Div[ Sum [T_ik(x) TensorProduct[e_i ,dx^k,]
-->Sum[ TensorProduct[e_i ExteriorD[ Tik(x) (-1)^(k-1) Delete[Wedge[ dx1 ,..., dx^n], k ]] ]
--> Sum[ TensiorProduct[ e_i , \[Partial_k T_ik ,x^k] ] Wedge[ dx1 ,..., dx^n]
This means that the divergence of a mixed tensor is a volume form with coefficients in the tensor product of basis vectors in T. As a volume form it can be integrated over a volume and yield the outward current over the surface.