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/compressible/sonicFoam/pEqn.H

53 lines
1.1 KiB
C
Raw Normal View History

2010-08-26 14:22:03 +00:00
{
2016-01-05 14:09:02 +00:00
U = UEqn.H()/UEqn.A();
2010-08-26 14:22:03 +00:00
2016-01-05 14:09:02 +00:00
for (int nonOrth = 0; nonOrth <= nNonOrthCorr; nonOrth++)
2010-08-26 14:22:03 +00:00
{
2016-01-05 14:09:02 +00:00
// Calculate phi for boundary conditions
phi = rhof*
(
(fvc::interpolate(U) & mesh.Sf())
);
surfaceScalarField phid2 = rhoReff/rhof*phi;
surfaceScalarField phid("phid", psisf/rhof*phi);
// Store pressure for under-relaxation
p.storePrevIter();
volScalarField divPhid
(
"divPhid",
fvc::div(phid)
);
fvScalarMatrix pEqn
(
fvm::ddt(psis, p)
+ fvm::div(phid, p)
// Convective flux relaxation terms
+ fvm::SuSp(-divPhid, p)
+ divPhid*p
+ fvc::div(phid2)
- fvm::laplacian(rho*rUA, p)
);
pEqn.solve();
// Calculate the flux
if (nonOrth == nNonOrthCorr)
{
phi = phid2 + pEqn.flux();
}
// Relax the pressure
p.relax();
2010-08-26 14:22:03 +00:00
}
2016-01-05 14:09:02 +00:00
# include "compressibleContinuityErrs.H"
2010-08-26 14:22:03 +00:00
2016-01-05 14:09:02 +00:00
U -= fvc::grad(p)/UEqn.A();
U.correctBoundaryConditions();
}