rhoPimpleFoam: Updated transonic option to be consistent with sonicFoam

Improves stability on start-up and allows running at slightly larger time-steps.
This commit is contained in:
Henry Weller
2017-05-12 11:04:38 +01:00
committed by Andrew Heather
parent 8f1a4f792d
commit 7b825d0817
6 changed files with 145 additions and 121 deletions

View File

@ -1,3 +1,5 @@
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
@ -10,7 +12,7 @@ if (pimple.nCorrPISO() <= 1)
surfaceScalarField phiHbyA surfaceScalarField phiHbyA
( (
"phiHbyA", "phiHbyA",
fvc::flux(rho*HbyA) fvc::interpolate(rho)*fvc::flux(HbyA)
+ rhorAUf*fvc::ddtCorr(rho, U, phi) + rhorAUf*fvc::ddtCorr(rho, U, phi)
); );
@ -26,7 +28,8 @@ if (pimple.transonic())
"phid", "phid",
(fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA
); );
phiHbyA -= fvc::interpolate(p)*phid;
phiHbyA -= fvc::interpolate(psi*p)*phiHbyA/fvc::interpolate(rho);
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
@ -84,9 +87,11 @@ U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
pressureControl.limit(p); if (pressureControl.limit(p))
{
p.correctBoundaryConditions(); p.correctBoundaryConditions();
rho = thermo.rho(); rho = thermo.rho();
}
if (!pimple.transonic()) if (!pimple.transonic())
{ {

View File

@ -1,3 +1,5 @@
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
@ -11,7 +13,7 @@ surfaceScalarField phiHbyA
( (
"phiHbyA", "phiHbyA",
( (
fvc::flux(rho*HbyA) fvc::interpolate(rho)*fvc::flux(HbyA)
+ fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi) + fvc::interpolate(rho*rAU)*fvc::ddtCorr(rho, U, phi)
) )
); );
@ -33,7 +35,7 @@ if (pimple.transonic())
phiHbyA += phiHbyA +=
fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf() fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf()
- fvc::interpolate(p)*phid; - fvc::interpolate(psi*p)*phiHbyA/fvc::interpolate(rho);
HbyA -= (rAU - rAtU)*fvc::grad(p); HbyA -= (rAU - rAtU)*fvc::grad(p);
@ -96,9 +98,11 @@ U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
K = 0.5*magSqr(U); K = 0.5*magSqr(U);
pressureControl.limit(p); if (pressureControl.limit(p))
{
p.correctBoundaryConditions(); p.correctBoundaryConditions();
rho = thermo.rho(); rho = thermo.rho();
}
if (!pimple.transonic()) if (!pimple.transonic())
{ {

View File

@ -1,4 +1,3 @@
{
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU)); surfaceScalarField rhorAUf("rhorAUf", fvc::interpolate(rho*rAU));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
@ -6,7 +5,7 @@
bool closedVolume = false; bool closedVolume = false;
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(rho)*fvc::flux(HbyA));
MRF.makeRelative(fvc::interpolate(rho), phiHbyA); MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
// Update the pressure BCs to ensure flux consistency // Update the pressure BCs to ensure flux consistency
@ -19,7 +18,8 @@
"phid", "phid",
(fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA (fvc::interpolate(psi)/fvc::interpolate(rho))*phiHbyA
); );
phiHbyA -= fvc::interpolate(p)*phid;
phiHbyA -= fvc::interpolate(psi*p)*phiHbyA/fvc::interpolate(rho);
while (simple.correctNonOrthogonal()) while (simple.correctNonOrthogonal())
{ {
@ -78,7 +78,6 @@
} }
} }
#include "incompressible/continuityErrs.H" #include "incompressible/continuityErrs.H"
// Explicitly relax pressure for momentum corrector // Explicitly relax pressure for momentum corrector
@ -88,7 +87,7 @@
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
pressureControl.limit(p); bool pLimited = pressureControl.limit(p);
// For closed-volume cases adjust the pressure and density levels // For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity // to obey overall mass continuity
@ -98,7 +97,10 @@
/fvc::domainIntegrate(psi); /fvc::domainIntegrate(psi);
} }
if (pLimited || closedVolume)
{
p.correctBoundaryConditions(); p.correctBoundaryConditions();
}
rho = thermo.rho(); rho = thermo.rho();
@ -106,4 +108,3 @@
{ {
rho.relax(); rho.relax();
} }
}

View File

@ -1,3 +1,5 @@
rho = thermo.rho();
volScalarField rAU(1.0/UEqn.A()); volScalarField rAU(1.0/UEqn.A());
volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1())); volScalarField rAtU(1.0/(1.0/rAU - UEqn.H1()));
volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p)); volVectorField HbyA(constrainHbyA(rAU*UEqn.H(), U, p));
@ -5,7 +7,7 @@ tUEqn.clear();
bool closedVolume = false; bool closedVolume = false;
surfaceScalarField phiHbyA("phiHbyA", fvc::flux(rho*HbyA)); surfaceScalarField phiHbyA("phiHbyA", fvc::interpolate(rho)*fvc::flux(HbyA));
MRF.makeRelative(fvc::interpolate(rho), phiHbyA); MRF.makeRelative(fvc::interpolate(rho), phiHbyA);
volScalarField rhorAtU("rhorAtU", rho*rAtU); volScalarField rhorAtU("rhorAtU", rho*rAtU);
@ -23,7 +25,7 @@ if (simple.transonic())
phiHbyA += phiHbyA +=
fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf() fvc::interpolate(rho*(rAtU - rAU))*fvc::snGrad(p)*mesh.magSf()
- fvc::interpolate(p)*phid; - fvc::interpolate(psi*p)*phiHbyA/fvc::interpolate(rho);
HbyA -= (rAU - rAtU)*fvc::grad(p); HbyA -= (rAU - rAtU)*fvc::grad(p);
@ -98,7 +100,7 @@ U = HbyA - rAtU*fvc::grad(p);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
fvOptions.correct(U); fvOptions.correct(U);
pressureControl.limit(p); bool pLimited = pressureControl.limit(p);
// For closed-volume cases adjust the pressure and density levels // For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity // to obey overall mass continuity
@ -108,9 +110,11 @@ if (closedVolume)
/fvc::domainIntegrate(psi); /fvc::domainIntegrate(psi);
} }
if (pLimited || closedVolume)
{
p.correctBoundaryConditions(); p.correctBoundaryConditions();
}
// Recalculate density from the relaxed pressure
rho = thermo.rho(); rho = thermo.rho();
if (!simple.transonic()) if (!simple.transonic())

View File

@ -207,14 +207,24 @@ Foam::pressureControl::pressureControl
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::pressureControl::limit(volScalarField& p) const bool Foam::pressureControl::limit(volScalarField& p) const
{ {
Info<< "pressureControl: p max/min " scalar pMax = max(p).value();
<< max(p).value() << " " scalar pMin = min(p).value();
<< min(p).value() << endl;
if (pMax > pMax_.value() || pMin < pMin_.value())
{
Info<< "pressureControl: p max/min " << pMax << " " << pMin << endl;
p = max(p, pMin_); p = max(p, pMin_);
p = min(p, pMax_); p = min(p, pMax_);
return true;
}
else
{
return false;
}
} }

View File

@ -89,8 +89,8 @@ public:
//- Return the pressure reference level //- Return the pressure reference level
inline scalar refValue() const; inline scalar refValue() const;
//- Limit the pressure //- Limit the pressure if necessary and return true if so
void limit(volScalarField& p) const; bool limit(volScalarField& p) const;
}; };