Inquiries about solving the N-S equation, projection algorithm and parallel

Hello everyone,

I am not very familiar with FEM and have limited knowledge about its implementation for the Navier-Stokes equation. Currently, I am trying to understand the principles of FEM and parallel computing, but my learning progress is slow.

For now, my research involves solving 2D/3D N-S equation and temperature equation under a large range of Ra/Re number(10^5<=Ra<=10^10). Consequently, the computational cost increases significantly due to the Kolmogorov length scale. To study a 2D convective heat transfer problem, I tried to adapt the script Rayleigh-Benard-time.edp by frederichecht, it works well but, slower and slower when Ra increases.
My serial script uploaded:R-B_obstacles.edp (7.8 KB)

My supervisor recommends the projection algorithm and parallel computing.
The projection method avoids solving a large system at a time, replaced by 2 or 3 decoupled equations for velocity and a Poisson-like equation for pressure. A implementation NSprojection.edp uses only P1 elements, but some common practices using the pressure space 1 order lower than the velocity space such as P2-P1.
I watched the tutorial Pierre Jolivet introduction to parallel FreeFEM part 1, I noticed that the equation for pressure pb4p(q, w, solver=CG, init=n, eps=epsp) = int2d(Th)(dx(q)*dx(w) + dy(q)*dy(w)) - int2d(Th)((dx(u) + dy(v))*w/dt) could be solved in parallel just as the video did.

To find some power law through a series of simulations under a large range of Ra, I need to ensure my numerical results reflect the properties of the equation derived from true physical world correctly.

So the problems are:

  1. Can NSprojection.edp handle high Reynolds numbers and be easily adapted in parallel?
  2. If so, how to deal with convective term:
    = int2d(Th)(
      u*w/dt + nu*(dx(u)*dx(w) + dy(u)*dy(w))
    )
    - int2d(Th)(
      (convect([uold, vold], -dt, uold)/dt - dx(p))*w
    )
  1. Is it reasonable to use the same element for u and p in projection algorithm? Is it better to use P2-P1 element?

Best regards

Hello,
I am not an expert on parallel issues, but I can give you some hints on the other parts.
2. You should not use convect, which is relevant when there is no viscosity. Since you have viscosity you can solve the convection implicitly as

= int2d(Th)(u*w/dt + nu*(dx(u)*dx(w) + dy(u)*dy(w)))
  - int2d(Th)(uold*w/dt)
  + int2d(Th)(dx(p)*w)
  + int2d(Th)((uold*dx(u)+vold*dy(u))*w)
  1. In the projection method it is not mandatory to satisfy an inf-sup condition (thus you can use P1/P1), but you will get a more accurate solution if the inf-sup condition is satisfied (as for P2/P1).
1 Like

Thanks a lot! Your answer has addressed many of my concerns, I will try to implement a simple script using such an implicit scheme for convection.

Best regards,
Haocheng Weng.

Sorry but I am a bit confused. Why the built-in function convect relevant to inviscid flow?
I have no idea because the convection term u'*grad(u) is without nu.
Also, those serial examples related to N-S equation like NSUzawaCahouetChabart.edp using “convect” and they are indeed viscous flow. Could you please explain this further or if I have some misunderstanding?
Thank you very much for your help,
H. Weng

The fact is that when there is no viscosity the problem is hyperbolic. Thus you should not use the implicit formulation because it could be unstable, and give weak or strong oscillations. You should use convect, which is adapted to the hyperbolic structure.
With viscosity you have elliptic regularization of the gradient of the solution, that stabilizes the implicit resolution of convection (intuitively second-order derivatives dominate the first-order ones involved in the convection). This holds with a moderate Reynolds number Re=L*u/nu. But you are right in this case you can also use convect even if it is of really different nature than the spirit of finite elements (but it is truly relevant if you consider small viscosity i.e. large Reynolds number).
Indeed since there is space discretization the real key value is the discrete Reynolds number Re_h=h*u/nu with h the size of the mesh cell. If Re_h is not too large then the implicit formulation is possible.

Thank you very much for such detailed response. I need some time to digest those different stability properties of PDEs.

So, if the discrete Reynolds number Re_h is not too large, computational stability can be guaranteed, right? From the definition Re_h=h*u/nu, it appears to imply that the size h is proportional to nu/u, when I take Re_h fixed. Before, when simulating some 3D pipe flow I just build a initial 2D mesh, and for different Re=1/nu, and do splitting to the initial mesh to ensure h_local*Re^3/4=const. My problem definition, similar to NSprojection.edp, using convect, but with an extra dimension z, I noticed that sometimes, during the transition to turbulence, the computation blows up when timestep too large.

Is it better, for the stability and accuracy of computing, to use something like adaptmesh to let local mesh size h = const*nu/u? Here, the exponent of Re_h is 1, whereas that of the Kolmogorov scale is 3/4. I would like to know if maintaining the condition of an appropriate Re_h is more strict than that of an appropriate Kolmogorov scale to resolve the details. Further more, what are the criteria for selecting an appropriate mesh size in DNS within FEM?

H. Weng

The condition say Re_h<1 does not mean that you get an accurate solution, it just means that your computation is stable with respect to space discretisation if you use the implicit method for advection.
If you use convect this condition is not required.
If you have other criterion on h to achieve accuracy, you have to respect them additionally.
Concerning time stability, probably you need to respect that nu*dt/h^2 and u*dt/h of order of unity at most.
The mesh size h should be dictacted a priori by your data: it should be the cutoff length under which you do not wish to compute the details of the solution. But as you say it should be small enough in relation with nu in order to resolve your Kolmogorov scale.

Thank you once again! Your comprehensive answer has provided me with a further understanding of the issue. Now it’s much more clear for me.

I have written a FreeFEM code to compute vorticity formulation of incompressible flow using problem, which is a bit slow and can’t be parallelized.
So I tried to write a matrix form but met some problem.
I found an algorithm to solve this problem(JIAN-GUO LIU AND WEINAN E, 2000"SIMPLE FINITE ELEMENT METHOD IN VORTICITY FORMULATION FOR INCOMPRESSIBLE FLOWS"), which decouples the vorticity \omega and stream function \psi :




image
The X_{0,h}^k is the subspace of X_h^k with zero boundary value.
To compute an auxiliary term \bar{\omega}^{n+1}, I need to get a submatrix (A_{0,0} A_{0,b}) from the stiffness matrix A to compute right hand side of (I’), and compute the nonlinear term N.
In my code using problem, the explicit nonlinear term (\nabla \varphi,\omega \nabla^{\perp}\psi) is:

grad(v1)'*[-dy(psiold),dx(psiold)]*omegaold

How to write a varf of nonlinear term as (2.6)?
I know that I can use varf Stiffness(u,v)=int2d(Th)(grad(u)'*grad(v)); and set tgv=-10 to build a matrix of Stiffness with zero rows of label 1 , but I have no idea to build A_{0,b}.
I found the method to get list of DoF boundary in Frédéric Hecht’s reply:

If I get the list of DoF on boundary, should I permutate the rows and columns of Stiffness to get A?Or is there a better way to implement such algorithm?
Could you give me some advice?