incompressible/pimpleDyMFoam, solver + tutorials

This commit is contained in:
Vuko Vukcevic 2016-04-05 14:06:15 +02:00
parent edb598687a
commit 74b90dd250
8 changed files with 112 additions and 78 deletions

View file

@ -1,27 +1,33 @@
fvVectorMatrix UEqn // Convection-diffusion matrix
fvVectorMatrix HUEqn
( (
fvm::ddt(U) fvm::div(phi, U)
+ fvm::div(phi, U)
+ turbulence->divDevReff(U) + turbulence->divDevReff(U)
); );
// Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
// Get under-relaxation factor
scalar UUrf = mesh.solutionDict().relaxationFactor(U.name());
if (oCorr == nOuterCorr - 1) if (oCorr == nOuterCorr - 1)
{ {
if (mesh.solutionDict().relax("UFinal")) if (mesh.solutionDict().relax("UFinal"))
{ {
UEqn.relax(mesh.solutionDict().relaxationFactor("UFinal")); UUrf = mesh.solutionDict().relaxationFactor("UFinal");
} }
else else
{ {
UEqn.relax(1); UUrf = 1;
} }
} }
else
{
UEqn.relax();
}
if (momentumPredictor) // Solve momentum predictor
{ solve
solve(UEqn == -fvc::grad(p)); (
} ddtUEqn
+ relax(HUEqn, UUrf)
==
- fvc::grad(p)
);

View file

@ -39,7 +39,7 @@
{ {
fvScalarMatrix pcorrEqn fvScalarMatrix pcorrEqn
( (
fvm::laplacian(rAU, pcorr) == fvc::div(phi) fvm::laplacian(1/aU, pcorr) == fvc::div(phi)
); );
pcorrEqn.setReference(pRefCell, pRefValue); pcorrEqn.setReference(pRefCell, pRefValue);

View file

@ -41,18 +41,18 @@
incompressible::turbulenceModel::New(U, phi, laminarTransport) incompressible::turbulenceModel::New(U, phi, laminarTransport)
); );
Info<< "Reading field rAU if present\n" << endl; Info<< "Reading field aU if present\n" << endl;
volScalarField rAU volScalarField aU
( (
IOobject IOobject
( (
"rAU", "aU",
runTime.timeName(), runTime.timeName(),
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE
), ),
mesh, mesh,
runTime.deltaT(), 1/runTime.deltaT(),
zeroGradientFvPatchScalarField::typeName zeroGradientFvPatchScalarField::typeName
); );

View file

@ -0,0 +1,70 @@
{
p.boundaryField().updateCoeffs();
// Prepare clean Ap without time derivative contribution and
// without contribution from under-relaxation
// HJ, 26/Oct/2015
aU = HUEqn.A();
// Store velocity under-relaxation point before using U for
// the flux precursor
U.storePrevIter();
U = HUEqn.H()/aU;
phi = (fvc::interpolate(U) & mesh.Sf());
// Global flux balance
adjustPhi(phi, U, p);
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(1/aU, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
if
(
corr == nCorr - 1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve
(
mesh.solutionDict().solver(p.name() + "Final")
);
}
else
{
pEqn.solve(mesh.solutionDict().solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}
// Explicitly relax pressure for momentum corrector
if (oCorr != nOuterCorr - 1)
{
p.relax();
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
# include "movingMeshContinuityErrs.H"
U = UUrf*
(
1.0/(aU + ddtUEqn.A())*
(
U*aU - fvc::grad(p) + ddtUEqn.H()
)
)
+ (1 - UUrf)*U.prevIter();
U.correctBoundaryConditions();
}

View file

@ -30,6 +30,11 @@ Description
Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected. Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
Consistent formulation without time-step and relaxation dependence by Jasak
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
@ -106,61 +111,7 @@ int main(int argc, char *argv[])
// --- PISO loop // --- PISO loop
for (int corr = 0; corr < nCorr; corr++) for (int corr = 0; corr < nCorr; corr++)
{ {
rAU = 1.0/UEqn.A(); # include "pEqn.H"
U = rAU*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf());
// ddtPhiCorr does not work. HJ, 20/Nov/2013
adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::laplacian(rAU, p) == fvc::div(phi)
);
pEqn.setReference(pRefCell, pRefValue);
if
(
// oCorr == nOuterCorr - 1
corr == nCorr - 1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve
(
mesh.solutionDict().solver(p.name() + "Final")
);
}
else
{
pEqn.solve(mesh.solutionDict().solver(p.name()));
}
if (nonOrth == nNonOrthCorr)
{
phi -= pEqn.flux();
}
}
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
if (oCorr != nOuterCorr - 1)
{
p.relax();
}
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
# include "movingMeshContinuityErrs.H"
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
} }
turbulence->correct(); turbulence->correct();

View file

@ -29,7 +29,7 @@ gradSchemes
divSchemes divSchemes
{ {
default none; default none;
div(phi,U) Gauss linear; div(phi,U) Gauss linearUpwind Gauss linear;
div((nuEff*dev(grad(U).T()))) Gauss linear; div((nuEff*dev(grad(U).T()))) Gauss linear;
} }
@ -37,8 +37,8 @@ laplacianSchemes
{ {
default none; default none;
laplacian(nu,U) Gauss linear corrected; laplacian(nu,U) Gauss linear corrected;
laplacian(rAU,pcorr) Gauss linear corrected; laplacian((1|aU),pcorr) Gauss linear corrected;
laplacian(rAU,p) Gauss linear corrected; laplacian((1|aU),p) Gauss linear corrected;
laplacian(diffusivity,cellMotionU) Gauss linear uncorrected; laplacian(diffusivity,cellMotionU) Gauss linear uncorrected;
laplacian(nuEff,U) Gauss linear uncorrected; laplacian(nuEff,U) Gauss linear uncorrected;
} }

View file

@ -65,4 +65,10 @@ PIMPLE
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }
relaxationFactors
{
U 1;
UFinal 1;
}
// ************************************************************************* // // ************************************************************************* //

View file

@ -41,14 +41,15 @@ laplacianSchemes
laplacian(1,p) Gauss linear limited 0.5; laplacian(1,p) Gauss linear limited 0.5;
laplacian((1|A(U)),p) Gauss linear limited 0.5; laplacian((1|aU),pcorr) Gauss linear limited 0.5;
laplacian((1|aU),p) Gauss linear limited 0.5;
} }
interpolationSchemes interpolationSchemes
{ {
default linear; default linear;
interpolate(HbyA) linear; interpolate(HbyA) linear;
interpolate(1|A) linear; interpolate(1|aU) linear;
} }
snGradSchemes snGradSchemes