First of all thank you for this great open source project and these forums.
I tried to use the multi-relaxation time model in conjunction with the example code for the 2D lid driven cavity and discovered a
slow decrease of rho with time. Is this a known “feature” or am I doing something wrong?
I manipulated the code in the following way:
-substitution of D2Q9Descriptor with MRTD2Q9Descriptor in the whole file
Global conservation of mass is not guaranteed in the example of a cavity flow. That’s due to the treatment of the corner nodes, in which the velocity profile is discontinuous. I don’t know of an elegant way of getting around this problem and would actually be happy if somebody had a suggestion.
Using ConstRhoBGKdynamics is a possible workaround. At every time step, a constant density offset is added to all lattice sites in such a way as to keep the average value of rho constant. The physical assumption which is made here is that you can split rho into a slowly oscillating density component and a rapidly oscillating pressure component. If you accept the point of view that the gain resp. loss of mass through non-mass-conserving corner nodes acts on the density component of rho, and given that we are simulating an incompressible fluid, adding such an offset is a valid thing to do.
You will experience global density variations for any dynamics other than ConstRhoBGKdynamics, including MRTdynamics and BGKdynamics. I guess we should add ConstRhoMRTdynamics to the OpenLB library. In the meantime, you may want to do this by hand by invoking a command such as
In fact one way of dealing with this kind of disconituities is to put a polynomial profile on the moving wall (a very fast decrease at the corners and constant velocities on the rest). I don’t know if it will cure the mass loss, but it’s the way it is done for the “calssical” methods.