This is a read only copy of the old FEniCS QA forum. Please visit the new QA forum to ask questions

Need some help for nonlinear term of Navier-Stokes Equation

0 votes

I test my iterative algorithm for solving Navier-Stokes Equation. My variation equation has this term
: ( ( \nabla \dot U_k ) U , V ), where U_k: know, and U :trial function and V: test function.

The problem is :
When I use :

inner ( nabla_grad (U) * U_k, V ) * dx

the solution will blow up. Especially for high Reynolds number !

But when I use (nothing changed other place) :

inner ( nabla_grad (U).T * U_k, V ) * dx

the solution is right.

Then I changed my code into the representation in components:

( ( U_k[0] * U[0].dx(0) + U_k[1] * U[0].dx(1) ) * V[0] + ( U_k[0] * U[1].dx(0) + U_k[1] * U[1].dx(1) ) * V[1] ) * dx

the solution is also right.

But I see the FEniCS Book 's example (page 402.) , and these examples are all using the first code. So , Does this change in new versions or my code is wrong? Thanks!

asked Dec 2, 2013 by HS.Sheng FEniCS Novice (570 points)

1 Answer

+2 votes
 
Best answer

Hi, your working example with components is

U[i].dx(j)*U_k[j],

which in ufl reads grad(U)*U_k. This is different from nabla_grad(U)*U_k, because

nabla_grad(U)[i, j] = U[j].dx(i),

i.e transpose of grad(U). Consequently nabla_grad(U).T*U_k is the same as grad(U)*U_k and that's why the second sample works as well. As far as the first example is concerned, in the latest version of the book, the code reads dot(U_k, nabla_grad(U)), that is

U_k[i]*U[j].dx[i].

So you see it is the same as grad(U)*U_k. Is there a chance you omitted the dot product?

answered Dec 2, 2013 by MiroK FEniCS Expert (80,920 points)
selected Dec 2, 2013 by HS.Sheng

Extremely thank you ! :)
This website is so helpful to our new users !

...