Update sonicLiquidFoam to PIMPLE

This commit is contained in:
Hrvoje Jasak 2015-06-26 19:28:31 +01:00
parent ad6bce6a29
commit 91e9838649
4 changed files with 62 additions and 57 deletions

View file

@ -1,6 +1,3 @@
{
# include "rhoEqn.H"
}
{ {
scalar sumLocalContErr = scalar sumLocalContErr =
(sum(mag(rho - rho0 - psi*(p - p0)))/sum(rho)).value(); (sum(mag(rho - rho0 - psi*(p - p0)))/sum(rho)).value();

View file

@ -52,58 +52,71 @@ int main(int argc, char *argv[])
{ {
Info<< "Time = " << runTime.timeName() << nl << endl; Info<< "Time = " << runTime.timeName() << nl << endl;
# include "readPISOControls.H" # include "readPIMPLEControls.H"
# include "compressibleCourantNo.H" # include "compressibleCourantNo.H"
# include "rhoEqn.H" # include "rhoEqn.H"
fvVectorMatrix UEqn // --- PIMPLE loop
( label oCorr = 0;
fvm::ddt(rho, U) do
+ fvm::div(phi, U)
- fvm::laplacian(mu, U)
);
solve(UEqn == -fvc::grad(p));
// --- PISO loop
for (int corr = 0; corr < nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); fvVectorMatrix UEqn
U = rUA*UEqn.H();
surfaceScalarField phid
( (
"phid", fvm::ddt(rho, U)
psi* + fvm::div(phi, U)
- fvm::laplacian(mu, U)
);
solve(UEqn == -fvc::grad(p));
// --- PISO loop
for (int corr = 0; corr < nCorr; corr++)
{
volScalarField rAU("rAU", 1.0/UEqn.A());
surfaceScalarField rhorAUf
( (
(fvc::interpolate(U) & mesh.Sf()) "rhorAUf",
+ fvc::ddtPhiCorr(rUA, rho, U, phi) fvc::interpolate(rho*rAU)
) );
);
phi = (rhoO/psi)*phid; U = rAU*UEqn.H();
fvScalarMatrix pEqn surfaceScalarField phid
( (
fvm::ddt(psi, p) "phid",
+ fvc::div(phi) psi*
+ fvm::div(phid, p) (
- fvm::laplacian(rho*rUA, p) (fvc::interpolate(U) & mesh.Sf())
); + fvc::ddtPhiCorr(rAU, rho, U, phi)
)
);
pEqn.solve(); phi = (rhoO/psi)*phid;
phi += pEqn.flux(); fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
+ fvm::div(phid, p)
- fvm::laplacian(rhorAUf, p)
);
# include "compressibleContinuityErrs.H" pEqn.solve();
U -= rUA*fvc::grad(p); phi += pEqn.flux();
U.correctBoundaryConditions();
}
# include "rhoEqn.H"
# include "compressibleContinuityErrs.H"
// Correct velocity
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions();
}
} while (++oCorr < nOuterCorr);
// Correct density
rho = rhoO + psi*p; rho = rhoO + psi*p;
runTime.write(); runTime.write();
@ -115,7 +128,7 @@ int main(int argc, char *argv[])
Info<< "End\n" << endl; Info<< "End\n" << endl;
return 0; return(0);
} }

View file

@ -37,7 +37,7 @@ laplacianSchemes
{ {
default none; default none;
laplacian(mu,U) Gauss linear corrected; laplacian(mu,U) Gauss linear corrected;
laplacian((rho*(1|A(U))),p) Gauss linear corrected; laplacian(rhorAUf,p) Gauss linear corrected;
} }
interpolationSchemes interpolationSchemes

View file

@ -19,32 +19,27 @@ solvers
{ {
p p
{ {
solver PBiCG; solver BiCGStab;
preconditioner DILU; preconditioner DILU;
tolerance 1e-06; minIter 1;
tolerance 1e-08;
relTol 0; relTol 0;
} }
U U
{ {
solver PBiCG; solver BiCGStab;
preconditioner DILU; preconditioner DILU;
tolerance 1e-05; tolerance 1e-08;
relTol 0; relTol 0;
} }
rho rho
{ {}
solver PCG;
preconditioner DIC;
tolerance 1e-05;
relTol 0;
}
} }
PISO PIMPLE
{ {
nCorrectors 2; nOuterCorrectors 2;
nCorrectors 2;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }