Stopping a multiphase simulation

Dear all,

I’m running a two-phase ShanChen simulation that I would like to stop when the red fluid reaches the outlet (to the right of the domain). Is there a way that I could check for a certain property (i.e. fluid density) at the last slice of my 3D domain? Or is there a better (efficient) way to do this?

Thanks a lot in advance.

Stay safe.


I have a thought, don’t know if it works.
Maybe you can add these codes next to lattice.CollideAndStream inside the iteration step to see the results,
pcout << "Average density in the right slice: " << endl;
Box3D sliceA(nx-1, nx-1, 0, ny-1, 0, nz-1);
T meanU= computeAverageDensity(lattice, sliceA);
pcout << setprecision(3) << computeAverageDensity(lattice, sliceA) << endl;
if (meanU > SomeValue) {

1 Like

I think this is a correct idea ideed. you can also create your own reductive processing functional.