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/basic/potentialDyMFoam/correctPhi.H

60 lines
1.3 KiB
C
Raw Normal View History

2014-08-19 14:42:49 +00:00
{
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
);
// Initialise flux with interpolated velocity
phi = fvc::interpolate(U) & mesh.Sf();
if (pcorr.needReference())
{
fvc::makeRelative(phi, U);
adjustPhi(phi, U, pcorr);
fvc::makeAbsolute(phi, U);
}
2016-04-12 07:31:33 +00:00
mesh.schemesDict().setFluxRequired(pcorr.name());
for(int nonOrth=0; nonOrth<=nNonOrthCorr; nonOrth++)
2014-08-19 14:42:49 +00:00
{
fvScalarMatrix pcorrEqn
(
fvm::laplacian(rAU, pcorr) == fvc::div(phi)
);
pcorrEqn.setReference(pRefCell, pRefValue);
pcorrEqn.solve();
if (nonOrth == nNonOrthCorr)
{
phi -= pcorrEqn.flux();
}
// Fluxes are corrected to absolute velocity and further corrected
// later. HJ, 6/Feb/2009
}
}
#include "continuityErrs.H"