# conversion of units

Hi there!

As a newbie to the lattice-boltzmann method I have problems with unit conversions as well. That’s why I’d like to present an example here the way I’d like to do the conversion and ask if this way of conversion is correct.

Let’s say I’d like to compute a solution for the lid-driven cavity flow of a cavity with dimensions 1m x 1m x 1m and a velocity of 10 m/s on top of the cavity.

–> l_0,p = 1 m ( reference length in physical units )
–> u_0,p = 10 m / s ( reference velocity in physical units )

As proposed in Jonas Latt’s article on unit conversion I set the boundary velocity u_0,lb = 0.02 in the LBM simlulation.

–> u_0,lb = 0.02 ( reference velocity in lattice-boltzmann units )

Further I set the number of grid points to 100 per dimension yielding a 100 x 100 x 100 grid with 100 * 100 * 100 grid points in total. This yields

–> dx = 1 / 100

From

u_0,lb = dt / dx (see J.Latt - reference velocity in lattice-boltzmann units)

I get

dt = dx * u_0,lb = 1/100 * 0.02 = 0.0002

From my boundary conditions I know that the physical reference time

t_0 = l_0 / u_0 = 1 m / 10 m/s = 0.1 s

Thus I need

N_iter = 1 / dt = 5000

steps to simulate 0.1 seconds of the fluid flow.

Is this correct?

Yes and no.
dx = 0.01 m, dt unknown, u_l = 0.02, u_p = 10 m/s
Now you have u_p = u_l * dx / dt => dt = u_l * dx / u_p => dt = 0.02 * 0.01 m / (10 m/s) => dt = 2e-5s
You need 50000 time steps for 1 s, or 5000 for 0.1 s, but dt = 2e-5 s and not 2e-4 s.

Thank you Timm!

I got some more questions on this topic…
I always read about a value called lattice speed “c” that is defined as

c = dx / dt

Thus, in the above mentioned example the lattice speed would be

c = 2e-2m / 2e-5s = 1000 m/s

Using the relation c_s^2 = c^2 / 3 we get the speed of sound as

c_s = c / sqrt(3) = 1000 / sqrt(3) m/s = 577,35 m/s

Is this correct so far?

How can I calculate the Machnumber now?

Using dx = 0.01 m and dt = 2e-5 s, you get a lattice speed of c = 500 m/s. The speed of sound is c_s = c / sqrt(3). The Mach number now simply is Ma = u / c_s, in your case Ma = sqrt(3) * 10 m/s / (500 m/s) = 0.035, which is ok. I have simulated LB flow up to Ma = 0.3 without problems (but one should do this only in test cases).

Oh… you’re right. Thanks!

Very often I also find

dx = 1 (m?)
dt = 1 (s?)

Does this mean the lattice speed gets

c = dx / dt = 1 m/s

yielding a speed of sound of

c_s = 1 / sqrt(3) = 0.577 m/s

If the Machnumber Ma should stay below 0.3 this would mean

Ma < 0.3 <=> u / c_s < 0.3 <=> u < 0.3 * c_s <=> u < 0.17 m/s

What can I do to increase the velocity u without raising the Machnumber and at the same time keep c = 1?

You have to understand that for any dimensional quantity you have two versions: the physical value including unit and the lattice value being a pure number. For the conversion there are well-defined rules. You have to specify the time step dt (in s), the lattice constant dx (in m) and a density rho (in kg/m^3 or kg/m^2, depending on your dimensionality of the simulation). The computer only understands the dimensionless variables, but it is your job to deliver them, based on physics.
When people talk about dx = 1 and dt = 1, then they use the lattice version, which has no unit. In principle, you can also use dx = 2 or dt = 10, but usually, both values are set to unity.
Whenever I write down a conversion equation to get the lattice values of the physical values, I use indexes l and p to differentiate between both versions.

You want to increase the physical velocity u_p, but keep the Mach number? You can do that by increasind dx_p or decreasing dt_p, since
u_p = u_l * dx_p / dt_p
and u_l fixed. You will find that this can be realized by changing the relaxation time tau.

Well… what I actually want to do is to keep the Reynoldsnumber while also keeping the Machnumber below 0.3

So, again let’s consider the example from the first post, setting the physical reference length

l_0,p = 1 m

and the physical reference velocity

u_0,p = 10 m/s

The reference time t_0,p is

t_0,p = l_0,p / v_0,p = 0.1s

Again, I use a grid with 100 x 100 x 100 lattice points yielding

dx_p = 0.01 m and dx_l = 0.01

Now, I set the kinematic viscosity

nu_p = 1/140 m^2/s

which should be something like honey…

This yields a Reynoldsnumber

Re = (l_0,p * u_0,p) / nu_p = ( 1m * 10 m/s ) / ( 1/140 m^2/s ) = 1400

If I now set

tau = 1.5

I can compute the kinematic viscosity in lattice units from the equation

nu_l = c_s^2 ( tau - 0.5 ) = 1/3

with c_s^2 = 1/3 ( like here --> does this mean the lattice speed c=dx_l/dt_l is set to unity? since c_s^2 = c^2 / 3 )

Now, using

nu_p = (dx_p^2/dt_p) * nu_l <=> dt_p = ( dx_p^2 / nu_p ) * nu_l

I can compute the physical time step

dt_p = (0.01m)^2 / (1/140 m^2/s) * 1/3 = 14 / 3000 s = 0,00467 s

The only thing missing is the reference velocity u_0,l in lattice units. Can I set this value arbitrarily (for example to get a small Machnumber)?
Since I want to keep the Reynoldsnumber I think I should pay attention on

Re = (l_0,l * u_0,l) / nu_l = 1400

but I’m very confused at this point now.

Here I think I have two variables that have not been set yet. There is the reference length in lattice units l_0,l and the reference velocity in lattice units u_0,l
Do I have to consider l_0,l to stay in a certain range, or can I just set u_0,l arbitrarily (for example 0.02)

Or is the correct way to compute u_0,l via the equation
u_0,l = dt_l / dx_l

( like in my first post ) then

u_0,l = 1

if I set dx_l = dt_l = 1.
This would yield a Machnumber > 1 since c_s^2 = 1/3…

Hello,

up to that point where you compute the time step dt_p = 0.00467 s, everything is correct.
With this, the reference velocity on the lattice is fixed, since
u_0,l = u_0,p * dt_p / dx_p = 10 m/s * 0.00467 s / 0.01 m = 4.67 >> 1
This is too much, or in other words: This won’t work. You have to reset e.g. tau to get a new dt_p which in turn reduces u_0,l.
Whenever dt_p, dx_p, and the density are set, you know everything, i.e. each conversion factor. There is no degree of freedom left, if your physical scales have all been fixed.

Does is help?
Timm

Hi Timm!

Yes, this helps a lot. Things are getting more and more clear to me. I see that reducing tau also reduces the time step dt_p and the reference velocity in lattice units u_0,l.

I always thought I can choose u_0,l and u_0,p independently since the only thing I want to achieve is to keep the Reynoldsnumber. But how do I achieve this now? Acutally I don’t know how to compute the Reynoldsnumber from the lattice units… I’m missing the reference lenght l_0,l to compute it from lattice units. How can I convert this value?

l_0,l = 1/dx * l_0,p ?

But most important: I’m still confused regarding the issue of setting dx = 1 and dt = 1 in lattice units. If I do this I get a lattice speed c = 1 in lattice units and a lattice speed of sound of c_s^2 = 1/3.

Now, if I run a simulation with this setup how do I convert units then? Say I set

u_0,l = 0.05 yielding a Machnumber of Ma = 0.05 / (1/3) = 0.15

I use a grid with 100 x 100 x 100 ( N_x x N_y x N_z ) grid points. Then I guess my reference length in lattice units would be

l_0,l = N_x * dx = 100 * 1 = 100

Setting

tau = 1.5

yields

nu_lb = (tau - 0.5) / 3 = 1/3

Is the Reynoldsnumber now

Re = (l_0,l * u_0,l) / nu_lb = 100 * 0.05 * 3 = 15 ?

The Reynolds number is just a number, right? So it does not have a unit. For this reason, it has to be the same in the physical system and in the lattice system. In other words:
Re = u_p * x_p / nu_p = u_l * x_l / nu_l
This relation is automatically fulfilled, if you have correctly computed your conversion factors. For an exercise: Just plug in u_p = u_l * dx_p / dt_p and so on, and you will see that all conversion factors cancel.
Very good! I think I got it 