What's the correct approach to the terms containing derivatives that cannot be represented (at least in any obvious way) as either convection or diffusion in FiPy? For example, in a system of PDEs being solved for functions u_i on a 2d region with coordinates x,y , one of the equations contains the term
u_2 * \partial_x u_1
I can represent it as a source, given that x and u_i are cell variables:
eq = ... + fipy.tools.numerix.dot(x.grad,u_1.grad) * u_2
However, due to how the gradient is computed in FiPy, x.grad is a vector with the value of (1,0) everywhere except the cells directly next to the x boundary, where it becomes (2,0). Which means that I have to use the vector (1,0) instead of x.grad from the start. But at this point I become unsure whether u_1.grad would have the correct value at the boundaries for the purpose of representing my term, and most probably, my whole approach is incorrect. What should I do to represent such a term?