CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Bugs (https://www.cfd-online.com/Forums/openfoam-bugs/)
-   -   interPhaseChangeFoam: sqrt(negativeValue) in SchnerrSauer (https://www.cfd-online.com/Forums/openfoam-bugs/82085-interphasechangefoam-sqrt-negativevalue-schnerrsauer.html)

 david November 16, 2010 11:03

interPhaseChangeFoam: sqrt(negativeValue) in SchnerrSauer

Hi everybody

A negative saturation pressure can cause a floating point exception in the following function:

Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::p Coeff
(
const volScalarField& p
) const
{
volScalarField limitedAlpha1 = min(max(alpha1_, scalar(0)), scalar(1));
volScalarField rho =
(limitedAlpha1*rho1() + (scalar(1) - limitedAlpha1)*rho2());

return
(3*rho1()*rho2())*sqrt(2/(3*rho1()))
*rRb(limitedAlpha1)/(rho*sqrt(mag(p - pSat()) + 0.01*pSat()));
}

The problem occured in 'sqrt(mag(p - pSat()) + 0.01*pSat())' when I tried to reduce the saturation pressure stepwise from an initial solution without cavitation. I know that a simple solution would be to use a higher pressure level but that's not really satisfying in my opininion. Does anybody know more about the term 0.01*pSat? I found some papers (not the referenced one) but this term is never mentioned.

Regards
David

 david November 17, 2010 04:51

I use

return
(3*rho1()*rho2())*sqrt(2/(3*rho1()))
*rRb(limitedAlpha1)/(rho*sqrt(max(mag(p - pSat()),dimensionedScalar("p",dimensionSet(1,-1,-2,0,0,0,0),VSMALL))));

as intermediate solution. Any comment is very appreciated.

Regards
David

 shipman February 20, 2014 08:57

hi

Quote:
 Originally Posted by david (Post 283727) I use return (3*rho1()*rho2())*sqrt(2/(3*rho1())) *rRb(limitedAlpha1)/(rho*sqrt(max(mag(p - pSat()),dimensionedScalar("p",dimensionSet(1,-1,-2,0,0,0,0),VSMALL)))); as intermediate solution. Any comment is very appreciated. Regards David
Hi Dear David,

Maybe it is a bit late but for few months i started to interested indeed with openfoam and try to make cavitation simulation in nozzle by using interphasechangeFoam. I have faced same problem too. Could you tell me that what is the meaning of mag(p - pSat()) + 0.01*pSat()) ???