Backported COUPLED solvers and tutorials (vanilla OF 3.0.1)

This commit is contained in:
Vanja Skuric 2016-05-27 14:11:25 +02:00
parent 3cd148c0c5
commit 0cd17ee5e0
18 changed files with 43 additions and 80 deletions

View file

@ -39,7 +39,7 @@ Description
#include "foamTime.H" #include "foamTime.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "fvBlockMatrix.H" #include "fvBlockMatrix.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,6 +49,9 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
# include "createMesh.H" # include "createMesh.H"
simpleControl simple(mesh);
# include "createFields.H" # include "createFields.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -57,13 +60,11 @@ int main(int argc, char *argv[])
# include "CourantNo.H" # include "CourantNo.H"
for (runTime++; !runTime.end(); runTime++) while (simple.loop())
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H" while (simple.correctNonOrthogonal())
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix TEqn fvScalarMatrix TEqn
( (

View file

@ -9,7 +9,7 @@
UEqn.relax(); UEqn.relax();
if (momentumPredictor) if (piso.momentumPredictor())
{ {
solve solve
( (

View file

@ -38,6 +38,7 @@ Description
#include "thermalModel.H" #include "thermalModel.H"
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "RASModel.H" #include "RASModel.H"
#include "pisoControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,6 +48,9 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
# include "createFluidMesh.H" # include "createFluidMesh.H"
# include "createSolidMesh.H" # include "createSolidMesh.H"
pisoControl piso(mesh);
# include "readGravitationalAcceleration.H" # include "readGravitationalAcceleration.H"
# include "createFields.H" # include "createFields.H"
# include "createSolidFields.H" # include "createSolidFields.H"
@ -64,7 +68,6 @@ int main(int argc, char *argv[])
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readTimeControls.H" # include "readTimeControls.H"
# include "readPISOControls.H"
# include "CourantNo.H" # include "CourantNo.H"
# include "setDeltaT.H" # include "setDeltaT.H"
@ -75,7 +78,7 @@ int main(int argc, char *argv[])
p_rgh.storePrevIter(); p_rgh.storePrevIter();
for (int corr = 0; corr < nCorr; corr++) while (piso.correct())
{ {
# include "pEqn.H" # include "pEqn.H"
} }

View file

@ -71,6 +71,7 @@
pRefCell, pRefCell,
pRefValue pRefValue
); );
mesh.schemesDict().setFluxRequired(p_rgh.name());
autoPtr<incompressible::RASModel> turbulence autoPtr<incompressible::RASModel> turbulence
( (

View file

@ -10,7 +10,7 @@
surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf()); surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf());
phi -= buoyancyPhi; phi -= buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) while (piso.correctNonOrthogonal())
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
@ -19,16 +19,15 @@
p_rghEqn.setReference(pRefCell, pRefValue); p_rghEqn.setReference(pRefCell, pRefValue);
if (corr == nCorr-1 && nonOrth == nNonOrthCorr) p_rghEqn.solve
{ (
p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name() + "Final")); mesh.solutionDict().solver
} (
else p_rgh.select(piso.finalInnerIter())
{ )
p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name())); );
}
if (nonOrth == nNonOrthCorr) if (piso.finalNonOrthogonalIter())
{ {
// Calculate the conservative fluxes // Calculate the conservative fluxes
phi -= p_rghEqn.flux(); phi -= p_rghEqn.flux();

View file

@ -9,7 +9,7 @@
UEqn().relax(); UEqn().relax();
eqnResidual = solve solve
( (
UEqn() UEqn()
== ==
@ -22,6 +22,4 @@
)*mesh.magSf() )*mesh.magSf()
) )
) )
).initialResidual(); );
maxResidual = max(eqnResidual, maxResidual);

View file

@ -38,6 +38,7 @@ Description
#include "thermalModel.H" #include "thermalModel.H"
#include "singlePhaseTransportModel.H" #include "singlePhaseTransportModel.H"
#include "RASModel.H" #include "RASModel.H"
#include "simpleControl.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -47,6 +48,9 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
# include "createFluidMesh.H" # include "createFluidMesh.H"
# include "createSolidMesh.H" # include "createSolidMesh.H"
simpleControl simple(mesh);
# include "readGravitationalAcceleration.H" # include "readGravitationalAcceleration.H"
# include "createFields.H" # include "createFields.H"
# include "createSolidFields.H" # include "createSolidFields.H"
@ -56,13 +60,10 @@ int main(int argc, char *argv[])
Info<< "\nStarting time loop\n" << endl; Info<< "\nStarting time loop\n" << endl;
while (runTime.loop()) while (simple.loop())
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readSIMPLEControls.H"
# include "initConvergenceCheck.H"
// Detach patches // Detach patches
# include "detachPatches.H" # include "detachPatches.H"

View file

@ -71,6 +71,7 @@
pRefCell, pRefCell,
pRefValue pRefValue
); );
mesh.schemesDict().setFluxRequired(p_rgh.name());
autoPtr<incompressible::RASModel> turbulence autoPtr<incompressible::RASModel> turbulence
( (

View file

@ -1,7 +0,0 @@
// initialize values for convergence checks
scalar eqnResidual = 1, maxResidual = 0;
scalar convergenceCriterion = 0;
simple.readIfPresent("convergence", convergenceCriterion);

View file

@ -11,7 +11,7 @@
surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf()); surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf());
phi -= buoyancyPhi; phi -= buoyancyPhi;
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) while (simple.correctNonOrthogonal())
{ {
fvScalarMatrix p_rghEqn fvScalarMatrix p_rghEqn
( (
@ -20,18 +20,9 @@
p_rghEqn.setReference(pRefCell, pRefValue); p_rghEqn.setReference(pRefCell, pRefValue);
// retain the residual from the first iteration
if (nonOrth == 0)
{
eqnResidual = p_rghEqn.solve().initialResidual();
maxResidual = max(eqnResidual, maxResidual);
}
else
{
p_rghEqn.solve(); p_rghEqn.solve();
}
if (nonOrth == nNonOrthCorr) if (simple.finalNonOrthogonalIter())
{ {
// Calculate the conservative fluxes // Calculate the conservative fluxes
phi -= p_rghEqn.flux(); phi -= p_rghEqn.flux();

View file

@ -1,9 +1,9 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | foam-extend: Open Source CFD | | \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 | | \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org | | \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | | | \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {

View file

@ -48,9 +48,4 @@ snGradSchemes
default corrected; default corrected;
} }
fluxRequired
{
default no;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -1,9 +1,9 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | foam-extend: Open Source CFD | | \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 | | \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org | | \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | | | \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
@ -39,4 +39,5 @@ boundaryField
} }
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -36,7 +36,7 @@ divSchemes
// div(phi,R) Gauss upwind; // div(phi,R) Gauss upwind;
// div(R) Gauss linear; // div(R) Gauss linear;
// div(phi,nuTilda) Gauss upwind; // div(phi,nuTilda) Gauss upwind;
div((nuEff*dev(grad(U).T()))) Gauss linear; div((nuEff*dev2(T(grad(U))))) Gauss linear;
} }
laplacianSchemes laplacianSchemes
@ -62,10 +62,4 @@ snGradSchemes
default corrected; default corrected;
} }
fluxRequired
{
default no;
p_rgh;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -46,9 +46,4 @@ snGradSchemes
default uncorrected; default uncorrected;
} }
fluxRequired
{
default no;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -1,9 +1,9 @@
/*--------------------------------*- C++ -*----------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
| ========= | | | ========= | |
| \\ / F ield | foam-extend: Open Source CFD | | \\ / F ield | foam-extend: Open Source CFD |
| \\ / O peration | Version: 3.2 | | \\ / O peration | Version: 4.0 |
| \\ / A nd | Web: http://www.foam-extend.org | | \\ / A nd | Web: http://www.foam-extend.org |
| \\/ M anipulation | | | \\/ M anipulation | For copyright notice see file Copyright |
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
FoamFile FoamFile
{ {
@ -39,4 +39,5 @@ boundaryField
} }
} }
// ************************************************************************* // // ************************************************************************* //

View file

@ -36,7 +36,7 @@ divSchemes
// div(phi,R) Gauss upwind; // div(phi,R) Gauss upwind;
// div(R) Gauss linear; // div(R) Gauss linear;
// div(phi,nuTilda) Gauss upwind; // div(phi,nuTilda) Gauss upwind;
div((nuEff*dev(grad(U).T()))) Gauss linear; div((nuEff*dev2(T(grad(U))))) Gauss linear;
} }
laplacianSchemes laplacianSchemes
@ -62,10 +62,4 @@ snGradSchemes
default corrected; default corrected;
} }
fluxRequired
{
default no;
p_rgh;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -46,9 +46,4 @@ snGradSchemes
default uncorrected; default uncorrected;
} }
fluxRequired
{
default no;
}
// ************************************************************************* // // ************************************************************************* //