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

55 lines
1.3 KiB
C++
Raw Normal View History

2010-08-26 14:22:03 +00:00
{
p.boundaryField().updateCoeffs();
2010-08-26 14:22:03 +00:00
volScalarField rAU("rAU", 1.0/UEqn().A());
surfaceScalarField rAUf("(1|A(U))", fvc::interpolate(rAU));
U = rAU*UEqn().H();
2010-08-26 14:22:03 +00:00
UEqn.clear();
simple.calcSteadyConsistentFlux(phi, U);
2010-08-26 14:22:03 +00:00
adjustPhi(phi, U, p);
surfaceScalarField buoyancyPhi =
rAUf*fvc::interpolate(rhok)*(g & mesh.Sf());
2010-08-26 14:22:03 +00:00
phi += buoyancyPhi;
while (simple.correctNonOrthogonal())
2010-08-26 14:22:03 +00:00
{
fvScalarMatrix pEqn
(
fvm::laplacian
(
rAUf/simple.aCoeff(U.name()),
p,
"laplacian(rAU," + p.name() + ')'
)
==
fvc::div(phi)
2010-08-26 14:22:03 +00:00
);
pEqn.setReference(pRefCell, pRefValue);
pEqn.solve();
2010-08-26 14:22:03 +00:00
if (simple.finalNonOrthogonalIter())
2010-08-26 14:22:03 +00:00
{
// Calculate the conservative fluxes
phi -= pEqn.flux();
}
// U += rAU*fvc::reconstruct((buoyancyPhi - pEqn.flux())/rAUf);
// U.correctBoundaryConditions();
2010-08-26 14:22:03 +00:00
}
# include "continuityErrs.H"
// Explicitly relax pressure for momentum corrector
p.relax();
// Correct the momentum source with the pressure gradient flux
// calculated from the relaxed pressure
U += rAU*(fvc::reconstruct(buoyancyPhi/rAUf) - fvc::grad(p));
U.correctBoundaryConditions();
2010-08-26 14:22:03 +00:00
}