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/engine/sonicTurbDyMEngineFoam/compressibleCorrectPhi.H
2013-07-18 10:15:54 +02:00

49 lines
1 KiB
C

{
wordList pcorrTypes(p.boundaryField().types());
for (label i=0; i<p.boundaryField().size(); i++)
{
if (p.boundaryField()[i].fixesValue())
{
pcorrTypes[i] = fixedValueFvPatchScalarField::typeName;
}
}
volScalarField pcorr
(
IOobject
(
"pcorr",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("pcorr", p.dimensions(), 0.0),
pcorrTypes
);
pcorr == p;
pcorr.oldTime() == p.oldTime();
phi = fvc::interpolate(rho)
*((fvc::interpolate(U) & mesh.Sf()) - fvc::meshPhi(rho, U));
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
{
fvScalarMatrix pcorrEqn
(
fvm::ddt(psi, pcorr)
+ fvc::div(phi)
- fvm::laplacian(rho*rUA, pcorr)
);
pcorrEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi += pcorrEqn.flux();
}
}
}