# yade-users team mailing list archive

## Re: [Question #698778]: Problem with imposing flux in a cavity in flow engine

```Question #698778 on Yade changed:

Robert Caulk proposed the following answer:
Hey Zoheir,

>> I injected 1e-4 m3/s into the cavity but the output of
know what I am missing?

Before I dive into the script myself (I won't have time until the
weekend), I will propose some possible reasons. You are using a
compressible fluid, and quite a small time step with very few time steps
before checking the cavity flux. So technically, the governing equations
would allow for an unequal fluid flux exiting the cavity to that which
is entering the cavity. However that contrast in fluxes seems quite
stark and so it is very possible something else is wrong.

Have you saved the VTK output to verify that the cavity is defined as
you expect it to be? This will also allow you to look at the pressure
gradients and verify that they are also as you expect them to be.

You can also compute the flux yourself by iterating on the cavity cells.
This would verify whether or not the function "getCavityFlux()" is
correct. (btw it is useful to store the list of cavityCells by their ID
so you can just iterate on those directly eachtime you want to make a
calculation such as this).

totalVolume = 0
v = np.array([0,0,0])
cavityCells = []
for i in range(0,flow.nCells()):
coords = flow.getCellCenter(i)
if flow.getCellPImposed(i): continue
if np.linalg.norm((coords-(maxX-dx/2.,maxY-dy/2.,maxZ-dz/2.)))<dz/4.:
cavityCells.append(i)
velocityVector = np.array(flow.getCellVelocity((coords[0],coords[1],coords[2])))
cellVol = flow.getCellVolume((coords[0],coords[1],coords[2]))
v = v + cellVol*velocityVector
totalVolume += cellVol

q = np.linalg.norm(v)/totalVolume

>> By the way, does flow.imposeFlux apply volumetric flux or mass flux?
In FlowEngine, it is a volumetric flux.

Cheers,

Robert

--