incompressible/pimpleDyMFoam, solver + tutorials
This commit is contained in:
parent
edb598687a
commit
74b90dd250
8 changed files with 112 additions and 78 deletions
|
@ -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)
|
||||
);
|
||||
|
||||
// Time derivative matrix
|
||||
fvVectorMatrix ddtUEqn(fvm::ddt(U));
|
||||
|
||||
// Get under-relaxation factor
|
||||
scalar UUrf = mesh.solutionDict().relaxationFactor(U.name());
|
||||
|
||||
if (oCorr == nOuterCorr - 1)
|
||||
{
|
||||
if (mesh.solutionDict().relax("UFinal"))
|
||||
{
|
||||
UEqn.relax(mesh.solutionDict().relaxationFactor("UFinal"));
|
||||
UUrf = mesh.solutionDict().relaxationFactor("UFinal");
|
||||
}
|
||||
else
|
||||
{
|
||||
UEqn.relax(1);
|
||||
UUrf = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UEqn.relax();
|
||||
}
|
||||
|
||||
if (momentumPredictor)
|
||||
{
|
||||
solve(UEqn == -fvc::grad(p));
|
||||
}
|
||||
// Solve momentum predictor
|
||||
solve
|
||||
(
|
||||
ddtUEqn
|
||||
+ relax(HUEqn, UUrf)
|
||||
==
|
||||
- fvc::grad(p)
|
||||
);
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
{
|
||||
fvScalarMatrix pcorrEqn
|
||||
(
|
||||
fvm::laplacian(rAU, pcorr) == fvc::div(phi)
|
||||
fvm::laplacian(1/aU, pcorr) == fvc::div(phi)
|
||||
);
|
||||
|
||||
pcorrEqn.setReference(pRefCell, pRefValue);
|
||||
|
|
|
@ -41,18 +41,18 @@
|
|||
incompressible::turbulenceModel::New(U, phi, laminarTransport)
|
||||
);
|
||||
|
||||
Info<< "Reading field rAU if present\n" << endl;
|
||||
volScalarField rAU
|
||||
Info<< "Reading field aU if present\n" << endl;
|
||||
volScalarField aU
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"rAU",
|
||||
"aU",
|
||||
runTime.timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh,
|
||||
runTime.deltaT(),
|
||||
1/runTime.deltaT(),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
);
|
||||
|
|
70
applications/solvers/incompressible/pimpleDyMFoam/pEqn.H
Normal file
70
applications/solvers/incompressible/pimpleDyMFoam/pEqn.H
Normal 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();
|
||||
}
|
|
@ -30,6 +30,11 @@ Description
|
|||
|
||||
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"
|
||||
|
@ -106,61 +111,7 @@ int main(int argc, char *argv[])
|
|||
// --- PISO loop
|
||||
for (int corr = 0; corr < nCorr; corr++)
|
||||
{
|
||||
rAU = 1.0/UEqn.A();
|
||||
|
||||
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();
|
||||
# include "pEqn.H"
|
||||
}
|
||||
|
||||
turbulence->correct();
|
||||
|
|
|
@ -29,7 +29,7 @@ gradSchemes
|
|||
divSchemes
|
||||
{
|
||||
default none;
|
||||
div(phi,U) Gauss linear;
|
||||
div(phi,U) Gauss linearUpwind Gauss linear;
|
||||
div((nuEff*dev(grad(U).T()))) Gauss linear;
|
||||
}
|
||||
|
||||
|
@ -37,8 +37,8 @@ laplacianSchemes
|
|||
{
|
||||
default none;
|
||||
laplacian(nu,U) Gauss linear corrected;
|
||||
laplacian(rAU,pcorr) Gauss linear corrected;
|
||||
laplacian(rAU,p) Gauss linear corrected;
|
||||
laplacian((1|aU),pcorr) Gauss linear corrected;
|
||||
laplacian((1|aU),p) Gauss linear corrected;
|
||||
laplacian(diffusivity,cellMotionU) Gauss linear uncorrected;
|
||||
laplacian(nuEff,U) Gauss linear uncorrected;
|
||||
}
|
||||
|
|
|
@ -65,4 +65,10 @@ PIMPLE
|
|||
nNonOrthogonalCorrectors 0;
|
||||
}
|
||||
|
||||
relaxationFactors
|
||||
{
|
||||
U 1;
|
||||
UFinal 1;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
|
|
@ -41,14 +41,15 @@ laplacianSchemes
|
|||
|
||||
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
|
||||
{
|
||||
default linear;
|
||||
interpolate(HbyA) linear;
|
||||
interpolate(1|A) linear;
|
||||
interpolate(1|aU) linear;
|
||||
}
|
||||
|
||||
snGradSchemes
|
||||
|
|
Reference in a new issue