Commit 56bfc759 by Henry Weller Committed by Andrew Heather

### Rationalize the "pos" function

```"pos" now returns 1 if the argument is greater than 0, otherwise it returns 0.
This is consistent with the common mathematical definition of the "pos" function:

https://en.wikipedia.org/wiki/Sign_(mathematics)

However the previous implementation in which 1 was also returned for a 0
argument is useful in many situations so the "pos0" has been added which returns
1 if the argument is greater or equal to 0.  Additionally the "neg0" has been
added which returns 1 if if the argument is less than or equal to 0.```
parent 639305e9
 ... ... @@ -73,8 +73,8 @@ rDeltaT.ref() = max ( rDeltaT(), pos(alpha1Bar() - alphaSpreadMin) *pos(alphaSpreadMax - alpha1Bar()) pos0(alpha1Bar() - alphaSpreadMin) *pos0(alphaSpreadMax - alpha1Bar()) *fvc::surfaceSum(mag(phi))()() /((2*maxAlphaCo)*mesh.V()) ); ... ...
 ... ... @@ -183,8 +183,8 @@ solve(fvm::ddt(alpha1) + fvc::div(alphaPhi1)); // Create the diffusion coefficients for alpha2<->alpha3 volScalarField Dc23(D23*max(alpha3, scalar(0))*pos(alpha2)); volScalarField Dc32(D23*max(alpha2, scalar(0))*pos(alpha3)); volScalarField Dc23(D23*max(alpha3, scalar(0))*pos0(alpha2)); volScalarField Dc32(D23*max(alpha2, scalar(0))*pos0(alpha3)); // Add the diffusive flux for alpha3->alpha2 alphaPhi2 -= fvc::interpolate(Dc32)*mesh.magSf()*fvc::snGrad(alpha1); ... ...
 ... ... @@ -214,8 +214,8 @@ Foam::threePhaseInterfaceProperties::nearInterface() const { return max ( pos(mixture_.alpha1() - 0.01)*pos(0.99 - mixture_.alpha1()), pos(mixture_.alpha2() - 0.01)*pos(0.99 - mixture_.alpha2()) pos0(mixture_.alpha1() - 0.01)*pos0(0.99 - mixture_.alpha1()), pos0(mixture_.alpha2() - 0.01)*pos0(0.99 - mixture_.alpha2()) ); } ... ...
 ... ... @@ -87,7 +87,7 @@ Foam::phaseChangeTwoPhaseMixtures::Kunz::mDotP() const return Pair> ( mcCoeff_*sqr(limitedAlpha1)*(1.0 - limitedAlpha1) *pos(p - pSat())/max(p - pSat(), 0.01*pSat()), *pos0(p - pSat())/max(p - pSat(), 0.01*pSat()), (-mvCoeff_)*limitedAlpha1*neg(p - pSat()) ); ... ...
 ... ... @@ -83,7 +83,7 @@ Foam::phaseChangeTwoPhaseMixtures::Merkle::mDotP() const return Pair> ( mcCoeff_*(1.0 - limitedAlpha1)*pos(p - pSat()), mcCoeff_*(1.0 - limitedAlpha1)*pos0(p - pSat()), (-mvCoeff_)*limitedAlpha1*neg(p - pSat()) ); } ... ...
 ... ... @@ -136,7 +136,7 @@ Foam::phaseChangeTwoPhaseMixtures::SchnerrSauer::mDotP() const return Pair> ( Cc_*(1.0 - limitedAlpha1)*pos(p - pSat())*apCoeff, Cc_*(1.0 - limitedAlpha1)*pos0(p - pSat())*apCoeff, (-Cv_)*(1.0 + alphaNuc() - limitedAlpha1)*neg(p - pSat())*apCoeff ); ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -78,13 +78,13 @@ Foam::tmp Foam::dragModels::GidaspowErgunWenYu::K volScalarField Cds ( neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) + pos(Re - 1000)*0.44 + pos0(Re - 1000)*0.44 ); // Wen and Yu (1966) return ( pos(alpha2 - 0.8) pos0(alpha2 - 0.8) *(0.75*Cds*phase2_.rho()*Ur*bp/d) + neg(alpha2 - 0.8) *( ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -77,7 +77,7 @@ Foam::tmp Foam::dragModels::GidaspowSchillerNaumann::K volScalarField Cds ( neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) + pos(Re - 1000)*0.44 + pos0(Re - 1000)*0.44 ); return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d(); ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -74,7 +74,7 @@ Foam::tmp Foam::dragModels::SchillerNaumann::K volScalarField Cds ( neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) + pos(Re - 1000)*0.44 + pos0(Re - 1000)*0.44 ); return 0.75*Cds*phase2_.rho()*Ur/phase1_.d(); ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -75,7 +75,7 @@ Foam::tmp Foam::dragModels::SyamlalOBrien::K volScalarField B ( neg(alpha2 - 0.85)*(0.8*pow(alpha2, 1.28)) + pos(alpha2 - 0.85)*(pow(alpha2, 2.65)) + pos0(alpha2 - 0.85)*(pow(alpha2, 2.65)) ); volScalarField Re(max(Ur*phase1_.d()/phase2_.nu(), scalar(1.0e-3))); ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -77,7 +77,7 @@ Foam::tmp Foam::dragModels::WenYu::K volScalarField Cds ( neg(Re - 1000)*(24.0*(1.0 + 0.15*pow(Re, 0.687))/Re) + pos(Re - 1000)*0.44 + pos0(Re - 1000)*0.44 ); return 0.75*Cds*phase2_.rho()*Ur*bp/phase1_.d(); ... ...
 ... ... @@ -846,7 +846,8 @@ Foam::multiphaseSystem::nearInterface() const forAllConstIter(PtrDictionary, phases_, iter) { tnearInt.ref() = max(tnearInt(), pos(iter() - 0.01)*pos(0.99 - iter())); tnearInt.ref() = max(tnearInt(), pos0(iter() - 0.01)*pos0(0.99 - iter())); } return tnearInt; ... ...
 ... ... @@ -254,8 +254,8 @@ // dgdt = // ( // pos(alpha2)*(pEqnComp2 & p)/rho2 // - pos(alpha1)*(pEqnComp1 & p)/rho1 // pos0(alpha2)*(pEqnComp2 & p)/rho2 // - pos0(alpha1)*(pEqnComp1 & p)/rho1 // ); p_rgh.relax(); ... ...
 ... ... @@ -548,7 +548,8 @@ Foam::multiphaseMixture::nearInterface() const forAllConstIter(PtrDictionary, phases_, iter) { tnearInt.ref() = max(tnearInt(), pos(iter() - 0.01)*pos(0.99 - iter())); tnearInt.ref() = max(tnearInt(), pos0(iter() - 0.01)*pos0(0.99 - iter())); } return tnearInt; ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -71,9 +71,9 @@ Foam::aspectRatioModels::VakhrushevEfremov::E() const return neg(Ta - scalar(1))*scalar(1) + pos(Ta - scalar(1))*neg(Ta - scalar(39.8)) + pos0(Ta - scalar(1))*neg(Ta - scalar(39.8)) *pow3(0.81 + 0.206*tanh(1.6 - 2*log10(max(Ta, scalar(1))))) + pos(Ta - scalar(39.8))*0.24; + pos0(Ta - scalar(39.8))*0.24; } ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -84,7 +84,7 @@ Foam::tmp Foam::dragModels::GidaspowErgunWenYu::CdRe() const { return pos(pair_.continuous() - 0.8)*WenYu_->CdRe() pos0(pair_.continuous() - 0.8)*WenYu_->CdRe() + neg(pair_.continuous() - 0.8)*Ergun_->CdRe(); } ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -74,7 +74,7 @@ Foam::dragModels::GidaspowSchillerNaumann::CdRe() const volScalarField CdsRe ( neg(Re - 1000)*24.0*(1.0 + 0.15*pow(Re, 0.687))/alpha2 + pos(Re - 1000)*0.44*max(Re, residualRe_) + pos0(Re - 1000)*0.44*max(Re, residualRe_) ); return ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -80,7 +80,7 @@ Foam::dragModels::IshiiZuber::CdRe() const volScalarField ReM(Re*muc/muMix); volScalarField CdRe ( pos(1000 - ReM)*24.0*(scalar(1) + 0.15*pow(ReM, 0.687)) pos0(1000 - ReM)*24.0*(scalar(1) + 0.15*pow(ReM, 0.687)) + neg(1000 - ReM)*0.44*ReM ); ... ... @@ -92,7 +92,7 @@ Foam::dragModels::IshiiZuber::CdRe() const volScalarField CdReEllipse(Ealpha*0.6666*sqrt(Eo)*Re); return pos(CdReEllipse - CdRe) pos0(CdReEllipse - CdRe) *min(CdReEllipse, Re*sqr(1 - pair_.dispersed())*2.66667) + neg(CdReEllipse - CdRe)*CdRe; } ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2014-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2014-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -66,9 +66,9 @@ Foam::tmp Foam::dragModels::Lain::CdRe() const return neg(Re - 1.5)*16.0 + pos(Re - 1.5)*neg(Re - 80.0)*14.9*pow(Re, 0.22) + pos(Re - 80.0)*neg(Re - 1500.0)*48*(1.0 - 2.21/sqrt(max(Re, SMALL))) + pos(Re - 1500.0)*2.61*Re; + pos0(Re - 1.5)*neg(Re - 80.0)*14.9*pow(Re, 0.22) + pos0(Re - 80.0)*neg(Re - 1500.0)*48*(1.0 - 2.21/sqrt(max(Re, SMALL))) + pos0(Re - 1500.0)*2.61*Re; } ... ...
 ... ... @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2017 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License ... ... @@ -67,7 +67,7 @@ Foam::tmp Foam::dragModels::SchillerNaumann::CdRe() const return neg(Re - 1000)*24.0*(1.0 + 0.15*pow(Re, 0.687)) + pos(Re - 1000)*0.44*max(Re, residualRe_); + pos0(Re - 1000)*0.44*max(Re, residualRe_); } ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!