Final iteration information now available in mesh::data (used to be mesh::fvData)

Relaxation and solution parameters for the final iteration in PIMPLE loops are
now selected according to the value of the "finalIteration" entry in the
mesh::data dictionary.

rhoPimpleFoam significantly updates and now replaces rhoPisoFoam.
This commit is contained in:
henry
2010-05-25 18:45:25 +01:00
parent 49ccf0ffaa
commit 361b153343
161 changed files with 685 additions and 859 deletions

View File

@ -7,30 +7,13 @@ fvVectorMatrix UEqn
UEqn.relax();
if (oCorr == nOuterCorr - 1)
{
solve
solve
(
UEqn
==
fvc::reconstruct
(
UEqn
==
fvc::reconstruct
(
fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
),
mesh.solver("UFinal")
);
}
else
{
solve
(
UEqn
==
fvc::reconstruct
(
fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
)
);
}
fvc::interpolate(rho)*(g & mesh.Sf())
- fvc::snGrad(p)*mesh.magSf()
)
);

View File

@ -70,6 +70,12 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
#include "UEqn.H"
#include "ftEqn.H"
@ -80,6 +86,11 @@ int main(int argc, char *argv[])
{
#include "pEqn.H"
}
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
turbulence->correct();

View File

@ -30,14 +30,20 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
closedVolume = p.needReference();
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
pEqn.solve
(
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{

View File

@ -31,14 +31,20 @@
- fvm::laplacian(rho*rUA, p)
);
if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve();
}
pEqn.solve
(
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{
@ -64,14 +70,20 @@
- fvm::laplacian(rho*rUA, p)
);
if (ocorr == nOuterCorr && corr == nCorr && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve();
}
pEqn.solve
(
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{

View File

@ -69,8 +69,14 @@ int main(int argc, char *argv[])
#include "chemistry.H"
#include "rhoEqn.H"
for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
for (label oCorr=1; oCorr <= nOuterCorr; oCorr++)
{
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
#include "UEqn.H"
#include "YEqn.H"
#include "hsEqn.H"
@ -80,6 +86,11 @@ int main(int argc, char *argv[])
{
#include "pEqn.H"
}
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
turbulence->correct();

View File

@ -7,27 +7,13 @@ tmp<fvVectorMatrix> UEqn
+ turbulence->divDevRhoReff(U)
);
if (oCorr == nOuterCorr-1)
{
UEqn().relax(1);
}
else
{
UEqn().relax();
}
UEqn().relax();
volScalarField rUA = 1.0/UEqn().A();
if (momentumPredictor)
{
if (oCorr == nOuterCorr-1)
{
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
}
else
{
solve(UEqn() == -fvc::grad(p));
}
solve(UEqn() == -fvc::grad(p));
}
else
{

View File

@ -37,12 +37,7 @@
mesh
);
# include "compressibleCreatePhi.H"
dimensionedScalar pMin
(
mesh.solutionDict().subDict("PIMPLE").lookup("pMin")
);
#include "compressibleCreatePhi.H"
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
@ -56,9 +51,6 @@
)
);
//dimensionedScalar initialMass = fvc::domainIntegrate(rho);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -8,16 +8,8 @@
DpDt
);
if (oCorr == nOuterCorr-1)
{
hEqn.relax();
hEqn.solve(mesh.solver("hFinal"));
}
else
{
hEqn.relax();
hEqn.solve();
}
hEqn.relax();
hEqn.solve();
thermo.correct();
}

View File

@ -1,6 +1,5 @@
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A();
U = rUA*UEqn().H();
if (nCorr <= 1)
@ -29,19 +28,20 @@ if (transonic)
- fvm::laplacian(rho*rUA, p)
);
if
pEqn.solve
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver("pFinal"));
}
else
{
pEqn.solve();
}
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{
@ -55,7 +55,7 @@ else
fvc::interpolate(rho)*
(
(fvc::interpolate(U) & mesh.Sf())
//+ fvc::ddtPhiCorr(rUA, rho, U, phi)
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
@ -68,19 +68,20 @@ else
- fvm::laplacian(rho*rUA, p)
);
if
pEqn.solve
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver("pFinal"));
}
else
{
pEqn.solve();
}
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{
@ -92,30 +93,15 @@ else
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
//if (oCorr != nOuterCorr-1)
{
// Explicitly relax pressure for momentum corrector
p.relax();
// Explicitly relax pressure for momentum corrector
p.relax();
rho = thermo.rho();
rho.relax();
Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl;
}
// Recalculate density from the relaxed pressure
rho = thermo.rho();
Info<< "rho max/min : " << max(rho).value()
<< " " << min(rho).value() << endl;
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
bound(p, pMin);
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
/*
if (closedVolume)
{
p += (initialMass - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(psi);
}
*/

View File

@ -61,15 +61,22 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
if (nOuterCorr != 1)
{
p.storePrevIter();
rho.storePrevIter();
}
#include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
if (nOuterCorr != 1)
{
p.storePrevIter();
}
#include "UEqn.H"
#include "hEqn.H"
@ -80,6 +87,11 @@ int main(int argc, char *argv[])
}
turbulence->correct();
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
runTime.write();

View File

@ -1,3 +0,0 @@
rhoPisoFoam.C
EXE = $(FOAM_APPBIN)/rhoPisoFoam

View File

@ -1,13 +0,0 @@
EXE_INC = \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
-I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \
-lfiniteVolume \
-lmeshTools \
-lbasicThermophysicalModels \
-lspecie \
-lcompressibleRASModels \
-lcompressibleLESModels

View File

@ -1,11 +0,0 @@
fvVectorMatrix UEqn
(
fvm::ddt(rho, U)
+ fvm::div(phi, U)
+ turbulence->divDevRhoReff(U)
);
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));
}

View File

@ -1,58 +0,0 @@
Info<< "Reading thermophysical properties\n" << endl;
autoPtr<basicPsiThermo> pThermo
(
basicPsiThermo::New(mesh)
);
basicPsiThermo& thermo = pThermo();
volScalarField& p = thermo.p();
volScalarField& h = thermo.h();
const volScalarField& psi = thermo.psi();
volScalarField rho
(
IOobject
(
"rho",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
thermo.rho()
);
Info<< "\nReading field U\n" << endl;
volVectorField U
(
IOobject
(
"U",
runTime.timeName(),
mesh,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
);
# include "compressibleCreatePhi.H"
Info<< "Creating turbulence model\n" << endl;
autoPtr<compressible::turbulenceModel> turbulence
(
compressible::turbulenceModel::New
(
rho,
U,
phi,
thermo
)
);
Info<< "Creating field DpDt\n" << endl;
volScalarField DpDt =
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -1,12 +0,0 @@
{
solve
(
fvm::ddt(rho, h)
+ fvm::div(phi, h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
DpDt
);
thermo.correct();
}

View File

@ -1,68 +0,0 @@
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
U = rUA*UEqn.H();
if (transonic)
{
surfaceScalarField phid
(
"phid",
fvc::interpolate(psi)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p)
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi == pEqn.flux();
}
}
}
else
{
phi =
fvc::interpolate(rho)*
(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
- fvm::laplacian(rho*rUA, p)
);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi += pEqn.flux();
}
}
}
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

View File

@ -1,93 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
rhoPisoFoam
Description
Transient PISO solver for compressible, laminar or turbulent flow.
\*---------------------------------------------------------------------------*/
#include "fvCFD.H"
#include "basicPsiThermo.H"
#include "turbulenceModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
#include "createFields.H"
#include "initContinuityErrs.H"
#include "readTimeControls.H"
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Info<< "\nStarting time loop\n" << endl;
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "rhoEqn.H"
#include "UEqn.H"
// --- PISO loop
for (int corr=1; corr<=nCorr; corr++)
{
#include "hEqn.H"
#include "pEqn.H"
}
turbulence->correct();
rho = thermo.rho();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
}
Info<< "End\n" << endl;
return 0;
}
// ************************************************************************* //

View File

@ -7,14 +7,7 @@ tmp<fvVectorMatrix> UEqn
+ turbulence->divDevRhoReff(U)
);
if (oCorr == nOuterCorr-1)
{
UEqn().relax(1);
}
else
{
UEqn().relax();
}
UEqn().relax();
mrfZones.addCoriolis(rho, UEqn());
pZones.addResistance(UEqn());
@ -23,14 +16,7 @@ volScalarField rUA = 1.0/UEqn().A();
if (momentumPredictor)
{
if (oCorr == nOuterCorr-1)
{
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
}
else
{
solve(UEqn() == -fvc::grad(p));
}
solve(UEqn() == -fvc::grad(p));
}
else
{

View File

@ -30,19 +30,20 @@ if (transonic)
- fvm::laplacian(rho*rUA, p)
);
if
pEqn.solve
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver("pFinal"));
}
else
{
pEqn.solve();
}
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{
@ -70,19 +71,20 @@ else
- fvm::laplacian(rho*rUA, p)
);
if
pEqn.solve
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver("pFinal"));
}
else
{
pEqn.solve();
}
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{

View File

@ -65,17 +65,23 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
if (nOuterCorr != 1)
{
p.storePrevIter();
rho.storePrevIter();
}
#include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
if (nOuterCorr != 1)
{
p.storePrevIter();
rho.storePrevIter();
}
#include "UEqn.H"
#include "hEqn.H"
@ -86,6 +92,11 @@ int main(int argc, char *argv[])
}
turbulence->correct();
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
runTime.write();

View File

@ -45,9 +45,14 @@
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("SIMPLE"), pRefCell, pRefValue);
dimensionedScalar pMin
dimensionedScalar rhoMax
(
mesh.solutionDict().subDict("SIMPLE").lookup("pMin")
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMax")
);
dimensionedScalar rhoMin
(
mesh.solutionDict().subDict("SIMPLE").lookup("rhoMin")
);
Info<< "Creating turbulence model\n" << endl;

View File

@ -5,8 +5,8 @@
- fvm::Sp(fvc::div(phi), h)
- fvm::laplacian(turbulence->alphaEff(), h)
==
fvc::div(phi/fvc::interpolate(rho)*fvc::interpolate(p, "div(U,p)"))
- p*fvc::div(phi/fvc::interpolate(rho))
fvc::div(phi/fvc::interpolate(rho), rho/psi, "div(U,p)")
- (rho/psi)*fvc::div(phi/fvc::interpolate(rho))
);
pZones.addEnthalpySource(thermo, rho, hEqn);

View File

@ -1,3 +1,8 @@
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
if (pressureImplicitPorosity)
{
U = trTU()&UEqn().H();
@ -58,8 +63,6 @@ else
U.correctBoundaryConditions();
bound(p, pMin);
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
@ -69,5 +72,7 @@ if (closedVolume)
}
rho = thermo.rho();
rho = max(rho, rhoMin);
rho = min(rho, rhoMax);
rho.relax();
Info<< "rho max/min : " << max(rho).value() << " " << min(rho).value() << endl;

View File

@ -37,7 +37,7 @@
mesh
);
# include "compressibleCreatePhi.H"
#include "compressibleCreatePhi.H"
label pRefCell = 0;

View File

@ -0,0 +1,3 @@
buoyantBoussinesqPimpleFoam.C
EXE = $(FOAM_APPBIN)/buoyantBoussinesqPimpleFoam

View File

@ -13,7 +13,6 @@
);
TEqn.relax();
TEqn.solve();
rhok = 1.0 - beta*(T - TRef);

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
buoyantBoussinesqPisoFoam
buoyantBoussinesqPimpleFoam
Description
Transient solver for buoyant, turbulent flow of incompressible fluids
@ -72,20 +72,40 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "readPIMPLEControls.H"
#include "CourantNo.H"
#include "setDeltaT.H"
#include "UEqn.H"
#include "TEqn.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"
}
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
turbulence->correct();
if (nOuterCorr != 1)
{
p.storePrevIter();
}
#include "UEqn.H"
#include "TEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
#include "pEqn.H"
}
turbulence->correct();
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
runTime.write();

View File

@ -42,9 +42,9 @@
mesh
);
# include "createPhi.H"
#include "createPhi.H"
# include "readTransportProperties.H"
#include "readTransportProperties.H"
Info<< "Creating turbulence model\n" << endl;
autoPtr<incompressible::RASModel> turbulence
@ -57,7 +57,7 @@
setRefCell
(
p,
mesh.solutionDict().subDict("PISO"),
mesh.solutionDict().subDict("PIMPLE"),
pRefCell,
pRefValue
);

View File

@ -0,0 +1,52 @@
{
volScalarField rUA("rUA", 1.0/UEqn.A());
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
surfaceScalarField buoyancyPhi =
rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
phi += buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUAf, p) == fvc::div(phi)
);
pEqn.solve
(
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{
// Calculate the conservative fluxes
phi -= pEqn.flux();
// Explicitly relax pressure for momentum corrector
p.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rUAf);
U.correctBoundaryConditions();
}
}
#include "continuityErrs.H"
}

View File

@ -1,3 +0,0 @@
buoyantBoussinesqPisoFoam.C
EXE = $(FOAM_APPBIN)/buoyantBoussinesqPisoFoam

View File

@ -1,41 +0,0 @@
{
volScalarField rUA("rUA", 1.0/UEqn.A());
surfaceScalarField rUAf("(1|A(U))", fvc::interpolate(rUA));
U = rUA*UEqn.H();
surfaceScalarField phiU
(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi)
);
phi = phiU + rUAf*fvc::interpolate(rhok)*(g & mesh.Sf());
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rUAf, p) == fvc::div(phi)
);
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}
U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
U.correctBoundaryConditions();
#include "continuityErrs.H"
}

View File

@ -0,0 +1,3 @@
buoyantPimpleFoam.C
EXE = $(FOAM_APPBIN)/buoyantPimpleFoam

View File

@ -22,7 +22,7 @@ License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Application
buoyantPisoFoam
buoyantPimpleFoam
Description
Transient solver for buoyant, turbulent flow of compressible fluids for
@ -59,7 +59,7 @@ int main(int argc, char *argv[])
while (runTime.run())
{
#include "readTimeControls.H"
#include "readPISOControls.H"
#include "readPIMPLEControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
@ -69,21 +69,39 @@ int main(int argc, char *argv[])
#include "rhoEqn.H"
#include "UEqn.H"
#include "hEqn.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"
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
if (nOuterCorr != 1)
{
p.storePrevIter();
}
#include "UEqn.H"
#include "hEqn.H"
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
#include "pEqn.H"
}
turbulence->correct();
rho = thermo.rho();
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
turbulence->correct();
rho = thermo.rho();
runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -12,16 +12,15 @@
U = rUA*UEqn.H();
surfaceScalarField phiU
phi = fvc::interpolate(rho)*
(
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
);
phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
surfaceScalarField buoyancyPhi =
rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
phi += buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
@ -32,27 +31,39 @@
- fvm::laplacian(rhorUAf, p)
);
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
pEqn.solve
(
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{
// Calculate the conservative fluxes
phi += pEqn.flux();
// Explicitly relax pressure for momentum corrector
p.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U += rUA*fvc::reconstruct((buoyancyPhi + pEqn.flux())/rhorUAf);
U.correctBoundaryConditions();
}
}
// Second part of thermodynamic density update
thermo.rho() += psi*p;
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
U.correctBoundaryConditions();
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
#include "rhoEqn.H"

View File

@ -1,3 +0,0 @@
buoyantPisoFoam.C
EXE = $(FOAM_APPBIN)/buoyantPisoFoam

View File

@ -22,16 +22,7 @@
);
pEqn.setReference(pRefCell, pRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)
{
pEqn.solve();
}
else
{
pEqn.solve();
}
pEqn.solve();
if (nonOrth == nNonOrthCorr)
{

View File

@ -1,16 +0,0 @@
fvVectorMatrix UEqn
(
fvm::ddt(U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U)
);
if (ocorr != nOuterCorr-1)
{
UEqn.relax();
}
if (momentumPredictor)
{
solve(UEqn == -fvc::grad(p));
}

View File

@ -0,0 +1,8 @@
#!/bin/sh
cd ${0%/*} || exit 1 # run from this directory
set -x
wmake
wmake pimpleDyMFoam
# ----------------------------------------------------------------- end-of-file

View File

@ -7,27 +7,13 @@ tmp<fvVectorMatrix> UEqn
+ turbulence->divDevReff(U)
);
if (oCorr == nOuterCorr-1)
{
UEqn().relax(1);
}
else
{
UEqn().relax();
}
UEqn().relax();
volScalarField rUA = 1.0/UEqn().A();
if (momentumPredictor)
{
if (oCorr == nOuterCorr-1)
{
solve(UEqn() == -fvc::grad(p), mesh.solver("UFinal"));
}
else
{
solve(UEqn() == -fvc::grad(p));
}
solve(UEqn() == -fvc::grad(p));
}
else
{

View File

@ -21,19 +21,20 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
pEqn.setReference(pRefCell, pRefValue);
if
pEqn.solve
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver("pFinal"));
}
else
{
pEqn.solve();
}
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{
@ -43,11 +44,8 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector except for last corrector
if (oCorr != nOuterCorr-1)
{
p.relax();
}
// Explicitly relax pressure for momentum corrector
p.relax();
U -= rUA*fvc::grad(p);
U.correctBoundaryConditions();

View File

@ -1,4 +1,5 @@
EXE_INC = \
-I.. \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/dynamicMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \

View File

@ -0,0 +1,55 @@
U = rAU*UEqn().H();
if (nCorr <= 1)
{
UEqn.clear();
}
phi = (fvc::interpolate(U) & mesh.Sf());
if (p.needReference())
{
fvc::makeRelative(phi, U);
adjustPhi(phi, U, p);
fvc::makeAbsolute(phi, U);
}
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve
(
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}
#include "continuityErrs.H"
p.relax();
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();

View File

@ -84,8 +84,14 @@ int main(int argc, char *argv[])
}
// --- PIMPLE loop
for (int ocorr=0; ocorr<nOuterCorr; ocorr++)
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
if (nOuterCorr != 1)
{
p.storePrevIter();
@ -96,62 +102,15 @@ int main(int argc, char *argv[])
// --- PISO loop
for (int corr=0; corr<nCorr; corr++)
{
rAU = 1.0/UEqn.A();
U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf());
if (p.needReference())
{
fvc::makeRelative(phi, U);
adjustPhi(phi, U, p);
fvc::makeAbsolute(phi, U);
}
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
if
(
ocorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}
#include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
if (ocorr != nOuterCorr-1)
{
p.relax();
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
#include "pEqn.H"
}
turbulence->correct();
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
runTime.write();

View File

@ -1,5 +1,5 @@
# include "readTimeControls.H"
# include "readPIMPLEControls.H"
#include "readTimeControls.H"
#include "readPIMPLEControls.H"
bool correctPhi = false;
if (pimple.found("correctPhi"))

View File

@ -62,6 +62,12 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
if (nOuterCorr != 1)
{
p.storePrevIter();
@ -76,6 +82,11 @@ int main(int argc, char *argv[])
}
turbulence->correct();
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
runTime.write();

View File

@ -15,14 +15,7 @@
//- fvc::div(rho*turbulence->nuEff()*dev(fvc::grad(U)().T()))
);
if (oCorr == nOuterCorr-1)
{
UEqn.relax(1);
}
else
{
UEqn.relax();
}
UEqn.relax();
if (momentumPredictor)
{
@ -34,7 +27,6 @@
(
fvc::interpolate(rho)*(g & mesh.Sf())
- mesh.magSf()*fvc::snGrad(p)
),
mesh.solver(oCorr == nOuterCorr-1 ? "UFinal" : "U")
)
);
}

View File

@ -22,18 +22,20 @@
pEqn.setReference(pRefCell, pRefValue);
if
pEqn.solve
(
corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
mesh.solver
(
p.select
(
(
finalIter
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
)
)
);
if (nonOrth == nNonOrthCorr)
{

View File

@ -68,6 +68,12 @@ int main(int argc, char *argv[])
// --- Pressure-velocity PIMPLE corrector loop
for (int oCorr=0; oCorr<nOuterCorr; oCorr++)
{
bool finalIter = oCorr == nOuterCorr-1;
if (finalIter)
{
mesh.data::add("finalIteration", true);
}
twoPhaseProperties.correct();
#include "alphaEqn.H"
@ -83,6 +89,11 @@ int main(int argc, char *argv[])
#include "continuityErrs.H"
turbulence->correct();
if (finalIter)
{
mesh.data::remove("finalIteration");
}
}
runTime.write();