Backported createTimeControls.H and readTimeControls.H from OF 3.0.1, and pimpleDyMFoam

This commit is contained in:
Vanja Skuric 2016-05-06 22:11:03 +02:00
parent a704cb308e
commit 36b4fa3811
8 changed files with 85 additions and 63 deletions

View file

@ -5,23 +5,12 @@
+ turbulence->divDevReff(U)
);
if (oCorr == nOuterCorr - 1)
{
if (mesh.solutionDict().relax("UFinal"))
{
UEqn.relax(mesh.solutionDict().relaxationFactor("UFinal"));
}
else
{
UEqn.relax(1);
}
}
else
{
UEqn.relax();
}
UEqn.relax
(
mesh.solutionDict().relaxationFactor(U.select(pimple.finalIter()))
);
if (momentumPredictor)
if (pimple.momentumPredictor())
{
solve(UEqn == -fvc::grad(p));
}

View file

@ -37,7 +37,7 @@
mesh.schemesDict().setFluxRequired(pcorr.name());
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pcorrEqn
(
@ -47,7 +47,7 @@
pcorrEqn.setReference(pRefCell, pRefValue);
pcorrEqn.solve();
if (nonOrth == nNonOrthCorr)
if (pimple.finalNonOrthogonalIter())
{
phi -= pcorrEqn.flux();
}

View file

@ -0,0 +1,11 @@
#include "createTimeControls.H"
bool correctPhi
(
pimple.dict().lookupOrDefault("correctPhi", false)
);
bool checkMeshCourantNo
(
pimple.dict().lookupOrDefault("checkMeshCourantNo", false)
);

View file

@ -33,6 +33,7 @@
label pRefCell = 0;
scalar pRefValue = 0.0;
setRefCell(p, mesh.solutionDict().subDict("PIMPLE"), pRefCell, pRefValue);
mesh.schemesDict().setFluxRequired(p.name());
singlePhaseTransportModel laminarTransport(U, phi);

View file

@ -36,6 +36,7 @@ Description
#include "singlePhaseTransportModel.H"
#include "turbulenceModel.H"
#include "dynamicFvMesh.H"
#include "pimpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -45,10 +46,12 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createDynamicFvMesh.H"
# include "readPIMPLEControls.H"
pimpleControl pimple(mesh);
# include "initContinuityErrs.H"
# include "createFields.H"
# include "readTimeControls.H"
# include "createControls.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -93,10 +96,9 @@ int main(int argc, char *argv[])
fvc::makeRelative(phi, U);
// --- PIMPLE loop
label oCorr = 0;
do
while (pimple.loop())
{
if (nOuterCorr != 1)
if (!pimple.firstIter())
{
p.storePrevIter();
}
@ -104,7 +106,7 @@ int main(int argc, char *argv[])
# include "UEqn.H"
// --- PISO loop
for (int corr = 0; corr < nCorr; corr++)
while (pimple.correct())
{
rAU = 1.0/UEqn.A();
@ -114,7 +116,7 @@ int main(int argc, char *argv[])
adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (pimple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -123,24 +125,15 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue);
if
(
// oCorr == nOuterCorr - 1
corr == nCorr - 1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve
(
mesh.solutionDict().solver(p.name() + "Final")
mesh.solutionDict().solver
(
p.select(pimple.finalInnerIter())
)
);
}
else
{
pEqn.solve(mesh.solutionDict().solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
if (pimple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}
@ -149,7 +142,7 @@ int main(int argc, char *argv[])
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
if (oCorr != nOuterCorr - 1)
if (!pimple.finalIter())
{
p.relax();
}
@ -164,7 +157,7 @@ int main(int argc, char *argv[])
}
turbulence->correct();
} while (++oCorr < nOuterCorr);
}
runTime.write();

View file

@ -1,14 +1,5 @@
#include "readTimeControls.H"
# include "readPIMPLEControls.H"
bool correctPhi = false;
if (pimple.found("correctPhi"))
{
correctPhi = Switch(pimple.lookup("correctPhi"));
}
correctPhi = pimple.dict().lookupOrDefault("correctPhi", false);
bool checkMeshCourantNo = false;
if (pimple.found("checkMeshCourantNo"))
{
checkMeshCourantNo = Switch(pimple.lookup("checkMeshCourantNo"));
}
checkMeshCourantNo = pimple.dict().lookupOrDefault("checkMeshCourantNo", false);

View file

@ -0,0 +1,41 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend 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.
foam-extend 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 foam-extend. If not, see <http://www.gnu.org/licenses/>.
Global
readTimeControls
Description
Read the control parameters used by setDeltaT
\*---------------------------------------------------------------------------*/
bool adjustTimeStep =
runTime.controlDict().lookupOrDefault("adjustTimeStep", false);
scalar maxCo =
runTime.controlDict().lookupOrDefault<scalar>("maxCo", 1.0);
scalar maxDeltaT =
runTime.controlDict().lookupOrDefault<scalar>("maxDeltaT", GREAT);
// ************************************************************************* //

View file

@ -29,17 +29,13 @@ Description
\*---------------------------------------------------------------------------*/
Switch adjustTimeStep
(
runTime.controlDict().lookup("adjustTimeStep")
);
adjustTimeStep =
runTime.controlDict().lookupOrDefault("adjustTimeStep", false);
scalar maxCo
(
readScalar(runTime.controlDict().lookup("maxCo"))
);
maxCo =
runTime.controlDict().lookupOrDefault<scalar>("maxCo", 1.0);
scalar maxDeltaT =
maxDeltaT =
runTime.controlDict().lookupOrDefault<scalar>("maxDeltaT", GREAT);
// ************************************************************************* //