Merge branch 'master' of /home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
mattijs
2009-06-04 16:29:45 +01:00
10 changed files with 98 additions and 162 deletions

View File

@ -24,10 +24,10 @@
==
fvc::reconstruct
(
(
fvc::interpolate(rho)*(g & mesh.Sf())
+ (
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
- fvc::snGrad(pd)
- fvc::snGrad(p)
) * mesh.magSf()
)
);

View File

@ -1,11 +1,11 @@
{
# include "continuityErrs.H"
wordList pcorrTypes(pd.boundaryField().types());
wordList pcorrTypes(p.boundaryField().types());
for (label i=0; i<pd.boundaryField().size(); i++)
for (label i=0; i<p.boundaryField().size(); i++)
{
if (pd.boundaryField()[i].fixesValue())
if (p.boundaryField()[i].fixesValue())
{
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
}
@ -22,7 +22,7 @@
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("pcorr", pd.dimensions(), 0.0),
dimensionedScalar("pcorr", p.dimensions(), 0.0),
pcorrTypes
);
@ -37,7 +37,7 @@
fvm::laplacian(rUAf, pcorr) == fvc::div(phi)
);
pcorrEqn.setReference(pdRefCell, pdRefValue);
pcorrEqn.setReference(pRefCell, pRefValue);
pcorrEqn.solve();
if (nonOrth == nNonOrthCorr)

View File

@ -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,
@ -83,45 +83,9 @@
);
Info<< "Calculating field g.h\n" << endl;
volScalarField gh("gh", g & mesh.C());
surfaceScalarField ghf("ghf", 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("PISO"), pRefCell, pRefValue);
// Construct interface from alpha1 distribution

View File

@ -89,18 +89,6 @@ int main(int argc, char *argv[])
#include "continuityErrs.H"
p = pd + rho*gh;
if (pd.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
turbulence->correct();
runTime.write();

View File

@ -12,33 +12,33 @@
phi = phiU +
(
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho)
)*rUAf*mesh.magSf();
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)*mesh.magSf()
+ fvc::interpolate(rho)*(g & mesh.Sf())
)*rUAf;
adjustPhi(phi, U, pd);
adjustPhi(phi, U, p);
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);
pEqn.setReference(pRefCell, pRefValue);
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{
pdEqn.solve(mesh.solver(pd.name() + "Final"));
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pdEqn.solve(mesh.solver(pd.name()));
pEqn.solve(mesh.solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{
phi -= pdEqn.flux();
phi -= pEqn.flux();
}
}

View File

@ -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")
);
}

View File

@ -3,6 +3,7 @@
(
fvm::ddt(alpha1)
+ fvm::div(phi, alpha1)
//- fvm::Sp(fvc::div(phi), alpha1)
- fvm::laplacian
(
Dab + alphatab*turbulence->nut(), alpha1,

View File

@ -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

View File

@ -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();
}
}

View File

@ -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"