Backported MRFSimpleFoam and porousSimpleFoam (setFluxRequired, solutionControl)

This commit is contained in:
Vanja Skuric 2016-05-07 08:38:01 +02:00
parent a3a524dbe6
commit d230fff954
6 changed files with 17 additions and 29 deletions

View file

@ -34,6 +34,7 @@ Description
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
#include "incompressible/RAS/RASModel/RASModel.H"
#include "MRFZones.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -44,6 +45,9 @@ int main(int argc, char *argv[])
# include "createTime.H"
# include "createMesh.H"
simpleControl simple(mesh);
# include "createFields.H"
# include "initContinuityErrs.H"
@ -55,8 +59,6 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H"
p.storePrevIter();
// Pressure-velocity SIMPLE corrector
@ -84,7 +86,7 @@ int main(int argc, char *argv[])
adjustPhi(phi, U, p);
// Non-orthogonal pressure corrector loop
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (simple.correctNonOrthogonal())
{
fvScalarMatrix pEqn
(
@ -94,7 +96,7 @@ int main(int argc, char *argv[])
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
if (nonOrth == nNonOrthCorr)
if (simple.finalNonOrthogonalIter())
{
phi -= pEqn.flux();
}

View file

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

View file

@ -34,12 +34,7 @@
{
pZones.addResistance(UEqn());
eqnResidual = solve
(
UEqn() == -fvc::grad(p)
). initialResidual();
maxResidual = max(eqnResidual, maxResidual);
solve(UEqn() == -fvc::grad(p));
trAU = 1.0/UEqn().A();
trAU().rename("rAU");

View file

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

View file

@ -11,7 +11,7 @@ UEqn.clear();
phi = fvc::interpolate(U) & mesh.Sf();
adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
while (simple.correctNonOrthogonal())
{
tmp<fvScalarMatrix> tpEqn;
@ -25,18 +25,10 @@ for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
}
tpEqn().setReference(pRefCell, pRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)
{
eqnResidual = tpEqn().solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);
}
else
{
tpEqn().solve();
}
if (nonOrth == nNonOrthCorr)
tpEqn().solve();
if (simple.finalNonOrthogonalIter())
{
phi -= tpEqn().flux();
}

View file

@ -34,6 +34,7 @@ Description
#include "singlePhaseTransportModel.H"
#include "RASModel.H"
#include "porousZones.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -42,6 +43,9 @@ int main(int argc, char *argv[])
#include "setRootCase.H"
#include "createTime.H"
#include "createMesh.H"
simpleControl simple(mesh);
#include "createFields.H"
#include "initContinuityErrs.H"
@ -53,9 +57,6 @@ int main(int argc, char *argv[])
{
Info<< "Time = " << runTime.timeName() << nl << endl;
#include "readSIMPLEControls.H"
#include "initConvergenceCheck.H"
p.storePrevIter();
// Pressure-velocity SIMPLE corrector
@ -71,8 +72,6 @@ int main(int argc, char *argv[])
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
<< " ClockTime = " << runTime.elapsedClockTime() << " s"
<< nl << endl;
#include "convergenceCheck.H"
}
Info<< "End\n" << endl;