BUG: Error in setReference behaviour with moving mesh, correctPhi and parallel run
I have noticed generation of spurious bubble generation in the bulk of the liquid when working with interIsoFoam or interFoam combined with moving mesh in parallel and using correctPhi in fvSolution->PIMPLE. My investigations indicate that there is a bug in the setting of the reference pressure (fvMatrix::setReference).
I have attached a minimal test case to this issue report which illustrates the problem. The case is based on v2206. The case is a simple square domain filled water and oscillating sinusoidally back and forth with a coded dynamicMeshDict. The case only includes 1 time step since this is enough for the problem to arise. To reproduce the problem, simply run the Allrun script in the case and look with paraview at the alpha.water values in the bottom of the domain (load the state.pvsm file to also see phi vectors). What you see is overshoot in the leftmost cell, which is cell 0 in processor0, and a corresponding undershoot in the leftmost cell (label 0) at the bottom of processor1:
The problem happens with both interFoam and interIsoFoam.
The flow is not solved (frozenFlow), but the correctPhi is set to "yes" in fvSolution->PIMPLE.
If correctPhi is set to "no" the problem disappears.
If the case is run in serial, the problem disappears.
If an "atmosphere" inlet/outlet is added to the top, so that no reference pressure is set, the problem disappears.
If I use 4 or 16 subdomains in decomposeParDict instead of 2, it is clear that it is the 0'th cell on each processor that is over- or undershooting in alpha.water:
In the case, phi is corrected in the first time step using CorrectPhi(...). The Foam::CorrectPhi function has hardcoded cell 0 to be the reference cell:
pcorrEqn.setReference(0, 0);
If I change this to pcorrEqn.setReference(2, 0), I observe that the problematic cells move two cells to the right. I assume that there should not be a reference cell for each processor, but a single reference cell on the entire domain to which all other cell pressures should refer.
Plotting phi-vectors in paraview, as done with the state.pvsm file supplied with the case, I have confirmed that the alpha.water over- and undershooting arise due to nonzero div(phi) where phi is the corrected phi from CorrectPhi.
Does anyone have an idea for how to fix this problem?
Test case: oscillatingTank.zip