Backported COUPLED solvers and tutorials (vanilla OF 3.0.1)
This commit is contained in:
parent
3cd148c0c5
commit
0cd17ee5e0
18 changed files with 43 additions and 80 deletions
|
@ -39,7 +39,7 @@ Description
|
|||
#include "foamTime.H"
|
||||
#include "fvMesh.H"
|
||||
#include "fvBlockMatrix.H"
|
||||
|
||||
#include "simpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -49,6 +49,9 @@ int main(int argc, char *argv[])
|
|||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
# include "createMesh.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
# include "createFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
@ -57,13 +60,11 @@ int main(int argc, char *argv[])
|
|||
|
||||
# include "CourantNo.H"
|
||||
|
||||
for (runTime++; !runTime.end(); runTime++)
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readSIMPLEControls.H"
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
while (simple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix TEqn
|
||||
(
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
UEqn.relax();
|
||||
|
||||
if (momentumPredictor)
|
||||
if (piso.momentumPredictor())
|
||||
{
|
||||
solve
|
||||
(
|
||||
|
|
|
@ -38,6 +38,7 @@ Description
|
|||
#include "thermalModel.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "pisoControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -47,6 +48,9 @@ int main(int argc, char *argv[])
|
|||
# include "createTime.H"
|
||||
# include "createFluidMesh.H"
|
||||
# include "createSolidMesh.H"
|
||||
|
||||
pisoControl piso(mesh);
|
||||
|
||||
# include "readGravitationalAcceleration.H"
|
||||
# include "createFields.H"
|
||||
# include "createSolidFields.H"
|
||||
|
@ -64,7 +68,6 @@ int main(int argc, char *argv[])
|
|||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readTimeControls.H"
|
||||
# include "readPISOControls.H"
|
||||
# include "CourantNo.H"
|
||||
# include "setDeltaT.H"
|
||||
|
||||
|
@ -75,7 +78,7 @@ int main(int argc, char *argv[])
|
|||
|
||||
p_rgh.storePrevIter();
|
||||
|
||||
for (int corr = 0; corr < nCorr; corr++)
|
||||
while (piso.correct())
|
||||
{
|
||||
# include "pEqn.H"
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
mesh.schemesDict().setFluxRequired(p_rgh.name());
|
||||
|
||||
autoPtr<incompressible::RASModel> turbulence
|
||||
(
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
||||
phi -= buoyancyPhi;
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
while (piso.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
|
@ -19,16 +19,15 @@
|
|||
|
||||
p_rghEqn.setReference(pRefCell, pRefValue);
|
||||
|
||||
if (corr == nCorr-1 && nonOrth == nNonOrthCorr)
|
||||
{
|
||||
p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name() + "Final"));
|
||||
}
|
||||
else
|
||||
{
|
||||
p_rghEqn.solve(mesh.solutionDict().solver(p_rgh.name()));
|
||||
}
|
||||
p_rghEqn.solve
|
||||
(
|
||||
mesh.solutionDict().solver
|
||||
(
|
||||
p_rgh.select(piso.finalInnerIter())
|
||||
)
|
||||
);
|
||||
|
||||
if (nonOrth == nNonOrthCorr)
|
||||
if (piso.finalNonOrthogonalIter())
|
||||
{
|
||||
// Calculate the conservative fluxes
|
||||
phi -= p_rghEqn.flux();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
UEqn().relax();
|
||||
|
||||
eqnResidual = solve
|
||||
solve
|
||||
(
|
||||
UEqn()
|
||||
==
|
||||
|
@ -22,6 +22,4 @@
|
|||
)*mesh.magSf()
|
||||
)
|
||||
)
|
||||
).initialResidual();
|
||||
|
||||
maxResidual = max(eqnResidual, maxResidual);
|
||||
);
|
||||
|
|
|
@ -38,6 +38,7 @@ Description
|
|||
#include "thermalModel.H"
|
||||
#include "singlePhaseTransportModel.H"
|
||||
#include "RASModel.H"
|
||||
#include "simpleControl.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -47,6 +48,9 @@ int main(int argc, char *argv[])
|
|||
# include "createTime.H"
|
||||
# include "createFluidMesh.H"
|
||||
# include "createSolidMesh.H"
|
||||
|
||||
simpleControl simple(mesh);
|
||||
|
||||
# include "readGravitationalAcceleration.H"
|
||||
# include "createFields.H"
|
||||
# include "createSolidFields.H"
|
||||
|
@ -56,13 +60,10 @@ int main(int argc, char *argv[])
|
|||
|
||||
Info<< "\nStarting time loop\n" << endl;
|
||||
|
||||
while (runTime.loop())
|
||||
while (simple.loop())
|
||||
{
|
||||
Info<< "Time = " << runTime.timeName() << nl << endl;
|
||||
|
||||
# include "readSIMPLEControls.H"
|
||||
# include "initConvergenceCheck.H"
|
||||
|
||||
// Detach patches
|
||||
# include "detachPatches.H"
|
||||
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
pRefCell,
|
||||
pRefValue
|
||||
);
|
||||
mesh.schemesDict().setFluxRequired(p_rgh.name());
|
||||
|
||||
autoPtr<incompressible::RASModel> turbulence
|
||||
(
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
// initialize values for convergence checks
|
||||
|
||||
scalar eqnResidual = 1, maxResidual = 0;
|
||||
scalar convergenceCriterion = 0;
|
||||
|
||||
simple.readIfPresent("convergence", convergenceCriterion);
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
surfaceScalarField buoyancyPhi(rUAf*ghf*fvc::snGrad(rhok)*mesh.magSf());
|
||||
phi -= buoyancyPhi;
|
||||
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
|
||||
while (simple.correctNonOrthogonal())
|
||||
{
|
||||
fvScalarMatrix p_rghEqn
|
||||
(
|
||||
|
@ -20,18 +20,9 @@
|
|||
|
||||
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
|
||||
phi -= p_rghEqn.flux();
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / 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 |
|
||||
| \\/ M anipulation | |
|
||||
| \\/ M anipulation | For copyright notice see file Copyright |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
|
|
|
@ -48,9 +48,4 @@ snGradSchemes
|
|||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / 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 |
|
||||
| \\/ M anipulation | |
|
||||
| \\/ M anipulation | For copyright notice see file Copyright |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
|
@ -39,4 +39,5 @@ boundaryField
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -36,7 +36,7 @@ divSchemes
|
|||
// div(phi,R) Gauss upwind;
|
||||
// div(R) Gauss linear;
|
||||
// div(phi,nuTilda) Gauss upwind;
|
||||
div((nuEff*dev(grad(U).T()))) Gauss linear;
|
||||
div((nuEff*dev2(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
|
@ -62,10 +62,4 @@ snGradSchemes
|
|||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p_rgh;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -46,9 +46,4 @@ snGradSchemes
|
|||
default uncorrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / 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 |
|
||||
| \\/ M anipulation | |
|
||||
| \\/ M anipulation | For copyright notice see file Copyright |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
FoamFile
|
||||
{
|
||||
|
@ -39,4 +39,5 @@ boundaryField
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -36,7 +36,7 @@ divSchemes
|
|||
// div(phi,R) Gauss upwind;
|
||||
// div(R) Gauss linear;
|
||||
// div(phi,nuTilda) Gauss upwind;
|
||||
div((nuEff*dev(grad(U).T()))) Gauss linear;
|
||||
div((nuEff*dev2(T(grad(U))))) Gauss linear;
|
||||
}
|
||||
|
||||
laplacianSchemes
|
||||
|
@ -62,10 +62,4 @@ snGradSchemes
|
|||
default corrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
p_rgh;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -46,9 +46,4 @@ snGradSchemes
|
|||
default uncorrected;
|
||||
}
|
||||
|
||||
fluxRequired
|
||||
{
|
||||
default no;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
Reference in a new issue