pimpleControl and pisoControl: Rationalize PISO and PIMPLE control
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -35,6 +35,7 @@ Description
|
||||
#include "fft.H"
|
||||
#include "calcEk.H"
|
||||
#include "graph.H"
|
||||
#include "pisoControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -44,6 +45,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMeshNoClear.H"
|
||||
|
||||
pisoControl piso(mesh);
|
||||
|
||||
#include "readTransportProperties.H"
|
||||
#include "createFields.H"
|
||||
#include "readTurbulenceProperties.H"
|
||||
@ -57,8 +61,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readPISOControls.H"
|
||||
|
||||
force.internalField() = ReImSum
|
||||
(
|
||||
fft::reverseTransform
|
||||
@ -82,8 +84,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=1; corr<=1; corr++)
|
||||
while (piso.correct())
|
||||
{
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
@ -102,7 +103,7 @@ int main(int argc, char *argv[])
|
||||
fvm::laplacian(rAUf, p) == fvc::div(phiHbyA)
|
||||
);
|
||||
|
||||
pEqn.solve();
|
||||
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
|
||||
|
||||
phi = phiHbyA - pEqn.flux();
|
||||
|
||||
|
||||
@ -104,4 +104,4 @@
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
setRefCell(p, piso.dict(), pRefCell, pRefValue);
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -49,7 +49,7 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "OSspecific.H"
|
||||
#include "pisoControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -59,6 +59,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pisoControl piso(mesh);
|
||||
pisoControl bpiso(mesh, "BPISO");
|
||||
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
@ -68,9 +72,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
while (runTime.loop())
|
||||
{
|
||||
#include "readPISOControls.H"
|
||||
#include "readBPISOControls.H"
|
||||
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "CourantNo.H"
|
||||
@ -85,12 +86,14 @@ int main(int argc, char *argv[])
|
||||
+ fvc::grad(DBU*magSqr(B))
|
||||
);
|
||||
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
if (piso.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
while (piso.correct())
|
||||
{
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
surfaceScalarField rAUf("rAUf", fvc::interpolate(rAU));
|
||||
@ -105,7 +108,7 @@ int main(int argc, char *argv[])
|
||||
+ rAUf*fvc::ddtCorr(U, phi)
|
||||
);
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
while (piso.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pEqn
|
||||
(
|
||||
@ -113,9 +116,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
pEqn.solve();
|
||||
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
if (piso.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA - pEqn.flux();
|
||||
}
|
||||
@ -129,8 +132,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// --- B-PISO loop
|
||||
|
||||
for (int Bcorr=0; Bcorr<nBcorr; Bcorr++)
|
||||
while (bpiso.correct())
|
||||
{
|
||||
fvVectorMatrix BEqn
|
||||
(
|
||||
@ -148,13 +150,20 @@ int main(int argc, char *argv[])
|
||||
phiB = (fvc::interpolate(B) & mesh.Sf())
|
||||
+ rABf*fvc::ddtCorr(B, phiB);
|
||||
|
||||
fvScalarMatrix pBEqn
|
||||
(
|
||||
fvm::laplacian(rABf, pB) == fvc::div(phiB)
|
||||
);
|
||||
pBEqn.solve();
|
||||
while (bpiso.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix pBEqn
|
||||
(
|
||||
fvm::laplacian(rABf, pB) == fvc::div(phiB)
|
||||
);
|
||||
|
||||
phiB -= pBEqn.flux();
|
||||
pBEqn.solve(mesh.solver(pB.select(bpiso.finalInnerIter())));
|
||||
|
||||
if (bpiso.finalNonOrthogonalIter())
|
||||
{
|
||||
phiB -= pBEqn.flux();
|
||||
}
|
||||
}
|
||||
|
||||
#include "magneticFieldErr.H"
|
||||
}
|
||||
|
||||
@ -52,4 +52,4 @@
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
setRefCell(p, piso.dict(), pRefCell, pRefValue);
|
||||
|
||||
@ -36,4 +36,4 @@
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
setRefCell(p, piso.dict(), pRefCell, pRefValue);
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
|
||||
label pRefCell = 0;
|
||||
scalar pRefValue = 0.0;
|
||||
setRefCell(p, mesh.solutionDict().subDict("PISO"), pRefCell, pRefValue);
|
||||
setRefCell(p, piso.dict(), pRefCell, pRefValue);
|
||||
|
||||
|
||||
singlePhaseTransportModel laminarTransport(U, phi);
|
||||
|
||||
@ -34,6 +34,7 @@ Description
|
||||
#include "fvCFD.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "turbulentTransportModel.H"
|
||||
#include "pisoControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -43,6 +44,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
#include "createTime.H"
|
||||
#include "createMesh.H"
|
||||
|
||||
pisoControl piso(mesh);
|
||||
|
||||
#include "createFields.H"
|
||||
#include "initContinuityErrs.H"
|
||||
|
||||
@ -54,7 +58,6 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
#include "readPISOControls.H"
|
||||
#include "CourantNo.H"
|
||||
|
||||
// Pressure-velocity PISO corrector
|
||||
@ -70,14 +73,13 @@ int main(int argc, char *argv[])
|
||||
|
||||
UEqn.relax();
|
||||
|
||||
if (momentumPredictor)
|
||||
if (piso.momentumPredictor())
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
|
||||
// --- PISO loop
|
||||
|
||||
for (int corr=0; corr<nCorr; corr++)
|
||||
while (piso.correct())
|
||||
{
|
||||
volScalarField rAU(1.0/UEqn.A());
|
||||
|
||||
@ -93,7 +95,7 @@ int main(int argc, char *argv[])
|
||||
adjustPhi(phiHbyA, U, p);
|
||||
|
||||
// Non-orthogonal pressure corrector loop
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
while (piso.correctNonOrthogonal())
|
||||
{
|
||||
// Pressure corrector
|
||||
|
||||
@ -104,20 +106,9 @@ int main(int argc, char *argv[])
|
||||
|
||||
pEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
if
|
||||
(
|
||||
corr == nCorr-1
|
||||
&& nonOrth == nNonOrthCorr
|
||||
)
|
||||
{
|
||||
pEqn.solve(mesh.solver("pFinal"));
|
||||
}
|
||||
else
|
||||
{
|
||||
pEqn.solve();
|
||||
}
|
||||
pEqn.solve(mesh.solver(p.select(piso.finalInnerIter())));
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
if (piso.finalNonOrthogonalIter())
|
||||
{
|
||||
phi = phiHbyA - pEqn.flux();
|
||||
}
|
||||
|
||||
@ -397,6 +397,7 @@ solutionControl = $(general)/solutionControl
|
||||
$(solutionControl)/solutionControl/solutionControl.C
|
||||
$(solutionControl)/simpleControl/simpleControl.C
|
||||
$(solutionControl)/pimpleControl/pimpleControl.C
|
||||
$(solutionControl)/pisoControl/pisoControl.C
|
||||
|
||||
porosity = $(general)/porosityModel
|
||||
$(porosity)/porosityModel/porosityModel.C
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -120,9 +120,9 @@ bool Foam::pimpleControl::criteriaSatisfied()
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pimpleControl::pimpleControl(fvMesh& mesh)
|
||||
Foam::pimpleControl::pimpleControl(fvMesh& mesh, const word& dictName)
|
||||
:
|
||||
solutionControl(mesh, "PIMPLE"),
|
||||
solutionControl(mesh, dictName),
|
||||
nCorrPIMPLE_(0),
|
||||
nCorrPISO_(0),
|
||||
corrPISO_(0),
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,6 +28,9 @@ Description
|
||||
PIMPLE control class to supply convergence information/checks for
|
||||
the PIMPLE loop.
|
||||
|
||||
May also be used to for PISO-based algorithms as PISO controls are a
|
||||
sub-set of PIMPLE controls.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pimpleControl_H
|
||||
@ -48,6 +51,15 @@ class pimpleControl
|
||||
:
|
||||
public solutionControl
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pimpleControl(const pimpleControl&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const pimpleControl&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
@ -78,16 +90,9 @@ protected:
|
||||
//- Return true if all convergence checks are satisfied
|
||||
virtual bool criteriaSatisfied();
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pimpleControl(const pimpleControl&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const pimpleControl&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// Static Data Members
|
||||
|
||||
//- Run-time type information
|
||||
@ -96,8 +101,8 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh
|
||||
pimpleControl(fvMesh& mesh);
|
||||
//- Construct from mesh and the name of control sub-dictionary
|
||||
pimpleControl(fvMesh& mesh, const word& dictName="PIMPLE");
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ 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/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pisoControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(pisoControl, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pisoControl::pisoControl(fvMesh& mesh, const word& dictName)
|
||||
:
|
||||
pimpleControl(mesh, dictName)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pisoControl::~pisoControl()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,86 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
\\/ 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/>.
|
||||
|
||||
Class
|
||||
Foam::pisoControl
|
||||
|
||||
Description
|
||||
Specialization of the pimpleControl class for PISO control.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef pisoControl_H
|
||||
#define pisoControl_H
|
||||
|
||||
#include "pimpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class pisoControl Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class pisoControl
|
||||
:
|
||||
public pimpleControl
|
||||
{
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
pisoControl(const pisoControl&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const pisoControl&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Static Data Members
|
||||
|
||||
//- Run-time type information
|
||||
TypeName("pisoControl");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from mesh and the name of control sub-dictionary
|
||||
pisoControl(fvMesh& mesh, const word& dictName="PISO");
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~pisoControl();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
Reference in New Issue
Block a user