What about rho and f in Navier-Stokes equations is not constant?

4 months ago by
In my model, the density and external force F varies on different elements on the mesh

but for the following function, all the demos I found treat both rho and f as constants? Otherwise I can't deal with the TrialFunction and TestFunction spaces. So, what should I do if rho and f are list related to the location of triangle vertices?

F1 = self.rho*dot((self.u - self.u0) / self.dt, self.v)*dx \
+ self.rho*dot(dot(self.u0, nabla_grad(self.u0)), self.v)*dx \
+ inner(sigma(self.U, self.p0), epsilon(self.v))*dx \
+ dot(self.p0*self.n, self.v)*ds - dot(self.mu*nabla_grad(self.U)*self.n, self.v)*ds \
- self.g0*self.v*dx

Community: FEniCS Project

1 Answer

4 months ago by
Hi there, rho has to be constant such that the flow is incompressible and mass balance is used for computing the pressure. Otherwise, rho can be computed by the mass balance, but in this case (compressible flow) you need to have a constitutive equation for the pressure. Only for ideal gas there is one, for a fluid it is very challenging to find or derive the appropriate constitutive equation. For f (if it is the supply term), you can use any function depending on space and time. Just use Expression() and define it.
Emek, you can have incompressible flow with space-varying density and mass balance equation, of course... The only thing with incompressibility is, that density must be constant on characteristics (i.e. lines where velocity is constant). So OP can of course add varying density and mass balance. But the question is a bit too generic (not fenics related)...
written 4 months ago by Michal Habera  
Dear Michal, you are right in general, but you need the mass balance for tracking the heterogeneous mass density (given initially). At least in the classical scheme of control domain, I don't see any other possibility. In this case the pressure needs a constitutive equation. Thanks for commenting, let me make my answer accurate: mass density has to be constant in time (called incompressible) and also homogeneous in the beginning leading to be constant in space as well.
written 4 months ago by Emek  
I do not agree. Think of an incompressible mixture of two immiscible fluids. You can stir it. You need mass balance to track both components, for sure. But pressure has no constitutive meaning for incompressible model. It is just Lagrange multiplier enforcing `\text{div}(v) = 0`. Again, mass density is constant only along characteristics. Incompressible means that determinant of deformation gradient is one and that is equivalent to `\text{div}(v) = 0`.
written 4 months ago by Michal Habera  
Interesting point and a nice example. If you use mass balance (for each constituent) for tracking them, how do you compute the numerical value of p? Is it by enforcing again div(v)=0 ? Which velocity is this v (constituent 1 or 2 or the mixture)?
written 4 months ago by Emek  
Thanks for your advices,  I have tried to add f by using Expression(), it may be silly, but how could I related f to the location of the element, say the x[0] and x[1] of certain element, and how to make f to be 2 dimensional that I could add f*v in the function, where v is Trial function.
written 4 months ago by wanting liu  
you can have

f = Expression( [ 'a * x[0] '  , ' x[1] ' ] , a=10.0 , degree=1 )
written 4 months ago by Emek  
thanks, it worked here.
written 4 months ago by wanting liu  
Please login to add an answer/comment or follow this question.

Similar posts:
Search »