Skip to content
Snippets Groups Projects
Commit c84e40f2 authored by mattijs's avatar mattijs
Browse files

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

parents ba9e8437 f2079249
Branches
Tags
No related merge requests found
Showing with 94 additions and 158 deletions
...@@ -24,10 +24,10 @@ ...@@ -24,10 +24,10 @@
== ==
fvc::reconstruct fvc::reconstruct
( (
( fvc::interpolate(rho)*(g & mesh.Sf())
+ (
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)
- ghf*fvc::snGrad(rho) - fvc::snGrad(p)
- fvc::snGrad(pd)
) * mesh.magSf() ) * mesh.magSf()
) )
); );
......
{ {
# include "continuityErrs.H" # 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; pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
} }
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
mesh, mesh,
dimensionedScalar("pcorr", pd.dimensions(), 0.0), dimensionedScalar("pcorr", p.dimensions(), 0.0),
pcorrTypes pcorrTypes
); );
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
fvm::laplacian(rUAf, pcorr) == fvc::div(phi) fvm::laplacian(rUAf, pcorr) == fvc::div(phi)
); );
pcorrEqn.setReference(pdRefCell, pdRefValue); pcorrEqn.setReference(pRefCell, pRefValue);
pcorrEqn.solve(); pcorrEqn.solve();
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
......
Info<< "Reading field pd\n" << endl; Info<< "Reading field p\n" << endl;
volScalarField pd volScalarField p
( (
IOobject IOobject
( (
"pd", "p",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
...@@ -83,45 +83,9 @@ ...@@ -83,45 +83,9 @@
); );
Info<< "Calculating field g.h\n" << endl; label pRefCell = 0;
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);
scalar pRefValue = 0.0; scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
if (pd.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
// Construct interface from alpha1 distribution // Construct interface from alpha1 distribution
......
...@@ -89,18 +89,6 @@ int main(int argc, char *argv[]) ...@@ -89,18 +89,6 @@ int main(int argc, char *argv[])
#include "continuityErrs.H" #include "continuityErrs.H"
p = pd + rho*gh;
if (pd.needReference())
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
turbulence->correct(); turbulence->correct();
runTime.write(); runTime.write();
......
...@@ -12,33 +12,33 @@ ...@@ -12,33 +12,33 @@
phi = phiU + phi = phiU +
( (
fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1) fvc::interpolate(interface.sigmaK())*fvc::snGrad(alpha1)*mesh.magSf()
- ghf*fvc::snGrad(rho) + fvc::interpolate(rho)*(g & mesh.Sf())
)*rUAf*mesh.magSf(); )*rUAf;
adjustPhi(phi, U, pd); adjustPhi(phi, U, p);
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) 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) if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{ {
pdEqn.solve(mesh.solver(pd.name() + "Final")); pEqn.solve(mesh.solver(p.name() + "Final"));
} }
else else
{ {
pdEqn.solve(mesh.solver(pd.name())); pEqn.solve(mesh.solver(p.name()));
} }
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
phi -= pdEqn.flux(); phi -= pEqn.flux();
} }
} }
......
...@@ -14,7 +14,14 @@ ...@@ -14,7 +14,14 @@
//- fvc::div(muEff*(fvc::interpolate(dev(fvc::grad(U))) & mesh.Sf())) //- 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) if (momentumPredictor)
{ {
...@@ -22,9 +29,11 @@ ...@@ -22,9 +29,11 @@
( (
UEqn 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 @@ ...@@ -3,6 +3,7 @@
( (
fvm::ddt(alpha1) fvm::ddt(alpha1)
+ fvm::div(phi, alpha1) + fvm::div(phi, alpha1)
//- fvm::Sp(fvc::div(phi), alpha1)
- fvm::laplacian - fvm::laplacian
( (
Dab + alphatab*turbulence->nut(), alpha1, Dab + alphatab*turbulence->nut(), alpha1,
......
Info<< "Reading field pd\n" << endl; Info<< "Reading field p\n" << endl;
volScalarField pd volScalarField p
( (
IOobject IOobject
( (
"pd", "p",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::MUST_READ, IOobject::MUST_READ,
...@@ -75,45 +75,9 @@ ...@@ -75,45 +75,9 @@
); );
Info<< "Calculating field g.h\n" << endl; label pRefCell = 0;
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);
scalar pRefValue = 0.0; scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue);
if (pd.needReference())
{
pRefValue = readScalar
(
mesh.solutionDict().subDict("PISO").lookup("pRefValue")
);
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
}
// Construct incompressible turbulence model // Construct incompressible turbulence model
......
...@@ -7,26 +7,37 @@ ...@@ -7,26 +7,37 @@
surfaceScalarField phiU surfaceScalarField phiU
( (
"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(); phi = phiU + fvc::interpolate(rho)*(g & mesh.Sf())*rUAf;
adjustPhi(phi, U, pd);
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) 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);
pdEqn.solve();
if
(
corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
if (nonOrth == nNonOrthCorr) if (nonOrth == nNonOrthCorr)
{ {
phi -= pdEqn.flux(); phi -= pEqn.flux();
} }
} }
......
...@@ -40,53 +40,52 @@ Description ...@@ -40,53 +40,52 @@ Description
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
#include "setRootCase.H"
# include "setRootCase.H" #include "createTime.H"
# include "createTime.H" #include "createMesh.H"
# include "createMesh.H" #include "readEnvironmentalProperties.H"
# include "readEnvironmentalProperties.H" #include "readPIMPLEControls.H"
# include "initContinuityErrs.H" #include "initContinuityErrs.H"
# include "createFields.H" #include "createFields.H"
#include "readTimeControls.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #include "CourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
while (runTime.loop()) while (runTime.run())
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; #include "readPIMPLEControls.H"
#include "readTimeControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
# include "readPISOControls.H" runTime++;
# include "CourantNo.H"
twoPhaseProperties.correct(); Info<< "Time = " << runTime.timeName() << nl << endl;
# include "alphaEqn.H" // --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
twoPhaseProperties.correct();
# include "UEqn.H" #include "alphaEqn.H"
// --- PISO loop #include "UEqn.H"
for (int corr=0; corr<nCorr; corr++)
{
# include "pEqn.H"
}
# include "continuityErrs.H" // --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
#include "pEqn.H"
}
p = pd + rho*gh; #include "continuityErrs.H"
if (pd.needReference()) turbulence->correct();
{
p += dimensionedScalar
(
"p",
p.dimensions(),
pRefValue - getRefCellValue(p, pdRefCell)
);
} }
turbulence->correct();
runTime.write(); runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment