incompressible/nonNewtonianIcoFoam, solver + tutorials

This commit is contained in:
Vuko Vukcevic 2016-04-05 12:55:56 +02:00
parent db568490b7
commit 1670cebef1
2 changed files with 27 additions and 14 deletions

View file

@ -26,6 +26,10 @@ Application
Description Description
Transient solver for incompressible, laminar flow of non-Newtonian fluids. Transient solver for incompressible, laminar flow of non-Newtonian fluids.
Consistent formulation without time-step and relaxation dependence by Jasak
Author
Hrvoje Jasak, Wikki Ltd. All rights reserved
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -39,7 +43,7 @@ int main(int argc, char *argv[])
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
# include "createMeshNoClear.H" # include "createMesh.H"
# include "createFields.H" # include "createFields.H"
# include "initContinuityErrs.H" # include "initContinuityErrs.H"
@ -56,32 +60,36 @@ int main(int argc, char *argv[])
fluid.correct(); fluid.correct();
fvVectorMatrix UEqn // Convection-diffusion matrix
fvVectorMatrix HUEqn
( (
fvm::ddt(U) fvm::div(phi, U)
+ fvm::div(phi, U)
- fvm::laplacian(fluid.nu(), U) - fvm::laplacian(fluid.nu(), U)
); );
solve(UEqn == -fvc::grad(p)); // Time derivative matrix
fvVectorMatrix ddtUEqn(fvm::ddt(U));
solve(ddtUEqn + HUEqn == -fvc::grad(p));
// Prepare clean Ap without time derivative contribution
// HJ, 26/Oct/2015
volScalarField aU = HUEqn.A();
// --- PISO loop // --- PISO loop
for (int corr = 0; corr < nCorr; corr++) for (int corr = 0; corr < nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); U = HUEqn.H()/aU;
phi = (fvc::interpolate(U) & mesh.Sf());
U = rUA*UEqn.H();
phi = (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, U, phi);
adjustPhi(phi, U, p); adjustPhi(phi, U, p);
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++) for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
{ {
fvScalarMatrix pEqn fvScalarMatrix pEqn
( (
fvm::laplacian(rUA, p) == fvc::div(phi) fvm::laplacian(1/aU, p) == fvc::div(phi)
); );
pEqn.setReference(pRefCell, pRefValue); pEqn.setReference(pRefCell, pRefValue);
@ -95,7 +103,12 @@ int main(int argc, char *argv[])
# include "continuityErrs.H" # include "continuityErrs.H"
U -= rUA*fvc::grad(p); // Note: cannot call H(U) here because the velocity is not complete
// HJ, 22/Jan/2016
U = 1.0/(aU + ddtUEqn.A())*
(
U*aU - fvc::grad(p) + ddtUEqn.H()
);
U.correctBoundaryConditions(); U.correctBoundaryConditions();
} }

View file

@ -28,7 +28,7 @@ gradSchemes
divSchemes divSchemes
{ {
default none; default none;
div(phi,U) Gauss linear; div(phi,U) Gauss linearUpwind leastSquares;
} }
laplacianSchemes laplacianSchemes