# average energy convergence criterion

Hi,

I’ve just started working with Palabos. I have some questions about the convergence criterion. In the tutorials the main loop runs until the criterion on the iteration number is satisfied. What if I want to stop the main loop when a given average energy is reached? I ask that because running tutorial and showcases codes, I see that the average energy increases (even though this increase is very small and the value stays below 1e-6) instead of becoming smaller and a smaller, as usually in traditional FVM commercial codes. For instance, running “cavity2d”, the value of the average energy at the first step is 2.5e-7, but after 100 iterations, its value is 1.23e-6. If I decided that solution converges when the value of the average energy is smaller than 1e-7, I’d never be able exit the loop.

Can anyone explain me the reason why average energy does not become smaller as the simulation goes on?

Thank you very much.

Hello,

I’m not sure to understand your question. LBM is an inherently time dependent scheme. Therefore unlike traditional CFD solvers you cannot solve stationary flows directly but has to wait until the time dependent scheme has reached some stationary state. That’s why in the tutorials the solver stop when the average energy has reached a constant value. If you just want the solver to stop when it has reached some maximum value, you can just put a such criterion in your code. Add a line like :

if (averageEnergy > 1.0e-6) break;

In your time loop and you will be fine.

For your second question. The average energy increases because of the initialization of your problem. For the cavity only the lid has a velocity at time t=0. Then as the fluid is being moved thanks to viscosity the kinetic energy increases. Is that clear?

Hi Malaspin,

thanks for your reply. Perhaps I’ve mistaken. The average kinetic energy that Palabos computes has not to be seen as a sort of residual to look at in order to check whether the solution is going to converge or not. Is that right or I’m mistaking again?

Thank you

No the energy is the “physical” average kinetic energy (1/N*sum_i u_i^2/2, with i ranging over the N nodes of the simulation). There are no residual computations since there are no matrix inversion in LBM.

This criterion is just chosen to see if time independent simulations have converged or not. If the value of the kinetic is constant we assume that the system is not changing anymore. You could take other criteria. Like checking if every point has a constant velocity with time, but it would be more expensive in terms of computational power.

I don’t remember any paper to post as a reference, but as far as I know, in LB it is pretty common to use the relative error of the velocity u as a convergence criterium.

so, what you need to do looks basically like:

error = ( u[sub]n-1[/sub] - u[sub]n[/sub] ) / u[sub]n[/sub]