1

The term I want to express is a part of N-S equation. u,v are the component of flow velocity

Is the following code correct?

u = CellVariable(mesh=mesh,hasOld=1,value=0.0)
v = CellVariable(mesh=mesh,hasOld=1,value=0.0)

coeff_con = FaceVariable(mesh=mesh,rank=1)
coeff_con.setValue([u.arithmeticFaceValue,v.arithmeticFaceValue])

ConvectionTerm(coeff=coeff_con,var=u)

I will reset the value of coeff_con whenever the u, v updates.

1 Answers1

1

As an incomplete piece of solving Navier-Stokes, what you have is OK. You will need to update coeff_con after every sweep. This won't result in stable solutions. Our Stokes example shows how to implement the SIMPLE pressure correction algorithm.

jeguyer
  • 2,379
  • 1
  • 11
  • 15
  • 1
    Thanks for your answers. Maybe I do not express the question clearly, and I re-edit it. To your first reason, I reset the value whenever u, v updates . To your second reason , I define the coeff_con as a rank-1 FaceVariable before I set value to it. Then, can the code work correctly? Thanks for your help again. – Xiukai Wang Jun 12 '20 at 01:35
  • 1
    I have revised my answer based on your revised question – jeguyer Jun 12 '20 at 13:22