Vector Diffusion Terms
We are now planning to implement equations of the form,
This has already been done partially in source:branches/vectorEquations. The convection term looks something like this
The coefficient is a rank 3 tensor in this case. The first index is always over the spatial range. The next two indices refer to the q's. We now have to address diffusion terms. The trouble is that we already have effective rank 3 coefficients for higher order diffusion terms so it's all getting a bit complicated, but it is still manageable.
For higher order terms, we generally use a list or tuple and don't embed the index as part of the tensor so I think that is automatically dealt with. So higher order terms should always be indexed with a tuple or list. That is our current policy and it makes sense. A second order diffusion term will now be of the following form,
Of course the rank of can vary depending on whether anisotropy is required. This requires some interpretation. If is rank 0 then it will be assumed that all the indices of are spatial. If q is rank 1 then it will be assumed that the last two indices are over q. For example if the variable is and the coefficient is then it's assumed that has a vector coefficient. If the variable was instead just then FiPy should throw an error as the coefficient has too many indices. Similarly, for a non-anisotropic vector equation the coefficient would simply be . The meaning of the coefficient indices changes based on context.