mass and volume balance at inlet & outlet

Hi ,
when simulating multiphase flow in 3d pipes I get perfect volume and mass balance

when I add obstacles or I simulate flow in porous media the balance between the injected and the discharged phases does not hold

his this a general problem with lattice Boltzmann methods due to compressibility ?
A programming error in my code is possible but unlikely given all the specific check I have done

I have a given velocity profile ad the inlet and I set rho=1 at the discharge using Zou boundary conditions

thank you for your attention, giovanna

Hi Giovanna,
I met the same problem some months ago and I solved it using at the inlet and at the outlet these BCs.

for(int i=0; i<ny+2; i++)
{
u[0][i] = U_in; // constant velocity profile at the inlet
rho[0][i] = rho[1][i];
rho[nx+1][i] = rho0; // rho0 initial density in the fluid domain
}

I tested it and works very fine!

P.s. you may check an average density as "sum(rho) / (nx*ny-A_obst) and see if it is approximately constant and equal to rho0.

Ciao, Alessandro