diff --git a/applications/solvers/DNS/dnsFoam/dnsFoam.C b/applications/solvers/DNS/dnsFoam/dnsFoam.C index 865af5618..38c5b7be8 100644 --- a/applications/solvers/DNS/dnsFoam/dnsFoam.C +++ b/applications/solvers/DNS/dnsFoam/dnsFoam.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 @@ -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(); diff --git a/applications/solvers/electromagnetics/mhdFoam/createFields.H b/applications/solvers/electromagnetics/mhdFoam/createFields.H index fb5a00493..a514f1141 100644 --- a/applications/solvers/electromagnetics/mhdFoam/createFields.H +++ b/applications/solvers/electromagnetics/mhdFoam/createFields.H @@ -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); diff --git a/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C b/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C index e9dedef5a..c9cb0242b 100644 --- a/applications/solvers/electromagnetics/mhdFoam/mhdFoam.C +++ b/applications/solvers/electromagnetics/mhdFoam/mhdFoam.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 @@ -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. + +\*---------------------------------------------------------------------------*/ + +#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() +{} + + +// ************************************************************************* // diff --git a/src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.H b/src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.H new file mode 100644 index 000000000..3d412e740 --- /dev/null +++ b/src/finiteVolume/cfdTools/general/solutionControl/pisoControl/pisoControl.H @@ -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 . + +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 + +// ************************************************************************* //