Welcome! Log In Create A New Profile

# Lattice Boltzmann Units Example

 Lattice Boltzmann Units Example March 27, 2008 04:38PM Registered: 11 years ago Posts: 19
I was wondering if it would be possible to make a sticky post for a units example. It seems
that units can be frustrating to figure out for people new to LBM. I did an example below. I had one
question about the pressure conversion and multiplying by rho.

Units example of LBM

Have a 2-D channel flow that is 4 cm long and 1 cm wide

___________________________________________
| |
| |
| |
| |
| | 1 cm
| |
| |
| |
|__________________________________________ |

4 cm

The grid is 100 x 25

The physical viscosity and rho are known...
nu_{Phys} = 0.035 cm^2/s
rho_{Phys} = 1 g/cm

Calculations

dx_{Phys} = 1/25 = 100/4 = .04 cm

assign a value to tau
tau = 1.5

given that nu_{Phys}=dt_{Phys}/(dx_{Phys}*dx_{Phys})*nu_{LB}

and that nu_{LB} = c_s^2(tau-1/2)

dt_{Phys} = nu_{Phys}*dx_{Phys}*dx_{Phys}/c_s^2/(tau-1/2)

dt_{Phys} = .035*.04*.04*3/(1.5-.5)

dt_{Phys} = 0.000168 s

Assume there is an applied pressure at the inlet of
P_{Phys} = 16000 Pa

1 Pa = Kg/m-s^2

P_{LB} = P_{Phys}* 1000g/kg * 1m/100cm * dx_{Phys} cm/LU *dt_{Phys}^2/TU
P_{LB} = 0.00018 g/LU-TU^2

rho_{LB} = rho_{Phys} * dx_{Phys}^3/LU^3
rho_{LB} = 1 gm/cm^3 * .04^3
rho_{LB} = 0.000064 g/LU^3

Does the pressure need to be multiplied by rho at this point???
 Re: Lattice Boltzmann Units Example March 28, 2008 03:39PM Registered: 11 years ago Posts: 347
Hi,

I like the idea of producing a show-case example for unit conversion. There are two points that are not clear to me in your post though.

1) You define the discrete space and time steps in such a way that they carry physical units: [dx] = cm and [dt] = s. On this assumption, a dimensional analysis of your equation which relates nu_{phys} to nu_{LB} is erroneous. Shouldn't this formula be as follows, in order to get the right units:

nu_{Phys}=(dx_{Phys}*dx_{Phys})/dt_{Phys}*nu_{LB} ?

2) I am not sure which lattice Boltzmann model you are referring to. If it is BGK, then pressure and density are not independent parameters. They are related through the law of an ideal gas: p = c_s^2 rho. I have the feeling that most people who use BGK use it to simulate an incompressible fluid. In that case, the physical value of the density rho is irrelevant (although variations of rho are still relevant in simulation, as they are proportional to pressure variations). Even if you do use BGK to simulate a compressible fluid (in which case you should be aware of the many limitations, such as being constraint to a low Mach-number regime, impossibility to adjust the speed of sound, and impossibility to adjust the bulk viscosity), I am not sure if it is a good idea to adapt the LB density as a function of the physical density. In practice, everybody I know of uses a density value close to 1, and you actually run into numerical instabilities and inaccuracies when you differ too much from this value.

When you implement a boundary condition for the pressure, the translation from physical units to lattice Boltzmann units should, according to me, be as follows:

rho_{LB} = 1+1/c_s^2 p_{Phys}dt_{Phys}^2 / dx_{Phys}^2

where c_s^2 is the constant 1/3, which should be used without units when you proceed to a dimensional analysis of the above equation.

Edited 1 time(s). Last edit at 03/28/2008 03:43PM by jlatt.
 Re: Lattice Boltzmann Units Example March 29, 2008 03:52AM Registered: 11 years ago Posts: 54
just wondering if this is really a good idea, setting tau to an arbitrary value. shouldn't it be the other way round, choose a value for delta_t, and then compute tau?
 Re: Lattice Boltzmann Units Example March 29, 2008 12:58PM Admin Registered: 11 years ago Posts: 231
You can do it both ways. The point is that chosing delta_t you can have troubles with the stability of your code (tau could become very close to 1/2).
 Re: Lattice Boltzmann Units Example April 16, 2008 09:06AM Registered: 11 years ago Posts: 21
Hello everybody,
Would you please inform me, If I want to put any constant value (e.g. Boltzman constant Kb=1.38065 J/K or Gas constant R=8.314511 J/mol/K) then how can I put it. Can I just put it directly or need to convert it to LB ? With all the best
 Re: Lattice Boltzmann Units Example April 18, 2008 01:39PM Admin Registered: 11 years ago Posts: 231
Hi,
of course you need to convert them into LB units since they have real world units. The non dimensional numbers are the only quantities you do not need to convert (it sounds quite trivial because they have no units...).

Orestis
 Re: Lattice Boltzmann Units Example April 18, 2008 09:43PM Registered: 11 years ago Posts: 7
A potentially useful reference here might be Sukop and Thorne LB Introductory textbook, pages 56-57 on gravity-forced 2D poiseuille channel flow. This includes:

(1) A slightly reversed case to the original question: how big does the channel need to be (lattice units) in order for the flow to give the desired Re number. In this case, a target value of tau = 1 is used.

(2) How to incorporate gravity by converting from SI to lattive units: ie. have to take 9.8 m/s^2 and find its value in units of (lattice units) / (timestep)^2.
 Re: Lattice Boltzmann Units Example April 21, 2008 03:25AM Registered: 11 years ago Posts: 21
Hi malaspin,
Would you please explain how can I convert gas constant R=8.314511 J/mol/K, if I know the lb units of length, time and mass?( J=m^2*kg/s^2). What should I do about Temperature unit(K)?
Yours Truly

Edited 1 time(s). Last edit at 05/12/2008 04:06PM by mmatadu.
 Re: Lattice Boltzmann Units Example April 21, 2008 11:57AM Admin Registered: 11 years ago Posts: 231
Hi,
it depends a bit of the kind of simulation you are performing.

Usually you will convert from lb to real world units using non dimensional numbers like Reyolds, Rayleigh, ...

For the temperature you can use the Rayleigh number to transform your quantities between the LB and physical units. You can find details in another post by tovarish here . I hope you can get the information you want from there. If not maybe you should tell me with more details what is your physical problem.

Orestis
 Re: Lattice Boltzmann Units Example April 21, 2008 07:17PM Registered: 11 years ago Posts: 50

is the problem you are trying to resolve isothermal? If the answer is yes, you wont find your answers in the post Orestis told you about.
Is your problem thermal dependent and it is such that you can define a dimensional number called Rayleigh number for it? well ... then the post could be useful. In fact the Rayleigh number depend on the gradient of the temperature.

Is your problem the Couette flow with energy dissipation due to the viscous forces? then still look at the post.. we refer to a paper that could help.

By the way ...
The Boltzmann's constant should be defined for a reference temperature... no? I'm not sure but ... then it would a constant that you could get rid off in LB units... of course you should remember about its value when you go back to the "real" world. Orestis? am I writing bullshit as usual? ;)

or, as Orestis said, you could look for an interesting dimensionless number where R appears ..

really .. could you please post your problem or ..the paper that you are looking at? I'm interested in it. To pass from real units to LB units is something that it has always been super tricky for me.
Do you find R when you define the internal energy of your system (which should depend on the temperature then)?

ciao
And
 Re: Lattice Boltzmann Units Example April 21, 2008 07:49PM Admin Registered: 11 years ago Posts: 231
Hi,
in fact if you are using the standard LBGK model then the model is "a-thermal", in the sense that you cannot adjust the temperature. The way to convert between temperature and lattice units is through the speed of sound and the ideal gas law.

You remember that p=c_s^2*rho, and p=rho*k*T, then c_s^2=k*T, where k is the Boltzmann constant.

I hope that if you are in one the cases mentioned by Tovarish or me.

If not just post your problem and try to help you. Btw you did not say so much bullshit ;p

Cheers,
Orestis
 Re: Lattice Boltzmann Units Example April 21, 2008 08:26PM Registered: 11 years ago Posts: 50
Thanks a lot Master... ;)

Andrea
 Re: Lattice Boltzmann Units Example April 22, 2008 08:35AM Registered: 11 years ago Posts: 21
Hi All,
I have a simple problem, just like a channel flow(say L=8mm, H=3mm)in which Lower plate is heated(300 K) and upper plate is maintained at a constant temperatrure(273K), however both plates are fixed .Incoming fluid (say water) velocity is controlled by Reynolds number . As a channel flow, velocity is important but most of Authors suggest me to use Rayleigh number. But we know ,in Rayleigh-Benard Convection, velocity is taken to be zero and Boussinesq approximations are used. So what should I do?
All kind of suggestions are most welcome.
Yours Truly
Sohag
 Re: Lattice Boltzmann Units Example April 22, 2008 05:43PM Registered: 11 years ago Posts: 50

look at this paper ...

it could help

Entropy generation in Poiseuille–Benard channel flow

doi:10.1016/S1290-0729(03)00095-4

let me know if this is what you were looking for .........

ciao
And
 Re: Lattice Boltzmann Units Example April 23, 2008 07:41AM Registered: 11 years ago Posts: 347
As there have been many discussions around the choice of units in LB simulations, I have tried to summarize the key ideas in a pdf document. You can retrieve it from the new "LB Howtos" section on lbmethod.org:

[www.lbmethod.org]

The document contains also a section on thermal fluids with Boussinesq approximation. Please let me know if this answers your question. Of course, I welcome any comments or hints on possible mistakes in the document.
 Re: Lattice Boltzmann Units Example April 23, 2008 07:20PM Registered: 11 years ago Posts: 19
Jonas,

Thank you very very much for the excellent pdf file on units! You have been super on this forum.

Mark
 Re: Lattice Boltzmann Units Example May 06, 2008 08:09AM Registered: 11 years ago Posts: 3
Hi,

This question is about units on the Matlab Lattice Boltzmann Coding:

I am trying to figure out the physical interpretation of the values for uMax, as well as the grid spacing for the Matlab code in "cylinder.m" however the author has failed to document/comment on what the units, is the uMax = 0.02 to mean 0.02 meters/sec?

Note: I have downloaded the other matlab m-files found on this site and none of them document the units.

 Re: Lattice Boltzmann Units Example May 06, 2008 09:16AM Admin Registered: 11 years ago Posts: 231
Hi,
all the values in the m-files are in LB units. Therefore this uMax is not in meters per second. To recover the real life units you have to do a conversion using non dimensional parameters such as Reynolds number in the cylinder case.

You should have a look at www.lbmethod.org for more informations. If it's not clear enough do not hesitate to ask more about this topic since the units in lattice boltzmann is usually tricky.

Cheers,
Orestis
 Re: Lattice Boltzmann Units Example August 21, 2008 12:17AM Registered: 11 years ago Posts: 10
Hi, I post here because I have a problem of units with the viscosity.

I have 1 geometry where 1 fluid could have 2 different volumetric flows. So I have 2 reynolds number, but the viscosity remains the same, and I can't calculate same viscosities, from LB units ...

I have found in file units.h :

Quote

/// viscosity in lattice units
T getLatticeNu() const { return getLatticeU()*getResolution()/Re; }

I don't understand because :

Here : Nu_{LB}=U_{LB}.N/Re ,
with U_{LB}=dx/dt , N=1/dx
so Nu_{LB}=1/dt .

I have read that Nu_{LB} = dx²/dt ...

Maybe I have wrong, but someone could explain me ?
 Re: Lattice Boltzmann Units Example August 22, 2008 03:05PM Registered: 11 years ago Posts: 347
The reason for this apparent contradiction is that you are mixing up two possible interpretations of the discrete steps dx and dt. As this is a common mistake, I do suggest that you read the tutorial on lattice units to understand the subtleties behind unit conversions.

The bottom line is that the physical units of a velocity scale like Length/Time, and the physical units of a viscosity like Length^2/Time. Now, variables dx and dt in OpenLB are defined so as to restore physical units, and not lattice units. Thus, if one assumes that velocity is unity in a reference physical system, one has

`U_{Phys} = dx/dt U_{LB} = 1, and therefore U_{LB} = dt/dx .`

Similarly, you have nu_{LB} = dt/dx^2, and everything ends up fine.
 Re: Lattice Boltzmann Units Example September 26, 2008 03:29PM Registered: 11 years ago Posts: 347
From what I see in the discussions, I suspect that some people are still uncomfortable with the two-step unit conversion (physical variables) -> (dimensionless variables) -> (lattice variables). Let me link to the following thread on the OpenLB forum, in which the procedure is explained step by step for a simple case. This should make clear how to translate, in practice, a physical problem into a numerical setup and vice versa.
 Re: Lattice Boltzmann Units Example December 31, 2008 04:01AM Registered: 11 years ago Posts: 21
-------------------------------------------------------
 Re: Lattice Boltzmann Units Example July 20, 2009 10:06PM Registered: 10 years ago Posts: 8
Hi All,

I have read all the discussions on lattice units to physical units conversions, including the 'Howtos' article on www.lbmethod.org. However, the pressure/density conversion is not clear to me. Consider the pressure/density conversion relation given in the above discussion:
rho_{LB} = 1+1/c_s^2 p_{Phys}dt_{Phys}^2 / dx_{Phys}^2

Since in LB, we have rho_{LB} ~ 1 (I initialize rho_{LB} = 1 and sometimes during solving it becomes <1), this would sometimes give a negative p_{Phys} right? Then, the conversion above would not be valid.

It is not very clear how one can convert mass. Pressure units (in SI system) = N/m^2 = kg/m-s^2. The conversion could go like:

p_{LB} = p_{Phys}*dx_{Phys}*dt_{Phys}*dt_{Phys} / dmass_{Phys}

This dmass_{Phys} should be some mass conversion. Is this correct? If so, could you'll please help me define this mass conversion.

If this is not correct, could you'll explain the correct pressure conversion from lattice units to physical units?

Thank you all!
 Re: Lattice Boltzmann Units Example July 21, 2009 03:20PM Registered: 11 years ago Posts: 347
Hi,

For your first question, remember that we are working in the framework of the incompressible Navier-Stokes equations, in which it is OK to have a negative pressure. Once more (I wonder how many times this has been said on this forum), what matters are pressure differences, and not absolute values of the pressure. When you convert to real-world physics, add a constant pressure offset everywhere to recover an always-positive value.

For the second question, I am not entirely sure. The argument is probably that mass is density times volume, density is constant, and therefore dmass_{Phys} goes like dx_{Phys}^3.
 Re: Lattice Boltzmann Units Example July 21, 2009 04:41PM Registered: 10 years ago Posts: 8
Thank you for your answer Dr. Latt.

It clears up a lot of things for me! So the p_{Phys} to p_{LB} conversion could go like:

p_{LB} = p_{Phys}*dt_{Phys}*dt_{Phys} / ( rho_{Phys} * dx_{Phys}* dx_{Phys} )
 Re: Lattice Boltzmann Units Example July 21, 2009 07:44PM Registered: 11 years ago Posts: 464
The unit of pressure in 3D is N/m2 or (kg/m3) * (m2 / s2). This can also be seen from p = cs2 rho.
Thus, for the pressure, the conversion factor is rhop * dxp2 / dtp2. An index p refers to the physical value, e.g. rhop = 1000 kg/m3.
The conversion factor for the mass then simply is rhop dxp3.
You just have to find the unit of the quantity you want to convert and express it by a combination of density, length and time. Then you will directly get the conversion factor.
 Re: Lattice Boltzmann Units Example December 01, 2009 11:18AM Registered: 10 years ago Posts: 20
jlatt Wrote:
-------------------------------------------------------
> Hi,
>
> I like the idea of producing a show-case example
> for unit conversion. There are two points that are
> not clear to me in your post though.
>
> 1) You define the discrete space and time steps in
> such a way that they carry physical units: = cm
> and = s. On this assumption, a dimensional
> analysis of your equation which relates nu_{phys}
> to nu_{LB} is erroneous. Shouldn't this formula be
> as follows, in order to get the right units:
>
> nu_{Phys}=(dx_{Phys}*dx_{Phys})/dt_{Phys}*nu_{LB}
> ?
>
> 2) I am not sure which lattice Boltzmann model you
> are referring to. If it is BGK, then pressure and
> density are not independent parameters. They are
> related through the law of an ideal gas: p = c_s^2
> rho. I have the feeling that most people who use
> BGK use it to simulate an incompressible fluid. In
> that case, the physical value of the density rho
> is irrelevant (although variations of rho are
> still relevant in simulation, as they are
> proportional to pressure variations). Even if you
> do use BGK to simulate a compressible fluid (in
> which case you should be aware of the many
> limitations, such as being constraint to a low
> Mach-number regime, impossibility to adjust the
> speed of sound, and impossibility to adjust the
> bulk viscosity), I am not sure if it is a good
> idea to adapt the LB density as a function of the
> physical density. In practice, everybody I know of
> uses a density value close to 1, and you actually
> run into numerical instabilities and inaccuracies
> when you differ too much from this value.
>
> When you implement a boundary condition for the
> pressure, the translation from physical units to
> lattice Boltzmann units should, according to me,
> be as follows:
>
> rho_{LB} = 1+1/c_s^2 p_{Phys}dt_{Phys}^2 /
> dx_{Phys}^2
>
> where c_s^2 is the constant 1/3, which should be
> used without units when you proceed to a
> dimensional analysis of the above equation.

> rho_{LB} = 1+1/c_s^2 p_{Phys}dt_{Phys}^2 /
> dx_{Phys}^2
what does this formula mean?
 Re: Lattice Boltzmann Units Example January 22, 2010 05:43PM Registered: 9 years ago Posts: 3
I failed to open this link: [www.lbmethod.org]
File name is: How to chose lattice units in a LB simulation (updated on May 30, 2008).

Can anyone help to upload this file?

thanks a lot!
Liang
 Re: Lattice Boltzmann Units Example March 19, 2010 12:33AM Registered: 10 years ago Posts: 36
Hello
I would like to return to this topic, because I face with small problem/mistery when I use the proposed there equation to convert p_{Phys} to rh0_{LB} in constant pressure BC, namely:
rho_{LB} = 1+1/c_s^2 p_{Phys}dt_{Phys}^2 / dx_{Phys}^2

I have such input data: p_{Phys}=12650 [Pa], dx_{Phys}=0,0125[cm], dt_{Phys}=1,66169E-05
so rho_{LB}=
1 + 1/0.333 * (12650 [kg/(m*s^2)]) * (1,76717E-06 [s^2/cm^2]) =
1 + 1/0.333 * (12650/100 [kg/(cm*s^2)]) * (1,76717E-06 [s^2/cm^2]) =
1 + 0,000670642 [kg/cm^3]

when I change data from [cm] to [m], dx_{Phys}=0,000125[m]
and rho_{LB}=
1 + 1/0.333 * (12650 [kg/(m*s^2)]) * (0,017671725 [s^2/m^2]) =
1 + 1/0.333 * (12650 [kg/(m*s^2)]) * (0,017671725 [s^2/m^2]) =
1 + 670,642 [kg/m^3]

I know that I can convert 670,642 [kg/m^3] to 0,000670,642 [kg/cm^3]
but WHY?
So does it mean that this/above equation to convert p_{Phys} to rho_{LB} is only valid for kg/cm^3
A little strange

I hope that this is only my mistake, but really I cannot find it.
Thanks for any help
 Re: Lattice Boltzmann Units Example March 19, 2010 06:57AM Registered: 11 years ago Posts: 464
Without reading everything of your post in detail: I strongly suggest to use only m, s, kg and other derived SI units without SI prefixes like centi or milli. Before computing the LB units, first convert everything to pure SI units.
Sorry, you do not have permission to post/reply in this forum.