Merge branch 'develop' of develop.openfoam.com:Development/OpenFOAM-dev-OpenCFD into develop

This commit is contained in:
mattijs
2015-12-10 11:26:26 +00:00
5 changed files with 93 additions and 15 deletions

View File

@ -90,3 +90,27 @@ volScalarField dpdt
Info<< "Creating field kinetic energy K\n" << endl; Info<< "Creating field kinetic energy K\n" << endl;
volScalarField K("K", 0.5*magSqr(U)); volScalarField K("K", 0.5*magSqr(U));
label pRefCell = 0;
scalar pRefValue = 0.0;
if (p_rgh.needReference())
{
setRefCell
(
p,
p_rgh,
pimple.dict(),
pRefCell,
pRefValue
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell)
);
}
dimensionedScalar initialMass("initialMass", fvc::domainIntegrate(rho));

View File

@ -1,4 +1,9 @@
{ {
bool closedVolume = p_rgh.needReference();
dimensionedScalar compressibility = fvc::domainIntegrate(psi);
bool compressible = (compressibility.value() > SMALL);
rho = thermo.rho(); rho = thermo.rho();
// Thermodynamic density needs to be updated by psi*d(p) after the // Thermodynamic density needs to be updated by psi*d(p) after the
@ -36,19 +41,27 @@
)/(mesh.magSf().boundaryField()*rAUf.boundaryField()) )/(mesh.magSf().boundaryField()*rAUf.boundaryField())
); );
fvScalarMatrix p_rghDDtEqn tmp<fvScalarMatrix> p_rghDDtEqn
( (
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) new fvScalarMatrix(p_rgh, dimMass/dimTime)
+ fvc::div(phiHbyA)
==
fvOptions(psi, p_rgh, rho.name())
); );
if (compressible)
{
p_rghDDtEqn =
(
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
==
fvOptions(psi, p_rgh, rho.name())
);
}
while (pimple.correctNonOrthogonal()) while (pimple.correctNonOrthogonal())
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
p_rghDDtEqn p_rghDDtEqn()
+ fvc::div(phiHbyA)
- fvm::laplacian(rAUf, p_rgh) - fvm::laplacian(rAUf, p_rgh)
); );
@ -81,6 +94,32 @@
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);
} }
#include "rhoEqn.H" if (compressible)
{
#include "rhoEqn.H"
}
#include "compressibleContinuityErrs.H" #include "compressibleContinuityErrs.H"
if (closedVolume)
{
if (!compressible)
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pRefCell)
);
}
else
{
p += (initialMass - fvc::domainIntegrate(thermo.rho()))
/compressibility;
rho = thermo.rho();
}
p_rgh = p - rho*gh;
}
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value()
<< endl;
} }

View File

@ -36,12 +36,21 @@
)/(mesh.magSf().boundaryField()*rhorAUf.boundaryField()) )/(mesh.magSf().boundaryField()*rhorAUf.boundaryField())
); );
tmp<fvScalarMatrix> p_rghDDtEqn
(
new fvScalarMatrix(p_rgh, dimMass/dimTime)
);
{ {
fvScalarMatrix p_rghDDtEqn if (compressible)
( {
fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh)) p_rghDDtEqn =
+ fvc::div(phiHbyA) (
); fvc::ddt(rho) + psi*correction(fvm::ddt(p_rgh))
==
fvOptions(psi, p_rgh, rho.name())
);
}
// Thermodynamic density needs to be updated by psi*d(p) after the // Thermodynamic density needs to be updated by psi*d(p) after the
// pressure solution - done in 2 parts. Part 1: // pressure solution - done in 2 parts. Part 1:
@ -52,6 +61,7 @@
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
p_rghDDtEqn p_rghDDtEqn
+ fvc::div(phiHbyA)
- fvm::laplacian(rhorAUf, p_rgh) - fvm::laplacian(rhorAUf, p_rgh)
); );
@ -93,8 +103,11 @@
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);
} }
// Solve continuity if (compressible)
#include "rhoEqn.H" {
// Solve continuity
#include "rhoEqn.H"
}
// Update continuity errors // Update continuity errors
#include "compressibleContinuityErrors.H" #include "compressibleContinuityErrors.H"

View File

@ -183,7 +183,7 @@ void Foam::helpType::init()
( (
"browse", "browse",
"word", "word",
"display documentation for boundary condition in browser" "display documentation in browser"
); );
} }

View File

@ -60,6 +60,8 @@ PIMPLE
nOuterCorrectors 1; nOuterCorrectors 1;
nCorrectors 2; nCorrectors 2;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 1e5;
} }