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/heatTransfer/chtMultiRegionFoam/fluid/pEqn.H

76 lines
1.7 KiB
C
Raw Normal View History

{
2010-08-26 14:22:03 +00:00
bool closedVolume = p.needReference();
2010-08-26 14:22:03 +00:00
rho = thermo.rho();
volScalarField rUA = 1.0/UEqn().A();
2010-08-26 14:22:03 +00:00
surfaceScalarField rhorUAf("(rho*(1|A(U)))", fvc::interpolate(rho*rUA));
2010-08-26 14:22:03 +00:00
U = rUA*UEqn().H();
surfaceScalarField phiU
(
fvc::interpolate(rho)
*(
2010-08-26 14:22:03 +00:00
(fvc::interpolate(U) & mesh.Sf())
+ fvc::ddtPhiCorr(rUA, rho, U, phi)
)
2010-08-26 14:22:03 +00:00
);
2010-08-26 14:22:03 +00:00
phi = phiU + fvc::interpolate(rho)*(g & mesh.Sf())*rhorUAf;
2010-08-26 14:22:03 +00:00
for (int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pEqn
(
fvm::ddt(psi, p)
+ fvc::div(phi)
- fvm::laplacian(rhorUAf, p)
);
2010-08-26 14:22:03 +00:00
if
(
oCorr == nOuterCorr-1
&& corr == nCorr-1
&& nonOrth == nNonOrthCorr
)
{
pEqn.solve(mesh.solver(p.name() + "Final"));
}
else
{
pEqn.solve(mesh.solver(p.name()));
}
2010-08-26 14:22:03 +00:00
if (nonOrth == nNonOrthCorr)
{
phi += pEqn.flux();
}
}
// Correct velocity field
2010-08-26 14:22:03 +00:00
U += rUA*fvc::reconstruct((phi - phiU)/rhorUAf);
U.correctBoundaryConditions();
// Update pressure substantive derivative
DpDt = fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
// Solve continuity
#include "rhoEqn.H"
// Update continuity errors
#include "compressibleContinuityErrors.H"
// For closed-volume cases adjust the pressure and density levels
// to obey overall mass continuity
if (closedVolume)
{
2010-08-26 14:22:03 +00:00
p += (massIni - fvc::domainIntegrate(psi*p))
/fvc::domainIntegrate(psi);
rho = thermo.rho();
}
// Update thermal conductivity
2010-08-26 14:22:03 +00:00
K = thermoFluid[i].Cp()*turb.alphaEff();
}