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/coupled/MRFPorousFoam/pEqn.H
2017-11-18 12:22:59 +00:00

48 lines
1 KiB
C

// Pressure parts of the continuity equation
tmp<fvScalarMatrix> tpEqn;
tmp<surfaceScalarField> tpresSource;
if (addMRF || addPorosity)
{
// Collect pressure source with tensorial 1/Ap
const volTensorField& rTU = trTU();
tpresSource =
(
(mesh.Sf() & fvc::interpolate(rTU))
& fvc::interpolate(fvc::grad(p))
);
const surfaceScalarField& presSource = tpresSource();
// Assemble pressure matrix with tensorial 1/Ap
tpEqn =
(
- fvm::laplacian(rTU, p)
==
- fvc::div(presSource)
);
}
else
{
// Collect pressure source with scalar 1/Ap
const volScalarField& rAU = trAU();
tpresSource =
(
fvc::interpolate(rAU)*
(mesh.Sf() & fvc::interpolate(fvc::grad(p, "grad(pSource)")))
);
const surfaceScalarField& presSource = tpresSource();
// Assemble pressure matrix with tensorial 1/Ap
tpEqn =
(
- fvm::laplacian(rAU, p)
==
- fvc::div(presSource)
);
}
tpEqn().setReference(pRefCell, pRefValue);
UpEqn.insertEquation(3, tpEqn());