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/combustion/fireFoam/pEqn.H

61 lines
1.3 KiB
C++
Raw Permalink Normal View History

2010-08-26 14:22:03 +00:00
bool closedVolume = false;
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn.A();
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
U = rUA*UEqn.H();
surfaceScalarField phiU
(
fvc::interpolate(rho)
*(
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
);
phi = phiU + rhorUAf*fvc::interpolate(rho)*(g & mesh.Sf());
while (pimple.correctNonOrthogonal())
2010-08-26 14:22:03 +00:00
{
surfaceScalarField rhorUAf = fvc::interpolate(rho*rUA);
fvScalarMatrix pEqn
(
fvm::ddt(psi,p)
+ fvc::div(phi)
- fvm::laplacian(rhorUAf, p)
);
closedVolume = p.needReference();
pEqn.solve
(
mesh.solutionDict().solver(p.select(pimple.finalInnerIter()))
);
2010-08-26 14:22:03 +00:00
if (pimple.finalNonOrthogonalIter())
2010-08-26 14:22:03 +00:00
{
phi += pEqn.flux();
}
}
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
#include "rhoEqn.H"
#include "compressibleContinuityErrs.H"
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
U.correctBoundaryConditions();
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
p +=
(initialMass - fvc::domainIntegrate(thermo.psi()*p))
/fvc::domainIntegrate(thermo.psi());
rho = thermo.rho();
}