OpenLB – Open Source Lattice Boltzmann Code Forums on OpenLB General Topics whats the math theory of the corner density calculation

Viewing 2 posts - 1 through 2 (of 2 total)
• Author
Posts
• #1764
Leaf
Member

hay, guys.rn I got several questions about openlb code. My code version is olb-0.8r0. Hope you can take some time to help me solve them.rnrn 1. When I traced the cavity2d example in olb-0.8r0, I found that the density on the corner is computed by the following code, which I couldn’t understand. Could anybody tell what theory of this process takes. Thank you so much.rn

Code:
T rho = (T)2/(T)3*(rho01+rho10) – (T)1/(T)6*(rho02+rho20);

rnrn 2. About the f distribution calculated in bgkCollision, why is the const multiplier of uxSqr_, uySqr_ 3. For most D2Q9 models it’s 9/2. Here is the code:rn

Code:
T uxSqr = u[0]*u[0];rn T uySqr = u[1]*u[1];rnrn T ux_ = (T)3 * u[0];rn T uy_ = (T)3 * u[1];rnrn T uxSqr_ = (T)3 * uxSqr;rn T uySqr_ = (T)3 * uySqr;rn T uxSqr__ = (T)3/(T)2 * uxSqr;rn T uySqr__ = (T)3/(T)2 * uySqr;rn T uSqr_ = uxSqr__ + uySqr__;rnrn T uxPySqr_ = (T)9/(T)2 * (u[0]+u[1])*(u[0]+u[1]);rn T uxMySqr_ = (T)9/(T)2 * (u[0]-u[1])*(u[0]-u[1]);rnrn rho_ = (T)1/(T)9 * rho;rn cf_ = (T)1/(T)9 * (rho-(T)1);rnrn cell[6] *= (T)1-omega;rn cell[6] += omega*(cf_ + rho_*(ux_ + uxSqr_ – uySqr__));rn cell[8] *= (T)1-omega;rn cell[8] += omega*(cf_ + rho_*(uy_ + uySqr_ – uxSqr__));rn cell[2] *= (T)1-omega;rn cell[2] += omega*(cf_ + rho_*(-ux_ + uxSqr_ – uySqr__));rn cell[4] *= (T)1-omega;rn cell[4] += omega*(cf_ + rho_*(-uy_ + uySqr_ – uxSqr__));

rn rn what’s more, does anybody have the example code of Kovasznay flow. If possible, would you plz send me a copy? Here is my email address, openlb12@163.com. Thank you so much.rnrnrnrn best wishes!

#2152
mathias
Keymaster

Hi openlb12,rnrn1/ This is extrapolating rho to the corner node. rn2/ If you rewrite the standard form as a sum you will see that the code is exactly teh same. It is written in this unusual form to speed up the code. (cf. e.g. Mohamad p. 71 -> e.g. in the line for k=1 you find twiche ux^2 terms. If you join them you get 9/2ux^2 – 3/2ux^2 = 3 ux^2, i.e. that is there the 3 comes from!)rnrnBest regardsrnMathias

Viewing 2 posts - 1 through 2 (of 2 total)
• You must be logged in to reply to this topic.