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,11 +52,15 @@ 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"
// --- PIMPLE loop
label oCorr = 0;
do
{
fvVectorMatrix UEqn fvVectorMatrix UEqn
( (
fvm::ddt(rho, U) fvm::ddt(rho, U)
@ -66,13 +70,17 @@ int main(int argc, char *argv[])
solve(UEqn == -fvc::grad(p)); solve(UEqn == -fvc::grad(p));
// --- PISO loop // --- PISO loop
for (int corr = 0; corr < nCorr; corr++) for (int corr = 0; corr < nCorr; corr++)
{ {
volScalarField rUA = 1.0/UEqn.A(); volScalarField rAU("rAU", 1.0/UEqn.A());
U = rUA*UEqn.H(); surfaceScalarField rhorAUf
(
"rhorAUf",
fvc::interpolate(rho*rAU)
);
U = rAU*UEqn.H();
surfaceScalarField phid surfaceScalarField phid
( (
@ -80,7 +88,7 @@ int main(int argc, char *argv[])
psi* psi*
( (
(fvc::interpolate(U) & mesh.Sf()) (fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi) + fvc::ddtPhiCorr(rAU, rho, U, phi)
) )
); );
@ -91,19 +99,24 @@ int main(int argc, char *argv[])
fvm::ddt(psi, p) fvm::ddt(psi, p)
+ fvc::div(phi) + fvc::div(phi)
+ fvm::div(phid, p) + fvm::div(phid, p)
- fvm::laplacian(rho*rUA, p) - fvm::laplacian(rhorAUf, p)
); );
pEqn.solve(); pEqn.solve();
phi += pEqn.flux(); phi += pEqn.flux();
# include "rhoEqn.H"
# include "compressibleContinuityErrs.H" # include "compressibleContinuityErrs.H"
U -= rUA*fvc::grad(p); // Correct velocity
U -= rAU*fvc::grad(p);
U.correctBoundaryConditions(); 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,31 +19,26 @@ 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
{ {
nOuterCorrectors 2;
nCorrectors 2; nCorrectors 2;
nNonOrthogonalCorrectors 0; nNonOrthogonalCorrectors 0;
} }