This repository has been archived on 2023-11-20. You can view files and clone it, but cannot push or open issues or pull requests.
foam-extend4.1-coherent-io/applications/solvers/multiphase/compressibleInterDyMFoam/pEqn.H

91 lines
2 KiB
C++
Raw Normal View History

2010-09-22 18:13:13 +00:00
{
volScalarField rUA = 1.0/UEqn.A();
surfaceScalarField rUAf = fvc::interpolate(rUA);
tmp<fvScalarMatrix> pEqnComp;
if (pimple.transonic())
2010-09-22 18:13:13 +00:00
{
pEqnComp =
(fvm::ddt(p) + fvm::div(phi, p) - fvm::Sp(fvc::div(phi), p));
}
else
{
pEqnComp =
(fvm::ddt(p) + fvc::div(phi, p) - fvc::Sp(fvc::div(phi), p));
}
U = rUA*UEqn.H();
surfaceScalarField phiU
(
"phiU",
(fvc::interpolate(U) & mesh.Sf())
);
phi = phiU +
(
fvc::interpolate(interface.sigmaK())*
fvc::snGrad(alpha1)*mesh.magSf()
2010-09-22 18:13:13 +00:00
+ fvc::interpolate(rho)*(g & mesh.Sf())
)*rUAf;
while (pimple.correctNonOrthogonal())
2010-09-22 18:13:13 +00:00
{
fvScalarMatrix pEqnIncomp
(
fvc::div(phi)
- fvm::laplacian(rUAf, p)
);
if (pimple.finalInnerIter())
2010-09-22 18:13:13 +00:00
{
solve
(
(
max(alpha1, scalar(0))*(psi1/rho1)
+ max(alpha2, scalar(0))*(psi2/rho2)
)
*pEqnComp()
+ pEqnIncomp,
mesh.solutionDict().solver(p.name() + "Final")
2010-09-22 18:13:13 +00:00
);
}
else
{
solve
(
(
max(alpha1, scalar(0))*(psi1/rho1)
+ max(alpha2, scalar(0))*(psi2/rho2)
)
*pEqnComp()
+ pEqnIncomp
);
}
if (pimple.finalNonOrthogonalIter())
2010-09-22 18:13:13 +00:00
{
dgdt =
(pos(alpha2)*(psi2/rho2) - pos(alpha1)*(psi1/rho1))
*(pEqnComp & p);
phi += pEqnIncomp.flux();
}
}
U += rUA*fvc::reconstruct((phi - phiU)/rUAf);
U.correctBoundaryConditions();
p.max(pMin);
rho1 = rho10 + psi1*p;
rho2 = rho20 + psi2*p;
Info<< "max(U) " << max(mag(U)).value() << endl;
Info<< "min(p) " << min(p).value() << endl;
// Make the fluxes relative to the mesh motion
fvc::makeRelative(phi, U);
}