mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
New, improved with p rather than pd, PIMPLE rather than PISO and more general handling of the diffusivity.
This commit is contained in:
@ -14,7 +14,14 @@
|
||||
//- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf()))
|
||||
);
|
||||
|
||||
UEqn.relax();
|
||||
if (oCorr == nOuterCorr-1)
|
||||
{
|
||||
UEqn.relax(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
UEqn.relax();
|
||||
}
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
@ -22,9 +29,11 @@
|
||||
(
|
||||
UEqn
|
||||
==
|
||||
-fvc::reconstruct
|
||||
fvc::reconstruct
|
||||
(
|
||||
mesh.magSf()*(fvc::snGrad(pd) + ghf*fvc::snGrad(rho))
|
||||
)
|
||||
fvc::interpolate(rho)*(g & mesh.Sf())
|
||||
- mesh.magSf()*fvc::snGrad(p)
|
||||
),
|
||||
mesh.solver(oCorr == nOuterCorr-1 ? "UFinal" : "U")
|
||||
);
|
||||
}
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
(
|
||||
fvm::ddt(alpha1)
|
||||
+ fvm::div(phi, alpha1)
|
||||
//- fvm::Sp(fvc::div(phi), alpha1)
|
||||
- fvm::laplacian
|
||||
(
|
||||
Dab + alphatab*turbulence->nut(), alpha1,
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
Info<< "Reading field pd\n" << endl;
|
||||
volScalarField pd
|
||||
Info<< "Reading field p\n" << endl;
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pd",
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
@ -75,45 +75,9 @@
|
||||
);
|
||||
|
||||
|
||||
Info<< "Calculating field g.h\n" << endl;
|
||||
volScalarField gh("gh", g & mesh.C());
|
||||
surfaceScalarField ghf("gh", g & mesh.Cf());
|
||||
|
||||
|
||||
volScalarField p
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"p",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
pd + rho*gh
|
||||
);
|
||||
|
||||
|
||||
label pdRefCell = 0;
|
||||
scalar pdRefValue = 0.0;
|
||||
setRefCell(pd, mesh.solutionDict().subDict("PISO"), pdRefCell, pdRefValue);
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
|
||||
if (pd.needReference())
|
||||
{
|
||||
pRefValue = readScalar
|
||||
(
|
||||
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
|
||||
);
|
||||
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pdRefCell)
|
||||
);
|
||||
}
|
||||
setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue);
|
||||
|
||||
|
||||
// Construct incompressible turbulence model
|
||||
|
||||
@ -7,26 +7,37 @@
|
||||
surfaceScalarField phiU
|
||||
(
|
||||
"phiU",
|
||||
(fvc::interpolate(U) & mesh.Sf()) + fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
(fvc::interpolate(U) & mesh.Sf())
|
||||
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
|
||||
);
|
||||
|
||||
phi = phiU - ghf*fvc::snGrad(rho)*rUAf*mesh.magSf();
|
||||
|
||||
adjustPhi(phi, U, pd);
|
||||
phi = phiU + fvc::interpolate(rho)*(g & mesh.Sf())*rUAf;
|
||||
|
||||
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
{
|
||||
fvScalarMatrix pdEqn
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
fvm::laplacian(rUAf, pd) == fvc::div(phi)
|
||||
fvm::laplacian(rUAf, p) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pdEqn.setReference(pdRefCell, pdRefValue);
|
||||
pdEqn.solve();
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
if
|
||||
(
|
||||
corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve(mesh.solver(p.name()));
|
||||
}
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
{
|
||||
phi -= pdEqn.flux();
|
||||
phi -= pEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -40,53 +40,52 @@ Description
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
#include "setRootCase.H"
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
#include "readEnvironmentalProperties.H"
|
||||
#include "readPIMPLEControls.H"
|
||||
#include "initContinuityErrs.H"
|
||||
#include "createFields.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setInitialDeltaT.H"
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
# include "readEnvironmentalProperties.H"
|
||||
# include "initContinuityErrs.H"
|
||||
# include "createFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.loop())
|
||||
while (runTime.run())
|
||||
{
|
||||
#include "readPIMPLEControls.H"
|
||||
#include "readTimeControls.H"
|
||||
#include "CourantNo.H"
|
||||
#include "setDeltaT.H"
|
||||
|
||||
runTime++;
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readPISOControls.H"
|
||||
# include "CourantNo.H"
|
||||
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
# include "alphaEqn.H"
|
||||
|
||||
# include "UEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
// --- Pressure-velocity PIMPLE corrector loop
|
||||
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
|
||||
{
|
||||
# include "pEqn.H"
|
||||
twoPhaseProperties.correct();
|
||||
|
||||
#include "alphaEqn.H"
|
||||
|
||||
#include "UEqn.H"
|
||||
|
||||
// --- PISO loop
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
{
|
||||
#include "pEqn.H"
|
||||
}
|
||||
|
||||
#include "continuityErrs.H"
|
||||
|
||||
turbulence->correct();
|
||||
}
|
||||
|
||||
# include "continuityErrs.H"
|
||||
|
||||
p = pd + rho*gh;
|
||||
|
||||
if (pd.needReference())
|
||||
{
|
||||
p += dimensionedScalar
|
||||
(
|
||||
"p",
|
||||
p.dimensions(),
|
||||
pRefValue - getRefCellValue(p, pdRefCell)
|
||||
);
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
||||
runTime.write();
|
||||
|
||||
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
|
||||
|
||||
Reference in New Issue
Block a user