Convective term unsteady 2D NS equations

Hi everyone, I am implementing unsteady 2D Navier-Stokes equations but I am having troubles with the convective term.
Looking at the FreeFem documentation, I have found the built-in function convect that works pretty well for my kind of problem. The code that implements the convective term in this way is the following one:

varf navierstokes([ux, uy, p], [vx, vy, q])  = int2d(Th)(
      rho/dt* [ux, uy]'* [vx, vy]
    + mu* (Grad(u):Grad(v))
    - p* div(v)
    - q* div(u)
    - 1e-10 *p*q    
	)
	+ int2d(Th) (
      [fx, fy]' * [vx, vy]
    + rho/dt* [convect([upx, upy], -dt, upx), convect([upx, upy], -dt, upy)]'* [vx, vy]
    )
  + on(noslip, ux=0, uy=0)
  + on(inflow, ux=uin, uy=0)
 ;

where up variables are the ones related to the previous time-step.
Thus, I have tried to directly implement the weak formulation of my problem, but it does not work. The related code is the following one:

varf navierstokes([ux, uy, p], [vx, vy, q])  = int2d(Th)(
      rho/dt*  [ux, uy]'* [vx, vy] 
    + mu* (Grad(u):Grad(v))
    - p* div(v)
    - q* div(u)
    - 1e-10 *p*q    
	)
	+ int2d(Th) (
      [fx, fy]' * [vx, vy]
    - rho/dt* [upx,upy]'*[vx, vy] 
	)
	+int2d(Th)(
	[upx,upy]'*Grad(u)*[vx, vy]
	)
  + on(noslip, ux=0, uy=0)
  + on(inflow, ux=uin, uy=0)
 ;

Have someone ever had the same problem? Can you help me?

Thanks in advance

Without the whole script it is impossible to sort out the error.

Is your problem is small and 2D, you can use the following approach:

This code uses implicit time stepping and LU factorization, and solves the perturbation for of the equations (stationary base flow and solves for the fluctuations). It worked for me nicely.

1 Like