# Boundary conditions and initialization

Hello all,

it is really a shame that I have to ask this, but my simulation is not working correctly. There are two issues:

1. velocity boundary condition
I want to simulate a rectangular channel in 3D and use fully developed flow velocity boundary condition. Here I know the velocity, but not the density. The density can be calculated as stated in Jonas’ paper. Okay. This makes some problems at the edges and the corners. So I used method BC4 and a density extrapolation for the fluid nodes close to the walls. The side-wall boundary condition is full-way bounceback.
However, after the simulation has reached steady state, the results are not satisfactory near the inlet and the outlet. The shear tensor is really wrong (up to 60 % error) and the density is not constant on the inlet and the outlet, but it should be in principle. This way I have velocity components perpendicular to the channel direction. Now I do not know, what my error is. At the middle of the channel (middle between inlet and outlet) the L2 error behaves approximately as it is expected, but not near the inlet / outlet.

2. Initialization
How should I initialize the region between inlet and outlet? My problem is time-independent. Is there a optimal strategy for the initialization?

I do not use the openLB code.

Thanks,
Timm

Hi Timm,

About initialization probably one paper will be useful for you - R. Mei, Li-Shi Luo, P. Lallemand, D. d’Humieres - Consistent initial conditions for lattice boltzmann simulations. It is told there that you need to adjust pressure to be consistent with Laplace equation for initial conditions.

Alex

Hello,
Alex is right you need to solve a Poisson equation to initialize correctly the pressure. YOu can do it with the method described in the paper cited by Alex. If you don’t want to code an MRT LB code (with BGK the computational cost is huge), another method (I think that’s what you did) is to solve the Poisson equation using a finite difference scheme. The problem are always the boundary conditions. Usually what is done is to use zero pressure gradient on boundaries. Maybe it could help. Then once you have the density, you initialize the f_i’s using the regularization formula (see Jonas thesis):

f_i=f_i^(eq)+f_i^(1)

where f_i^(1) depends on the strain rate tensor that you can evaluate numerically or analytically.

After all these explanations, I want to ask some question. If you are using velocity BC at in/outlet, and is your simulation is time-INdependent then the initial condition should not affect your result, no? So maybe you have some problem with your velocity BC. If I remember correctly the square channel in 3D has some awful analytical solution which is an infinite series. So maybe you should check if the profile you impose contains enough terms, in order to be accurate enough.

Finally, is it natural to observe small “perpendicular to the flow” velocities (they are really much smaller than the parallel one), but maybe they are acceptable.

Orestis

Hello,

first thank you a lot Alex for your hint. I will read the paper and see what I can do.

Orestis, I also think that the initial conditions shouldn’t influence the final result, since I have time-independent boundary conditions. In fact, at the middle of the channel (between inlet and outlet) the velocity and shear stress profiles are really good, regardless how crappy the values are at the inlet / outlet. I just wonder, if the required simulation time would be significantly smaller with appropriate initialization. Of course a good initialization is important for time-dependent flows.
Regarding your other question: The solution to the rectangular problem is in fact an infinite series, but I consider a lot of terms and have an accuracy around 1e-6 or even better. I have checked this. Furthermore, the velocity components perpendicular to the main flow are never zero, but usually four or five orders of magnitude smaller than the dominant component. But in my case those components are much larger near the inlet / outlet. So I think that I may have implemented the boundary condition in a wrong way. I will check this thoroughly tomorrow.

Again thanks for your fast replies,
Timm

Well, it seems that the quality of the boundary condition significantly depends on the choice of the relaxation parameter tau.
Jonas and Orestis, in your paper comparing all those velocity boundary conditions, which values of tau have you used?

Yes it depends on tau.
But it should not give such bad results. Maybe an exception would be if omega is too small, because the Knudsen number may be too high.

Usually the values of tau were not too big (omega=1/tau=1.5 more or less).

What kind of BC are you using?

For the side walls I use normal full-way BB. And at the inlet and the outlet I now use the regularized version proposed by Jonas. If I choose tau carefully, the results are really good, even directly near the inlet and the outlet. I have found out that tau around 0.9 is a very good choice in my case. For say tau = 0.6 or 0.7 however the flow results near the inlet and the outlet are poor as I have posted yesterday. So I still wonder if I implement the regularized BC in a wrong way or if it is just very sensitive to variations of tau.
I couldn’t get the Skordos BC to work properly.

Hmmm… Are you properly treating the fullway bounceback? Do you pout the walls “halfway” between the bounceback cell and the first normal cell?

What is the characteristic size of your domain? Because tau=0.9 is not too big in normal cases. Of course it depends on your grid size. Try to evaluate Kn=Ma/Re to see if it’s << 1.

We did the benchmark of the 3D square channel, and I don’t remember finding such big errors…

The fullway BB is working nicely. The walls are where they should be. The Knudsen number is 0.005 in my current simulation (Ma = 0.01, Re = 2). It seems that there has been an error when calculating the shear stress on the boundary… I have to recheck some parts of my code…