pimpleFoam fails if ddtCorr is turned off
Summary
The ddtCorr term is now optional in the pimpleFoam solver. It is controlled by the pimpleControl class through:
ddtCorr_ = pimpleDict.getOrDefault("ddtCorr", true);
The default value is true. But if one tries to set it to false the pimpleFoam returns the following error:
--> FOAM FATAL ERROR: (openfoam-2012)
Different dimensions for '(a += b)'
dimensions : [0 3 -1 0 0 0 0] != [0 0 1 0 0 0 0]
Steps to reproduce
One can simply reproduce this problem by setting ddtCorr to false in the PIMPLE dictionary in fvSolution of any pimpleFoam case.
What is the current bug behaviour?
In the pEqn.H file of pimpleFoam we have:
if (pimple.ddtCorr())
{
phiHbyA += MRF.zeroFilter(fvc::interpolate(rAU)*fvc::ddtCorr(U, phi, Uf));
}
else
{
phiHbyA += MRF.zeroFilter(fvc::interpolate(rAU));
}
Therefore, when ddtCorr is set to false the else statement activates. However, the zeroFilter needs a phi (flux) field as an input argument, while fvc::interpolate(rAU)
does not have a flux dimension. That's why we get a dimension error.
Possible fixes
Simply removing the else statement should fix the problem. When the ddtCorr is set to false, no extra time correction is required for the fluxes. Therefore, we should simply skip the if statement.